db-migrate 1.0.0-beta.10 → 1.0.0-beta.14

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/connect.js CHANGED
@@ -25,10 +25,10 @@ exports.connect = function (config, PassedClass) {
25
25
  return;
26
26
  }
27
27
 
28
+ var dirPath = path.resolve(
29
+ internals.argv['migrations-dir'] || 'migrations'
30
+ );
28
31
  if (internals.migrationMode) {
29
- var dirPath = path.resolve(
30
- internals.argv['migrations-dir'] || 'migrations'
31
- );
32
32
  if (internals.migrationMode !== 'all') {
33
33
  var switched = false;
34
34
  var newConf;
@@ -56,7 +56,7 @@ exports.connect = function (config, PassedClass) {
56
56
  null,
57
57
  new PassedClass(
58
58
  db,
59
- internals.argv['migrations-dir'],
59
+ dirPath,
60
60
  internals.mode !== 'static',
61
61
  internals,
62
62
  prefix
@@ -69,7 +69,7 @@ exports.connect = function (config, PassedClass) {
69
69
  null,
70
70
  new PassedClass(
71
71
  db,
72
- internals.argv['migrations-dir'],
72
+ dirPath,
73
73
  internals.mode !== 'static',
74
74
  internals,
75
75
  prefix
@@ -112,7 +112,7 @@ exports.connect = function (config, PassedClass) {
112
112
  null,
113
113
  new PassedClass(
114
114
  db,
115
- internals.argv['migrations-dir'],
115
+ dirPath,
116
116
  internals.mode !== 'static',
117
117
  internals,
118
118
  prefix
@@ -2,6 +2,7 @@ const Promise = require('bluebird');
2
2
  const State = require('../../state');
3
3
  const Chain = require('../../chain');
4
4
  const Migrate = require('./migrate');
5
+ const log = require('db-migrate-shared').log;
5
6
 
6
7
  const methods = {
7
8
  createTable: async (driver, [t], internals) => {
@@ -42,6 +43,26 @@ const methods = {
42
43
 
43
44
  changeColumn: async (driver, [t, c], internals) => {
44
45
  return driver.changeColumn(t, c, internals.modSchema.c[t][c]);
46
+ },
47
+
48
+ addIndex: async (driver, [t, i], internals) => {
49
+ if (!internals.modSchema.i[t][i]) {
50
+ log.warn(
51
+ `There was an attempt to create the index "${i}" in the table "${t}".`
52
+ );
53
+ log.warn(
54
+ `This index did not exist at the time of deleting it. ` +
55
+ `This can happen if an index was created by hand and then deleted` +
56
+ `by db-migrate. Make sure to recreate it by hand to avoid any problems.`
57
+ );
58
+ return Promise.resolve();
59
+ }
60
+ return driver.addIndex(
61
+ t,
62
+ i,
63
+ internals.modSchema.i[t][i].c,
64
+ internals.modSchema.i[t][i].u ? true : undefined
65
+ );
45
66
  }
46
67
  };
47
68
 
package/package.json CHANGED
@@ -31,7 +31,7 @@
31
31
  "programable",
32
32
  "api"
33
33
  ],
34
- "version": "1.0.0-beta.10",
34
+ "version": "1.0.0-beta.14",
35
35
  "engines": {
36
36
  "node": ">=8.0.0"
37
37
  },
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+
7
+ /**
8
+ * We receive the dbmigrate dependency from dbmigrate initially.
9
+ * This enables us to not have to rely on NODE_PATH.
10
+ */
11
+ exports.setup = function(options, seedLink) {
12
+ dbm = options.dbmigrate;
13
+ type = dbm.dataType;
14
+ seed = seedLink;
15
+ };
16
+
17
+ exports.up = function(db) {
18
+ return null;
19
+ };
20
+
21
+ exports.down = function(db) {
22
+ return null;
23
+ };
24
+
25
+ exports._meta = {
26
+ "version": 1
27
+ };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+
7
+ /**
8
+ * We receive the dbmigrate dependency from dbmigrate initially.
9
+ * This enables us to not have to rely on NODE_PATH.
10
+ */
11
+ exports.setup = function(options, seedLink) {
12
+ dbm = options.dbmigrate;
13
+ type = dbm.dataType;
14
+ seed = seedLink;
15
+ };
16
+
17
+ exports.up = function(db) {
18
+ return null;
19
+ };
20
+
21
+ exports.down = function(db) {
22
+ return null;
23
+ };
24
+
25
+ exports._meta = {
26
+ "version": 1
27
+ };