canRecreateTableWithoutDataLoss() — astro Function Reference
Architecture documentation for the canRecreateTableWithoutDataLoss() function in migration-queries.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD e15cd5dc_37f0_2b94_a984_85714025b10b["canRecreateTableWithoutDataLoss()"] d1459290_7e42_1f92_05bd_dcc3aeda9fd3["migration-queries.ts"] e15cd5dc_37f0_2b94_a984_85714025b10b -->|defined in| d1459290_7e42_1f92_05bd_dcc3aeda9fd3 d8e591b7_f3dd_5f49_beb9_c9047d4d1e02["getTableChangeQueries()"] d8e591b7_f3dd_5f49_beb9_c9047d4d1e02 -->|calls| e15cd5dc_37f0_2b94_a984_85714025b10b 7682e3a8_d373_faeb_f416_795930ac2f26["canChangeTypeWithoutQuery()"] e15cd5dc_37f0_2b94_a984_85714025b10b -->|calls| 7682e3a8_d373_faeb_f416_795930ac2f26 style e15cd5dc_37f0_2b94_a984_85714025b10b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/cli/migration-queries.ts lines 324–342
function canRecreateTableWithoutDataLoss(
added: DBColumns,
updated: UpdatedColumns,
): DataLossResponse {
for (const [columnName, a] of Object.entries(added)) {
if (hasPrimaryKey(a) && a.type !== 'number' && !hasDefault(a)) {
return { dataLoss: true, columnName, reason: 'added-required' };
}
if (!a.schema.optional && !hasDefault(a)) {
return { dataLoss: true, columnName, reason: 'added-required' };
}
}
for (const [columnName, u] of Object.entries(updated)) {
if (u.old.type !== u.new.type && !canChangeTypeWithoutQuery(u.old, u.new)) {
return { dataLoss: true, columnName, reason: 'updated-type' };
}
}
return { dataLoss: false };
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does canRecreateTableWithoutDataLoss() do?
canRecreateTableWithoutDataLoss() is a function in the astro codebase, defined in packages/db/src/core/cli/migration-queries.ts.
Where is canRecreateTableWithoutDataLoss() defined?
canRecreateTableWithoutDataLoss() is defined in packages/db/src/core/cli/migration-queries.ts at line 324.
What does canRecreateTableWithoutDataLoss() call?
canRecreateTableWithoutDataLoss() calls 1 function(s): canChangeTypeWithoutQuery.
What calls canRecreateTableWithoutDataLoss()?
canRecreateTableWithoutDataLoss() is called by 1 function(s): getTableChangeQueries.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free