init
This commit is contained in:
commit
c9995b30f8
6
.env.local
Normal file
6
.env.local
Normal 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
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
22
docker-compose.yml
Normal file
22
docker-compose.yml
Normal 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"
|
5
migrations/000_thread_kind.sql
Normal file
5
migrations/000_thread_kind.sql
Normal file
@ -0,0 +1,5 @@
|
||||
create type public.thread_kind as enum
|
||||
( 'post'
|
||||
, 'short'
|
||||
, 'message'
|
||||
);
|
5
migrations/010_thread.sql
Normal file
5
migrations/010_thread.sql
Normal 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
1
reference/Dockerfile
Normal file
@ -0,0 +1 @@
|
||||
|
21
scripts/build-reference.sh
Executable file
21
scripts/build-reference.sh
Executable 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/{}
|
Loading…
Reference in New Issue
Block a user