Commit bb1f5dfd authored by Dries's avatar Dries
Browse files

- Patch #40303 by Cvbge: drop old columns for PostgreSQL and fixed some...

- Patch #40303 by Cvbge: drop old columns for PostgreSQL and fixed some PostgreSQL problems in the update script.
parent 94d6b9ab
...@@ -650,7 +650,7 @@ CREATE TABLE system ( ...@@ -650,7 +650,7 @@ CREATE TABLE system (
status integer NOT NULL default '0', status integer NOT NULL default '0',
throttle smallint NOT NULL default '0', throttle smallint NOT NULL default '0',
bootstrap integer NOT NULL default '0', bootstrap integer NOT NULL default '0',
schema_version int2 NOT NULL CHECK (schema_version > 0), schema_version smallint NOT NULL default 1,
PRIMARY KEY (filename) PRIMARY KEY (filename)
); );
......
...@@ -136,8 +136,7 @@ function db_change_column(&$ret, $table, $column, $column_new, $type, $attribute ...@@ -136,8 +136,7 @@ function db_change_column(&$ret, $table, $column, $column_new, $type, $attribute
$ret[] = update_sql("UPDATE {". $table ."} SET $column_new = ". $column ."_old"); $ret[] = update_sql("UPDATE {". $table ."} SET $column_new = ". $column ."_old");
if ($default) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET $default"); } if ($default) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET $default"); }
if ($not_null) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET NOT NULL"); } if ($not_null) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET NOT NULL"); }
// We don't drop columns for now $ret[] = update_sql("ALTER TABLE {". $table ."} DROP ". $column ."_old");
// $ret[] = update_sql("ALTER TABLE {". $table ."} DROP ". $column ."_old");
} }
/** /**
...@@ -196,7 +195,7 @@ function update_fix_schema_version() { ...@@ -196,7 +195,7 @@ function update_fix_schema_version() {
switch ($GLOBALS['db_type']) { switch ($GLOBALS['db_type']) {
case 'pgsql': case 'pgsql':
$ret = array(); $ret = array();
db_add_column($ret, 'system', 'schema_version', 'int2', array('not null' => TRUE)); db_add_column($ret, 'system', 'schema_version', 'smallint', array('not null' => TRUE, 'default' => 1));
break; break;
case 'mysql': case 'mysql':
...@@ -244,11 +243,12 @@ function update_fix_watchdog() { ...@@ -244,11 +243,12 @@ function update_fix_watchdog() {
if (update_get_installed_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) { if (update_get_installed_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) {
switch ($GLOBALS['db_type']) { switch ($GLOBALS['db_type']) {
case 'pgsql': case 'pgsql':
$ret = array();
db_add_column($ret, 'watchdog', 'referer', 'varchar(128)', array('not null' => TRUE, 'default' => "''")); db_add_column($ret, 'watchdog', 'referer', 'varchar(128)', array('not null' => TRUE, 'default' => "''"));
break; break;
case 'mysql': case 'mysql':
case 'mysqli': case 'mysqli':
$ret[] = db_query("ALTER TABLE {watchdog} ADD COLUMN referer varchar(128) NOT NULL"); db_query("ALTER TABLE {watchdog} ADD COLUMN referer varchar(128) NOT NULL");
break; break;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment