mirror of
https://github.com/frappe/books.git
synced 2025-01-08 17:24:05 +00:00
query builder: imperative to declarative 😠
This commit is contained in:
parent
beffd73259
commit
01a7a31a0d
@ -74,16 +74,14 @@ module.exports = class sqliteDatabase extends Database {
|
||||
}
|
||||
|
||||
getColumnDefinition(field) {
|
||||
let def = `${field.fieldname} ${this.typeMap[field.fieldtype]}`;
|
||||
if (field.fieldname==='name') {
|
||||
def += ' PRIMARY KEY NOT NULL';
|
||||
}
|
||||
else if (field.required) {
|
||||
def += ' NOT NULL';
|
||||
}
|
||||
if (field.default) {
|
||||
def += `DEFAULT ${field.default}`;
|
||||
}
|
||||
let def = [
|
||||
field.fieldname,
|
||||
this.typeMap[field.fieldtype],
|
||||
field.fieldname === 'name' ? 'PRIMARY KEY NOT NULL' : '',
|
||||
field.required ? 'NOT NULL' : '',
|
||||
field.default ? `DEFAULT ${field.default}` : ''
|
||||
].join(' ');
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user