sequelize create migration code example

Example 1: sequelize generate migration

npx sequelize-cli migration:generate --name add-title-post-table

Example 2: squelize-cli create empty migration

npx sequelize-cli migration:create --name your_migration_name

Example 3: sequelize migration limit

queryInterface.createTable(
    'Posts',
    {
        title: {
            type: Sequelize.DataTypes.STRING(100),
            allowNull: false
        }
    }
);

Example 4: sequelize path

app.get('/fruit/:fruitName', function(req, res) {
    console.log(req.params.fruitName);
});

Tags:

Misc Example