From aa68b350d5ea0f99fc4cc2d1978677d60729f98f Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Mon, 26 Jun 2023 22:18:35 -0500 Subject: [PATCH] updating helper sql scripts --- gemp-lotr/db/export-player-decks.sql | 2 +- gemp-lotr/db/fix-incorrect-sealed-card.sql | 21 ++++++++++++++++++--- gemp-lotr/db/update-game-history-date.sql | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gemp-lotr/db/export-player-decks.sql b/gemp-lotr/db/export-player-decks.sql index ba555dc80..00da4ceef 100644 --- a/gemp-lotr/db/export-player-decks.sql +++ b/gemp-lotr/db/export-player-decks.sql @@ -1,7 +1,7 @@ SELECT p.name AS player_name ,d.name AS deck_name - ,CONCAT('https://play.lotrtcgpc.net/share/deck?id=', TO_BASE64(CONCAT(p.name, '|', d.name))) AS deck_URL + ,CONCAT('https://play.lotrtcgpc.net/share/deck?id=',TO_BASE64(CONCAT(REPLACE(p.name, '_', '%5F'), '|', d.name))) AS DeckURL FROM gemp_db.deck d INNER JOIN player p ON p.id = d.player_id diff --git a/gemp-lotr/db/fix-incorrect-sealed-card.sql b/gemp-lotr/db/fix-incorrect-sealed-card.sql index ce5818247..eb6b59998 100644 --- a/gemp-lotr/db/fix-incorrect-sealed-card.sql +++ b/gemp-lotr/db/fix-incorrect-sealed-card.sql @@ -1,4 +1,13 @@ +SELECT * +FROM collection c +INNER JOIN collection_entries ce + ON ce.collection_id = c.id +INNER JOIN player p + ON c.player_id = p.id +WHERE p.name = 'Sibiatu' AND c.type = 'trophy' +ORDER BY p.name + AND ce.product_type @@ -16,13 +25,13 @@ LEFT JOIN ) X ON X.collection_id = c.id WHERE c.type = '1673497069403' - AND product = '101_42' + AND product = '2_108' AND X.collection_id IS NOT NULL ORDER BY p.name SELECT * FROM transfer t -WHERE player = 'elfwarrior' +WHERE player = 'Sibiatu' ORDER BY id DESC @@ -51,7 +60,13 @@ WHERE c.type = '1673497069403' AND ce.product = '101_42' - +UPDATE collection_entries ce +INNER JOIN collection c + ON ce.collection_id = c.id +SET ce.product = '2_108' +WHERE c.type = '1673497069403' + AND c.id = 131631 + AND ce.product = '2_108*' SELECT * diff --git a/gemp-lotr/db/update-game-history-date.sql b/gemp-lotr/db/update-game-history-date.sql index 369f926af..962795d5d 100644 --- a/gemp-lotr/db/update-game-history-date.sql +++ b/gemp-lotr/db/update-game-history-date.sql @@ -50,7 +50,8 @@ ADD CONSTRAINT fk_winnerId FOREIGN KEY (winnerId) REFERENCES player(id); ALTER TABLE gemp_db.game_history ADD CONSTRAINT fk_loserId FOREIGN KEY (loserId) REFERENCES player(id); - +ALTER TABLE gemp_db.game_history +ADD COLUMN replay_version INT NOT NULL DEFAULT 0 AFTER tournament;