rewrite: Shop and economy system.
This commit is contained in:
@@ -159,7 +159,7 @@ CREATE TABLE coin_transactions(
|
||||
guildid BIGINT NOT NULL REFERENCES guild_config (guildid) ON DELETE CASCADE,
|
||||
actorid BIGINT NOT NULL,
|
||||
amount INTEGER NOT NULL,
|
||||
bonus INTEGER NOT NULL,
|
||||
bonus INTEGER NOT NULL DEFAULT 0,
|
||||
from_account BIGINT,
|
||||
to_account BIGINT,
|
||||
refunds INTEGER REFERENCES coin_transactions (transactionid) ON DELETE SET NULL,
|
||||
@@ -222,6 +222,25 @@ ALTER TABLE member_inventory
|
||||
DROP COLUMN count;
|
||||
|
||||
CREATE INDEX member_inventory_members ON member_inventory(guildid, userid);
|
||||
|
||||
|
||||
CREATE VIEW member_inventory_info AS
|
||||
SELECT
|
||||
inv.inventoryid AS inventoryid,
|
||||
inv.guildid AS guildid,
|
||||
inv.userid AS userid,
|
||||
inv.transactionid AS transactionid,
|
||||
items.itemid AS itemid,
|
||||
items.item_type AS item_type,
|
||||
items.price AS price,
|
||||
items.purchasable AS purchasable,
|
||||
items.deleted AS deleted,
|
||||
items.guild_itemid AS guild_itemid,
|
||||
items.roleid AS roleid
|
||||
FROM
|
||||
member_inventory inv
|
||||
LEFT JOIN shop_item_info items USING (itemid)
|
||||
ORDER BY itemid ASC;
|
||||
-- }}}
|
||||
|
||||
INSERT INTO VersionHistory (version, author) VALUES (13, 'v12-v13 migration');
|
||||
|
||||
@@ -50,6 +50,7 @@ CREATE TABLE user_config(
|
||||
timezone TEXT,
|
||||
topgg_vote_reminder BOOLEAN,
|
||||
avatar_hash TEXT,
|
||||
name TEXT,
|
||||
API_timestamp BIGINT,
|
||||
gems INTEGER DEFAULT 0
|
||||
);
|
||||
@@ -230,12 +231,13 @@ CREATE TABLE shop_items_colour_roles(
|
||||
);
|
||||
|
||||
CREATE TABLE member_inventory(
|
||||
inventoryid SERIAL PRIMARY KEY,
|
||||
guildid BIGINT NOT NULL,
|
||||
userid BIGINT NOT NULL,
|
||||
itemid INTEGER NOT NULL REFERENCES shop_items(itemid) ON DELETE CASCADE,
|
||||
count INTEGER DEFAULT 1,
|
||||
PRIMARY KEY(guildid, userid)
|
||||
transactionid INTEGER REFERENCES coin_transactions(transactionid) ON DELETE SET NULL,
|
||||
itemid INTEGER NOT NULL REFERENCES shop_items(itemid) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX member_inventory_members ON member_inventory(guildid, userid);
|
||||
|
||||
|
||||
CREATE VIEW shop_item_info AS
|
||||
|
||||
Reference in New Issue
Block a user