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

prepareSingleStoreCreateTableJson() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6a93ce6a_0fbc_1e25_07f8_b6c72cd98d0c["prepareSingleStoreCreateTableJson()"]
  6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"]
  6a93ce6a_0fbc_1e25_07f8_b6c72cd98d0c -->|defined in| 6139f734_8ada_c641_9fec_9a55cfdf376f
  d4992b27_bf78_8099_5134_750cef1c518c["applySingleStoreSnapshotsDiff()"]
  d4992b27_bf78_8099_5134_750cef1c518c -->|calls| 6a93ce6a_0fbc_1e25_07f8_b6c72cd98d0c
  style 6a93ce6a_0fbc_1e25_07f8_b6c72cd98d0c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/jsonStatements.ts lines 948–974

export const prepareSingleStoreCreateTableJson = (
	table: Table,
	// TODO: remove?
	json2: SingleStoreSchema,
	// we need it to know if some of the indexes(and in future other parts) are expressions or columns
	// didn't change singlestoreserialaizer, because it will break snapshots and diffs and it's hard to detect
	// if previously it was an expression or column
	internals: SingleStoreKitInternals,
): JsonCreateTableStatement => {
	const { name, schema, columns, compositePrimaryKeys, uniqueConstraints } = table;

	return {
		type: 'create_table',
		tableName: name,
		schema,
		columns: Object.values(columns),
		compositePKs: Object.values(compositePrimaryKeys),
		compositePkName: Object.values(compositePrimaryKeys).length > 0
			? json2.tables[name].compositePrimaryKeys[
				SingleStoreSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0])
					.name
			].name
			: '',
		uniqueConstraints: Object.values(uniqueConstraints),
		internals,
	};
};

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free