update_85
- Versions
- 4.6
update_85()
Code
database/updates.inc, line 1077
<?php
function update_85() {
$ret = array();
if ($GLOBALS['db_type'] == 'mysql') {
$ret[] = update_sql("ALTER TABLE {bundle} RENAME TO {aggregator_category}");
$ret[] = update_sql("ALTER TABLE {aggregator_category} DROP attributes");
$ret[] = update_sql("ALTER TABLE {aggregator_category} CHANGE bid cid int(10) NOT NULL auto_increment");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ADD description longtext NOT NULL");
$ret[] = update_sql("UPDATE {sequences} SET name = '{aggregator_category}_cid' WHERE name = '{bundle}_bid'");
$ret[] = update_sql("ALTER TABLE {feed} RENAME TO {aggregator_feed}");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} DROP attributes");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} ADD block tinyint(2) NOT NULL");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ADD block tinyint(2) NOT NULL");
$ret[] = update_sql("UPDATE {sequences} SET name = '{aggregator_feed}_fid' WHERE name = '{feed}_fid'");
$ret[] = update_sql("ALTER TABLE {item} RENAME TO {aggregator_item}");
$ret[] = update_sql("ALTER TABLE {aggregator_item} DROP attributes");
$max = db_result(db_query_range("SELECT iid FROM {aggregator_item} ORDER BY iid DESC", 0, 1));
if ($max) {
$ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{aggregator_item}_iid', $max)");
}
$ret[] = update_sql("CREATE TABLE {aggregator_category_feed} (
fid int(10) NOT NULL,
cid int(10) NOT NULL,
PRIMARY KEY (fid, cid)
)");
$ret[] = update_sql("CREATE TABLE {aggregator_category_item} (
iid int(10) NOT NULL,
cid int(10) NOT NULL,
PRIMARY KEY (iid, cid)
)");
$ret[] = update_sql("ALTER TABLE {aggregator_category} MODIFY description longtext NULL");
$ret[] = update_sql("ALTER TABLE {aggregator_item} MODIFY description longtext NULL");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} MODIFY description longtext NULL");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} MODIFY image longtext NULL");
}
else {
$ret[] = update_sql("ALTER TABLE {bundle} RENAME TO {aggregator_category}");
$ret[] = update_sql("ALTER TABLE {aggregator_category} DROP attributes");
$ret[] = update_sql("ALTER TABLE {aggregator_category} RENAME bid TO cid");
$lastvalue = db_result(db_query('SELECT last_value from {bundle}_bid_seq'));
$ret[] = update_sql("CREATE SEQUENCE {aggregator_category}_cid_seq START $lastvalue MINVALUE 0");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ALTER cid SET DEFAULT nextval('public.{aggregator_category}_cid_seq'::text)");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ADD description text");
$ret[] = update_sql("UPDATE {aggregator_category} SET description = ''");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ALTER COLUMN description SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {feed} RENAME TO {aggregator_feed}");
$lastvalue = db_result(db_query('SELECT last_value from {feed}_fid_seq'));
$ret[] = update_sql("CREATE SEQUENCE {aggregator_feed}_fid_seq START $lastvalue MINVALUE 0");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} ALTER fid SET DEFAULT nextval('public.{aggregator_feed}_fid_seq'::text)");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} DROP attributes");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} ADD block smallint");
$ret[] = update_sql("UPDATE {aggregator_feed} SET block = 0");
$ret[] = update_sql("ALTER TABLE {aggregator_feed} ALTER COLUMN block SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ADD block smallint");
$ret[] = update_sql("UPDATE {aggregator_category} SET block = 0");
$ret[] = update_sql("ALTER TABLE {aggregator_category} ALTER COLUMN block SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {item} RENAME TO {aggregator_item}");
$lastvalue = db_result(db_query('SELECT last_value from {item}_iid_seq'));
$ret[] = update_sql("CREATE SEQUENCE {aggregator_item}_iid_seq START $lastvalue MINVALUE 0");
$ret[] = update_sql("ALTER TABLE {aggregator_item} ALTER iid SET DEFAULT nextval('public.{aggregator_item}_iid_seq'::text)");
$ret[] = update_sql("ALTER TABLE {aggregator_item} DROP attributes");
$ret[] = update_sql("CREATE TABLE {aggregator_category_feed} (
fid integer NOT NULL default '0',
cid integer NOT NULL default '0',
PRIMARY KEY (fid,cid)
);");
$ret[] = update_sql("CREATE TABLE {aggregator_category_item} (
iid integer NOT NULL default '0',
cid integer NOT NULL default '0',
PRIMARY KEY (iid,cid)
)");
}
return $ret;
}
?>Login or register to post comments 