Skip to content

Files

Latest commit

 

History

History
75 lines (55 loc) · 1.77 KB

README.md

File metadata and controls

75 lines (55 loc) · 1.77 KB

Vinplan server

Starting server with Docker

Make sure you have the needed environmental variables. (contact trusted entity)

docker-compose up
yarn install
yarn run dev-ts

Starting server

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

Migrations

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.

Automatic

  1. Stop the server and make sure there is connection to the DB.
  2. Run the migrate command from this folder
./migrate.sh
  1. Provide a name for the migration in Camel Case format (e.g. AddNewFieldToTable)
  2. Starting the server will run the migration. Hopefully your changes will be available right after that.

Manual

  1. Stop the server, Remove the old dist/ Folder

  2. Generate new production bundle dist/

npm run build
  1. 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"
  }
}
  1. Move the new migrations file to the src/migrations/ folder

  2. Remove the dist/ again

  3. Generate the dist folder again

npm run build
  1. Run the server to apply the migrations (auto apply set on src/typeorm.config.ts)

Reminders

Docu Dont use functions for the Default values in the entities. Error with defaults