Home / Function/ singlestoreSuite.renameTableWithCompositePrimaryKey() — drizzle-orm Function Reference

singlestoreSuite.renameTableWithCompositePrimaryKey() — drizzle-orm Function Reference

Architecture documentation for the singlestoreSuite.renameTableWithCompositePrimaryKey() function in singlestore.test.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  241b6778_8080_df3d_0c74_eb2043050ecd["singlestoreSuite.renameTableWithCompositePrimaryKey()"]
  080335b9_a640_8a6d_81f7_fed0bb4ae5ca["singlestore.test.ts"]
  241b6778_8080_df3d_0c74_eb2043050ecd -->|defined in| 080335b9_a640_8a6d_81f7_fed0bb4ae5ca
  style 241b6778_8080_df3d_0c74_eb2043050ecd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/tests/push/singlestore.test.ts lines 370–404

	renameTableWithCompositePrimaryKey: async function(context?: any): Promise<void> {
		const productsCategoriesTable = (tableName: string) => {
			return singlestoreTable(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 diffTestSchemasPushSingleStore(
			context.client as Connection,
			schema1,
			schema2,
			['public.products_categories->public.products_to_categories'],
			'drizzle',
			false,
		);

		// It's not possible to create/alter/drop primary keys in SingleStore
		expect(sqlStatements).toStrictEqual([
			'ALTER TABLE `products_categories` RENAME TO `products_to_categories`;',
		]);

		await context.client.query(`DROP TABLE \`products_categories\``);
	},

Domain

Subdomains

Frequently Asked Questions

What does singlestoreSuite.renameTableWithCompositePrimaryKey() do?
singlestoreSuite.renameTableWithCompositePrimaryKey() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/singlestore.test.ts.
Where is singlestoreSuite.renameTableWithCompositePrimaryKey() defined?
singlestoreSuite.renameTableWithCompositePrimaryKey() is defined in drizzle-kit/tests/push/singlestore.test.ts at line 370.

Analyze Your Own Codebase

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

Try Supermodel Free