installer: Add support for PlatformSettings.php
[lhc/web/wiklou.git] / includes / installer / PostgresUpdater.php
index 2bfadf4..ba6e968 100644 (file)
@@ -294,7 +294,7 @@ class PostgresUpdater extends DatabaseUpdater {
                                [ 'log_timestamp', 'timestamptz_ops', 'btree', 0 ],
                        ],
                        'CREATE INDEX "logging_times" ON "logging" USING "btree" ("log_timestamp")' ],
-                       [ 'dropIndex', 'oldimage', 'oi_name' ],
+                       [ 'dropPgIndex', 'oldimage', 'oi_name' ],
                        [ 'checkIndex', 'oi_name_archive_name', [
                                [ 'oi_name', 'text_ops', 'btree', 0 ],
                                [ 'oi_archive_name', 'text_ops', 'btree', 0 ],
@@ -353,7 +353,7 @@ class PostgresUpdater extends DatabaseUpdater {
                        [ 'checkOiNameConstraint' ],
                        [ 'checkPageDeletedTrigger' ],
                        [ 'checkRevUserFkey' ],
-                       [ 'dropIndex', 'ipblocks', 'ipb_address' ],
+                       [ 'dropPgIndex', 'ipblocks', 'ipb_address' ],
                        [ 'checkIndex', 'ipb_address_unique', [
                                [ 'ipb_address', 'text_ops', 'btree', 0 ],
                                [ 'ipb_user', 'int4_ops', 'btree', 0 ],
@@ -487,6 +487,15 @@ class PostgresUpdater extends DatabaseUpdater {
 
                        // 1.31
                        [ 'addTable', 'slots', 'patch-slots-table.sql' ],
+                       [ 'dropPgIndex', 'slots', 'slot_role_inherited' ],
+                       [ 'dropPgField', 'slots', 'slot_inherited' ],
+                       [ 'addPgField', 'slots', 'slot_origin', 'INTEGER NOT NULL' ],
+                       [
+                               'addPgIndex',
+                               'slots',
+                               'slot_revision_origin_role',
+                               '( slot_revision_id, slot_origin, slot_role_id )',
+                       ],
                        [ 'addTable', 'content', 'patch-content-table.sql' ],
                        [ 'addTable', 'content_models', 'patch-content_models-table.sql' ],
                        [ 'addTable', 'slot_roles', 'patch-slot_roles-table.sql' ],
@@ -763,6 +772,18 @@ END;
                $this->db->query( "ALTER INDEX $old RENAME TO $new" );
        }
 
+       protected function dropPgField( $table, $field ) {
+               $fi = $this->db->fieldInfo( $table, $field );
+               if ( is_null( $fi ) ) {
+                       $this->output( "...$table table does not contain $field field.\n" );
+
+                       return;
+               } else {
+                       $this->output( "Dropping column '$table.$field'\n" );
+                       $this->db->query( "ALTER TABLE $table DROP COLUMN $field" );
+               }
+       }
+
        protected function addPgField( $table, $field, $type ) {
                $fi = $this->db->fieldInfo( $table, $field );
                if ( !is_null( $fi ) ) {
@@ -1039,7 +1060,7 @@ END;
                }
        }
 
-       protected function dropIndex( $table, $index, $patch = '', $fullpath = false ) {
+       protected function dropPgIndex( $table, $index ) {
                if ( $this->db->indexExists( $table, $index ) ) {
                        $this->output( "Dropping obsolete index '$index'\n" );
                        $this->db->query( "DROP INDEX \"" . $index . "\"" );