summaryrefslogtreecommitdiff
path: root/bin/villages.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-11-29 09:35:27 +0100
committerDaniel Weipert <code@drogueronin.de>2023-11-29 09:35:27 +0100
commit3afcaef927391db23fe23c6c8c26b8960e8dae32 (patch)
tree143b9f6df9e8c795c8c6ed901bffdc7119f40df1 /bin/villages.php
parentc4ce3e884a6aa527bcc138771617215cf03265a4 (diff)
intermediate commit
Diffstat (limited to 'bin/villages.php')
-rw-r--r--bin/villages.php147
1 files changed, 0 insertions, 147 deletions
diff --git a/bin/villages.php b/bin/villages.php
deleted file mode 100644
index 092a754..0000000
--- a/bin/villages.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-use App\DB;
-use Symfony\Component\Dotenv\Dotenv;
-
-require dirname(__DIR__) . '/vendor/autoload.php';
-
-$dotenv = new Dotenv();
-$dotenv->load(dirname(__DIR__) . '/.env');
-
-DB::init();
-
-DB::query(<<<SQL
- create table if not exists "villages" (
- "id" bigserial primary key,
-
- "name" character varying(255) not null,
-
- "x" integer not null,
- "y" integer not null,
-
- "wood" bigint not null,
- "clay" bigint not null,
- "iron" bigint not null,
- "food" bigint not null,
-
- "satisfaction" bigint not null,
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null,
-
- unique ("x", "y")
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "village_buildings" (
- "id" bigserial primary key,
-
- "level" smallint not null,
- "type" character varying(255) not null,
-
- "village_id" bigint not null,
- constraint "relation_village"
- foreign key ("village_id") references villages("id") on delete cascade,
-
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null,
-
- unique ("type", "village_id")
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "village_units" (
- "id" bigserial primary key,
-
- "amount" bigint not null,
- "type" character varying(255) not null,
-
- "is_traveling" boolean not null default false,
-
- "home_village_id" bigint not null,
- constraint "relation_village_home"
- foreign key ("home_village_id") references villages("id") on delete cascade,
-
- "residence_village_id" bigint not null,
- constraint "relation_village_residence"
- foreign key ("residence_village_id") references villages("id") on delete cascade,
-
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null,
-
- unique ("type", "home_village_id", "residence_village_id")
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "village_storage_config" (
- "id" bigserial primary key,
-
- "wood" smallint not null,
- "clay" smallint not null,
- "iron" smallint not null,
- "food" smallint not null,
-
- "village_id" bigint not null,
- constraint "relation_village"
- foreign key ("village_id") references villages("id") on delete cascade,
-
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "events" (
- "id" bigserial primary key,
-
- "type" character varying(255) not null,
- "time" timestamp(0) not null,
- "payload" jsonb not null,
-
- "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 "users" (
- "id" bigserial primary key,
-
- "username" character varying(255) not null,
- "password" character varying(255) not null,
- "email" character varying(255) not null,
-
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null,
-
- unique ("username")
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "user_settings" (
- "id" bigserial primary key,
-
- "display_name" character varying(255) not null,
-
- "user_id" bigint not null,
- constraint "relation_user"
- foreign key ("user_id") references users("id") on delete cascade,
-
- "created_at" timestamp(0) not null,
- "updated_at" timestamp(0) not null
- );
-SQL);
-
-DB::query(<<<SQL
- create table if not exists "system" (
- "key" character varying(255) primary key,
- "value" jsonb
- );
-SQL);