Selaa lähdekoodia

Поправлен баг

Book Pauk 3 vuotta sitten
vanhempi
commit
6286d663c9
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 6 4
      server/db/JembaDb/JembaDb.js

+ 6 - 4
server/db/JembaDb/JembaDb.js

@@ -111,14 +111,16 @@ class JembaDb {
 
 
         let table;
         let table;
         if (query.table) {
         if (query.table) {
-            if (!(await this.tableExists({table: query.table}))) {
+            if (await this.tableExists({table: query.table})) {
+                if (!query.quietIfExists)
+                    throw new Error(`Table '${query.table}' already exists`);
+
+                table = this.table.get(query.table);
+            } else {
                 table = new Table();
                 table = new Table();
                 this.table.set(query.table, table);
                 this.table.set(query.table, table);
 
 
                 await this.open(query);
                 await this.open(query);
-            } else {
-                if (!query.quietIfExists)
-                    throw new Error(`Table '${query.table}' already exists`);
             }
             }
         } else {
         } else {
             if (await this.tableExists({table: query.in})) {
             if (await this.tableExists({table: query.in})) {