API for fiat2defi.ch
- Install TypeORM CLI:
npm install -g typeorm
- Add the
ormconfig.json
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:
typeorm migration:generate -n <migration-name> -o
- 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.