This commit is contained in:
Orion Kindel 2023-06-08 15:44:06 -05:00
commit c9995b30f8
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
7 changed files with 61 additions and 0 deletions

6
.env.local Normal file
View File

@ -0,0 +1,6 @@
FLYWAY_URL=jdbc:postgresql://db:5432/dnim
FLYWAY_USER=postgres
FLYWAY_PASSWORD=password
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=dnim

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

22
docker-compose.yml Normal file
View File

@ -0,0 +1,22 @@
version: "3"
name: "dnim_db"
services:
base:
container_name: "base"
image: "postgres:15.3-bullseye"
ports:
- "5433:5432"
volumes:
- "./data/base:/var/lib/postgres/data"
env_file:
- "./.env"
head:
container_name: "head"
image: "postgres:15.3-bullseye"
restart: "always"
ports:
- "5432:5432"
volumes:
- "./data/head:/var/lib/postgres/data"
env_file:
- "./.env"

View File

@ -0,0 +1,5 @@
create type public.thread_kind as enum
( 'post'
, 'short'
, 'message'
);

View File

@ -0,0 +1,5 @@
create table public.thread
( id int not null generated always as identity
, uid uuid not null default gen_random_uuid()
, kind thread_kind not null
);

1
reference/Dockerfile Normal file
View File

@ -0,0 +1 @@

21
scripts/build-reference.sh Executable file
View File

@ -0,0 +1,21 @@
#! /usr/bin/bash
$rev=${1:-HEAD}
if [ "$rev" = "HEAD" ]; then
$port = 5432
else
$port = 5433
fi
while read line; do export $line; done < ./.env
psql \
--echo-all \
postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:$port/$POSTGRES_DB \
--command="drop schema public cascade; create schema public;"
ls ./migrations/ | xargs -I{} psql \
--echo-all \
postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5433/$POSTGRES_DB \
--file=./migrations/{}