mirror of
https://github.com/frappe/books.git
synced 2025-01-24 15:48:25 +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) {
|
getColumnDefinition(field) {
|
||||||
let def = `${field.fieldname} ${this.typeMap[field.fieldtype]}`;
|
let def = [
|
||||||
if (field.fieldname==='name') {
|
field.fieldname,
|
||||||
def += ' PRIMARY KEY NOT NULL';
|
this.typeMap[field.fieldtype],
|
||||||
}
|
field.fieldname === 'name' ? 'PRIMARY KEY NOT NULL' : '',
|
||||||
else if (field.required) {
|
field.required ? 'NOT NULL' : '',
|
||||||
def += ' NOT NULL';
|
field.default ? `DEFAULT ${field.default}` : ''
|
||||||
}
|
].join(' ');
|
||||||
if (field.default) {
|
|
||||||
def += `DEFAULT ${field.default}`;
|
|
||||||
}
|
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user