2
0
mirror of https://github.com/frappe/books.git synced 2024-12-25 12:10:06 +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) {
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;