There was an error while loading. Please reload this page.
1 parent 98c6b54 commit 0aad7eaCopy full SHA for 0aad7ea
2 files changed
lib/application.js
@@ -48,6 +48,11 @@ class BookkeepingApplication {
48
async run() {
49
try {
50
await this.database.connect();
51
+
52
+ if (this.isInTestMode()) {
53
+ await this.database.dropAllTables();
54
+ }
55
56
await this.database.migrate();
57
58
if (this.isInTestMode()) {
lib/database/index.js
@@ -82,6 +82,15 @@ class SequelizeDatabase {
82
return this.sequelize.close();
83
}
84
85
+ /**
86
+ * Drops all tables.
87
+ *
88
+ * @returns {Promise} Promise object represents the outcome.
89
+ */
90
+ async dropAllTables() {
91
+ return this.sequelize.getQueryInterface().dropAllTables();
92
93
94
/**
95
* Executes every *pending* migrations.
96
*
0 commit comments