moon-miner/data.sql
2023-02-20 12:49:24 +07:00

50 lines
1.3 KiB
SQL

INSERT INTO resource(name) VALUES
('SOLLUX'),
('SHADOWSTONE'),
('AZURIUM'),
('NOVAFOR'),
('NEBULANCE');
INSERT INTO users(name) VALUES
('Joe'),
('Emil'),
('Niko'),
('Plug'),
('Upgrade');
INSERT INTO bank_account(user_id, resource_id, balance) VALUES
(1, 1, 200),
(1, 2, 175),
(1, 3, 0),
(1, 4, 25),
(1, 5, 10);
INSERT INTO store_item(name, currency, target_resource, price, claim_amount) VALUES
('Drill 1A', 1, 1, 25, 500),
('Drill 1B', 1, 2, 25, 500),
('Drill 1C', 1, 3, 25, 500),
('Drill 1D', 1, 4, 25, 500),
('Drill 1E', 1, 5, 25, 500);
SELECT staking_event.id,well_id,staking_event.source_id,
inventory_item_id,staking_event.created_at,expiration_at
FROM staking_event
INNER JOIN resource_well ON resource_well.id = well_id
INNER JOIN staking_source on staking_event.source_id = staking_source.id
WHERE staking_event.source_id = ? AND staking_source.user_id = ?;
SELECT name,init_supply
FROM resource_well
INNER JOIN resource ON resource.id = resource_well.resource_id
WHERE source_id = 1;
SELECT inventory_item.id,store_item_id, COUNT(upgrade_event.id) as upgrades
FROM inventory_item
LEFT JOIN upgrade_event ON inventory_item.id = upgrade_event.inventory_item_id
WHERE inventory_item.user_id = 1
GROUP BY inventory_item.id;
SELECT inventory_item.id,store_item_id
FROM inventory_item;