diff options
| author | cjd24 | 2018-02-07 03:09:50 +0000 |
|---|---|---|
| committer | cjd24 | 2018-02-07 03:09:50 +0000 |
| commit | d66a0d90a658d5094ba274c4b4c4c3d66d8254a3 (patch) | |
| tree | 997352d8fdc611f7a16df9ed409c706413cd877e /src/db/initPostgresDB.ts | |
| parent | Merge branch 'cjd24/stubsgres' into 'master' (diff) | |
| download | medicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.tar.gz medicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.zip | |
Streamlined script for adding postgres, and added packages in preparation for writing ORM
Diffstat (limited to 'src/db/initPostgresDB.ts')
| -rw-r--r-- | src/db/initPostgresDB.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/db/initPostgresDB.ts b/src/db/initPostgresDB.ts new file mode 100644 index 0000000..307d9b6 --- /dev/null +++ b/src/db/initPostgresDB.ts @@ -0,0 +1,13 @@ +var Sequelize = require('sequelize'); +const Op = Sequelize.Op; +const gres = new Sequelize('postgres://admin:eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af@localhost:5432/be4', + {operatorsAliases : false}); + +gres + .authenticate() + .then(() => { + console.log('Connection has been established successfully.'); + }) + .catch(err => { + console.error('Unable to connect to the database:', err); + }); |
