2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 12:28:12 +00:00

fix: String default value must be in quotes

This commit is contained in:
Faris Ansari 2019-10-19 20:00:31 +05:30
parent f1823a71ab
commit bf4b6c6f6b

View File

@ -79,12 +79,16 @@ module.exports = class sqliteDatabase extends Database {
} }
getColumnDefinition(field) { getColumnDefinition(field) {
let defaultValue = field.default;
if (typeof defaultValue === 'string') {
defaultValue = `'${defaultValue}'`
}
let def = [ let def = [
field.fieldname, field.fieldname,
this.typeMap[field.fieldtype], this.typeMap[field.fieldtype],
field.fieldname === 'name' ? 'PRIMARY KEY NOT NULL' : '', field.fieldname === 'name' ? 'PRIMARY KEY NOT NULL' : '',
field.required ? 'NOT NULL' : '', field.required ? 'NOT NULL' : '',
field.default ? `DEFAULT ${field.default}` : '' field.default ? `DEFAULT ${defaultValue}` : ''
].join(' '); ].join(' ');
return def; return def;