Skip to content

DB Migrations

tiblu edited this page Oct 23, 2018 · 15 revisions

What are DB migrations?

Database migrations are a way to update database structure (migrate) to a new one or roll back to previous one. For example when citizenos-api code change requires a change in DB structure, these changes can be easily applied and reverted on an existing database. You can think of it as database versioning.

How to use Citizen OS DB migrations?

Citizen OS API uses Sequelize ORM and their standard migrations system.

Please read before going any further:

Shortcuts

There are some shortcuts described in package.json:

  • dbstatus - Migration status. Runs Sequelize db:migrate:status.
  • dbmigrate - Run migration. Runs Sequelize db:migrate.
  • dbrollback - Roll back migration. Runs Sequelize db:migrate:undo.
Clone this wiki locally