After some research I don't seem to be able to find a great approach doing following:
I wan't to add a new column, to an existing table, that should be an auto incrementing integer, starting with the value of 1000.
My migration file is for now simple and obvious:
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.addColumn(
'Orders',
'orderRef',
{
autoIncrement: true,
type: Sequelize.INTEGER
}
)
])
},
down: {...
}
};
So this adds the column to the table unproblematic. But I don't seem to be able to find a great approach to set the value to start at 1000 and increment from there.
I know I could run a query like ALTER TABLE Orders AUTO_INCREMENT = 1000; but I would very much appreciate to keep it in Sequelize.
I'm using a PostgreSQL database and Sequelize version 4.38.1.
Does anyone know a nice way around this issue?