getDefaultValueSql() — astro Function Reference
Architecture documentation for the getDefaultValueSql() function in queries.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD c628104c_faef_c095_180d_890bd11e4417["getDefaultValueSql()"] ad642171_aa4f_abf2_da4d_c5b2e217a132["queries.ts"] c628104c_faef_c095_180d_890bd11e4417 -->|defined in| ad642171_aa4f_abf2_da4d_c5b2e217a132 8d1b704b_bb80_1aba_c294_631b6d77405c["getModifiers()"] 8d1b704b_bb80_1aba_c294_631b6d77405c -->|calls| c628104c_faef_c095_180d_890bd11e4417 21c1da33_45c1_639a_3787_4bdd0afd8051["toDefault()"] c628104c_faef_c095_180d_890bd11e4417 -->|calls| 21c1da33_45c1_639a_3787_4bdd0afd8051 style c628104c_faef_c095_180d_890bd11e4417 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/queries.ts lines 178–206
function getDefaultValueSql(columnName: string, column: DBColumnWithDefault): string {
if (isSerializedSQL(column.schema.default)) {
return column.schema.default.sql;
}
switch (column.type) {
case 'boolean':
case 'number':
case 'text':
case 'date':
return toDefault(column.schema.default);
case 'json': {
let stringified = '';
try {
stringified = JSON.stringify(column.schema.default);
} catch {
// biome-ignore lint/suspicious/noConsole: allowed
console.log(
`Invalid default value for column ${colors.bold(
columnName,
)}. Defaults must be valid JSON when using the \`json()\` type.`,
);
process.exit(0);
}
return sqlite.escapeString(stringified);
}
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does getDefaultValueSql() do?
getDefaultValueSql() is a function in the astro codebase, defined in packages/db/src/core/queries.ts.
Where is getDefaultValueSql() defined?
getDefaultValueSql() is defined in packages/db/src/core/queries.ts at line 178.
What does getDefaultValueSql() call?
getDefaultValueSql() calls 1 function(s): toDefault.
What calls getDefaultValueSql()?
getDefaultValueSql() is called by 1 function(s): getModifiers.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free