Add PostgreSQL setup files
This commit is contained in:
parent
7bff94d3b2
commit
65b234f7aa
|
@ -0,0 +1,2 @@
|
|||
POSTGRES_USER=username
|
||||
POSTGRES_PASSWORD=password
|
|
@ -21,3 +21,6 @@
|
|||
# Go workspace file
|
||||
go.work
|
||||
|
||||
db-config/db-data/**
|
||||
!db-config/db-data/.blank
|
||||
.env
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
-- create a table
|
||||
CREATE TABLE test(
|
||||
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
name TEXT NOT NULL,
|
||||
archived BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
|
||||
-- add test data
|
||||
INSERT INTO test (name, archived)
|
||||
VALUES ('test row 1', true),
|
||||
('test row 2', false);
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
services:
|
||||
postgres:
|
||||
image: 'postgres:latest'
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
POSTGRES_DB: drahoot
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./db-config/db-data/:/var/lib/postgresql/data/
|
||||
- ./db-config/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
user: "1000:1000"
|
Loading…
Reference in New Issue