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

singlestoreSuite.createCompositePrimaryKey() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

drizzle-kit/tests/push/singlestore.test.ts lines 325–369

	createCompositePrimaryKey: async function(context: any): Promise<void> {
		const schema1 = {};

		const schema2 = {
			table: singlestoreTable('table', {
				col1: int('col1').notNull(),
				col2: int('col2').notNull(),
			}, (t) => ({
				pk: primaryKey({
					columns: [t.col1, t.col2],
				}),
			})),
		};

		const { statements, sqlStatements } = await diffTestSchemasPushSingleStore(
			context.client as Connection,
			schema1,
			schema2,
			[],
			'drizzle',
			false,
		);

		expect(statements).toStrictEqual([
			{
				type: 'create_table',
				tableName: 'table',
				schema: undefined,
				internals: {
					indexes: {},
					tables: {},
				},
				compositePKs: ['table_col1_col2_pk;col1,col2'],
				compositePkName: 'table_col1_col2_pk',
				uniqueConstraints: [],
				columns: [
					{ name: 'col1', type: 'int', primaryKey: false, notNull: true, autoincrement: false },
					{ name: 'col2', type: 'int', primaryKey: false, notNull: true, autoincrement: false },
				],
			},
		]);
		expect(sqlStatements).toStrictEqual([
			'CREATE TABLE `table` (\n\t`col1` int NOT NULL,\n\t`col2` int NOT NULL,\n\tCONSTRAINT `table_col1_col2_pk` PRIMARY KEY(`col1`,`col2`)\n);\n',
		]);
	},

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free