Also: Dont even *try* to use the "Rearrange Code" feature of your IDE, unless you rewrite the db.py

This commit is contained in:
2021-08-09 13:57:22 +02:00
parent 391ed747d3
commit 80b5a4b577
39 changed files with 95 additions and 181271 deletions
+4 -119
View File
@@ -1,126 +1,11 @@
# noinspection LongLineForFile
DROP TABLE IF EXISTS whompah_cities;
CREATE TABLE IF NOT EXISTS whompah_cities
(
id INT PRIMARY KEY AUTO_INCREMENT,
city_name VARCHAR(50) NOT NULL,
zone VARCHAR(50) NOT NULL,
faction VARCHAR(10) NOT NULL,
short_name VARCHAR(255) DEFAULT NULL
);
INSERT INTO whompah_cities (id, city_name, zone, faction, short_name)
VALUES (1, 'ICC', 'Andromeda', 'Neutral', 'icc'),
(2, 'Camelot', 'Avalon', 'Clan', 'camelot'),
(3, 'Bliss', 'The Longest Road', 'Clan', 'bliss'),
(4, 'Broken Shores - North', 'Broken Shores', 'Clan', 'bsn'),
(5, 'Old Athen', 'Athen', 'Clan', 'oa'),
(6, 'Tir', 'Tir County', 'Clan', 'tir'),
(7, 'Varmint Woods', 'Varmint Woods', 'Clan', 'vw'),
(8, 'Wailing Wastes', 'Wailing Wastes', 'Clan', 'ww'),
(9, 'Wine', 'Belial Forest', 'Clan', 'wine'),
(10, 'Newland City', 'Newland', 'Neutral', 'nlc'),
(11, 'Newland Desert', 'Newland Desert', 'Neutral', 'nld'),
(12, 'Borealis', 'Borealis', 'Neutral', 'bor'),
(13, 'Hope', 'Mort', 'Neutral', 'hope'),
(14, 'Stret West Bank', 'Stret West Bank', 'Neutral', 'swb'),
(15, 'Omni Trade', 'Omni Trade', 'Omni', 'trade'),
(16, 'Omni Entertainment', 'Omni Entertainment', 'Omni', 'ent'),
(17, 'Galway Castle', 'Galway County', 'Omni', 'gc'),
(18, '20K', 'Pleasant Meadows', 'Omni', '20k'),
(19, '4 Holes', '4 Holes', 'Clan', '4ho'),
(20, 'Broken Shores - South', 'Broken Shores', 'Omni', 'bss'),
(21, 'Outpost 10-3', 'Southern Artery Valley', 'Omni', 'sav'),
(22, '2HO', 'Stret East Bank', 'Omni', '2ho'),
(23, 'Rome', 'Rome Red', 'Omni', 'rr'),
(24, 'The Longest Road', 'The Longest Road', 'Omni', 'tlr'),
(25, 'Mutant Domain', 'Mutant Domain', 'Omni', 'md'),
(26, 'Perpetual Wasteland', 'Perpetual Wasteland', 'Neutral', 'pw'),
(27, 'Southern Fouls Hills', 'Southern Fouls Hills', 'Omni', 'sfh'),
(28, 'Central Artery Valley', 'Central Artery Valley', 'Clan', 'cav'),
(29, 'The Reck North', 'The Reck', 'Omni', 'trn'),
(30, 'The Reck South', 'The Reck', 'Clan', 'trs');
CREATE TABLE IF NOT EXISTS whompah_cities ( id INT PRIMARY KEY AUTO_INCREMENT, city_name VARCHAR(50) NOT NULL, zone VARCHAR(50) NOT NULL, faction VARCHAR(10) NOT NULL, short_name VARCHAR(255) DEFAULT NULL);
INSERT INTO whompah_cities (id, city_name, zone, faction, short_name) VALUES(1, 'ICC', 'Andromeda', 'Neutral', 'icc'), (2, 'Camelot', 'Avalon', 'Clan', 'camelot'), (3, 'Bliss', 'The Longest Road', 'Clan', 'bliss'), (4, 'Broken Shores - North', 'Broken Shores', 'Clan', 'bsn'), (5, 'Old Athen', 'Athen', 'Clan', 'oa'), (6, 'Tir', 'Tir County', 'Clan', 'tir'), (7, 'Varmint Woods', 'Varmint Woods', 'Clan', 'vw'), (8, 'Wailing Wastes', 'Wailing Wastes', 'Clan', 'ww'), (9, 'Wine', 'Belial Forest', 'Clan', 'wine'), (10, 'Newland City', 'Newland', 'Neutral', 'nlc'), (11, 'Newland Desert', 'Newland Desert', 'Neutral', 'nld'), (12, 'Borealis', 'Borealis', 'Neutral', 'bor'), (13, 'Hope', 'Mort', 'Neutral', 'hope'), (14, 'Stret West Bank', 'Stret West Bank', 'Neutral', 'swb'), (15, 'Omni Trade', 'Omni Trade', 'Omni', 'trade'), (16, 'Omni Entertainment', 'Omni Entertainment', 'Omni', 'ent'), (17, 'Galway Castle', 'Galway County', 'Omni', 'gc'), (18, '20K', 'Pleasant Meadows', 'Omni', '20k'), (19, '4 Holes', '4 Holes', 'Clan', '4ho'), (20, 'Broken Shores - South', 'Broken Shores', 'Omni', 'bss'), (21, 'Outpost 10-3', 'Southern Artery Valley', 'Omni', 'sav'), (22, '2HO', 'Stret East Bank', 'Omni', '2ho'), (23, 'Rome', 'Rome Red', 'Omni', 'rr'), (24, 'The Longest Road', 'The Longest Road', 'Omni', 'tlr'), (25, 'Mutant Domain', 'Mutant Domain', 'Omni', 'md'), (26, 'Perpetual Wasteland', 'Perpetual Wasteland', 'Neutral', 'pw'), (27, 'Southern Fouls Hills', 'Southern Fouls Hills', 'Omni', 'sfh'), (28, 'Central Artery Valley', 'Central Artery Valley', 'Clan', 'cav'), (29, 'The Reck North', 'The Reck', 'Omni', 'trn'), (30, 'The Reck South', 'The Reck', 'Clan', 'trs');
DROP TABLE IF EXISTS whompah_cities_rel;
CREATE TABLE whompah_cities_rel
(
city1_id SMALLINT NOT NULL,
city2_id SMALLINT NOT NULL
);
INSERT INTO whompah_cities_rel (city1_id, city2_id)
VALUES (1, 10),
(1, 15),
(1, 6),
(2, 3),
(2, 8),
(3, 2),
(3, 4),
(3, 5),
(4, 3),
(4, 9),
(5, 3),
(5, 6),
(5, 8),
(6, 1),
(6, 5),
(6, 7),
(7, 6),
(7, 8),
(7, 9),
(8, 2),
(8, 5),
(8, 7),
(9, 4),
(9, 7),
(10, 1),
(10, 11),
(10, 12),
(11, 10),
(11, 13),
(12, 10),
(12, 14),
(13, 11),
(13, 14),
(14, 12),
(14, 13),
(15, 1),
(15, 16),
(15, 17),
(16, 15),
(16, 18),
(16, 23),
(16, 25),
(17, 15),
(17, 21),
(17, 23),
(18, 16),
(18, 21),
(20, 23),
(21, 17),
(21, 18),
(21, 22),
(22, 21),
(22, 24),
(23, 16),
(23, 17),
(23, 20),
(24, 22),
(25, 16),
(26, 13),
(13, 26),
(25, 22),
(22, 25),
(24, 20),
(20, 24),
(27, 18),
(18, 27),
(28, 19),
(19, 28),
(19, 4),
(4, 19),
(30, 6),
(6, 30),
(29, 15),
(15, 29);
CREATE TABLE whompah_cities_rel ( city1_id SMALLINT NOT NULL, city2_id SMALLINT NOT NULL);
INSERT INTO whompah_cities_rel (city1_id, city2_id) VALUES(1, 10), (1, 15), (1, 6), (2, 3), (2, 8), (3, 2), (3, 4), (3, 5), (4, 3), (4, 9), (5, 3), (5, 6), (5, 8), (6, 1), (6, 5), (6, 7), (7, 6), (7, 8), (7, 9), (8, 2), (8, 5), (8, 7), (9, 4), (9, 7), (10, 1), (10, 11), (10, 12), (11, 10), (11, 13), (12, 10), (12, 14), (13, 11), (13, 14), (14, 12), (14, 13), (15, 1), (15, 16), (15, 17), (16, 15), (16, 18), (16, 23), (16, 25), (17, 15), (17, 21), (17, 23), (18, 16), (18, 21), (20, 23), (21, 17), (21, 18), (21, 22), (22, 21), (22, 24), (23, 16), (23, 17), (23, 20), (24, 22), (25, 16), (26, 13), (13, 26), (25, 22), (22, 25), (24, 20), (20, 24), (27, 18), (18, 27), (28, 19), (19, 28), (19, 4), (4, 19), (30, 6), (6, 30), (29, 15), (15, 29);
-- test congruency
-- SELECT * FROM (SELECT city1_id, count(*) AS cnt FROM whompah_cities_rel GROUP BY city1_id ) t1 JOIN (SELECT city2_id, count(*) AS cnt FROM whompah_cities_rel GROUP BY city2_id) t2 ON t1.city1_id = t2.city2_id WHERE t1.cnt <> t2.cnt