summaryrefslogtreecommitdiff
path: root/util/sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-09-06 03:35:36 +0200
committerYorhel <git@yorhel.nl>2015-09-06 03:35:36 +0200
commit19ce5fcf536ed478ad34b6b1014bf6f44841d25d (patch)
tree772556d6df88dc204f2a9dbe3d0cb118d94cc3cf /util/sql
parent6e0def1868b20ef1174d06c4bd8655548c024302 (diff)
SQL: Convert threads_board.type to ENUM
The char(2) solution is both inefficient and ugly. Also needed to be careful with handling the extra space that Postgres would automatically add to single-character types.
Diffstat (limited to 'util/sql')
-rw-r--r--util/sql/all.sql1
-rw-r--r--util/sql/schema.sql2
2 files changed, 2 insertions, 1 deletions
diff --git a/util/sql/all.sql b/util/sql/all.sql
index 7c535f7a..833f5890 100644
--- a/util/sql/all.sql
+++ b/util/sql/all.sql
@@ -5,6 +5,7 @@
CREATE TYPE anime_type AS ENUM ('tv', 'ova', 'mov', 'oth', 'web', 'spe', 'mv');
CREATE TYPE blood_type AS ENUM ('unknown', 'a', 'b', 'ab', 'o');
+CREATE TYPE board_type AS ENUM ('an', 'db', 'ge', 'v', 'p', 'u');
CREATE TYPE char_role AS ENUM ('main', 'primary', 'side', 'appears');
CREATE TYPE credit_type AS ENUM ('scenario', 'chardesign', 'art', 'music', 'songs', 'director', 'staff');
CREATE TYPE dbentry_type AS ENUM ('v', 'r', 'p', 'c', 's');
diff --git a/util/sql/schema.sql b/util/sql/schema.sql
index 5c4342e2..8de05fde 100644
--- a/util/sql/schema.sql
+++ b/util/sql/schema.sql
@@ -352,7 +352,7 @@ CREATE TABLE threads_posts (
-- threads_boards
CREATE TABLE threads_boards (
tid integer NOT NULL DEFAULT 0,
- type character(2) NOT NULL DEFAULT 0,
+ type board_type NOT NULL,
iid integer NOT NULL DEFAULT 0,
PRIMARY KEY(tid, type, iid)
);