summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-26 10:59:18 +0200
committerYorhel <git@yorhel.nl>2009-09-26 10:59:18 +0200
commitc160933061f58a0f64a6037c1db8b79fb725b495 (patch)
tree37e5fce3913c18504757a944c394f18b63e13e3b /util
parent836eb84c9be9197b5ca842a755051f4230df7600 (diff)
Converted VN relations to ENUM data type and made them translatable
OK, these are actually two separate things: to make the relations translatable they didn't necessarily have to be stored as enum, and I could've also converted them to enum but not have it translatable. Nevertheless, it was easier to just do both at the same time. Also note how I used the string "$____vnrel_<rel>____$" as identifier in the relation graphs while I could have used something a lot shorter ("$<rel>$" would have been fine, for example). This is done so that graphviz can make some space for those relations - the long identifier gives a slightly more realistic representation of the actual length of the relation titles.
Diffstat (limited to 'util')
-rw-r--r--util/updates/update_2.8.sql18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/updates/update_2.8.sql b/util/updates/update_2.8.sql
index a48c1e73..f9704be3 100644
--- a/util/updates/update_2.8.sql
+++ b/util/updates/update_2.8.sql
@@ -14,3 +14,21 @@ CREATE TABLE vn_graphs (
);
ALTER TABLE vn ADD FOREIGN KEY (rgraph) REFERENCES vn_graphs (id);
+
+-- VN relations stored as enum
+CREATE TYPE vn_relation AS ENUM ('seq', 'preq', 'set', 'alt', 'char', 'side', 'par', 'ser', 'fan', 'orig');
+ALTER TABLE vn_relations ALTER COLUMN relation DROP DEFAULT;
+ALTER TABLE vn_relations ALTER COLUMN relation TYPE vn_relation USING
+ CASE
+ WHEN relation = 0 THEN 'seq'::vn_relation
+ WHEN relation = 1 THEN 'preq'
+ WHEN relation = 2 THEN 'set'
+ WHEN relation = 3 THEN 'alt'
+ WHEN relation = 4 THEN 'char'
+ WHEN relation = 5 THEN 'side'
+ WHEN relation = 6 THEN 'par'
+ WHEN relation = 7 THEN 'ser'
+ WHEN relation = 8 THEN 'fan'
+ ELSE 'orig'
+ END;
+