- Patch #62478 by Cvbge: fixed some database inconsistencies with PostgreSQL.
parent
8c8af42c64
commit
d7f3ace214
|
@ -419,13 +419,14 @@ CREATE TABLE node (
|
|||
promote integer NOT NULL default '0',
|
||||
moderate integer NOT NULL default '0',
|
||||
sticky integer NOT NULL default '0',
|
||||
PRIMARY KEY (nid)
|
||||
PRIMARY KEY (nid, vid)
|
||||
);
|
||||
CREATE INDEX node_nid_idx ON node(nid);
|
||||
CREATE INDEX node_type_idx ON node(type);
|
||||
CREATE INDEX node_title_type_idx ON node(title,type);
|
||||
CREATE INDEX node_status_idx ON node(status);
|
||||
CREATE INDEX node_uid_idx ON node(uid);
|
||||
CREATE INDEX node_vid_idx ON node(vid);
|
||||
CREATE UNIQUE INDEX node_vid_idx ON node(vid);
|
||||
CREATE INDEX node_moderate_idx ON node (moderate);
|
||||
CREATE INDEX node_promote_status_idx ON node (promote, status);
|
||||
CREATE INDEX node_created_idx ON node(created);
|
||||
|
|
|
@ -1964,17 +1964,24 @@ function system_update_179() {
|
|||
function system_update_180() {
|
||||
$ret = array();
|
||||
|
||||
if ($GLOBALS['db_type'] == 'mysql') {
|
||||
$ret[] = update_sql("ALTER TABLE {node} DROP PRIMARY KEY");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
|
||||
$ret[] = update_sql("ALTER TABLE {node} DROP INDEX vid");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD UNIQUE (vid)");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX (nid)");
|
||||
switch ($GLOBALS['db_type']) {
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
$ret[] = update_sql("ALTER TABLE {node} DROP PRIMARY KEY");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
|
||||
$ret[] = update_sql("ALTER TABLE {node} DROP INDEX vid");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD UNIQUE (vid)");
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD INDEX (nid)");
|
||||
|
||||
$ret[] = update_sql("ALTER TABLE {node_counter} CHANGE nid nid INT(10) NOT NULL DEFAULT '0'");
|
||||
}
|
||||
else { // pgsql
|
||||
// Insert queries here.
|
||||
$ret[] = update_sql("ALTER TABLE {node_counter} CHANGE nid nid INT(10) NOT NULL DEFAULT '0'");
|
||||
break;
|
||||
case 'pgsql':
|
||||
$ret[] = update_sql("ALTER TABLE {node} DROP CONSTRAINT {node}_pkey"); // Change PK
|
||||
$ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
|
||||
$ret[] = update_sql('DROP INDEX {node}_vid_idx'); // Change normal index to UNIQUE index
|
||||
$ret[] = update_sql('CREATE UNIQUE INDEX {node}_vid_idx ON {node}(vid)');
|
||||
$ret[] = update_sql('CREATE INDEX {node}_nid_idx ON {node}(nid)'); // Add index on nid
|
||||
break;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -1988,7 +1995,7 @@ function system_update_181() {
|
|||
$ret[] = update_sql("ALTER TABLE {profile_fields} ADD autocomplete TINYINT(1) NOT NULL AFTER visibility ;");
|
||||
break;
|
||||
case 'pgsql':
|
||||
db_add_column($ret, 'profile_fields', 'autocomplete', 'smallint');
|
||||
db_add_column($ret, 'profile_fields', 'autocomplete', 'smallint', array('not null' => TRUE, 'default' => 0));
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
|
@ -2001,7 +2008,7 @@ function system_update_182() {
|
|||
$ret = array();
|
||||
|
||||
if ($GLOBALS['db_type'] == 'pgsql') {
|
||||
$ret[] = update_sql('ALTER TABLE {locales_target} DROP CONSTRAINT {locales_target}_lid_idx');
|
||||
$ret[] = update_sql('ALTER TABLE {locales_target} DROP CONSTRAINT {locales_target}_lid_key');
|
||||
$ret[] = update_sql('CREATE INDEX {locales_target}_lid_idx ON {locales_target} (lid)');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue