install/schemas/upgrade/1.1.5-1.1.6-postgresql.sql
author Dan
Thu, 17 Dec 2009 04:27:50 -0500
changeset 1168 277a9cdead3e
parent 831 45e887f23282
permissions -rw-r--r--
Namespace_Default: added a workaround for an inconsistency in SQL. Basically, if you join the same table multiple times under multiple aliases, COUNT() always uses the first instance. Was affecting the comment counter in the "discussion" button.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
831
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     1
ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN password_salt varchar(40) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     2
ALTER TABLE {{TABLE_PREFIX}}pages ADD COLUMN page_format varchar(16) NOT NULL DEFAULT 'wikitext';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     3
ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN page_format varchar(16) NOT NULL DEFAULT 'wikitext';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     4
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     5
--
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     6
-- Make page_id and namespace column sizes consistent (former bug)
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     7
-- Yes, this is a PITA in PostgreSQL.
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     8
--
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
     9
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    10
-- comments
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    11
ALTER TABLE {{TABLE_PREFIX}}comments ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    12
UPDATE {{TABLE_PREFIX}}comments SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    13
ALTER TABLE {{TABLE_PREFIX}}comments DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    14
ALTER TABLE {{TABLE_PREFIX}}comments RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    15
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    16
ALTER TABLE {{TABLE_PREFIX}}comments ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    17
UPDATE {{TABLE_PREFIX}}comments SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    18
ALTER TABLE {{TABLE_PREFIX}}comments DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    19
ALTER TABLE {{TABLE_PREFIX}}comments RENAME namespace_new TO namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    20
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    21
-- logs
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    22
ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    23
UPDATE {{TABLE_PREFIX}}logs SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    24
ALTER TABLE {{TABLE_PREFIX}}logs DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    25
ALTER TABLE {{TABLE_PREFIX}}logs RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    26
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    27
ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    28
UPDATE {{TABLE_PREFIX}}logs SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    29
ALTER TABLE {{TABLE_PREFIX}}logs DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    30
ALTER TABLE {{TABLE_PREFIX}}logs RENAME namespace_new TO namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    31
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    32
-- page_text
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    33
ALTER TABLE {{TABLE_PREFIX}}page_text ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    34
UPDATE {{TABLE_PREFIX}}page_text SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    35
ALTER TABLE {{TABLE_PREFIX}}page_text DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    36
ALTER TABLE {{TABLE_PREFIX}}page_text RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    37
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    38
-- pages
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    39
ALTER TABLE {{TABLE_PREFIX}}pages ADD COLUMN urlname_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    40
UPDATE {{TABLE_PREFIX}}pages SET urlname_new = urlname;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    41
ALTER TABLE {{TABLE_PREFIX}}pages DROP urlname;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    42
ALTER TABLE {{TABLE_PREFIX}}pages RENAME urlname_new TO urlname;
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents:
diff changeset
    43
831
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    44
-- hits
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    45
ALTER TABLE {{TABLE_PREFIX}}hits ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    46
UPDATE {{TABLE_PREFIX}}hits SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    47
ALTER TABLE {{TABLE_PREFIX}}hits DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    48
ALTER TABLE {{TABLE_PREFIX}}hits RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    49
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    50
ALTER TABLE {{TABLE_PREFIX}}hits ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    51
UPDATE {{TABLE_PREFIX}}hits SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    52
ALTER TABLE {{TABLE_PREFIX}}hits DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    53
ALTER TABLE {{TABLE_PREFIX}}hits RENAME namespace_new TO namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    54
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    55
-- acl
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    56
ALTER TABLE {{TABLE_PREFIX}}acl ADD COLUMN page_id_new varchar(512) DEFAULT NULL;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    57
UPDATE {{TABLE_PREFIX}}acl SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    58
ALTER TABLE {{TABLE_PREFIX}}acl DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    59
ALTER TABLE {{TABLE_PREFIX}}acl RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    60
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    61
ALTER TABLE {{TABLE_PREFIX}}acl ADD COLUMN namespace_new varchar(16) DEFAULT NULL;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    62
UPDATE {{TABLE_PREFIX}}acl SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    63
ALTER TABLE {{TABLE_PREFIX}}acl DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    64
ALTER TABLE {{TABLE_PREFIX}}acl RENAME namespace_new TO namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    65
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    66
-- page_group_members
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    67
ALTER TABLE {{TABLE_PREFIX}}page_group_members ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    68
UPDATE {{TABLE_PREFIX}}page_group_members SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    69
ALTER TABLE {{TABLE_PREFIX}}page_group_members DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    70
ALTER TABLE {{TABLE_PREFIX}}page_group_members RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    71
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    72
ALTER TABLE {{TABLE_PREFIX}}page_group_members ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    73
UPDATE {{TABLE_PREFIX}}page_group_members SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    74
ALTER TABLE {{TABLE_PREFIX}}page_group_members DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    75
ALTER TABLE {{TABLE_PREFIX}}page_group_members RENAME namespace_new TO namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    76
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    77
-- tags
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    78
ALTER TABLE {{TABLE_PREFIX}}tags ADD COLUMN page_id_new varchar(512) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    79
UPDATE {{TABLE_PREFIX}}tags SET page_id_new = page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    80
ALTER TABLE {{TABLE_PREFIX}}tags DROP page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    81
ALTER TABLE {{TABLE_PREFIX}}tags RENAME page_id_new TO page_id;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    82
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    83
ALTER TABLE {{TABLE_PREFIX}}tags ADD COLUMN namespace_new varchar(16) NOT NULL DEFAULT '';
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    84
UPDATE {{TABLE_PREFIX}}tags SET namespace_new = namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    85
ALTER TABLE {{TABLE_PREFIX}}tags DROP namespace;
45e887f23282 Made all page_id and namespace columns consistent
Dan
parents: 801
diff changeset
    86
ALTER TABLE {{TABLE_PREFIX}}tags RENAME namespace_new TO namespace;