setup to control production db from local app

This commit is contained in:
Arjun Patel
2019-04-13 15:11:07 -07:00
parent 9ed96806fb
commit c670f506ac
4 changed files with 22 additions and 1 deletions
+10 -1
View File
@@ -29,6 +29,15 @@ module.exports = {
password: 'ykjkyenyvxig208z',
database: 'n0j9gxnf4ijr7g8t',
host: 'am1shyeyqbxzy8gc.cbetxkdyhwsb.us-east-1.rds.amazonaws.com',
dialect: 'mysql'
dialect: 'mysql',
// default options for all models
define: {
underscored: true, // true: use underscore for automatically added attributes like timestamps below
timestamps: true // createdAt and updatedAt automatically added
},
// disable logging; default: console.log
logging: false
}
};
+7
View File
@@ -0,0 +1,7 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
process.env.DROP_TABLES = true;
require('dotenv-flow').config({
node_env: process.env.NODE_ENV
});
require('../server');
+4
View File
@@ -0,0 +1,4 @@
To run different npm scripts from package.json in heroku application itself:
1. `heroku login`
2. `heroku run npm run drop:local -a {heroku_app_name}`
Note: you may have to also run `npm install` within the application to get some packages to run other scripts.
+1
View File
@@ -8,6 +8,7 @@
"test": "nodemon bin/test.js",
"drop:local": "DROP_TABLES=true node bin/dev.js",
"drop:test": "DROP_TABLES=true node bin/test.js",
"drop:prod": "node bin/prod.js",
"drop:local:windows": "SET DROP_TABLES=true&& node bin/dev.js",
"drop:test:windows": "SET DROP_TABLES=true&& node bin/test.js",
"start": "node server.js"