summaryrefslogtreecommitdiff
path: root/bin/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'bin/db.php')
-rw-r--r--bin/db.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/db.php b/bin/db.php
index 7f3f344..84cb85c 100644
--- a/bin/db.php
+++ b/bin/db.php
@@ -115,6 +115,10 @@ DB::query(<<<SQL
constraint "relation_event"
foreign key ("event_id") references events("id") on delete cascade,
+ "village_id" bigint not null,
+ constraint "relation_village"
+ foreign key ("village_id") references villages("id") on delete cascade,
+
"type" character varying(255) not null,
"created_at" timestamp(0) not null default current_timestamp,
@@ -130,6 +134,10 @@ DB::query(<<<SQL
constraint "relation_event"
foreign key ("event_id") references events("id") on delete cascade,
+ "village_id" bigint not null,
+ constraint "relation_village"
+ foreign key ("village_id") references villages("id") on delete cascade,
+
"amount" bigint not null,
"type" character varying(255) not null,
@@ -203,6 +211,23 @@ DB::query(<<<SQL
SQL);
DB::query(<<<SQL
+ create table if not exists "user_villages" (
+ "id" bigserial primary key,
+
+ "user_id" bigint not null,
+ constraint "relation_user"
+ foreign key ("user_id") references users("id") on delete cascade,
+
+ "village_id" bigint not null,
+ constraint "relation_village"
+ 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
+ );
+SQL);
+
+DB::query(<<<SQL
create table if not exists "system" (
"key" character varying(255) primary key,
"value" jsonb