Answer the question
In order to leave comments, you need to log in
How to do nestjs migrations with postgresql and sequelize?
I'm used to doing everything according to guides and I just can't find a normal explanation: how to do migrations using nest.js and sequelize. Please explain or help with a link to a good article.
Answer the question
In order to leave comments, you need to log in
npx sequelize-cli migration:create --name migration-name
20220204133519-migration-name.js:
module.exports = {
async up (queryInterface, Sequelize) {
await queryInterface.addColumn("table", "field", {
type: Sequelize.INTEGER
defaultValue: 0
})
},
async down (queryInterface, Sequelize) {
await queryInterface.removeColumn("table", "field");
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question