diff options
Diffstat (limited to 'bin/db.php')
-rw-r--r-- | bin/db.php | 51 |
1 files changed, 50 insertions, 1 deletions
@@ -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, |