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