Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# node_skeleton
# node_skeleton
<br>
Add env credentials in config/config.json

1. Genrate new migrations<br>
- `sequelize migration:generate --name <name>` <br>

2. Run migrations<br>
- `sequelize db:migrate --env <name>` <br>
3. Undo migrations<br>
- `sequelize db:migrate:undo` <br>
- `sequelize db:migrate:undo:all` <br>
4. Genrate new seeder<br>
- `sequelize seed:generate`<br>
5. Run seeders<br>
- `sequelize db:seed --seed <name>`<br>
- `sequelize db:seed:all`
6. Undo seeders<br>
- `sequelize db:seed:undo` <br>
- `sequelize db:seed:undo:all` <br>
39 changes: 39 additions & 0 deletions config/aws.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
}
}
}
17 changes: 17 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
2 changes: 0 additions & 2 deletions config/dev.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"app_route": "http://localhost:3000/",
"bot_account": "rahulsps",
"google_analytics": "",
"db": {
"database": "node_skeleton",
"username": "root",
Expand Down
42 changes: 42 additions & 0 deletions migrations/20210723082011-shop.js
Original file line number Diff line number Diff line change
@@ -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) => {}
};