$ npm install --save pg pg-hstore
$ npm install --save mysql2
$ npm install --save sqlite3
$ npm install --save tedious // MSSQL
$ yarn add pg pg-hstore
$ yarn add mysql2
$ yarn add sqlite3
$ yarn add tedious // MSSQL
-
- LOCAL_HOST
- PRODUCTION_HOST
- STAGING_HOST
- SECRET_KEY
- PORT
- DB_USER
- DB_PASSWORD
- DATABASE
- DB_HOST
- Create a migration file running this command example in the main dir of the project:
$ sequelize migration:create --name "nameOfMigrationFile" --migrations-path migrations/
- Write logic to change db structure in the new generated file in migrations/
- Documentation: http://docs.sequelizejs.com/en/latest/docs/migrations/
- Run the command sequelize db:migrate to update database structure
NOTE: database models are attached on the koa context so you are able to use it easily around the project like:
cont users = await ctx.db.models.User.findAll()