From 4954dcb789af3660400426d03173cb6724ae5f7f Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 12 Nov 2020 17:13:42 -0700 Subject: [PATCH] should probably split this since theres already live data --- .../postgres/migrations/V0001__initial.sql | 24 ------------------- .../postgres/migrations/V0002__equips.sql | 23 ++++++++++++++++++ src/entity/item/mod.rs | 2 +- 3 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 src/entity/gateway/postgres/migrations/V0002__equips.sql diff --git a/src/entity/gateway/postgres/migrations/V0001__initial.sql b/src/entity/gateway/postgres/migrations/V0001__initial.sql index 98e2f63..b4cd507 100644 --- a/src/entity/gateway/postgres/migrations/V0001__initial.sql +++ b/src/entity/gateway/postgres/migrations/V0001__initial.sql @@ -122,27 +122,3 @@ create table mag_modifier ( modifier jsonb not null, created_at timestamptz default current_timestamp not null ); - -create table equipped ( - pchar integer references player_character (id) unique not null, - weapon integer references item (id), - armor integer references item (id), - shield integer references item (id), - unit0 integer references item (id), - unit1 integer references item (id), - unit2 integer references item (id), - unit3 integer references item (id), - mag integer references item (id) -); - -create table inventory ( - pchar integer references player_character (id) unique not null, - items jsonb not null -); - -create table bank ( - pchar integer references player_character (id) not null, - items jsonb not null, - name varchar(128) not null, - unique (pchar, name) -); diff --git a/src/entity/gateway/postgres/migrations/V0002__equips.sql b/src/entity/gateway/postgres/migrations/V0002__equips.sql new file mode 100644 index 0000000..a88a1e3 --- /dev/null +++ b/src/entity/gateway/postgres/migrations/V0002__equips.sql @@ -0,0 +1,23 @@ +create table equipped ( + pchar integer references player_character (id) unique not null, + weapon integer references item (id), + armor integer references item (id), + shield integer references item (id), + unit0 integer references item (id), + unit1 integer references item (id), + unit2 integer references item (id), + unit3 integer references item (id), + mag integer references item (id) +); + +create table inventory ( + pchar integer references player_character (id) unique not null, + items jsonb not null +); + +create table bank ( + pchar integer references player_character (id) not null, + items jsonb not null, + name varchar(128) not null, + unique (pchar, name) +); diff --git a/src/entity/item/mod.rs b/src/entity/item/mod.rs index 7555296..22e2913 100644 --- a/src/entity/item/mod.rs +++ b/src/entity/item/mod.rs @@ -217,7 +217,7 @@ impl InventoryItemEntity { } } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Default)] pub struct EquippedEntity { pub weapon: Option, pub armor: Option,