Sequelize Migration CLI

Origin1 Technologies · 22K views · 2014 · 9:06

Open on YouTube

Databases & storageWeb developmentdemodated

Why Stack Overflow recommends it

Stack Overflow users link it when asking how to auto-generate or update Sequelize migrations after changing a model, since the video shows that workflow even though the tool was never finished.

Recommended by 0 people across 0 different months, 2015 to 2016.

What it is

A short 2014 screencast demonstrating a proof-of-concept Sequelize migration CLI that auto-generates migration files from changes in model state. The uploader, Origin1 Technologies, notes the project is deprecated and kept only for posterity.

What people said

Cites Dor Rotman · 2015-02 · Stack Overflow · on “How to auto generate migrations with Sequelize CLI from Sequelize models?”

You cannot create migration scripts for existing models. Resources: Tutorial video on migrations [this video] . If going the classic way, you'll have to recreate the models via the CLI: sequelize model:create --name MyUser --attributes first_name:string,last_name:string,bio:text It will generate these files: models/myuser.js: "use strict"; module.exports = function(sequelize, DataTypes) { var MyUser = sequelize.define("MyUser", { first_name: DataTypes.STRING, last_name: DataTypes.STRING, bio: DataTypes.TEXT }, { classMethods: { associate: function(models) { // associations can be defined here } } }); return MyUser; }; migrations/20150210104840-create-my-user.js: "use strict"; module.exports = { u

Cites ivan · 2015-07 · Stack Overflow · on “How to create a Sequelize cli db migration after changes to the model”

I am starting with sequelize and was following their video tutorial [this video] online. After running node_modules/.bin/sequelize model:create --name User --attributes username:string node_modules/.bin/sequelize model:create --name Task --attributes title:string which created the migration files for create user and create task. Then I had to add the associations to each model as follow: // user.js classMethods: { associate: function(models) { User.hasMany(models.Task); } } // task.js classMethods: { associate: function(models) { Task.belongsTo(models.User); } } However, the migration files for creating the tables for user and task are already created. Do i have to manually update them to add the

Cites Dirus · 2015-09 · Stack Overflow · on “How to update migration files when change column or add new column using Sequelize”

I'm new in Sequelize, right now I'm creating a RESTful api with NodeJS and Sequelize. I'm trying to figure out how to change my Database Schema like change my Column name using Sequelize I create a Model like this sequelize model:create --name MyUser --attributes first_name:string,last_name:string,bio:text It created a file in Models 'use strict'; module.exports = function(sequelize, DataTypes) { var Page = sequelize.define('Page', { name: DataTypes.STRING, text: DataTypes.TEXT, url: DataTypes.STRING }, { classMethods: { associate: function(models) { // associations can be defined here } } }); return Page; }; and one file in Migrations Folder 'use strict'; module.exports = { up: function(que

Cites Detuned · 2016-03 · Stack Overflow · on “Sequelize migrations not picking up model changes”

I'm new to Sequelize and have been reading through the documentation to get the migrations workflow, as described in this video, to work: Sequelize Migrations [this video] I understand that running the commands from the CLI to model:create ... creates the model as well as the migration file. After running db:migrate to have the database up-to-date, I'd like to alter the model that was just created (e.g. adding a new column) and then creating migration:create ... it doesn't recognize the changes to the model. It's simply the boilerplate code for writing the migration from scratch. In the video, I can see that creating a new migration detects the changes and creates the migration file accordingly.