mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-02-18 05:43:35 +00:00
init
This commit is contained in:
commit
05bb43acde
79 changed files with 16983 additions and 0 deletions
|
|
@ -0,0 +1,59 @@
|
|||
-- -------------------------------------------------------------
|
||||
-- TablePlus 3.1.0(290)
|
||||
--
|
||||
-- https://tableplus.com/
|
||||
--
|
||||
-- Database: t2_stats
|
||||
-- Generation Time: 2020-01-25 17:48:36.5480
|
||||
-- -------------------------------------------------------------
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS "public"."players";
|
||||
CREATE SEQUENCE IF NOT EXISTS player_id_seq;
|
||||
|
||||
-- Table Definition
|
||||
CREATE TABLE "public"."players" (
|
||||
"id" int4 NOT NULL DEFAULT nextval('player_id_seq'::regclass),
|
||||
"player_guid" numeric NOT NULL UNIQUE,
|
||||
"player_name" text NOT NULL UNIQUE,
|
||||
"total_games" numeric NOT NULL DEFAULT 0,
|
||||
"stat_overwrite" numeric NOT NULL DEFAULT 1,
|
||||
"uuid" text NOT NULL UNIQUE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT players_pk PRIMARY KEY (player_guid)
|
||||
);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS "public"."games";
|
||||
CREATE SEQUENCE IF NOT EXISTS games_id_seq;
|
||||
|
||||
-- Table Definition
|
||||
CREATE TABLE "public"."games" (
|
||||
"id" int4 NOT NULL DEFAULT nextval('games_id_seq'::regclass),
|
||||
"player_guid" numeric NOT NULL,
|
||||
"player_name" text NOT NULL,
|
||||
"stat_overwrite" numeric NOT NULL,
|
||||
"map" text NOT NULL,
|
||||
"stats" jsonb NOT NULL,
|
||||
"datestamp" timestamp NOT NULL,
|
||||
"uuid" text NOT NULL UNIQUE,
|
||||
"gametype" text NOT NULL,
|
||||
CONSTRAINT games_pk PRIMARY KEY (id),
|
||||
FOREIGN KEY (player_guid) REFERENCES players (player_guid)
|
||||
);
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION trigger_set_timestamp()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
|
||||
CREATE TRIGGER set_timestamp
|
||||
BEFORE UPDATE ON "public"."players"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE trigger_set_timestamp();
|
||||
13
build/postgres/docker-entrypoint-initdb.d/restore_db.sh
Executable file
13
build/postgres/docker-entrypoint-initdb.d/restore_db.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Setting up database..."
|
||||
BACKUP_FILE_PATH=/docker-entrypoint-initdb.d/backup/t2_stats.sql
|
||||
|
||||
psql -d t2_stats -U dev -p 5432 -a -q -f $BACKUP_FILE_PATH
|
||||
# -h PostgreSQL server IP address
|
||||
# -d database name
|
||||
# -U user name
|
||||
# -p port which PostgreSQL server is listening on
|
||||
# -f path to SQL script
|
||||
# -a all echo
|
||||
# -q quiet
|
||||
7
build/postgres/export_local_db.sh
Executable file
7
build/postgres/export_local_db.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
BACKUP_FILE_PATH=/docker-entrypoint-initdb.d/backup/dev_${POSTGRES_DB}.dump
|
||||
|
||||
echo "Exporting $POSTGRES_DB to $BACKUP_FILE_PATH"
|
||||
|
||||
PGPASSWORD="dev" pg_dump -v -h db -p 5432 -Fc -o -U dev $POSTGRES_DB > $BACKUP_FILE_PATH
|
||||
Loading…
Add table
Add a link
Reference in a new issue