This commit is contained in:
Andrew Kingston 2024-10-02 10:54:17 +01:00
parent a49e779d11
commit 27c65ccff2
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -134,10 +134,10 @@ async function processDefaultValues(table: Table, row: Row) {
for (const [key, schema] of Object.entries(table.schema)) {
if ("default" in schema && schema.default != null && row[key] == null) {
let processed = schema.default
if (typeof processed === "string") {
processed = await processString(schema.default, ctx)
}
const processed =
typeof schema.default === "string"
? await processString(schema.default, ctx)
: schema.default
try {
row[key] = coerce(processed, schema.type)
} catch (err: any) {