mysqlSuite.renameTableWithCompositePrimaryKey() — drizzle-orm Function Reference
Architecture documentation for the mysqlSuite.renameTableWithCompositePrimaryKey() function in mysql.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 941f69de_dd45_15bb_04e4_635b4f43877c["mysqlSuite.renameTableWithCompositePrimaryKey()"] e4016db2_352d_b236_2557_d9a74c6066c1["mysql.test.ts"] 941f69de_dd45_15bb_04e4_635b4f43877c -->|defined in| e4016db2_352d_b236_2557_d9a74c6066c1 style 941f69de_dd45_15bb_04e4_635b4f43877c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/tests/push/mysql.test.ts lines 713–748
renameTableWithCompositePrimaryKey: async function(context?: any): Promise<void> {
const productsCategoriesTable = (tableName: string) => {
return mysqlTable(tableName, {
productId: varchar('product_id', { length: 10 }).notNull(),
categoryId: varchar('category_id', { length: 10 }).notNull(),
}, (t) => ({
pk: primaryKey({
columns: [t.productId, t.categoryId],
}),
}));
};
const schema1 = {
table: productsCategoriesTable('products_categories'),
};
const schema2 = {
test: productsCategoriesTable('products_to_categories'),
};
const { sqlStatements } = await diffTestSchemasPushMysql(
context.client as Connection,
schema1,
schema2,
['public.products_categories->public.products_to_categories'],
'drizzle',
false,
);
expect(sqlStatements).toStrictEqual([
'RENAME TABLE `products_categories` TO `products_to_categories`;',
'ALTER TABLE `products_to_categories` DROP PRIMARY KEY;',
'ALTER TABLE `products_to_categories` ADD PRIMARY KEY(`product_id`,`category_id`);',
]);
await context.client.query(`DROP TABLE \`products_categories\``);
},
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does mysqlSuite.renameTableWithCompositePrimaryKey() do?
mysqlSuite.renameTableWithCompositePrimaryKey() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/mysql.test.ts.
Where is mysqlSuite.renameTableWithCompositePrimaryKey() defined?
mysqlSuite.renameTableWithCompositePrimaryKey() is defined in drizzle-kit/tests/push/mysql.test.ts at line 713.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free