-
Create one migration file per table (eg. 1-create-user.js, 2-create-repository.js 3-create-contribution.js) with the following skeleton:
- up method has the logic for the migration, down is for reverting it.
- The migrations are executed in transactions.
- The files are executed in alphabetical orde.
-
Add a migrate-db script to the scripts in package.json and corresponding scripts/migrate-db.js file.
-
Using postgresql database and pg, fs, path, assert packages, create sql scripts and run them via packag.json script.
-
The process should run the scripts and assert the results against expected results to velidate the the process is valid.
-
Create script pre-commit that runs 3 actions:
- pretty - prettifies the code.
- lint - points code errors
- tests
- git clone https://github.com/orennitzan/bootcamp-step-3.git
- Change directory to bootcamp-step-3
- Run 'npm install'
- Modify 'POSTGRES_CONFIG' in config.js file to your db parameters
- Run 'npm run pre-commit' to exec pre-commit script
- Run 'npm run db-create' to create db tables.
- Did not study migrations!!!