db-migrate 1.0.0-beta.23 → 1.0.0-beta.25
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/lib/commands/fix.js +1 -1
- package/lib/state.js +3 -3
- package/lib/walker.js +4 -4
- package/package.json +1 -1
package/lib/commands/fix.js
CHANGED
|
@@ -31,7 +31,7 @@ async function prepare (internals, config) {
|
|
|
31
31
|
|
|
32
32
|
internals.migrationsDir = migrator.directory;
|
|
33
33
|
|
|
34
|
-
await migrator.createMigrationsTable();
|
|
34
|
+
await migrator.createMigrationsTable({ emptyState: true });
|
|
35
35
|
log.verbose('migration table created');
|
|
36
36
|
|
|
37
37
|
return migrator;
|
package/lib/state.js
CHANGED
|
@@ -29,12 +29,12 @@ module.exports = {
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
|
|
32
|
-
init: async function (driver, internals) {
|
|
32
|
+
init: async function (driver, internals, { emptyState }) {
|
|
33
33
|
await driver._createKV(internals.migrationState);
|
|
34
|
-
const schema = await driver._getKV(internals.migrationState, SSTATE);
|
|
34
|
+
const schema = emptyState !== true ? await driver._getKV(internals.migrationState, SSTATE) : null;
|
|
35
35
|
if (schema) {
|
|
36
36
|
internals.schema = JSON.parse(schema.value);
|
|
37
|
-
} else {
|
|
37
|
+
} else if (!emptyState) {
|
|
38
38
|
await driver._insertKV(internals.migrationState, SSTATE, '{}');
|
|
39
39
|
}
|
|
40
40
|
|
package/lib/walker.js
CHANGED
|
@@ -59,12 +59,12 @@ const Walker = function (driver, directory, mode, intern, prefix) {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
Walker.prototype = {
|
|
62
|
-
createTables: async function () {
|
|
63
|
-
await State.init(this._driver, this.internals);
|
|
62
|
+
createTables: async function (options) {
|
|
63
|
+
await State.init(this._driver, this.internals, options);
|
|
64
64
|
return this._driver._createList(this.internals.migrationTable);
|
|
65
65
|
},
|
|
66
66
|
|
|
67
|
-
createMigrationsTable: function () {
|
|
67
|
+
createMigrationsTable: function (options) {
|
|
68
68
|
if (
|
|
69
69
|
typeof this._driver._createList !== 'function' ||
|
|
70
70
|
typeof this._driver._getList !== 'function' ||
|
|
@@ -85,7 +85,7 @@ Walker.prototype = {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
return this.createTables();
|
|
88
|
+
return this.createTables(options);
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
writeMigrationRecord: function (migration, callback) {
|