doix-db 1.0.7 → 1.0.8

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.
@@ -47,27 +47,17 @@ class DbMigrationPlan extends EventEmitter {
47
47
  action, object)
48
48
  )
49
49
 
50
- this.on ('create', object => add (
51
- this.toDo,
52
- 'comment', object)
53
- )
54
-
55
50
  for (const action of COLUMN_ACTIONS) this.on (action, column => add (
56
51
  this.asIs.get (column.relation.name).toDo,
57
52
  action, column)
58
53
  )
59
54
 
60
- for (const action of ['add-column', 'migrate-column']) this.on (action, column => add (
61
- this.asIs.get (column.relation.name).toDo,
62
- 'comment-column', column)
63
- )
64
-
65
55
  }
66
56
 
67
57
  compareRelation (asIs, toBe) {
68
58
 
69
59
  const {lang} = this, {columns} = toBe, existingColumns = asIs.columns
70
-
60
+
71
61
  for (const [name, column] of Object.entries (columns)) {
72
62
 
73
63
  if (name in existingColumns) {
@@ -78,14 +68,20 @@ class DbMigrationPlan extends EventEmitter {
78
68
 
79
69
  const action = lang.getRequiredColumnMutation (existingColumn, column)
80
70
 
81
- if (action !== null) this.emit (action, column)
71
+ if (action === null) continue
72
+
73
+ this.emit (action, column)
74
+
75
+ if (action === 'alter-column' && existingColumn.comment == column.comment) continue
82
76
 
83
- if (existingColumn.comment != column.comment) this.emit ('comment-column', column)
77
+ this.emit ('comment-column', column)
84
78
 
85
79
  }
86
80
  else {
87
81
 
88
82
  this.emit ('add-column', column)
83
+
84
+ this.emit ('comment-column', column)
89
85
 
90
86
  }
91
87
 
@@ -122,6 +118,8 @@ class DbMigrationPlan extends EventEmitter {
122
118
  this.compareObject (asIs.get (name), object)
123
119
 
124
120
  if (action !== null) this.emit (action, object)
121
+
122
+ if (action === 'create') this.emit ('comment', object)
125
123
 
126
124
  }
127
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doix-db",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Shared database related code for doix",
5
5
  "main": "index.js",
6
6
  "files": [