Skip to content

Database Migrations

Katie Broida edited this page Dec 20, 2019 · 2 revisions

Creating Migrations

yarn create-migration <migration name>

# Example
yarn create-migration create-users-table

db-migrate tool will subsequently create a JS migration file that can be edited in the migrations folder.

Applying Migrations

yarn db-migrate-up

This command can be customized with the following options: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/usage/#running-migrations

Example: Passing a count: npm run db-migrate-down -- -c 1

Reverting Migrations

yarn db-migrate-down

This command can be customized with the following options https://db-migrate.readthedocs.io/en/latest/Getting%20Started/commands/#down

Clone this wiki locally