Home / Function/ prepareAlterCompositePrimaryKeyMySql() — drizzle-orm Function Reference

prepareAlterCompositePrimaryKeyMySql() — drizzle-orm Function Reference

Architecture documentation for the prepareAlterCompositePrimaryKeyMySql() function in jsonStatements.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  c580f61a_d3e7_a71f_c6b4_8e661650ca42["prepareAlterCompositePrimaryKeyMySql()"]
  6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"]
  c580f61a_d3e7_a71f_c6b4_8e661650ca42 -->|defined in| 6139f734_8ada_c641_9fec_9a55cfdf376f
  a5972ffc_ff1b_9523_2495_5373af710e65["applyMysqlSnapshotsDiff()"]
  a5972ffc_ff1b_9523_2495_5373af710e65 -->|calls| c580f61a_d3e7_a71f_c6b4_8e661650ca42
  style c580f61a_d3e7_a71f_c6b4_8e661650ca42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/jsonStatements.ts lines 3342–3363

export const prepareAlterCompositePrimaryKeyMySql = (
	tableName: string,
	pks: Record<string, { __old: string; __new: string }>,
	// TODO: remove?
	json1: MySqlSchema,
	json2: MySqlSchema,
): JsonAlterCompositePK[] => {
	return Object.values(pks).map((it) => {
		return {
			type: 'alter_composite_pk',
			tableName,
			old: it.__old,
			new: it.__new,
			oldConstraintName: json1.tables[tableName].compositePrimaryKeys[
				MySqlSquasher.unsquashPK(it.__old).name
			].name,
			newConstraintName: json2.tables[tableName].compositePrimaryKeys[
				MySqlSquasher.unsquashPK(it.__new).name
			].name,
		} as JsonAlterCompositePK;
	});
};

Domain

Subdomains

Frequently Asked Questions

What does prepareAlterCompositePrimaryKeyMySql() do?
prepareAlterCompositePrimaryKeyMySql() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/jsonStatements.ts.
Where is prepareAlterCompositePrimaryKeyMySql() defined?
prepareAlterCompositePrimaryKeyMySql() is defined in drizzle-kit/src/jsonStatements.ts at line 3342.
What calls prepareAlterCompositePrimaryKeyMySql()?
prepareAlterCompositePrimaryKeyMySql() is called by 1 function(s): applyMysqlSnapshotsDiff.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free