doix-db 1.0.8 → 1.0.10

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.
@@ -14,7 +14,6 @@ const COLUMN_ACTIONS = [
14
14
  'add-column',
15
15
  'alter-column',
16
16
  'migrate-column',
17
- 'comment-column',
18
17
  ]
19
18
 
20
19
  const add = (toDo, action, object) => {
@@ -67,21 +66,17 @@ class DbMigrationPlan extends EventEmitter {
67
66
  existingColumn.diff = lang.compareColumns (existingColumn, column)
68
67
 
69
68
  const action = lang.getRequiredColumnMutation (existingColumn, column)
70
-
71
- if (action === null) continue
72
69
 
73
- this.emit (action, column)
74
-
75
- if (action === 'alter-column' && existingColumn.comment == column.comment) continue
70
+ if (action) this.emit (action, column)
76
71
 
77
- this.emit ('comment-column', column)
72
+ if (action === 'migrate-column' || existingColumn.comment != column.comment) this.emit ('comment', column)
78
73
 
79
74
  }
80
75
  else {
81
76
 
82
77
  this.emit ('add-column', column)
83
78
 
84
- this.emit ('comment-column', column)
79
+ this.emit ('comment', column)
85
80
 
86
81
  }
87
82
 
@@ -116,11 +111,27 @@ class DbMigrationPlan extends EventEmitter {
116
111
  !asIs.has (name) ? 'create' :
117
112
 
118
113
  this.compareObject (asIs.get (name), object)
114
+
115
+ if (action === null) continue
119
116
 
120
- if (action !== null) this.emit (action, object)
117
+ this.emit (action, object)
118
+
119
+ switch (action) {
120
+
121
+ case 'recreate':
122
+
123
+ if (object instanceof DbRelation)
124
+
125
+ for (const column of Object.values (object.columns))
121
126
 
122
- if (action === 'create') this.emit ('comment', object)
127
+ this.emit ('comment', column)
128
+
129
+ case 'create':
123
130
 
131
+ this.emit ('comment', object)
132
+
133
+ }
134
+
124
135
  }
125
136
 
126
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doix-db",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Shared database related code for doix",
5
5
  "main": "index.js",
6
6
  "files": [