Skip to content

Latest commit

 

History

History
49 lines (29 loc) · 1.46 KB

File metadata and controls

49 lines (29 loc) · 1.46 KB

LESSONS I LEARNT FROM BUILDING THIS BACKEND PROJECT

COMMANDS NEEDED TO RUN MIGRATIONS AND EXPORT THEM TO POSTGRESQL

Command used for migrating all classes and attributes to the migration folder

   npx typeorm-ts-node-esm migration:generate -d ./src/data-source.ts src/migration/InitialMigration

Command to run all pending migrations to the database

   npx typeorm-ts-node-esm migration:run -d ./src/data-source.ts 

Command to view your existing migrations table

   npx typeorm-ts-node-esm schema:log -d ./src/data-source.ts 

if you are updating the existing migrations for your application, use the cmd,

   npx typeorm-ts-node-esm migration:generate -d ./src/data-source.ts src/migration/<migrationName>

if you are updating the existing migrations for your application, and it recreates the table again, use the cmd to create an empty migration file and write your safe migration in it,

   npx typeorm-ts-node-esm migration:create ./src/packages/database/migrations/<migrationName>  

and then run the command afterwards

   npx typeorm-ts-node-esm migration:run -d ./src/data-source.ts

Deploying NODEJS Web App With PostgreSQL

Make sure to replace your db credentials in your env with the ones provided by your deployment site (eg.render)

If your source directory folder is src, make sure to set it in your configuration in your deployment site