diff options
author | Yorhel <git@yorhel.nl> | 2010-02-02 18:33:51 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-02-02 18:33:51 +0100 |
commit | 1c0c4477f76dee105274aab7efe58b4381533b80 (patch) | |
tree | 39becf82b0c38ace8012697c1c7021350c56f437 /util/updates | |
parent | 3dc88eb0b242a1e26f7e6884d20fa63d30f5aab3 (diff) |
SQL: Converted language columns to an ENUM type
And changed vn.c_languages to an array type while I was at it. This
required some changes in the Perl code, and I found a bug in DBD::Pg
while I was at it:
https://rt.cpan.org/Ticket/Display.html?id=54224
Luckily, there's an easy workaround for that.
Diffstat (limited to 'util/updates')
-rw-r--r-- | util/updates/update_2.11.sql | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/updates/update_2.11.sql b/util/updates/update_2.11.sql index 27b90c8f..f9601ce7 100644 --- a/util/updates/update_2.11.sql +++ b/util/updates/update_2.11.sql @@ -29,6 +29,19 @@ ALTER TABLE threads_boards DROP COLUMN lastread; +-- languages -> ENUM +CREATE TYPE language AS ENUM('cs', 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja', 'ko', 'nl', 'no', 'pl', 'pt', 'ru', 'sk', 'sv', 'tr', 'vi', 'zh'); +ALTER TABLE producers_rev ALTER COLUMN lang DROP DEFAULT; +ALTER TABLE producers_rev ALTER COLUMN lang TYPE language USING lang::language; +ALTER TABLE producers_rev ALTER COLUMN lang SET DEFAULT 'ja'; +ALTER TABLE releases_lang ALTER COLUMN lang TYPE language USING lang::language; +-- c_languages is an now array of languages, rather than a serialized string +ALTER TABLE vn ALTER COLUMN c_languages DROP DEFAULT; +ALTER TABLE vn ALTER COLUMN c_languages TYPE language[] USING coalesce(string_to_array(c_languages, '/')::language[], '{}'); +ALTER TABLE vn ALTER COLUMN c_languages SET DEFAULT '{}'; + + + ALTER TABLE changes ADD COLUMN ihid boolean NOT NULL DEFAULT FALSE; ALTER TABLE changes ADD COLUMN ilock boolean NOT NULL DEFAULT FALSE; |