install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql
changeset 1259 49db7495f6b8
parent 1258 d972b1276d95
child 1260 cd72bcd83401
equal deleted inserted replaced
1258:d972b1276d95 1259:49db7495f6b8
     1 -- This is really honestly a better way to handle plugins.
       
     2 
       
     3 CREATE TABLE {{TABLE_PREFIX}}plugins (
       
     4   plugin_id SERIAL,
       
     5   plugin_filename varchar(63),
       
     6   plugin_flags int,
       
     7   plugin_version varchar(16),
       
     8   PRIMARY KEY ( plugin_id )
       
     9 );
       
    10 
       
    11 -- User title
       
    12 ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_title varchar(64) DEFAULT NULL;
       
    13 
       
    14 -- Modifications to user_rank column
       
    15 -- http://pgsqld.active-venture.com/ddl-alter.html#AEN1984
       
    16 ALTER TABLE {{TABLE_PREFIX}}users ALTER COLUMN user_rank DROP NOT NULL,
       
    17               ALTER COLUMN user_rank DROP DEFAULT;
       
    18 ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_group int NOT NULL DEFAULT 1;
       
    19 UPDATE {{TABLE_PREFIX}}users SET user_rank = NULL;
       
    20               
       
    21 -- Aggregate function array_accum
       
    22 -- http://www.postgresql.org/docs/current/static/xaggr.html
       
    23 
       
    24 CREATE AGGREGATE {{TABLE_PREFIX}}array_accum (anyelement)
       
    25 (
       
    26     sfunc = array_append,
       
    27     stype = anyarray,
       
    28     initcond = '{}'
       
    29 );
       
    30 
       
    31 -- The "guest" rank
       
    32 -- No frontend to this yet so ranks should not have been created.
       
    33 DELETE FROM {{TABLE_PREFIX}}ranks WHERE rank_id = 4;
       
    34 INSERT INTO {{TABLE_PREFIX}}ranks(rank_id, rank_title, rank_style) VALUES
       
    35   (4, 'user_rank_guest', '');
       
    36   
       
    37 -- For some reason this is required, it came up in my QA testing on a2hosting
       
    38 SELECT NEXTVAL('{{TABLE_PREFIX}}ranks_rank_id_seq'::regclass);
       
    39 
       
    40 -- Other rank-related columns
       
    41 ALTER TABLE {{TABLE_PREFIX}}groups ADD COLUMN group_rank int DEFAULT NULL;
       
    42 
       
    43 -- Disable JS effects column
       
    44 ALTER TABLE {{TABLE_PREFIX}}users_extra ADD COLUMN disable_js_fx smallint NOT NULL DEFAULT 0;
       
    45 
       
    46 -- Add "grv" avatar type
       
    47 ALTER TABLE {{TABLE_PREFIX}}users DROP CONSTRAINT {{TABLE_PREFIX}}users_avatar_type_check;
       
    48 ALTER TABLE {{TABLE_PREFIX}}users ADD CONSTRAINT {{TABLE_PREFIX}}users_avatar_type_check CHECK ( avatar_type IN ( 'png', 'gif', 'jpg', 'grv' ) );