MCPcopy
hub / github.com/drizzle-team/drizzle-orm / prepareLibSQLPush

Function prepareLibSQLPush

drizzle-kit/src/cli/commands/migrate.ts:1024–1055  ·  view source on GitHub ↗
(
	schemaPath: string | string[],
	snapshot: SQLiteSchema,
	casing: CasingType | undefined,
)

Source from the content-addressed store, hash-verified

1022};
1023
1024export const prepareLibSQLPush = async (
1025 schemaPath: string | string[],
1026 snapshot: SQLiteSchema,
1027 casing: CasingType | undefined,
1028) => {
1029 const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing);
1030
1031 const validatedPrev = sqliteSchema.parse(prev);
1032 const validatedCur = sqliteSchema.parse(cur);
1033
1034 const squashedPrev = squashSqliteScheme(validatedPrev, 'push');
1035 const squashedCur = squashSqliteScheme(validatedCur, 'push');
1036
1037 const { sqlStatements, statements, _meta } = await applyLibSQLSnapshotsDiff(
1038 squashedPrev,
1039 squashedCur,
1040 tablesResolver,
1041 columnsResolver,
1042 sqliteViewsResolver,
1043 validatedPrev,
1044 validatedCur,
1045 'push',
1046 );
1047
1048 return {
1049 sqlStatements,
1050 statements,
1051 squashedPrev,
1052 squashedCur,
1053 meta: _meta,
1054 };
1055};
1056
1057const freeeeeeze = (obj: any) => {
1058 Object.freeze(obj);

Callers 1

libSQLPushFunction · 0.85

Calls 3

squashSqliteSchemeFunction · 0.90
applyLibSQLSnapshotsDiffFunction · 0.90

Tested by

no test coverage detected