summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-10-11 12:00:48 +0200
committerYorhel <git@yorhel.nl>2015-10-11 12:00:48 +0200
commit15382265b39f045fc5f20e9e676b24941da6bd63 (patch)
tree89a581d32849e113f28de85746d3d12cd5108998 /util
parent3d10c6358eb0594a6a2970facf56e79205e002a4 (diff)
SQL: Convert producers_rev.type into enum
Same reasoning as 19ce5fcf536ed478ad34b6b1014bf6f44841d25d
Diffstat (limited to 'util')
-rw-r--r--util/sql/all.sql1
-rw-r--r--util/sql/schema.sql2
-rw-r--r--util/updates/update_2.25.sql7
3 files changed, 9 insertions, 1 deletions
diff --git a/util/sql/all.sql b/util/sql/all.sql
index a1689149..91f58267 100644
--- a/util/sql/all.sql
+++ b/util/sql/all.sql
@@ -17,6 +17,7 @@ CREATE TYPE notification_ntype AS ENUM ('pm', 'dbdel', 'listdel', 'dbedit', 'ann
CREATE TYPE notification_ltype AS ENUM ('v', 'r', 'p', 'c', 't', 's');
CREATE TYPE platform AS ENUM ('win', 'dos', 'lin', 'mac', 'ios', 'and', 'dvd', 'bdp', 'fmt', 'gba', 'gbc', 'msx', 'nds', 'nes', 'p88', 'p98', 'pce', 'pcf', 'psp', 'ps1', 'ps2', 'ps3', 'ps4', 'psv', 'drc', 'sat', 'sfc', 'wii', 'n3d', 'x68', 'xb1', 'xb3', 'xbo', 'web', 'oth');
CREATE TYPE prefs_key AS ENUM ('l10n', 'skin', 'customcss', 'filter_vn', 'filter_release', 'show_nsfw', 'hide_list', 'notify_nodbedit', 'notify_announce', 'vn_list_own', 'vn_list_wish', 'tags_all', 'tags_cat', 'spoilers', 'traits_sexual');
+CREATE TYPE producer_type AS ENUM ('co', 'in', 'ng');
CREATE TYPE producer_relation AS ENUM ('old', 'new', 'sub', 'par', 'imp', 'ipa', 'spa', 'ori');
CREATE TYPE release_type AS ENUM ('complete', 'partial', 'trial');
CREATE TYPE tag_category AS ENUM('cont', 'ero', 'tech');
diff --git a/util/sql/schema.sql b/util/sql/schema.sql
index 8de05fde..3fba4342 100644
--- a/util/sql/schema.sql
+++ b/util/sql/schema.sql
@@ -127,7 +127,7 @@ CREATE TABLE producers_relations (
CREATE TABLE producers_rev (
id integer NOT NULL PRIMARY KEY,
pid integer NOT NULL DEFAULT 0,
- type character(2) NOT NULL DEFAULT 'co',
+ type producer_type NOT NULL DEFAULT 'co',
name varchar(200) NOT NULL DEFAULT '',
original varchar(200) NOT NULL DEFAULT '',
website varchar(250) NOT NULL DEFAULT '',
diff --git a/util/updates/update_2.25.sql b/util/updates/update_2.25.sql
index 07275ae7..6302daaf 100644
--- a/util/updates/update_2.25.sql
+++ b/util/updates/update_2.25.sql
@@ -67,3 +67,10 @@ $$ LANGUAGE sql IMMUTABLE;
-- Changes to search normalization
UPDATE vn SET c_search = NULL;
+
+
+-- Convert producers_rev.type to enum
+CREATE TYPE producer_type AS ENUM ('co', 'in', 'ng');
+ALTER TABLE producers_rev ALTER COLUMN type DROP DEFAULT;
+ALTER TABLE producers_rev ALTER COLUMN type TYPE producer_type USING type::producer_type;
+ALTER TABLE producers_rev ALTER COLUMN type SET DEFAULT 'co';