Answers for "sequelize create migration field"

PHP
1

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'
});
Posted by: Guest on April-07-2021
1

sequelize migration default value

queryInterface.addColumn('OrderBackups', 'my_column', {
  type: Sequelize.INTEGER,
  defaultValue: 0
})
Posted by: Guest on May-12-2020

Code answers related to "sequelize create migration field"

Browse Popular Code Answers by Language