mythix 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mythix",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Mythix is a NodeJS web-app framework",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"express": "^4.17.3",
|
|
31
31
|
"express-busboy": "^8.0.2",
|
|
32
32
|
"form-data": "^4.0.0",
|
|
33
|
+
"mythix-orm": "^1.0.4",
|
|
33
34
|
"nife": "^1.11.3",
|
|
34
35
|
"prompts": "^2.4.2"
|
|
35
36
|
}
|
|
@@ -61,18 +61,18 @@ module.exports = defineCommand('migrate', ({ Parent }) => {
|
|
|
61
61
|
return migrationFiles.slice((isRollback) ? index : index + 1);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
async executeMigration(dbConnection, migrationFileName, useTransaction, rollback) {
|
|
64
|
+
async executeMigration(application, dbConnection, migrationFileName, useTransaction, rollback) {
|
|
65
65
|
let migration = require(migrationFileName);
|
|
66
66
|
let startTime = Nife.now();
|
|
67
67
|
|
|
68
68
|
if (rollback) {
|
|
69
|
-
await migration.down(dbConnection);
|
|
69
|
+
await migration.down(dbConnection, application);
|
|
70
70
|
await this.removeMigrationFromDB(migration.MIGRATION_ID);
|
|
71
71
|
|
|
72
72
|
let seconds = ((Nife.now() - startTime) / MILLISECONDS_PER_SECOND).toFixed(2);
|
|
73
73
|
console.log(`Rolled back migration ${migrationFileName} successfully in ${seconds} seconds`);
|
|
74
74
|
} else {
|
|
75
|
-
await migration.up(dbConnection);
|
|
75
|
+
await migration.up(dbConnection, application);
|
|
76
76
|
await this.storeSuccessfulMigrationToDB(migration.MIGRATION_ID);
|
|
77
77
|
|
|
78
78
|
let seconds = ((Nife.now() - startTime) / MILLISECONDS_PER_SECOND).toFixed(2);
|
|
@@ -130,7 +130,7 @@ module.exports = defineCommand('migrate', ({ Parent }) => {
|
|
|
130
130
|
else
|
|
131
131
|
console.log(`Running migration ${migrationFileName}...`);
|
|
132
132
|
|
|
133
|
-
this.executeMigration(dbConnection, migrationFileName, useTransaction, rollback).then(
|
|
133
|
+
this.executeMigration(application, dbConnection, migrationFileName, useTransaction, rollback).then(
|
|
134
134
|
() => nextMigration(doneCallback, index + 1),
|
|
135
135
|
(error) => {
|
|
136
136
|
console.error(`Error while running migration ${migrationFileName}: `, error);
|