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)) { for (const [key, schema] of Object.entries(table.schema)) {
if ("default" in schema && schema.default != null && row[key] == null) { if ("default" in schema && schema.default != null && row[key] == null) {
let processed = schema.default const processed =
if (typeof processed === "string") { typeof schema.default === "string"
processed = await processString(schema.default, ctx) ? await processString(schema.default, ctx)
} : schema.default
try { try {
row[key] = coerce(processed, schema.type) row[key] = coerce(processed, schema.type)
} catch (err: any) { } catch (err: any) {