diff options
Diffstat (limited to 'database')
-rw-r--r-- | database/database.mysql | 118 | ||||
-rw-r--r-- | database/updates.inc | 39 |
2 files changed, 107 insertions, 50 deletions
diff --git a/database/database.mysql b/database/database.mysql index d48390b76..d8073ad79 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -30,6 +30,75 @@ CREATE TABLE accesslog ( ) TYPE=MyISAM; -- +-- Table structure for table 'aggregator_category' +-- + +CREATE TABLE aggregator_category ( + cid int(10) NOT NULL auto_increment, + title varchar(255) NOT NULL default '', + description longtext NOT NULL, + block tinyint(2) NOT NULL default '0', + PRIMARY KEY (cid), + UNIQUE KEY title (title) +) TYPE=MyISAM; + +-- +-- Table structure for table 'aggregator_category_feed' +-- + +CREATE TABLE aggregator_category_feed ( + fid int(10) NOT NULL default '0', + cid int(10) NOT NULL default '0', + PRIMARY KEY (fid,cid) +) TYPE=MyISAM; + +-- +-- Table structure for table 'aggregator_category_item' +-- + +CREATE TABLE aggregator_category_item ( + iid int(10) NOT NULL default '0', + cid int(10) NOT NULL default '0', + PRIMARY KEY (iid,cid) +) TYPE=MyISAM; + +-- +-- Table structure for table 'aggregator_feed' +-- + +CREATE TABLE aggregator_feed ( + fid int(10) NOT NULL auto_increment, + title varchar(255) NOT NULL default '', + url varchar(255) NOT NULL default '', + refresh int(10) NOT NULL default '0', + checked int(10) NOT NULL default '0', + link varchar(255) NOT NULL default '', + description longtext NOT NULL, + image longtext NOT NULL, + etag varchar(255) NOT NULL default '', + modified int(10) NOT NULL default '0', + block tinyint(2) NOT NULL default '0', + PRIMARY KEY (fid), + UNIQUE KEY link (url), + UNIQUE KEY title (title) +) TYPE=MyISAM; + +-- +-- Table structure for table 'aggregator_item' +-- + +CREATE TABLE aggregator_item ( + iid int(10) NOT NULL auto_increment, + fid int(10) NOT NULL default '0', + title varchar(255) NOT NULL default '', + link varchar(255) NOT NULL default '', + author varchar(255) NOT NULL default '', + description longtext NOT NULL, + timestamp int(11) default NULL, + PRIMARY KEY (iid) +) TYPE=MyISAM; + +-- -- Table structure for table 'authmap' -- @@ -87,18 +156,6 @@ CREATE TABLE boxes ( ) TYPE=MyISAM; -- --- Table structure for table 'bundle' --- - -CREATE TABLE bundle ( - bid int(10) NOT NULL auto_increment, - title varchar(255) NOT NULL default '', - attributes varchar(255) NOT NULL default '', - PRIMARY KEY (bid), - UNIQUE KEY title (title) -) TYPE=MyISAM; - --- -- Table structure for table 'cache' -- @@ -147,27 +204,6 @@ CREATE TABLE directory ( ) TYPE=MyISAM; -- --- Table structure for table 'feed' --- - -CREATE TABLE feed ( - fid int(10) NOT NULL auto_increment, - title varchar(255) NOT NULL default '', - url varchar(255) NOT NULL default '', - refresh int(10) NOT NULL default '0', - checked int(10) NOT NULL default '0', - attributes varchar(255) NOT NULL default '', - link varchar(255) NOT NULL default '', - description longtext NOT NULL, - image longtext NOT NULL default '', - etag varchar(255) NOT NULL default '', - modified int(10) NOT NULL default '0', - PRIMARY KEY (fid), - UNIQUE KEY link (url), - UNIQUE KEY title (title) -) TYPE=MyISAM; - --- -- Table structure for table 'filters' -- @@ -201,22 +237,6 @@ CREATE TABLE history ( ) TYPE=MyISAM; -- --- Table structure for table 'item' --- - -CREATE TABLE item ( - iid int(10) NOT NULL auto_increment, - fid int(10) NOT NULL default '0', - title varchar(255) NOT NULL default '', - link varchar(255) NOT NULL default '', - author varchar(255) NOT NULL default '', - description longtext NOT NULL, - timestamp int(11) default NULL, - attributes varchar(255) NOT NULL default '', - PRIMARY KEY (iid) -) TYPE=MyISAM; - --- -- Table structure for table 'locales' -- diff --git a/database/updates.inc b/database/updates.inc index 837c881ee..e19ed3813 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -55,7 +55,8 @@ $sql_updates = array( "2004-02-20" => "update_81", "2004-02-27" => "update_82", "2004-04-15" => "update_83", - "2004-04-21" => "update_84" + "2004-04-21" => "update_84", + "2004-04-27" => "update_85" ); function update_32() { @@ -934,6 +935,42 @@ function update_84() { return $ret; } +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", 1, 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) + )"); + } + else { + /* Needs PostgreSQL equivalent */ + } + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); |