mirror of
https://github.com/frappe/books.git
synced 2025-01-23 07:08:36 +00:00
Merge pull request #10 from achillesrasquinha/9
[FIX] Default values shouldn't be null
This commit is contained in:
commit
f3407d79f5
0
.travis.yml
Normal file
0
.travis.yml
Normal file
@ -45,9 +45,6 @@ class sqliteDatabase {
|
||||
for (let df of meta.get_valid_fields({ with_children: false })) {
|
||||
if (this.type_map[df.fieldtype]) {
|
||||
columns.push(this.get_column_definition(df));
|
||||
if (df.default) {
|
||||
values.push(df.default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +59,7 @@ class sqliteDatabase {
|
||||
}
|
||||
|
||||
get_column_definition(df) {
|
||||
return `${df.fieldname} ${this.type_map[df.fieldtype]} ${df.reqd ? "not null" : ""} ${df.default ? "default ?" : ""}`
|
||||
return `${df.fieldname} ${this.type_map[df.fieldtype]} ${df.reqd && !df.default ? "not null" : ""} ${df.default ? `default ${df.default}` : ""}`
|
||||
}
|
||||
|
||||
async alter_table(doctype) {
|
||||
@ -226,10 +223,11 @@ class sqliteDatabase {
|
||||
}
|
||||
|
||||
run(query, params) {
|
||||
// TODO promisify
|
||||
return new Promise((resolve, reject) => {
|
||||
this.conn.run(query, params, (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
|
15
yarn.lock
15
yarn.lock
@ -309,6 +309,10 @@ boom@5.x.x:
|
||||
dependencies:
|
||||
hoek "4.x.x"
|
||||
|
||||
bootstrap@4.0.0-beta.3:
|
||||
version "4.0.0-beta.3"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.0.0-beta.3.tgz#60f0660bc3d121176514b361f6f83201c7ff8874"
|
||||
|
||||
bootstrap@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.0.0.tgz#ceb03842c145fcc1b9b4e15da2a05656ba68469a"
|
||||
@ -1384,6 +1388,17 @@ forwarded@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
|
||||
|
||||
frappejs@^0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/frappejs/-/frappejs-0.0.1.tgz#8926c6043327535aa11683c1f7831b2cfb8ed414"
|
||||
dependencies:
|
||||
body-parser "^1.18.2"
|
||||
bootstrap "4.0.0-beta.3"
|
||||
express "^4.16.2"
|
||||
node-fetch "^1.7.3"
|
||||
sqlite3 "^3.1.13"
|
||||
walk "^2.3.9"
|
||||
|
||||
fresh@0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
|
||||
|
Loading…
x
Reference in New Issue
Block a user