2
0
mirror of https://github.com/frappe/books.git synced 2025-02-02 12:08:27 +00:00

fixed changes

This commit is contained in:
Achilles Rasquinha 2018-02-01 15:02:33 +05:30
parent ab6c737294
commit d6c8c800d2

View File

@ -1,6 +1,6 @@
const frappe = require('frappejs'); const frappe = require('frappejs');
const sqlite3 = require('sqlite3').verbose(); const sqlite3 = require('sqlite3').verbose();
const debug = true; const debug = false;
class sqliteDatabase { class sqliteDatabase {
constructor({ db_path }) { constructor({ db_path }) {
@ -29,17 +29,12 @@ class sqliteDatabase {
if (frappe.modules[doctype].Meta) { if (frappe.modules[doctype].Meta) {
if (await this.table_exists(doctype)) { if (await this.table_exists(doctype)) {
await this.alter_table(doctype); await this.alter_table(doctype);
commit = true
} else { } else {
await this.create_table(doctype); await this.create_table(doctype);
commit = true
} }
} }
} }
if ( commit )
await this.commit();
} }
async create_table(doctype) { async create_table(doctype) {
@ -50,9 +45,6 @@ class sqliteDatabase {
for (let df of meta.get_valid_fields({ with_children: false })) { for (let df of meta.get_valid_fields({ with_children: false })) {
if (this.type_map[df.fieldtype]) { if (this.type_map[df.fieldtype]) {
columns.push(this.get_column_definition(df)); columns.push(this.get_column_definition(df));
// if (df.default) {
// values.push(df.default);
// }
} }
} }