install/schemas/upgrade/1.1.5-1.1.6-postgresql.sql
changeset 831 45e887f23282
parent 801 eb8b23f11744
equal deleted inserted replaced
830:79fb483807f6 831:45e887f23282
     1 ALTER TABLE users ADD COLUMN password_salt varchar(40) NOT NULL DEFAULT '';
     1 ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN password_salt varchar(40) NOT NULL DEFAULT '';
       
     2 ALTER TABLE {{TABLE_PREFIX}}pages ADD COLUMN page_format varchar(16) NOT NULL DEFAULT 'wikitext';
       
     3 ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN page_format varchar(16) NOT NULL DEFAULT 'wikitext';
     2 
     4 
       
     5 --
       
     6 -- Make page_id and namespace column sizes consistent (former bug)
       
     7 -- Yes, this is a PITA in PostgreSQL.
       
     8 --
       
     9 
       
    10 -- comments
       
    11 ALTER TABLE {{TABLE_PREFIX}}comments ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    12 UPDATE {{TABLE_PREFIX}}comments SET page_id_new = page_id;
       
    13 ALTER TABLE {{TABLE_PREFIX}}comments DROP page_id;
       
    14 ALTER TABLE {{TABLE_PREFIX}}comments RENAME page_id_new TO page_id;
       
    15 
       
    16 ALTER TABLE {{TABLE_PREFIX}}comments ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
       
    17 UPDATE {{TABLE_PREFIX}}comments SET namespace_new = namespace;
       
    18 ALTER TABLE {{TABLE_PREFIX}}comments DROP namespace;
       
    19 ALTER TABLE {{TABLE_PREFIX}}comments RENAME namespace_new TO namespace;
       
    20 
       
    21 -- logs
       
    22 ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    23 UPDATE {{TABLE_PREFIX}}logs SET page_id_new = page_id;
       
    24 ALTER TABLE {{TABLE_PREFIX}}logs DROP page_id;
       
    25 ALTER TABLE {{TABLE_PREFIX}}logs RENAME page_id_new TO page_id;
       
    26 
       
    27 ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
       
    28 UPDATE {{TABLE_PREFIX}}logs SET namespace_new = namespace;
       
    29 ALTER TABLE {{TABLE_PREFIX}}logs DROP namespace;
       
    30 ALTER TABLE {{TABLE_PREFIX}}logs RENAME namespace_new TO namespace;
       
    31 
       
    32 -- page_text
       
    33 ALTER TABLE {{TABLE_PREFIX}}page_text ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    34 UPDATE {{TABLE_PREFIX}}page_text SET page_id_new = page_id;
       
    35 ALTER TABLE {{TABLE_PREFIX}}page_text DROP page_id;
       
    36 ALTER TABLE {{TABLE_PREFIX}}page_text RENAME page_id_new TO page_id;
       
    37 
       
    38 -- pages
       
    39 ALTER TABLE {{TABLE_PREFIX}}pages ADD COLUMN urlname_new varchar(512) NOT NULL DEFAULT '';
       
    40 UPDATE {{TABLE_PREFIX}}pages SET urlname_new = urlname;
       
    41 ALTER TABLE {{TABLE_PREFIX}}pages DROP urlname;
       
    42 ALTER TABLE {{TABLE_PREFIX}}pages RENAME urlname_new TO urlname;
       
    43 
       
    44 -- hits
       
    45 ALTER TABLE {{TABLE_PREFIX}}hits ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    46 UPDATE {{TABLE_PREFIX}}hits SET page_id_new = page_id;
       
    47 ALTER TABLE {{TABLE_PREFIX}}hits DROP page_id;
       
    48 ALTER TABLE {{TABLE_PREFIX}}hits RENAME page_id_new TO page_id;
       
    49 
       
    50 ALTER TABLE {{TABLE_PREFIX}}hits ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
       
    51 UPDATE {{TABLE_PREFIX}}hits SET namespace_new = namespace;
       
    52 ALTER TABLE {{TABLE_PREFIX}}hits DROP namespace;
       
    53 ALTER TABLE {{TABLE_PREFIX}}hits RENAME namespace_new TO namespace;
       
    54 
       
    55 -- acl
       
    56 ALTER TABLE {{TABLE_PREFIX}}acl ADD COLUMN page_id_new varchar(512) DEFAULT NULL;
       
    57 UPDATE {{TABLE_PREFIX}}acl SET page_id_new = page_id;
       
    58 ALTER TABLE {{TABLE_PREFIX}}acl DROP page_id;
       
    59 ALTER TABLE {{TABLE_PREFIX}}acl RENAME page_id_new TO page_id;
       
    60 
       
    61 ALTER TABLE {{TABLE_PREFIX}}acl ADD COLUMN namespace_new varchar(16) DEFAULT NULL;
       
    62 UPDATE {{TABLE_PREFIX}}acl SET namespace_new = namespace;
       
    63 ALTER TABLE {{TABLE_PREFIX}}acl DROP namespace;
       
    64 ALTER TABLE {{TABLE_PREFIX}}acl RENAME namespace_new TO namespace;
       
    65 
       
    66 -- page_group_members
       
    67 ALTER TABLE {{TABLE_PREFIX}}page_group_members ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    68 UPDATE {{TABLE_PREFIX}}page_group_members SET page_id_new = page_id;
       
    69 ALTER TABLE {{TABLE_PREFIX}}page_group_members DROP page_id;
       
    70 ALTER TABLE {{TABLE_PREFIX}}page_group_members RENAME page_id_new TO page_id;
       
    71 
       
    72 ALTER TABLE {{TABLE_PREFIX}}page_group_members ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
       
    73 UPDATE {{TABLE_PREFIX}}page_group_members SET namespace_new = namespace;
       
    74 ALTER TABLE {{TABLE_PREFIX}}page_group_members DROP namespace;
       
    75 ALTER TABLE {{TABLE_PREFIX}}page_group_members RENAME namespace_new TO namespace;
       
    76 
       
    77 -- tags
       
    78 ALTER TABLE {{TABLE_PREFIX}}tags ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
       
    79 UPDATE {{TABLE_PREFIX}}tags SET page_id_new = page_id;
       
    80 ALTER TABLE {{TABLE_PREFIX}}tags DROP page_id;
       
    81 ALTER TABLE {{TABLE_PREFIX}}tags RENAME page_id_new TO page_id;
       
    82 
       
    83 ALTER TABLE {{TABLE_PREFIX}}tags ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
       
    84 UPDATE {{TABLE_PREFIX}}tags SET namespace_new = namespace;
       
    85 ALTER TABLE {{TABLE_PREFIX}}tags DROP namespace;
       
    86 ALTER TABLE {{TABLE_PREFIX}}tags RENAME namespace_new TO namespace;