- Add the
dev-data-source.ts
file (use configuration fromapp.module.ts
with valid DB connection values)
- Do the required changes to the entity classes.
- Recompile the code (
npm run build
) and make sure your database has all previous migrations applied. - Generate a migration:
npm run migration <migration-name>
- Verify the generated SQL code in the new file in the migration folder.
- Update the database:
typeorm migration:run
If you need to revert:typeorm migration:revert
(will revert one migration)
Hint: Set migrationsRun: true
in the TypeORM config to automatically apply all pending migrations on application start.