getUpdatedColumns() — astro Function Reference
Architecture documentation for the getUpdatedColumns() function in migration-queries.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 4cd3c863_fa29_c34a_a49a_467807e47651["getUpdatedColumns()"] d1459290_7e42_1f92_05bd_dcc3aeda9fd3["migration-queries.ts"] 4cd3c863_fa29_c34a_a49a_467807e47651 -->|defined in| d1459290_7e42_1f92_05bd_dcc3aeda9fd3 d8e591b7_f3dd_5f49_beb9_c9047d4d1e02["getTableChangeQueries()"] d8e591b7_f3dd_5f49_beb9_c9047d4d1e02 -->|calls| 4cd3c863_fa29_c34a_a49a_467807e47651 7682e3a8_d373_faeb_f416_795930ac2f26["canChangeTypeWithoutQuery()"] 4cd3c863_fa29_c34a_a49a_467807e47651 -->|calls| 7682e3a8_d373_faeb_f416_795930ac2f26 style 4cd3c863_fa29_c34a_a49a_467807e47651 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/cli/migration-queries.ts lines 372–399
function getUpdatedColumns(oldColumns: DBColumns, newColumns: DBColumns): UpdatedColumns {
const updated: UpdatedColumns = {};
for (const [key, newColumn] of Object.entries(newColumns)) {
let oldColumn = oldColumns[key];
if (!oldColumn) continue;
if (oldColumn.type !== newColumn.type && canChangeTypeWithoutQuery(oldColumn, newColumn)) {
// If we can safely change the type without a query,
// try parsing the old schema as the new schema.
// This lets us diff the columns as if they were the same type.
const asNewColumn = columnSchema.safeParse({
type: newColumn.type,
schema: oldColumn.schema,
});
if (asNewColumn.success) {
oldColumn = asNewColumn.data;
}
// If parsing fails, move on to the standard diff.
}
const diff = deepDiff(oldColumn, newColumn);
if (diff) {
updated[key] = { old: oldColumn, new: newColumn };
}
}
return updated;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getUpdatedColumns() do?
getUpdatedColumns() is a function in the astro codebase, defined in packages/db/src/core/cli/migration-queries.ts.
Where is getUpdatedColumns() defined?
getUpdatedColumns() is defined in packages/db/src/core/cli/migration-queries.ts at line 372.
What does getUpdatedColumns() call?
getUpdatedColumns() calls 1 function(s): canChangeTypeWithoutQuery.
What calls getUpdatedColumns()?
getUpdatedColumns() 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