Skip to content

Commit 5102c70

Browse files
committed
Added SIMULATE_MIGRATION environment variable to test migration
Added SIMULATE_MIGRATION environment variable to test migration Added SIMULATE_MIGRATION environment variable to test migration fix Added SIMULATE_MIGRATION environment variable to test migration fix Added SIMULATE_MIGRATION environment variable to test migration fix
1 parent e54794c commit 5102c70

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/migration.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ function mixinMigration(PostgreSQL) {
213213
var found = self.searchForPropertyInActual(
214214
model, self.column(model, propName), actualFields);
215215
if (!found && self.propertyHasNotBeenDeleted(model, propName)) {
216-
sql.push('ADD COLUMN ' + self.addPropertyToActual(model, propName));
216+
if (process.env.SIMULATE_MIGRATION && process.env.SIMULATE_MIGRATION === 'true') {
217+
console.log('ADD COLUMN %s (%s)', self.addPropertyToActual(model, propName), model)
218+
} else {
219+
sql.push('ADD COLUMN ' + self.addPropertyToActual(model, propName));
220+
}
217221
}
218222
});
219223
if (sql.length > 0) {
@@ -322,7 +326,11 @@ function mixinMigration(PostgreSQL) {
322326
return;
323327
}
324328
if (actualFieldNotPresentInModel(actualField, model)) {
325-
sql.push('DROP COLUMN ' + self.escapeName(actualField.column));
329+
if (process.env.SIMULATE_MIGRATION && process.env.SIMULATE_MIGRATION === 'true') {
330+
console.log('DROP COLUMN %s (%s)', self.escapeName(actualField.column), model)
331+
} else {
332+
sql.push('DROP COLUMN ' + self.escapeName(actualField.column));
333+
}
326334
}
327335
});
328336
if (sql.length > 0) {

0 commit comments

Comments
 (0)