if ( $conn->tableExists( $ctest, $schema ) ) {
$conn->doQuery( "DROP TABLE $safeschema.$ctest" );
}
- $res = $this->doQuery( "CREATE TABLE $safeschema.$ctest(a int)" );
+ $res = $conn->doQuery( "CREATE TABLE $safeschema.$ctest(a int)" );
if ( !$res ) {
$status->fatal( 'config-install-pg-schema-failed',
$this->getVar( 'wgDBuser'), $schema );
return $status;
}
- protected function commitChanges() {
+ function commitChanges() {
$this->db->query( 'COMMIT' );
+
+ return Status::newGood();
}
function getLocalSettings() {
* @file
* @ingroup Deployment
*/
-
+
/**
* Class for handling updates to Postgres databases.
*
# new tables
array( 'addTable', 'category', 'patch-category.sql' ),
- array( 'addTable', 'mwuser', 'patch-mwuser.sql' ),
array( 'addTable', 'page', 'patch-page.sql' ),
- array( 'addTable', 'pagecontent', 'patch-pagecontent.sql' ),
array( 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ),
array( 'addTable', 'page_props', 'patch-page_props.sql' ),
array( 'addTable', 'page_restrictions', 'patch-page_restrictions.sql' ),
array( 'addTable', 'msg_resource_links','patch-msg_resource_links.sql' ),
array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
+ # rename tables
+ array( 'renameTable', 'text', 'pagecontent' ),
+ array( 'renameTable', 'user', 'mwuser' ),
+
# Needed before new field
array( 'convertArchive2' ),
$fieldRecord[2]
);
}
-
+
return $updates;
}
}
}
+ protected function renameTable( $old, $new ) {
+ if ( $this->db->tableExists( $old ) ) {
+ $this->output( "Renaming table $old to $new\n" );
+ $this->db->query( "ALTER TABLE \"$old\" RENAME TO $new" );
+ }
+ }
+
protected function addPgField( $table, $field, $type ) {
$fi = $this->db->fieldInfo( $table, $field );
if ( !is_null( $fi ) ) {