install/schemas/upgrade/1.1.1-1.1.2-postgresql.sql
author Dan Fuhry <dan@enanocms.org>
Tue, 16 Nov 2010 12:31:41 -0500
branch1.1.7-maintenance
changeset 1317 6012710ae538
parent 1159 a1cca4472a58
permissions -rw-r--r--
SECURITY: Fix SQL injection in banlist check (1.1.7 branch)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
410
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
     1
-- Enano CMS
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
     2
-- Upgrade schema - Enano 1.1.1 - 1.1.2
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
     3
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
     4
ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN log_id SERIAL, ADD PRIMARY KEY ( log_id );
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 410
diff changeset
     5
ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN is_draft smallint NOT NULL DEFAULT 0;
410
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
     6
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 430
diff changeset
     7
ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_rank int NOT NULL DEFAULT 1;
625
0122f538c242 Hopefully fixed user_timezone bug in PostgreSQL upgrade
Dan
parents: 494
diff changeset
     8
@ALTER TABLE {{TABLE_PREFIX}}users DROP user_timezone;
1159
a1cca4472a58 Set up more sensible defaults (UTC, DST off) for timezone preferences. Also modified enano_date() to properly include GMT offsets when timezone characters are used. Fixes issue 4.
Dan
parents: 1151
diff changeset
     9
ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_timezone int NOT NULL DEFAULT 1440;
494
6c78cc456091 Added support for upgrading arbitrary previous 1.0.x versions (very experimental)
Dan
parents: 430
diff changeset
    10
430
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 413
diff changeset
    11
ALTER TABLE {{TABLE_PREFIX}}themes
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 413
diff changeset
    12
  ADD COLUMN group_list text DEFAULT NULL,
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 413
diff changeset
    13
  ADD COLUMN group_policy varchar(5) NOT NULL DEFAULT 'deny',
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 413
diff changeset
    14
  ADD CHECK (group_policy IN ('allow', 'deny'));
410
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    15
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    16
CREATE TABLE {{TABLE_PREFIX}}ranks(
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    17
  rank_id SERIAL,
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    18
  rank_title varchar(63) NOT NULL DEFAULT '',
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    19
  rank_style varchar(255) NOT NULL DEFAULT '',
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    20
  PRIMARY KEY ( rank_id )
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    21
);
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    22
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    23
CREATE TABLE {{TABLE_PREFIX}}captcha(
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    24
  code_id SERIAL,
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    25
  session_id varchar(40) NOT NULL DEFAULT '',
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    26
  code varchar(64) NOT NULL DEFAULT '',
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    27
  session_data text,
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    28
  source_ip varchar(39),
625
0122f538c242 Hopefully fixed user_timezone bug in PostgreSQL upgrade
Dan
parents: 494
diff changeset
    29
  user_id int,
410
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    30
  PRIMARY KEY ( code_id )
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    31
);
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    32
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    33
INSERT INTO {{TABLE_PREFIX}}ranks(rank_id, rank_title, rank_style) VALUES
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    34
  (1, 'user_rank_member', ''),
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    35
  (2, 'user_rank_mod', 'font-weight: bold; color: #00AA00;'),
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    36
  (3, 'user_rank_admin', 'font-weight: bold; color: #AA0000;');
9db359d6e60c Added upgrade schema files for 1.1.1 -> current (1.1.2-dev)
Dan
parents:
diff changeset
    37
1151
8f0cbce6d5f3 Fixed ranks table under PostgreSQL. FIXME, only affects new installations and upgrades, if this bug is encountered in the wild we might want to look at auto-integrating a fix.
Dan
parents: 625
diff changeset
    38
-- For some reason this is required, it came up in my QA testing on a2hosting
8f0cbce6d5f3 Fixed ranks table under PostgreSQL. FIXME, only affects new installations and upgrades, if this bug is encountered in the wild we might want to look at auto-integrating a fix.
Dan
parents: 625
diff changeset
    39
SELECT NEXTVAL('{{TABLE_PREFIX}}ranks_rank_id_seq'::regclass);
8f0cbce6d5f3 Fixed ranks table under PostgreSQL. FIXME, only affects new installations and upgrades, if this bug is encountered in the wild we might want to look at auto-integrating a fix.
Dan
parents: 625
diff changeset
    40