Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 872 Bytes

DbMigration.md

File metadata and controls

18 lines (14 loc) · 872 Bytes

DB Migrations

DB migrations are managed using TypeORM built-in tools.

Pre-requisite:

  • The Postgres Database is up-and-running.
  • The file ormconfig.json contains the necessary properties, see ormconfig.json.sample

This is the step-by-step sequence to upgrade the database schema:

  • Adapt the model with the proper annotations.
  • Build the project.
  • Choose a name for the migration, for instance MyMigration.
  • Run yarn typeorm migration:generate ./src/logion/migration/MyMigration - this will generate a new migration TIMESTAMP-MyMigration.ts under migration.
  • (Optional) Modify the generated file.
  • Build the project again.
  • Apply the migration(s): yarn typeorm migration:run.
  • (Optional) Revert the last migration: yarn typeorm migration:revert.