summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
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,