summaryrefslogtreecommitdiff
path: root/util/sql/all.sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-10-21 02:19:15 +0200
committerYorhel <git@yorhel.nl>2015-10-21 02:28:48 +0200
commit9cf3eef0e0a7bde10a0e1bb8c94c38b058e5121d (patch)
tree9cbd3a439316bdfe3946cc80378e4f95a9d6e6db /util/sql/all.sql
parent718f4d0258049aa92f229c08d5ec7204dae3ffa6 (diff)
SQL: Fix editing + func.sql + triggers.sql + autocreate editing funcs
This changes quite a bit to the way the editing functions work. Because these functions are very repetitive and it's easy to keep things out of sync, I created a script to generate them automatically. I had to rename a few function and table names for consistency to make this work. Since database entries don't have a 'latest' column anymore, and since the order in which tables are updated doesn't have to be fixed, I dropped many of the SQL triggers and replaced them with a edit_committed() function which is called from edit_*_commit() and checks for stuff to be done. Don't forget to run 'make' before importing the update script.
Diffstat (limited to 'util/sql/all.sql')
-rw-r--r--util/sql/all.sql6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/sql/all.sql b/util/sql/all.sql
index 496479a2..b2b4fabc 100644
--- a/util/sql/all.sql
+++ b/util/sql/all.sql
@@ -9,7 +9,7 @@ CREATE TYPE board_type AS ENUM ('an', 'db', 'ge', 'v', 'p', 'u');
CREATE TYPE char_role AS ENUM ('main', 'primary', 'side', 'appears');
CREATE TYPE credit_type AS ENUM ('scenario', 'chardesign', 'art', 'music', 'songs', 'director', 'staff');
CREATE TYPE dbentry_type AS ENUM ('v', 'r', 'p', 'c', 's');
-CREATE TYPE edit_rettype AS (iid integer, cid integer, rev integer);
+CREATE TYPE edit_rettype AS (itemid integer, chid integer, rev integer);
CREATE TYPE gender AS ENUM ('unknown', 'm', 'f', 'b');
CREATE TYPE language AS ENUM ('ar', 'ca', 'cs', 'da', 'de', 'en', 'es', 'fi', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'ko', 'nl', 'no', 'pl', 'pt-pt', 'pt-br', 'ro', 'ru', 'sk', 'sv', 'tr', 'uk', 'vi', 'zh');
CREATE TYPE medium AS ENUM ('cd', 'dvd', 'gdr', 'blr', 'flp', 'mrt', 'mem', 'umd', 'nod', 'in', 'otc');
@@ -33,6 +33,10 @@ CREATE TYPE vn_relation AS ENUM ('seq', 'preq', 'set', 'alt', 'char', 'sid
\i util/sql/func.sql
+-- auto-generated editing functions
+
+\i util/sql/editfunc.sql
+
-- constraints & indices
\i util/sql/tableattrs.sql