Make sure you have the needed environmental variables. (contact trusted entity)
docker-compose up
yarn install
yarn run dev-ts
Make sure an instance of postgres and an instance of redis is running in your computer. Overwrite the environmental variables to fit your local instances.
yarn install
yarn run dev-ts
Use it everytime you generate changes in the DB entities, to generate the neccessary migration scripts
Requirements: Database must be running and there has to be a connection with the database.
- Stop the server and make sure there is connection to the DB.
- Run the migrate command from this folder
./migrate.sh
- Provide a name for the migration in Camel Case format (e.g. AddNewFieldToTable)
- Starting the server will run the migration. Hopefully your changes will be available right after that.
-
Stop the server, Remove the old
dist/
Folder -
Generate new production bundle
dist/
npm run build
- Generate migrations from
dist/
npm run typeorm migration:generate -- -n AnyName
The Script to run the automatic migrations is in package.json
:
{
"scripts": {
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"
}
}
-
Move the new migrations file to the
src/migrations/
folder -
Remove the
dist/
again -
Generate the dist folder again
npm run build
- Run the server to apply the migrations (auto apply set on
src/typeorm.config.ts
)
Docu Dont use functions for the Default values in the entities. Error with defaults