School timetable generator web application. It can create the best timetables based on user's preferences (inputs and constraints).
$ docker compose up
$ (cd backend && yarn) && (cd frontend && yarn) # install node packages on host machine for eslint, husky...
$ docker compose up
For more information see the Sequelize migrations docs.
cd backend
npx sequelize-cli model:generate --name User --attributes email:string,password:string
This will:
- Create a model file user in models folder
- Create a migration file with name like XXXXXXXXXXXXXX-create-user.js in migrations folder.
Migrate model to TS (example) and remove line 'use strict';
First of all, make sure your local server is up and running. Now to create the table in the database run:
$ cd backend
$ npx sequelize-cli db:migrate
If you want to revert to old state by just running a command use:
cd backend
npx sequelize-cli db:migrate:undo
If you want to revert back to initial state by undoing all migrations use:
cd backend
npx sequelize-cli db:migrate:undo:all
If you want to revert back to specific migration you can pass migration name with the --to
option:
cd backend
npx sequelize-cli db:migrate:undo:all --to XXXXXXXXXXXXXX-create-user.js
To manage all data migrations you can use seeders. Seed files are some change in data that can be used to populate database tables with sample or test data.
To create a seed file run:
cd backend
npx sequelize-cli seed:generate --name demo-user
This will:
- Create a seed file in seeders folder. File name will look something like XXXXXXXXXXXXXX-demo-user.js
Now you can edit that seed file to insert some data into prefered table, in this example it would be User
table.
To commit a seed file or files to the database run:
cd backend
npx sequelize-cli db:seed:all
Seeders can be undone if they are using any storage. There are three possible commands for that:
-
If you want to undo the most recent seed use:
npx sequelize-cli db:seed:undo
-
If you want to undo a specific seed:
npx sequelize-cli db:seed:undo --seed name-of-seed-as-in-data
-
If you want to undo all seeds use coomand:
npx sequelize-cli db:seed:undo:all
$ ./backend/src/algorithm/cli.ts