pgSuite.renameTableWithCompositePrimaryKey() — drizzle-orm Function Reference
Architecture documentation for the pgSuite.renameTableWithCompositePrimaryKey() function in pg.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD cae672f5_5904_d1f4_e428_49f5d6788b42["pgSuite.renameTableWithCompositePrimaryKey()"] 0408ab8f_6d6f_cdae_29f3_25c8efadbfae["pg.test.ts"] cae672f5_5904_d1f4_e428_49f5d6788b42 -->|defined in| 0408ab8f_6d6f_cdae_29f3_25c8efadbfae style cae672f5_5904_d1f4_e428_49f5d6788b42 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/tests/push/pg.test.ts lines 965–999
async renameTableWithCompositePrimaryKey() {
const client = new PGlite();
const productsCategoriesTable = (tableName: string) => {
return pgTable(tableName, {
productId: text('product_id').notNull(),
categoryId: text('category_id').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 diffTestSchemasPush(
client,
schema1,
schema2,
['public.products_categories->public.products_to_categories'],
false,
['public'],
);
expect(sqlStatements).toStrictEqual([
'ALTER TABLE "products_categories" RENAME TO "products_to_categories";',
'ALTER TABLE "products_to_categories" DROP CONSTRAINT "products_categories_product_id_category_id_pk";',
'ALTER TABLE "products_to_categories" ADD CONSTRAINT "products_to_categories_product_id_category_id_pk" PRIMARY KEY("product_id","category_id");',
]);
},
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pgSuite.renameTableWithCompositePrimaryKey() do?
pgSuite.renameTableWithCompositePrimaryKey() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/pg.test.ts.
Where is pgSuite.renameTableWithCompositePrimaryKey() defined?
pgSuite.renameTableWithCompositePrimaryKey() is defined in drizzle-kit/tests/push/pg.test.ts at line 965.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free