0

Can we generate model using a migration file ? i have created migrations file . i want to genrate corresponding model file using it ? is it possible in node sequlizer ?

This is my one of migration file :

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('Vendors', {
      id: {
        allowNull: false,
        primaryKey: true,
        type: Sequelize.UUID,
        defaultValue: Sequelize.UUIDV1
      },
      firstName: {
        type: Sequelize.STRING
      }
    });
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('Vendors');
  }
}; ```

i know it is possible to generate migration using given model file . Can we do the opposite of that ?
devaka dabare
  • 39
  • 1
  • 10

1 Answers1

0

Just run the migration which you have created like this :

node ./node_modules/sequelize-auto-migrations/bin/runmigration

Also run db:migrate

Prabhjot Singh Kainth
  • 1,831
  • 2
  • 18
  • 26