summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-01-08 22:28:02 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-01-08 22:28:02 +0100
commite4351601a7ced91bf5a2c516a38db714d43e6ecf (patch)
tree045b0fb41621aab160cca3b24fd4184e1d8db9c2 /bin
parent82875448c485d26375ed6dea4e64e940f6e10f74 (diff)
send resources + adminer css
Diffstat (limited to 'bin')
-rw-r--r--bin/db.php51
1 files changed, 50 insertions, 1 deletions
diff --git a/bin/db.php b/bin/db.php
index 8047b42..7938f87 100644
--- a/bin/db.php
+++ b/bin/db.php
@@ -88,7 +88,9 @@ DB::query(<<<SQL
foreign key ("village_id") references villages("id") on delete cascade,
"created_at" timestamp(0) not null default current_timestamp,
- "updated_at" timestamp(0) not null default current_timestamp
+ "updated_at" timestamp(0) not null default current_timestamp,
+
+ unique ("village_id")
);
SQL);
@@ -181,6 +183,53 @@ DB::query(<<<SQL
SQL);
DB::query(<<<SQL
+ create table if not exists "events_send_resources" (
+ "id" bigserial primary key,
+
+ "event_id" bigint not null,
+ constraint "relation_event"
+ foreign key ("event_id") references events("id") on delete cascade,
+
+ "wood" bigint not null,
+ "clay" bigint not null,
+ "iron" bigint not null,
+ "food" bigint 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"),
+
+ "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_resources_merchants" (
+ "id" bigserial primary key,
+
+ "event_id" bigint not null,
+ constraint "relation_event"
+ foreign key ("event_id") references events_send_resources("id") on delete cascade,
+
+ "unit_id" bigint not null,
+ constraint "relation_unit"
+ foreign key ("unit") references village_units("id"),
+
+ "amount" bigint 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 "users" (
"id" bigserial primary key,