prepareAndMigrateLibSQL() — drizzle-orm Function Reference
Architecture documentation for the prepareAndMigrateLibSQL() function in migrate.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD fb79a54b_99a5_2063_0a0c_a9cc728865a9["prepareAndMigrateLibSQL()"] b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|defined in| b14d3855_8cce_38c9_8952_a9d014c2fb1b 5f10022b_622b_eb8e_812e_30a6459027c8["assertV1OutFolder()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| 5f10022b_622b_eb8e_812e_30a6459027c8 0b87f963_e54e_497f_7271_110d21942e56["prepareMigrationFolder()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| 0b87f963_e54e_497f_7271_110d21942e56 9e7489ff_1b4d_bb21_dfdd_c572d42b308e["prepareSqliteMigrationSnapshot()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| 9e7489ff_1b4d_bb21_dfdd_c572d42b308e cb2d3951_4fcb_d824_359b_9f044d2f7e6c["writeResult()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| cb2d3951_4fcb_d824_359b_9f044d2f7e6c dec1e114_a97f_91d6_7d9a_a12a7c1789b4["squashSqliteScheme()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| dec1e114_a97f_91d6_7d9a_a12a7c1789b4 55569cde_7638_9cfc_9dcd_34636d975ec3["applyLibSQLSnapshotsDiff()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| 55569cde_7638_9cfc_9dcd_34636d975ec3 b0ef3d06_896b_eefc_c410_dfb419673d70["error()"] fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| b0ef3d06_896b_eefc_c410_dfb419673d70 style fb79a54b_99a5_2063_0a0c_a9cc728865a9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/migrate.ts lines 897–957
export const prepareAndMigrateLibSQL = async (config: GenerateConfig) => {
const outFolder = config.out;
const schemaPath = config.schema;
const casing = config.casing;
try {
assertV1OutFolder(outFolder);
const { snapshots, journal } = prepareMigrationFolder(outFolder, 'sqlite');
const { prev, cur, custom } = await prepareSqliteMigrationSnapshot(
snapshots,
schemaPath,
casing,
);
const validatedPrev = sqliteSchema.parse(prev);
const validatedCur = sqliteSchema.parse(cur);
if (config.custom) {
writeResult({
cur: custom,
sqlStatements: [],
journal,
outFolder,
name: config.name,
breakpoints: config.breakpoints,
bundle: config.bundle,
type: 'custom',
prefixMode: config.prefix,
});
return;
}
const squashedPrev = squashSqliteScheme(validatedPrev);
const squashedCur = squashSqliteScheme(validatedCur);
const { sqlStatements, _meta } = await applyLibSQLSnapshotsDiff(
squashedPrev,
squashedCur,
tablesResolver,
columnsResolver,
sqliteViewsResolver,
validatedPrev,
validatedCur,
);
writeResult({
cur,
sqlStatements,
journal,
_meta,
outFolder,
name: config.name,
breakpoints: config.breakpoints,
bundle: config.bundle,
prefixMode: config.prefix,
});
} catch (e) {
console.error(e);
}
};
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does prepareAndMigrateLibSQL() do?
prepareAndMigrateLibSQL() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/migrate.ts.
Where is prepareAndMigrateLibSQL() defined?
prepareAndMigrateLibSQL() is defined in drizzle-kit/src/cli/commands/migrate.ts at line 897.
What does prepareAndMigrateLibSQL() call?
prepareAndMigrateLibSQL() calls 7 function(s): applyLibSQLSnapshotsDiff, assertV1OutFolder, error, prepareMigrationFolder, prepareSqliteMigrationSnapshot, squashSqliteScheme, writeResult.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free