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

Function prepareAndExportLibSQL

drizzle-kit/src/cli/commands/migrate.ts:959–989  ·  view source on GitHub ↗
(config: ExportConfig)

Source from the content-addressed store, hash-verified

957};
958
959export const prepareAndExportLibSQL = async (config: ExportConfig) => {
960 const schemaPath = config.schema;
961
962 try {
963 const { prev, cur, custom } = await prepareSqliteMigrationSnapshot(
964 [],
965 schemaPath,
966 undefined,
967 );
968
969 const validatedPrev = sqliteSchema.parse(prev);
970 const validatedCur = sqliteSchema.parse(cur);
971
972 const squashedPrev = squashSqliteScheme(validatedPrev);
973 const squashedCur = squashSqliteScheme(validatedCur);
974
975 const { sqlStatements, _meta } = await applyLibSQLSnapshotsDiff(
976 squashedPrev,
977 squashedCur,
978 tablesResolver,
979 columnsResolver,
980 sqliteViewsResolver,
981 validatedPrev,
982 validatedCur,
983 );
984
985 console.log(sqlStatements.join('\n'));
986 } catch (e) {
987 console.error(e);
988 }
989};
990
991export const prepareSQLitePush = async (
992 schemaPath: string | string[],

Callers 1

schema.tsFile · 0.85

Calls 3

squashSqliteSchemeFunction · 0.90
applyLibSQLSnapshotsDiffFunction · 0.90

Tested by

no test coverage detected