File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,14 @@ const DBURLLOCAL = require("../configs/config").DBURLLOCAL;
55const connectionString =
66 process . env . NODE_ENV === "production" ?
process . env . DBURL :
DBURLLOCAL ; //require("../config/config").DBURL; //'postgresql://dbuser:[email protected] :3211/mydb' 77
8- console . log ( connectionString ) ;
8+ if ( ! connectionString ) {
9+ console . warn (
10+ "connectionString is not defined\nPlease define connectionString in Environment variables \nAborting migration"
11+ ) ;
12+ process . exit ( 1 ) ;
13+ }
14+
15+ // console.log(connectionString);
916
1017const client = new Client ( {
1118 connectionString : connectionString ,
@@ -20,16 +27,16 @@ async function migrate() {
2027
2128 let script = fs . readFileSync ( __dirname + "/db-migrate.sql" ) . toString ( ) ;
2229
23- console . log ( script ) ;
30+ // console.log(script);
2431
2532 let query = {
2633 text : script ,
2734 values : [ ] ,
2835 } ;
2936
3037 let res = await client . query ( query ) ;
31- console . log ( res . command ) ;
32- console . log ( res . rowCount ) ;
38+ // console.log(res.command);
39+ // console.log(res.rowCount);
3340 await client . end ( ) ;
3441 console . log ( "disconnected from database" ) ;
3542 console . log ( "migration ran successfully" ) ;
You can’t perform that action at this time.
0 commit comments