sequelize generate migration
npx sequelize-cli migration:generate --name add-title-post-table
sequelize generate migration
npx sequelize-cli migration:generate --name add-title-post-table
sequelize migration add column foreign key
queryInterface.addConstraint('table_name', {
fields: ['column_name'],
type: 'foreign key',
name: 'custom_fkey_constraint_name', // optional
references: {
table: 'target_table_name',
field: 'target_column_name'
},
onDelete: 'cascade',
onUpdate: 'cascade'
});
sequelize migration default value
queryInterface.addColumn('OrderBackups', 'my_column', {
type: Sequelize.INTEGER,
defaultValue: 0
})
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us