From 9b8ad3972e2a791317ca9d7f49c9bdbef130afcf Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 18 Jun 2021 15:03:22 +0100 Subject: [PATCH] Adding script for creating basic postgres setup. --- .../integrations/postgres/docker-compose.yml | 28 +++++++++++++++++++ .../scripts/integrations/postgres/init.sql | 9 ++++++ 2 files changed, 37 insertions(+) create mode 100644 packages/server/scripts/integrations/postgres/docker-compose.yml create mode 100644 packages/server/scripts/integrations/postgres/init.sql diff --git a/packages/server/scripts/integrations/postgres/docker-compose.yml b/packages/server/scripts/integrations/postgres/docker-compose.yml new file mode 100644 index 0000000000..e2bba9f38e --- /dev/null +++ b/packages/server/scripts/integrations/postgres/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.8" +services: + db: + container_name: postgres + image: postgres + restart: always + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: root + POSTGRES_DB: main + ports: + - "5432:5432" + volumes: + #- pg_data:/var/lib/postgresql/data/ + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4 + restart: always + environment: + PGADMIN_DEFAULT_EMAIL: root@root.com + PGADMIN_DEFAULT_PASSWORD: root + ports: + - "5050:80" + +#volumes: +# pg_data: diff --git a/packages/server/scripts/integrations/postgres/init.sql b/packages/server/scripts/integrations/postgres/init.sql new file mode 100644 index 0000000000..baa7022f87 --- /dev/null +++ b/packages/server/scripts/integrations/postgres/init.sql @@ -0,0 +1,9 @@ +SELECT 'CREATE DATABASE main' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec +CREATE TABLE Persons ( + PersonID int NOT NULL PRIMARY KEY, + LastName varchar(255), + FirstName varchar(255), + Address varchar(255), + City varchar(255) +);