working database in docker-compose

This commit is contained in:
Pit-Storm 2019-11-02 17:44:57 +01:00
parent 1f5a5ab95e
commit 795d6567b1
3 changed files with 14 additions and 8 deletions

View file

@ -1,4 +1,4 @@
/connect candymat_db
\connect candymat_db
-- Create schema for candymat_data
CREATE SCHEMA candymat_data;
@ -41,7 +41,7 @@ CREATE TABLE candymat_data.category
CREATE TABLE candymat_data.question
(
id serial primary key,
category_id integer REFERENCES candymat_data"category" (id) ON UPDATE CASCADE ON DELETE SET NULL,
category_id integer REFERENCES candymat_data."category" (id) ON UPDATE CASCADE ON DELETE SET NULL,
text character varying(3000) NOT NULL,
description character varying(5000)
);

View file

@ -4,7 +4,7 @@ services:
postgres:
image: candymat-postgres:11.5
build:
dockerfile: ./backend/Dockerfile.postgres
dockerfile: ./Dockerfile.postgres
context: ./backend/
env_file: ./backend/.env-backend
ports:
@ -12,4 +12,6 @@ services:
restart: always
networks:
- backend
networks:
backend:

View file

@ -4,14 +4,18 @@ services:
postgres:
image: candymat-postgres:11.5
build:
dockerfile: ./backend/Dockerfile.postgres
dockerfile: ./Dockerfile.postgres
context: ./backend/
env_file: ./backend/.env-backend
volumes:
- "db-data:/var/lib/postgresql/data"
ports:
- "5432:5432"
restart: always
volumes:
- "db-data:/var/lib/postgresql/data"
networks:
- backend
networks:
backend:
columes:
db-data: