Express app enabling gamification of description classification (converting a description to a commodity code) as part of continuous search improvemments.
- Node.js (v14 or higher)
- Yarn
- Sequelize CLI
- Docker
- Docker Compose
yarn install
Follow the intstructions here to use OTT Docker environment and docker-compose for local development
- Build and Run Containers
docker compose up --build -d
- Stop and Remove Containers
docker compose down
-
Review
npx sequelize --help
for more commands. -
Create database. You don't need to provide the database name in this command; it will be created dynamically based on the configuration in a configs.ts file.
npx sequelize-cli db:create
- Create a Model. The model has been created for testing purpose, you can delete it and recreate yours
npx sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
- Create a Migration.
npx sequelize migration:generate --name create-user
- Run migrations. Migrations are automatically run when you use Docker Compose. To manually run migrations:
npx sequelize db:migrate
- Create a Seeder. Seeder has been created for testing purpose, you can delete it and recreate your own
npx sequelize seed:generate --name demo-user
-
Update the Seeder File Edit the generated seed file in
seeders/
directory to include the data you want to seed. -
Run the seeder. Seed data is automatically applied when you use Docker Compose. To manually run the seeder:
npx sequelize db:seed:all
- Access the PostgreSQL Container
docker exec -it <db-container-name> psql -U <postgres-user> -d <postgres-db>
- List Tables
\dt
- View Table Content
SELECT * FROM <table-name>;
- View Table Structure
\d+ <table-name>
- Exit psql
\q