From 190bd7f073e77eb538731506a92a175880aef24e Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Tue, 29 Aug 2023 20:51:38 -0400 Subject: Init database connector --- migrations/20230829204517_create_plant_table.down.sql | 2 ++ migrations/20230829204517_create_plant_table.up.sql | 8 ++++++++ migrations/20230829205506_create_stead_table.down.sql | 0 migrations/20230829205506_create_stead_table.up.sql | 12 ++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 migrations/20230829204517_create_plant_table.down.sql create mode 100644 migrations/20230829204517_create_plant_table.up.sql create mode 100644 migrations/20230829205506_create_stead_table.down.sql create mode 100644 migrations/20230829205506_create_stead_table.up.sql (limited to 'migrations') diff --git a/migrations/20230829204517_create_plant_table.down.sql b/migrations/20230829204517_create_plant_table.down.sql new file mode 100644 index 0000000..ab89f59 --- /dev/null +++ b/migrations/20230829204517_create_plant_table.down.sql @@ -0,0 +1,2 @@ +DROP TABLE Plant; +DROP TYPE plant_kind; diff --git a/migrations/20230829204517_create_plant_table.up.sql b/migrations/20230829204517_create_plant_table.up.sql new file mode 100644 index 0000000..0302a0d --- /dev/null +++ b/migrations/20230829204517_create_plant_table.up.sql @@ -0,0 +1,8 @@ +CREATE TYPE plant_kind AS ENUM('bbc', 'hvv', 'cyl', 'dirt'); +CREATE TABLE Plant ( + id SERIAL PRIMARY KEY, + kind plant_kind NOT NULL DEFAULT 'dirt', + xp INTEGER NOT NULL DEFAULT 0, + xp_multiplier FLOAT NOT NULL DEFAULT 1, + next_yield TIMESTAMP +); diff --git a/migrations/20230829205506_create_stead_table.down.sql b/migrations/20230829205506_create_stead_table.down.sql new file mode 100644 index 0000000..e69de29 diff --git a/migrations/20230829205506_create_stead_table.up.sql b/migrations/20230829205506_create_stead_table.up.sql new file mode 100644 index 0000000..55f3ccc --- /dev/null +++ b/migrations/20230829205506_create_stead_table.up.sql @@ -0,0 +1,12 @@ +CREATE TABLE Stead ( + id SERIAL PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password TEXT NOT NULL, + inventory JSONB, + ephemeral_statuses TEXT[] +); + +CREATE TABLE stead_plant ( + stead INTEGER references stead(id), + plant INTEGER references plant(id) +); -- cgit v1.2.3