Migrations queryInterface.addColumn before/after another column?
See original GitHub issueAnyhow can I use queryInterface.addColumn to add a column before or after another specific column?
It’d be nice to have this feature.
Add a column after another column
queryInterface.addColumn('tableA', 'columnC', Sequelize.STRING, {
after: 'columnB'
});
What do you expect to happen?
The column C should be added after columnB
What is actually happening?
The column append at the end of table
Add a column as the first column in the table
queryInterface.addColumn('tableA', 'columnA', Sequelize.STRING, {
first: true
});
What do you expect to happen?
The columnA should be added as the first column of the table
What is actually happening?
The column append at the end of table
Dialect: mysql Database version: MySQL 5.6.20 Sequelize version: Sequelize [Node: 6.7.0, CLI: 2.4.0, ORM: 3.24.3, mysql: ^2.11.1]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Migrations Add Column after specified column and index column
Below is my existing migration file. 'use strict'; module.exports = { up: function (queryInterface, Sequelize) ...
Read more >“sequelize migration add column after another ... - Code Grepper
module.exports = { up: (queryInterface, Sequelize) => { return queryInterface.sequelize.transaction((t) => { return Promise.all([ queryInterface.
Read more >How to Add New Fields to Existing Sequelize Migration
Step 1 - Create a new migration ... addColumn( 'Users', // table name 'twitter', // new field name { type: Sequelize.STRING, allowNull: true ......
Read more >Modifying an existing Sequelize migration | Codementor
addColumn if you want to add a new column or columns. This is a sequelize method queryInterface uses, to add a new column...
Read more >QueryInterface - Sequelize
Add a new column to a table queryInterface.addColumn('tableA', 'columnC', Sequelize.STRING, { after: 'columnB' // after option is only supported by MySQL }); ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This one is currently burning me as well, on Postgres.
@abdullah2993 postgres doesn’t support adding a column AFTER another one.