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

prepareSQLiteRecreateTable() — drizzle-orm Function Reference

Architecture documentation for the prepareSQLiteRecreateTable() function in statementCombiner.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  ee76d848_3a47_3ee3_65e2_2d2277c500b8["prepareSQLiteRecreateTable()"]
  21a395af_9564_2dbd_9ea9_060ad50ee7a0["statementCombiner.ts"]
  ee76d848_3a47_3ee3_65e2_2d2277c500b8 -->|defined in| 21a395af_9564_2dbd_9ea9_060ad50ee7a0
  17594a40_df6d_dbbc_6d7a_c1e90069584f["sqliteCombineStatements()"]
  17594a40_df6d_dbbc_6d7a_c1e90069584f -->|calls| ee76d848_3a47_3ee3_65e2_2d2277c500b8
  0848c4a3_d489_0afb_1396_c6648ea30e50["prepareCreateIndexesJson()"]
  ee76d848_3a47_3ee3_65e2_2d2277c500b8 -->|calls| 0848c4a3_d489_0afb_1396_c6648ea30e50
  style ee76d848_3a47_3ee3_65e2_2d2277c500b8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/statementCombiner.ts lines 43–74

export const prepareSQLiteRecreateTable = (
	table: SQLiteSchemaSquashed['tables'][keyof SQLiteSchemaSquashed['tables']],
	action?: 'push',
): JsonStatement[] => {
	const { name, columns, uniqueConstraints, indexes, checkConstraints } = table;

	const composites: string[][] = Object.values(table.compositePrimaryKeys).map(
		(it) => SQLiteSquasher.unsquashPK(it),
	);

	const references: string[] = Object.values(table.foreignKeys);
	const fks = references.map((it) =>
		action === 'push' ? SQLiteSquasher.unsquashPushFK(it) : SQLiteSquasher.unsquashFK(it)
	);

	const statements: JsonStatement[] = [
		{
			type: 'recreate_table',
			tableName: name,
			columns: Object.values(columns),
			compositePKs: composites,
			referenceData: fks,
			uniqueConstraints: Object.values(uniqueConstraints),
			checkConstraints: Object.values(checkConstraints),
		},
	];

	if (Object.keys(indexes).length) {
		statements.push(...prepareCreateIndexesJson(name, '', indexes));
	}
	return statements;
};

Domain

Subdomains

Frequently Asked Questions

What does prepareSQLiteRecreateTable() do?
prepareSQLiteRecreateTable() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/statementCombiner.ts.
Where is prepareSQLiteRecreateTable() defined?
prepareSQLiteRecreateTable() is defined in drizzle-kit/src/statementCombiner.ts at line 43.
What does prepareSQLiteRecreateTable() call?
prepareSQLiteRecreateTable() calls 1 function(s): prepareCreateIndexesJson.
What calls prepareSQLiteRecreateTable()?
prepareSQLiteRecreateTable() is called by 1 function(s): sqliteCombineStatements.

Analyze Your Own Codebase

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

Try Supermodel Free