summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-02-19 09:58:00 +0100
committerYorhel <git@yorhel.nl>2011-02-19 09:58:00 +0100
commitdaf605104b5181341b52465f7574f7451f2008ff (patch)
tree2ffd17c06fd40c79e2799cf2544e2a241ee7975c /util
parent9470cf12cb6ae8a4610a24ae5b60017ddfcc1568 (diff)
chardb: Added blood type + misc. fixes and improvements
Diffstat (limited to 'util')
-rw-r--r--util/sql/func.sql4
-rw-r--r--util/updates/update_2.19.sql9
2 files changed, 8 insertions, 5 deletions
diff --git a/util/sql/func.sql b/util/sql/func.sql
index ffc39d3b..aa453350 100644
--- a/util/sql/func.sql
+++ b/util/sql/func.sql
@@ -388,7 +388,7 @@ BEGIN
INSERT INTO edit_char DEFAULT VALUES;
-- load revision
ELSE
- INSERT INTO edit_char SELECT name, original, alias, image, "desc", s_bust, s_waist, s_hip, b_month, b_day, height, weight FROM chars_rev WHERE id = hid;
+ INSERT INTO edit_char SELECT name, original, alias, image, "desc", s_bust, s_waist, s_hip, b_month, b_day, height, weight,bloodt FROM chars_rev WHERE id = hid;
END IF;
END;
$$ LANGUAGE plpgsql;
@@ -403,7 +403,7 @@ BEGIN
RAISE 'edit_char must have exactly one row!';
END IF;
SELECT INTO r * FROM edit_commit();
- INSERT INTO chars_rev SELECT r.cid, r.iid, name, original, alias, image, "desc", s_bust, s_waist, s_hip, b_month, b_day, height, weight FROM edit_char;
+ INSERT INTO chars_rev SELECT r.cid, r.iid, name, original, alias, image, "desc", s_bust, s_waist, s_hip, b_month, b_day, height, weight, bloodt FROM edit_char;
UPDATE chars SET latest = r.cid WHERE id = r.iid;
RETURN r;
END;
diff --git a/util/updates/update_2.19.sql b/util/updates/update_2.19.sql
index 462e4eed..94f32bc0 100644
--- a/util/updates/update_2.19.sql
+++ b/util/updates/update_2.19.sql
@@ -31,6 +31,7 @@ CREATE TRIGGER insert_notify AFTER INSERT ON traits
-- character database -> chars
CREATE TYPE char_role AS ENUM ('main', 'primary', 'side', 'appears');
+CREATE TYPE blood_type AS ENUM ('unknown', 'a', 'b', 'ab', 'o', 'other');
CREATE TABLE chars (
id SERIAL PRIMARY KEY,
@@ -54,6 +55,7 @@ CREATE TABLE chars_rev (
b_day smallint NOT NULL DEFAULT 0,
height smallint NOT NULL DEFAULT 0,
weight smallint NOT NULL DEFAULT 0,
+ bloodt blood_type NOT NULL DEFAULT 'unknown',
main integer REFERENCES chars (id),
main_spoil boolean NOT NULL DEFAULT false
);
@@ -87,15 +89,16 @@ 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();
-CREATE TRIGGER chars_rev_image_notify AFTER INSERT OR UPDATE ON chars_rev FOR EACH ROW WHEN (NEW.image < 0) EXECUTE PROCEDURE chars_rev_image_notify();
-
-- load the updated functions
\i util/sql/func.sql
+CREATE TRIGGER hidlock_update BEFORE UPDATE ON chars FOR EACH ROW WHEN (OLD.latest IS DISTINCT FROM NEW.latest) EXECUTE PROCEDURE update_hidlock();
+CREATE TRIGGER chars_rev_image_notify AFTER INSERT OR UPDATE ON chars_rev FOR EACH ROW WHEN (NEW.image < 0) EXECUTE PROCEDURE chars_rev_image_notify();
+
+
-- test
--SELECT edit_char_init(null);
--UPDATE edit_revision SET comments = 'New test entry', requester = 2, ip = '0.0.0.0';