From bf4b6c6f6bd4710ac1d7b3e7e37bf49f3b892cea Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 19 Oct 2019 20:00:31 +0530 Subject: [PATCH] fix: String default value must be in quotes --- backends/sqlite.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/sqlite.js b/backends/sqlite.js index 1c691712..86d587b4 100644 --- a/backends/sqlite.js +++ b/backends/sqlite.js @@ -79,12 +79,16 @@ module.exports = class sqliteDatabase extends Database { } getColumnDefinition(field) { + let defaultValue = field.default; + if (typeof defaultValue === 'string') { + defaultValue = `'${defaultValue}'` + } let def = [ field.fieldname, this.typeMap[field.fieldtype], field.fieldname === 'name' ? 'PRIMARY KEY NOT NULL' : '', field.required ? 'NOT NULL' : '', - field.default ? `DEFAULT ${field.default}` : '' + field.default ? `DEFAULT ${defaultValue}` : '' ].join(' '); return def;