diff --git a/README.md b/README.md index 3327e79..3ec72de 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -# node_skeleton \ No newline at end of file +# node_skeleton +
+Add env credentials in config/config.json + + 1. Genrate new migrations
+ - `sequelize migration:generate --name `
+ + 2. Run migrations
+ - `sequelize db:migrate --env `
+ 3. Undo migrations
+ - `sequelize db:migrate:undo`
+ - `sequelize db:migrate:undo:all`
+ 4. Genrate new seeder
+ - `sequelize seed:generate`
+ 5. Run seeders
+ - `sequelize db:seed --seed `
+ - `sequelize db:seed:all` + 6. Undo seeders
+ - `sequelize db:seed:undo`
+ - `sequelize db:seed:undo:all`
diff --git a/config/aws.json b/config/aws.json new file mode 100644 index 0000000..3c6d282 --- /dev/null +++ b/config/aws.json @@ -0,0 +1,39 @@ +{ + "app_route": "http://nodeskeleton-env.eba-xdbkk62b.us-east-1.elasticbeanstalk.com/", + "db": { + "database": "ebdb", + "username": "nodeskeletonU", + "password": "node_skeletonPwD3$", + "host": "aa1wa97ei75c1y9.cvd3esvflamb.us-east-1.rds.amazonaws.com", + "port": 3306, + "options": { + "timezone": "+05:30", + "dialect": "mysql", + "dialectOptions": { + "decimalNumbers": true + }, + "port": 3306, + "pool": { + "max": 50, + "min": 0, + "idle": 500 + }, + "replication": { + "write": { + "username": "nodeskeletonU", + "password": "node_skeletonPwD3$", + "host": "aa1wa97ei75c1y9.cvd3esvflamb.us-east-1.rds.amazonaws.com", + "port": 3306 + }, + "read": [ + { + "username": "nodeskeletonU", + "password": "node_skeletonPwD3$", + "host": "aa1wa97ei75c1y9.cvd3esvflamb.us-east-1.rds.amazonaws.com", + "port": 3306 + } + ] + } + } + } +} diff --git a/config/config.json b/config/config.json new file mode 100644 index 0000000..63bbe82 --- /dev/null +++ b/config/config.json @@ -0,0 +1,17 @@ +{ + "dev": { + "username": "root", + "password": "root", + "database": "node_skeleton", + "host": "127.0.0.1", + "dialect": "mysql" + }, + "aws": { + "database": "ebdb", + "username": "nodeskeletonU", + "password": "node_skeletonPwD3$", + "host": "aa1wa97ei75c1y9.cvd3esvflamb.us-east-1.rds.amazonaws.com", + "port": 3306, + "dialect": "mysql" + } +} diff --git a/config/dev.json b/config/dev.json index d0b8be4..9fa1b67 100755 --- a/config/dev.json +++ b/config/dev.json @@ -1,7 +1,5 @@ { "app_route": "http://localhost:3000/", - "bot_account": "rahulsps", - "google_analytics": "", "db": { "database": "node_skeleton", "username": "root", diff --git a/migrations/20210723082011-shop.js b/migrations/20210723082011-shop.js new file mode 100644 index 0000000..993d9c6 --- /dev/null +++ b/migrations/20210723082011-shop.js @@ -0,0 +1,42 @@ +'use strict'; + +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.createTable('shops', + { + id: { + type: Sequelize.INTEGER(20), + unique: true, + allowNull: false, + primaryKey: true, + autoIncrement: true, + unsigned: true + }, + shop_name: { + type: Sequelize.STRING(255), + unique: true, + allowNull: false + }, + shop_url: { + type: Sequelize.STRING(255), + unique: true, + allowNull: true + }, + access_token: { + type: Sequelize.STRING(255), + unique: true, + allowNull: true + } + }, + { + engine: 'InnoDB', // default: 'InnoDB' + schema: '', // default: public, PostgreSQL only. + comment: 'shops table', // comment for table + collate: 'utf8_bin' // collation, MYSQL only + } + ); + + }, + + down: (queryInterface, Sequelize) => {} +};