statementCombiner.ts — drizzle-orm Source File
Architecture documentation for statementCombiner.ts, a typescript file in the drizzle-orm codebase. 9 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 21a395af_9564_2dbd_9ea9_060ad50ee7a0["statementCombiner.ts"] 6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 6139f734_8ada_c641_9fec_9a55cfdf376f e2d6842f_6f04_26fc_4953_22d9a4d20e06["JsonCreateIndexStatement"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> e2d6842f_6f04_26fc_4953_22d9a4d20e06 41c049cb_dc6c_3fb1_cc0e_cef649a10052["JsonRecreateTableStatement"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 41c049cb_dc6c_3fb1_cc0e_cef649a10052 01a65a15_492e_372b_ce91_8e23fbd7b487["JsonStatement"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 01a65a15_492e_372b_ce91_8e23fbd7b487 0848c4a3_d489_0afb_1396_c6648ea30e50["prepareCreateIndexesJson"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 0848c4a3_d489_0afb_1396_c6648ea30e50 d63c81a6_6779_4926_bffe_7351e12a4301["singlestoreSchema.ts"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> d63c81a6_6779_4926_bffe_7351e12a4301 57685c31_5dce_5e65_ed14_35a5274af516["SingleStoreSchemaSquashed"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 57685c31_5dce_5e65_ed14_35a5274af516 03c276d3_0efe_66e2_9ba9_e67edbf29418["sqliteSchema.ts"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 03c276d3_0efe_66e2_9ba9_e67edbf29418 1906f782_c6ab_facd_3040_fbb6a08a7353["SQLiteSchemaSquashed"] 21a395af_9564_2dbd_9ea9_060ad50ee7a0 --> 1906f782_c6ab_facd_3040_fbb6a08a7353 582ba146_631b_7794_80a3_5b8044ba7cde["snapshotsDiffer.ts"] 582ba146_631b_7794_80a3_5b8044ba7cde --> 21a395af_9564_2dbd_9ea9_060ad50ee7a0 style 21a395af_9564_2dbd_9ea9_060ad50ee7a0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import {
JsonCreateIndexStatement,
JsonRecreateTableStatement,
JsonStatement,
prepareCreateIndexesJson,
} from './jsonStatements';
import { SingleStoreSchemaSquashed } from './serializer/singlestoreSchema';
import { SQLiteSchemaSquashed, SQLiteSquasher } from './serializer/sqliteSchema';
export const prepareLibSQLRecreateTable = (
table: SQLiteSchemaSquashed['tables'][keyof SQLiteSchemaSquashed['tables']],
action?: 'push',
): (JsonRecreateTableStatement | JsonCreateIndexStatement)[] => {
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: (JsonRecreateTableStatement | JsonCreateIndexStatement)[] = [
{
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;
};
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',
// ... (538 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does statementCombiner.ts do?
statementCombiner.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, CLIWorkflow subdomain.
What functions are defined in statementCombiner.ts?
statementCombiner.ts defines 6 function(s): libSQLCombineStatements, prepareLibSQLRecreateTable, prepareSQLiteRecreateTable, prepareSingleStoreRecreateTable, singleStoreCombineStatements, sqliteCombineStatements.
What does statementCombiner.ts depend on?
statementCombiner.ts imports 9 module(s): JsonCreateIndexStatement, JsonRecreateTableStatement, JsonStatement, SQLiteSchemaSquashed, SingleStoreSchemaSquashed, jsonStatements.ts, prepareCreateIndexesJson, singlestoreSchema.ts, and 1 more.
What files import statementCombiner.ts?
statementCombiner.ts is imported by 1 file(s): snapshotsDiffer.ts.
Where is statementCombiner.ts in the architecture?
statementCombiner.ts is located at drizzle-kit/src/statementCombiner.ts (domain: DrizzleKit, subdomain: CLIWorkflow, directory: drizzle-kit/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free