Skip to content

Commit 8c3ebf9

Browse files
committed
Escape column names on add/change/drop
1 parent 6e82322 commit 8c3ebf9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/migration.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = function(IBMDB) {
6868
if (found) {
6969
actualize(propName, found);
7070
} else {
71-
operations.push('ADD COLUMN ' + propName + ' ' +
71+
operations.push('ADD COLUMN ' + self.columnEscaped(propName) + ' ' +
7272
self.buildColumnDefinition(model, propName));
7373
}
7474
});
@@ -77,8 +77,8 @@ module.exports = function(IBMDB) {
7777
var newSettings = m.properties[propName];
7878
if (newSettings && changed(newSettings, oldSettings)) {
7979
// TODO: NO TESTS EXECUTE THIS CODE PATH
80-
var pName = '\'' + propName + '\'';
81-
operations.push('CHANGE COLUMN ' + pName + ' ' + pName + ' ' +
80+
operations.push('CHANGE COLUMN ' + self.columnEscaped(propName) + ' ' +
81+
self.columnEscaped(propName) + ' ' +
8282
self.buildColumnDefinition(model, propName));
8383
}
8484
}
@@ -116,7 +116,7 @@ module.exports = function(IBMDB) {
116116
var notFound = !~propNames.indexOf(f.NAME);
117117
if (m.properties[f.NAME] && self.id(model, f.NAME)) return;
118118
if (notFound || !m.properties[f.NAME]) {
119-
operations.push('DROP COLUMN ' + f.NAME);
119+
operations.push('DROP COLUMN ' + self.columnEscaped(f.NAME));
120120
}
121121
});
122122
}

0 commit comments

Comments
 (0)