summaryrefslogtreecommitdiff
path: root/bin/db.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-11-29 11:03:15 +0100
committerDaniel Weipert <code@drogueronin.de>2023-11-29 11:03:15 +0100
commitfa9096c0ab521aae45cab6c48a54290d14a221b9 (patch)
tree61466b792c2714848cfea00594456ac06c259c94 /bin/db.php
parent3afcaef927391db23fe23c6c8c26b8960e8dae32 (diff)
event tables
Diffstat (limited to 'bin/db.php')
-rw-r--r--bin/db.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/db.php b/bin/db.php
index 951c0b3..7f3f344 100644
--- a/bin/db.php
+++ b/bin/db.php
@@ -123,6 +123,56 @@ DB::query(<<<SQL
SQL);
DB::query(<<<SQL
+ create table if not exists "events_train_units" (
+ "id" bigserial primary key,
+
+ "event_id" bigint not null,
+ constraint "relation_event"
+ foreign key ("event_id") references events("id") on delete cascade,
+
+ "amount" bigint not null,
+ "type" character varying(255) not null,
+
+ "created_at" timestamp(0) not null default current_timestamp,
+ "updated_at" timestamp(0) not null default current_timestamp
+ );
+SQL);
+
+DB::query(<<<SQL
+ create table if not exists "events_send_units" (
+ "id" bigserial primary key,
+
+ "event_id" bigint not null,
+ constraint "relation_event"
+ foreign key ("event_id") references events("id") on delete cascade,
+
+ "type" character varying(255) not null,
+ "amount" bigint not null,
+ "unit" character varying(255) not null,
+ "is_canceled" boolean not null default false,
+
+ "source" bigint not null,
+ constraint "relation_village_source"
+ foreign key ("source") references villages("id"),
+
+ "destination" bigint not null,
+ constraint "relation_village_destination"
+ foreign key ("destination") references villages("id"),
+
+ "home" bigint,
+ constraint "relation_village_home"
+ foreign key ("home") references villages("id"),
+
+ "residence" bigint,
+ constraint "relation_village_residence"
+ foreign key ("residence") references villages("id"),
+
+ "created_at" timestamp(0) not null default current_timestamp,
+ "updated_at" timestamp(0) not null default current_timestamp
+ );
+SQL);
+
+DB::query(<<<SQL
create table if not exists "users" (
"id" bigserial primary key,