TypeORM Migrations
Steps for Dev
1. Install typeorm globally
2. Make ormconfig.js file and put it in project root.
3. Make changes to domain classes
example: adding a column to a pre existing class
4. Generate a migration with a name
On console
5. Check for migration in migration folder
you should see this code
instance for a postgres db
6. Run Migrations
on console
on first migration , this should result
Steps where there is no ts-node
1. Have js files generated in dev
- check if 'migrations' directory exists in 'dist' directory
- check for required migration files.
- if required files do not exist, get them generated using while build using
run tsc
2. Use Js path in ormconfig.js
**– check for migration folder in dist folder and generated js files for migrations, only proceed if required migration files exist in dist folder **
3. Run Migration