Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sequelize migration docs

Creating a model from scratch

  1. How do you create a migration for a new model? $ sequelize model:create --name User --attributes "email:string, password:string"

  2. How do you create a migration for a new model with an association? Run step 1, then add it yourself.

Updating a model

  1. How do you create a migration for an existing model? $ sequelize migration:generate --name doSomeThingsHere

  2. How do you create a migration for an existing model that adds an association?

General

  1. How do you run your migrations manually? $ sequelize db:migrate

  2. How do you run migrations automatically? ? Maybe db.sync()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.