From b133e86769ee3ea669eae92f776748a1253c54a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 12 May 2023 23:15:53 +0200 Subject: [PATCH] rename database fields --- database.py | 12 ++++++------ variant_suits_schema.sql | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/database.py b/database.py index fc891bd..a6763e9 100644 --- a/database.py +++ b/database.py @@ -76,7 +76,7 @@ def init_static_tables(): create = True if not create: - return + pass # init tables in database with open("variant_suits_schema.sql", "r") as f: @@ -109,10 +109,10 @@ def init_static_tables(): assert([all_colors, no_color_clues, prism].count(True) <= 1) assert(not all([no_rank_clues, all_ranks])) - colors = 2 if all_colors else (0 if no_color_clues else 1) - ranks = 2 if all_ranks else (0 if no_rank_clues else 1) + color_clues = 2 if all_colors else (0 if no_color_clues else 1) + rank_clues = 2 if all_ranks else (0 if no_rank_clues else 1) - clue_colors = suit.get('clueColors', [name] if (colors == 1 and not prism) else []) + clue_colors = suit.get('clueColors', [name] if (color_clues == 1 and not prism) else []) for rev in [False, True]: if rev is True and name not in suits_to_reverse: @@ -120,10 +120,10 @@ def init_static_tables(): suit_name = name suit_name += ' Reversed' if rev else '' cur.execute( - "INSERT INTO suits (name, display_name, abbreviation, ranks, colors, dark, reversed, prism)" + "INSERT INTO suits (name, display_name, abbreviation, rank_clues, color_clues, dark, reversed, prism)" "VALUES" "(%s, %s, %s, %s, %s, %s, %s, %s)", - (suit_name, display_name, abbreviation, ranks, colors, dark, rev, prism) + (suit_name, display_name, abbreviation, rank_clues, color_clues, dark, rev, prism) ) cur.execute( "SELECT id FROM suits WHERE name = %s", diff --git a/variant_suits_schema.sql b/variant_suits_schema.sql index bde6f0a..772836a 100644 --- a/variant_suits_schema.sql +++ b/variant_suits_schema.sql @@ -13,14 +13,14 @@ CREATE TABLE suits ( 1: touched by actual rank of the cards 2: touched by all ranks */ - ranks SMALLINT NOT NULL DEFAULT 1, + rank_clues SMALLINT NOT NULL DEFAULT 1, /** This encodes how cards of this suit behave under color clues, we use: 0: not touched by color, 1: touched by native colors, 2: touched by all colors */ - colors SMALLINT NOT NULL DEFAULT 1, + color_clues SMALLINT NOT NULL DEFAULT 1, prism BOOLEAN NOT NULL DEFAULT FALSE, dark BOOLEAN NOT NULL DEFAULT FALSE, reversed BOOLEAN NOT NULL DEFAULT FALSE