- sequelize :
npm install --save-dev sequelize
- sequelize :
npm install --save-dev sequelize-cli
- postgres :
npm install --save pg
- sequelize-isunique-validator :
npm install--save sequelize-isunique-validator
- Database's name : db_user_skills
- Table :
- users :
- username (STRING)
- password (STRING)
- email (STRING)
- skills
- name (STRING)
- value (STRING)
- users :
- install dependencies
- express configuration :
express .
- sequelize init
- edit config/config.json
- make Users table :
sequelize model:create --name Users --attributes "username:string,password:string,email:string"
- migrate :
sequelize db:migrate
- make Skills table :
sequelize model:create --name Skills --attributes "value:string"
- migrate :
sequelize db:migrate
- seeding admin data into Users table :
sequelize seed:create --name seed_users_admin
- seed the admin seeder file
sequelize db:seed --seed seeders/20161106234045-seed_users_admin.js
- add new attribute to Skills table
sequelize migration:create --name add_name_attribute_to_skills_table
- migrate :
sequelize db:migrate
- add FK :
sequelize migration:create --name add_FK_to_skills_table
- migrate :
sequelize db:migrate
Ken Duigraha Putra © 2016
MIT