aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcjd242018-02-07 03:09:50 +0000
committercjd242018-02-07 03:09:50 +0000
commitd66a0d90a658d5094ba274c4b4c4c3d66d8254a3 (patch)
tree997352d8fdc611f7a16df9ed409c706413cd877e /src
parentMerge branch 'cjd24/stubsgres' into 'master' (diff)
downloadmedicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.tar.gz
medicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.zip

Streamlined script for adding postgres, and added packages in preparation for writing ORM

Diffstat (limited to 'src')
-rw-r--r--src/db/initPostgresDB.ts13
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);
+ });