prepareMigrationFolder() — drizzle-orm Function Reference
Architecture documentation for the prepareMigrationFolder() function in utils.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD d9a56fd8_8416_73a6_c78e_6634d08ec9d5["prepareMigrationFolder()"] 9a65f2dd_b887_59d0_3288_3a5819ba6273["utils.ts"] d9a56fd8_8416_73a6_c78e_6634d08ec9d5 -->|defined in| 9a65f2dd_b887_59d0_3288_3a5819ba6273 b9dd0927_4e2f_fdc5_f01a_42b2da10f99a["prepareAndMigratePg()"] b9dd0927_4e2f_fdc5_f01a_42b2da10f99a -->|calls| d9a56fd8_8416_73a6_c78e_6634d08ec9d5 a5f47b46_0877_87d7_2bd6_4add9c7a7140["prepareAndMigrateMysql()"] a5f47b46_0877_87d7_2bd6_4add9c7a7140 -->|calls| d9a56fd8_8416_73a6_c78e_6634d08ec9d5 65d2c0fe_27f1_a304_0c21_88bf9e958dbc["prepareAndMigrateSingleStore()"] 65d2c0fe_27f1_a304_0c21_88bf9e958dbc -->|calls| d9a56fd8_8416_73a6_c78e_6634d08ec9d5 f07f6c43_51fe_8050_2d03_c28df98b8ee4["prepareAndMigrateSqlite()"] f07f6c43_51fe_8050_2d03_c28df98b8ee4 -->|calls| d9a56fd8_8416_73a6_c78e_6634d08ec9d5 b2f5d0e6_3256_9d80_0992_b2e81f3fe729["prepareAndMigrateLibSQL()"] b2f5d0e6_3256_9d80_0992_b2e81f3fe729 -->|calls| d9a56fd8_8416_73a6_c78e_6634d08ec9d5 fcb07289_ca64_1c36_5d79_d07996b14ea1["prepareOutFolder()"] d9a56fd8_8416_73a6_c78e_6634d08ec9d5 -->|calls| fcb07289_ca64_1c36_5d79_d07996b14ea1 18f7219a_b7d2_6b64_16e6_f21e7d2c93c1["validateWithReport()"] d9a56fd8_8416_73a6_c78e_6634d08ec9d5 -->|calls| 18f7219a_b7d2_6b64_16e6_f21e7d2c93c1 style d9a56fd8_8416_73a6_c78e_6634d08ec9d5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/utils.ts lines 193–246
export const prepareMigrationFolder = (
outFolder: string = 'drizzle',
dialect: Dialect,
) => {
const { snapshots, journal } = prepareOutFolder(outFolder, dialect);
const report = validateWithReport(snapshots, dialect);
if (report.nonLatest.length > 0) {
console.log(
report.nonLatest
.map((it) => {
return `${it}/snapshot.json is not of the latest version`;
})
.concat(`Run ${chalk.green.bold(`drizzle-kit up`)}`)
.join('\n'),
);
process.exit(0);
}
if (report.malformed.length) {
const message = report.malformed
.map((it) => {
return `${it} data is malformed`;
})
.join('\n');
console.log(message);
}
const collisionEntries = Object.entries(report.idsMap).filter(
(it) => it[1].snapshots.length > 1,
);
const message = collisionEntries
.map((it) => {
const data = it[1];
return `[${
data.snapshots.join(
', ',
)
}] are pointing to a parent snapshot: ${data.parent}/snapshot.json which is a collision.`;
})
.join('\n')
.trim();
if (message) {
console.log(chalk.red.bold('Error:'), message);
}
const abort = report.malformed.length!! || collisionEntries.length > 0;
if (abort) {
process.exit(0);
}
return { snapshots, journal };
};
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does prepareMigrationFolder() do?
prepareMigrationFolder() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/utils.ts.
Where is prepareMigrationFolder() defined?
prepareMigrationFolder() is defined in drizzle-kit/src/utils.ts at line 193.
What does prepareMigrationFolder() call?
prepareMigrationFolder() calls 2 function(s): prepareOutFolder, validateWithReport.
What calls prepareMigrationFolder()?
prepareMigrationFolder() is called by 5 function(s): prepareAndMigrateLibSQL, prepareAndMigrateMysql, prepareAndMigratePg, prepareAndMigrateSingleStore, prepareAndMigrateSqlite.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free