2
0
mirror of https://github.com/frappe/books.git synced 2025-01-22 22:58:28 +00:00

Merge pull request #10 from achillesrasquinha/9

[FIX] Default values shouldn't be null
This commit is contained in:
Achilles Rasquinha 2018-02-01 15:30:00 +05:30 committed by GitHub
commit f3407d79f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 5 deletions

0
.travis.yml Normal file
View File

View 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();

View File

@ -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"