install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql
changeset 541 acb7e23b6ffa
parent 519 94214ec0871c
child 555 ac4c6a7f01d8
--- a/install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql	Sat Apr 26 17:25:28 2008 -0400
+++ b/install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql	Sun May 04 21:57:48 2008 -0400
@@ -7,3 +7,30 @@
   plugin_version varchar(16),
   PRIMARY KEY ( plugin_id )
 );
+
+-- User title
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_title varchar(64) DEFAULT NULL;
+
+-- Modifications to user_rank column
+-- http://pgsqld.active-venture.com/ddl-alter.html#AEN1984
+ALTER TABLE {{TABLE_PREFIX}}users ALTER COLUMN user_rank DROP NOT NULL,
+              ALTER COLUMN user_rank DROP DEFAULT;
+ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_group int NOT NULL DEFAULT 1;
+UPDATE {{TABLE_PREFIX}}users SET user_rank = NULL;
+              
+-- Aggregate function array_accum
+-- http://www.postgresql.org/docs/current/static/xaggr.html
+
+CREATE AGGREGATE {{TABLE_PREFIX}}array_accum (anyelement)
+(
+    sfunc = array_append,
+    stype = anyarray,
+    initcond = '{}'
+);
+
+-- The "guest" rank
+-- No frontend to this yet so ranks should not have been created.
+DELETE FROM {{TABLE_PREFIX}}ranks WHERE rank_id = 4;
+INSERT INTO {{TABLE_PREFIX}}ranks(rank_id, rank_title, rank_style) VALUES
+  (4, 'user_rank_guest', '');
+