We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to change multiple columns in one migration. Could you provide example.
This is what I tried so far:
exports.up = function(db) { return [ db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }), db.changeColumn(models.PROJECT_TABLE, 'updated_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }), ] };
and
exports.up = function(db) { db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }), db.changeColumn(models.PROJECT_TABLE, 'updated_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }), return null; };
db-migrate version: X.Y.Z plugins with versions: X.Y.Z db-migrate driver with versions: Additional information: - Node version: XX - Platform: Others:
The text was updated successfully, but these errors were encountered:
You need to chain them, use promise migrations in their correct way.
exports.up = function(db) { return db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }). then(() => db.changeColumn(models.PROJECT_TABLE, 'updated_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') })); };
Either that way, or if you're on node 8 you can also do this:
exports.up = async function(db) { await db.changeColumn(models.PROJECT_BIM_MODEL_SYNC, 'created_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }), return db.changeColumn(models.PROJECT_TABLE, 'updated_at', { type: 'timestamp', notNull: true, defaultValue: new String('CURRENT_TIMESTAMP') }) };
Sorry, something went wrong.
and never return null unless your migration step does simply nothing.
No branches or pull requests
I'm submitting a...
Current behavior
I want to change multiple columns in one migration. Could you provide example.
This is what I tried so far:
and
Expected behavior
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: