setup to control production db from local app
This commit is contained in:
+10
-1
@@ -29,6 +29,15 @@ module.exports = {
|
|||||||
password: 'ykjkyenyvxig208z',
|
password: 'ykjkyenyvxig208z',
|
||||||
database: 'n0j9gxnf4ijr7g8t',
|
database: 'n0j9gxnf4ijr7g8t',
|
||||||
host: 'am1shyeyqbxzy8gc.cbetxkdyhwsb.us-east-1.rds.amazonaws.com',
|
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
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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');
|
||||||
@@ -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.
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
"test": "nodemon bin/test.js",
|
"test": "nodemon bin/test.js",
|
||||||
"drop:local": "DROP_TABLES=true node bin/dev.js",
|
"drop:local": "DROP_TABLES=true node bin/dev.js",
|
||||||
"drop:test": "DROP_TABLES=true node bin/test.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:local:windows": "SET DROP_TABLES=true&& node bin/dev.js",
|
||||||
"drop:test:windows": "SET DROP_TABLES=true&& node bin/test.js",
|
"drop:test:windows": "SET DROP_TABLES=true&& node bin/test.js",
|
||||||
"start": "node server.js"
|
"start": "node server.js"
|
||||||
|
|||||||
Reference in New Issue
Block a user