summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-02-16 16:14:30 +0100
committerYorhel <git@yorhel.nl>2011-02-16 16:14:30 +0100
commitcd7b3f34173dfeceec03691957c95f4d4ab9cf47 (patch)
tree819817f5e60ef4c8af7b98aba8264b0954970e8b /util
parent24680d31a5a3433db5fd0140d9cb80b371659342 (diff)
chardb: Added character add/edit form + misc. fixes
Diffstat (limited to 'util')
-rw-r--r--util/sql/func.sql10
-rw-r--r--util/updates/update_2.19.sql2
2 files changed, 7 insertions, 5 deletions
diff --git a/util/sql/func.sql b/util/sql/func.sql
index 4fc95165..23ae0fb2 100644
--- a/util/sql/func.sql
+++ b/util/sql/func.sql
@@ -375,7 +375,7 @@ $$ LANGUAGE plpgsql;
-- PLACEHOLDERS, not complete yet
-CREATE OR REPLACE FUNCTION edit_char_init(cid integer) RETURNS void AS $$
+CREATE OR REPLACE FUNCTION edit_char_init(hid integer) RETURNS void AS $$
BEGIN
BEGIN
CREATE TEMPORARY TABLE edit_char (LIKE chars_rev INCLUDING DEFAULTS INCLUDING CONSTRAINTS);
@@ -384,13 +384,13 @@ BEGIN
EXCEPTION WHEN duplicate_table THEN
TRUNCATE edit_char;
END;
- PERFORM edit_revtable('c', cid);
+ PERFORM edit_revtable('c', hid);
-- new char
- IF cid IS NULL THEN
+ IF hid IS NULL THEN
INSERT INTO edit_char DEFAULT VALUES;
-- load revision
ELSE
- INSERT INTO edit_char SELECT name, original, alias, image, "desc" FROM chars_rev WHERE id = cid;
+ INSERT INTO edit_char SELECT name, original, alias, image, "desc" FROM chars_rev WHERE id = hid;
END IF;
END;
$$ LANGUAGE plpgsql;
@@ -663,7 +663,7 @@ $$ LANGUAGE plpgsql;
--- update (vn|release|producer).(hidden|locked) on a new revision
+-- update (vn|release|producer|char).(hidden|locked) on a new revision
-- NOTE: this is a /before/ trigger, it modifies NEW
CREATE OR REPLACE FUNCTION update_hidlock() RETURNS trigger AS $$
DECLARE
diff --git a/util/updates/update_2.19.sql b/util/updates/update_2.19.sql
index 43337ef9..0360feda 100644
--- a/util/updates/update_2.19.sql
+++ b/util/updates/update_2.19.sql
@@ -85,6 +85,8 @@ DROP FUNCTION edit_revtable(dbentry_type, integer);
DROP TYPE dbentry_type;
ALTER TYPE dbentry_type_tmp RENAME TO dbentry_type;
+CREATE TRIGGER hidlock_update BEFORE UPDATE ON chars FOR EACH ROW WHEN (OLD.latest IS DISTINCT FROM NEW.latest) EXECUTE PROCEDURE update_hidlock();
+
-- load the updated functions