noot
This commit is contained in:
parent
79cea96292
commit
b0a5939eec
@ -13,10 +13,13 @@ jobs:
|
|||||||
IMAGE_ROOT: a/wynn
|
IMAGE_ROOT: a/wynn
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
options:
|
args:
|
||||||
name: ts
|
- name: ts
|
||||||
context: ./ts
|
context: ./ts
|
||||||
file: ./ts/Dockerfile
|
file: ./ts/Dockerfile
|
||||||
|
- name: "migrations"
|
||||||
|
context: ./migrations
|
||||||
|
file: ./migrations/Dockerfile
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -31,13 +34,13 @@ jobs:
|
|||||||
- name: build and push typescript
|
- name: build and push typescript
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.options.context }}
|
context: ${{ matrix.args.context }}
|
||||||
file: ${{ matrix.options.file }}
|
file: ${{ matrix.args.file }}
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_ROOT }}/${{matrix.options.name}}:cache
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_ROOT }}/${{matrix.args.name}}:cache
|
||||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_ROOT }}/${{matrix.options.name}}:cache,mode=max,image-manifest=true,oci-mediatypes=true,type=registry
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_ROOT }}/${{matrix.args.name}}:cache,mode=max,image-manifest=true,oci-mediatypes=true,type=registry
|
||||||
tags: |
|
tags: |
|
||||||
${{env.REGISTRY}}/${{env.IMAGE_ROOT}}/${{matrix.options.name}}:${{ gitea.ref_name }},
|
${{env.REGISTRY}}/${{env.IMAGE_ROOT}}/${{matrix.args.name}}:${{ gitea.ref_name }},
|
||||||
${{env.REGISTRY}}/${{env.IMAGE_ROOT}}/${{matrix.options.name}}:${{ gitea.head_ref || gitea.ref_name }}
|
${{env.REGISTRY}}/${{env.IMAGE_ROOT}}/${{matrix.args.name}}:${{ gitea.head_ref || gitea.ref_name }}
|
||||||
|
|
||||||
|
9
Makefile
Normal file
9
Makefile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.PHONY: migrate tern
|
||||||
|
|
||||||
|
|
||||||
|
tern:
|
||||||
|
@echo "running tern $(ARGS)"
|
||||||
|
@cd migrations && PGUSER=postgres PGPASSWORD=postgres PGHOST=127.0.0.1 PGPORT=54327 PGDATABASE=postgres tern $(ARGS)
|
||||||
|
|
||||||
|
migrate: $(shell find migrations -type f -name "*.sql")
|
||||||
|
$(MAKE) tern ARGS="migrate"
|
53
migrations/001_original.sql
Normal file
53
migrations/001_original.sql
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
create table if not exists wynn_guild_members (
|
||||||
|
guild_id UUID not null,
|
||||||
|
member_id UUID not null,
|
||||||
|
rank text not null,
|
||||||
|
joined_at timestamptz not null,
|
||||||
|
contributed bigint not null,
|
||||||
|
primary key (guild_id, member_id),
|
||||||
|
unique(member_id)
|
||||||
|
);
|
||||||
|
create table if not exists wynn_guild_info (
|
||||||
|
uid UUID not null,
|
||||||
|
name text not null,
|
||||||
|
prefix text not null,
|
||||||
|
xp bigint not null default 0,
|
||||||
|
level bigint,
|
||||||
|
xp_percent bigint,
|
||||||
|
territories bigint,
|
||||||
|
wars bigint,
|
||||||
|
created timestamptz,
|
||||||
|
primary key (uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
create index if not exists wynn_guild_info_xp on wynn_guild_info (xp);
|
||||||
|
|
||||||
|
create table if not exists wynn_guild_season_results (
|
||||||
|
guild_id UUID not null,
|
||||||
|
season text not null,
|
||||||
|
rating bigint not null,
|
||||||
|
territories bigint not null,
|
||||||
|
primary key (guild_id, season)
|
||||||
|
);
|
||||||
|
create table if not exists minecraft_user (
|
||||||
|
uid UUID not null,
|
||||||
|
name text not null,
|
||||||
|
server text,
|
||||||
|
primary key (uid)
|
||||||
|
);
|
||||||
|
create table if not exists discord_guild_setting(
|
||||||
|
discord_guild text not null,
|
||||||
|
name text not null,
|
||||||
|
value jsonb not null,
|
||||||
|
primary key (discord_guild, name)
|
||||||
|
);
|
||||||
|
|
||||||
|
---- create above / drop below ----
|
||||||
|
|
||||||
|
drop table if exists wynn_guild_members;
|
||||||
|
drop table if exists wynn_guild_info;
|
||||||
|
drop table if exists wynn_guild_season_results;
|
||||||
|
drop table if exists minecraft_user;
|
||||||
|
drop table if exists discord_guild_setting;
|
||||||
|
|
||||||
|
|
6
migrations/Dockerfile
Normal file
6
migrations/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM ghcr.io/jackc/tern:v2.3.2
|
||||||
|
|
||||||
|
|
||||||
|
USER 1000:1000
|
||||||
|
WORKDIR /migrations
|
||||||
|
COPY . .
|
34
migrations/tern.conf
Normal file
34
migrations/tern.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[database]
|
||||||
|
# host is required (network host or path to Unix domain socket)
|
||||||
|
# host =
|
||||||
|
# port = 5432
|
||||||
|
# database is required
|
||||||
|
# database =
|
||||||
|
# user defaults to OS user
|
||||||
|
# user =
|
||||||
|
# password =
|
||||||
|
# version_table = public.schema_version
|
||||||
|
#
|
||||||
|
# sslmode generally matches the behavior described in:
|
||||||
|
# http://www.postgresql.org/docs/9.4/static/libpq-ssl.html#LIBPQ-SSL-PROTECTION
|
||||||
|
#
|
||||||
|
# There are only two modes that most users should use:
|
||||||
|
# prefer - on trusted networks where security is not required
|
||||||
|
# verify-full - require SSL connection
|
||||||
|
# sslmode = prefer
|
||||||
|
#
|
||||||
|
# sslrootcert is generally used with sslmode=verify-full
|
||||||
|
# sslrootcert = /path/to/root/ca
|
||||||
|
|
||||||
|
# Proxy the above database connection via SSH
|
||||||
|
# [ssh-tunnel]
|
||||||
|
# host =
|
||||||
|
# port = 22
|
||||||
|
# user defaults to OS user
|
||||||
|
# user =
|
||||||
|
# password is not required if using SSH agent authentication
|
||||||
|
# password =
|
||||||
|
|
||||||
|
[data]
|
||||||
|
# Any fields in the data section are available in migration templates
|
||||||
|
# prefix = foo
|
Loading…
Reference in New Issue
Block a user