]> ruin.nu Git - ndwebbie.git/blobdiff - database/r100.sql
Updates for round 100
[ndwebbie.git] / database / r100.sql
diff --git a/database/r100.sql b/database/r100.sql
new file mode 100644 (file)
index 0000000..b5f644c
--- /dev/null
@@ -0,0 +1,37 @@
+ALTER TYPE governments RENAME TO govs;
+\i tables/races.sql
+\i data/races.sql
+\i tables/governments.sql
+\i data/governments.sql
+
+DROP VIEW full_defcalls;
+DROP VIEW defcalls;
+DROP VIEW full_intel;
+DROP VIEW users_defprio;
+DROP VIEW alliance_resources;
+DROP VIEW current_planet_stats_full;
+DROP VIEW current_planet_stats;
+ALTER TABLE planets
+       ALTER COLUMN race TYPE TEXT,
+       ALTER COLUMN gov TYPE TEXT,
+       ALTER COLUMN gov SET DEFAULT '';
+ALTER TABLE planets ADD FOREIGN KEY (race) REFERENCES races(race) ON UPDATE CASCADE ON DELETE RESTRICT;
+ALTER TABLE planets ADD FOREIGN KEY (gov) REFERENCES governments(gov) ON UPDATE CASCADE ON DELETE SET DEFAULT;
+\d planets
+\i views/current_planet_stats.sql
+\i views/alliances_resources.sql
+\i views/users_defprio.sql
+\i views/full_intel.sql
+\i views/defcalls.sql
+
+DROP FUNCTION IF EXISTS find_planet_id(text,text,text,race);
+DROP FUNCTION covop_alert(integer, integer, integer, integer, govs, integer);
+\i functions/find_planet_id.sql
+\i functions/find_planet_id.sql
+ALTER TABLE ship_stats ADD FOREIGN KEY (race) REFERENCES races(race) ON UPDATE CASCADE ON DELETE CASCADE;
+\d ship_stats
+
+DROP TYPE race;
+DROP TYPE govs;
+
+\i functions/hostile_alliances.sql