aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-03-21 18:25:41 -0700
committerfriendica <info@friendica.com>2013-03-21 18:25:41 -0700
commitddf5bf8968a12501939cd37898d303967b748600 (patch)
tree9ec457948c7fadae811b1af676257c43bab93d4c /install
parentb3c699d49a5ef2023fcbdaa8226be95fce9589a7 (diff)
downloadvolse-hubzilla-ddf5bf8968a12501939cd37898d303967b748600.tar.gz
volse-hubzilla-ddf5bf8968a12501939cd37898d303967b748600.tar.bz2
volse-hubzilla-ddf5bf8968a12501939cd37898d303967b748600.zip
rename 'uri' (and parent_uri) to 'mid' (and parent_mid) since these no longer remotely resemble uri's and are actually message_id's. This change is potentially destabilising because it touches a lot of code and structure. But it has to get done and there's no better time than the present.
Diffstat (limited to 'install')
-rw-r--r--install/database.sql20
-rw-r--r--install/update.php35
2 files changed, 43 insertions, 12 deletions
diff --git a/install/database.sql b/install/database.sql
index 138213fbd..7dbaff7ea 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -423,12 +423,12 @@ CREATE TABLE IF NOT EXISTS `issue` (
CREATE TABLE IF NOT EXISTS `item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `uri` char(255) CHARACTER SET ascii NOT NULL DEFAULT '',
+ `mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '',
`aid` int(10) unsigned NOT NULL DEFAULT '0',
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`wall` tinyint(1) NOT NULL DEFAULT '0',
`parent` int(10) unsigned NOT NULL DEFAULT '0',
- `parent_uri` char(255) CHARACTER SET ascii NOT NULL DEFAULT '',
+ `parent_mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '',
`thr_parent` char(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -466,7 +466,6 @@ CREATE TABLE IF NOT EXISTS `item` (
`item_flags` int(11) NOT NULL DEFAULT '0',
`item_private` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
- KEY `uri` (`uri`),
KEY `uid` (`uid`),
KEY `parent` (`parent`),
KEY `created` (`created`),
@@ -475,14 +474,12 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `wall` (`wall`),
KEY `uid_commented` (`uid`,`commented`),
KEY `uid_created` (`uid`,`created`),
- KEY `parent_uri` (`parent_uri`),
KEY `aid` (`aid`),
KEY `owner_xchan` (`owner_xchan`),
KEY `author_xchan` (`author_xchan`),
KEY `resource_type` (`resource_type`),
KEY `item_restrict` (`item_restrict`),
KEY `item_flags` (`item_flags`),
- KEY `uid_uri` (`uri`,`uid`),
KEY `commented` (`commented`),
KEY `verb` (`verb`),
KEY `item_private` (`item_private`),
@@ -490,6 +487,9 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `expires` (`expires`),
KEY `revision` (`revision`),
KEY `mimetype` (`mimetype`),
+ KEY `mid` (`mid`),
+ KEY `parent_mid` (`parent_mid`),
+ KEY `uid_mid` (`mid`,`uid`),
FULLTEXT KEY `title` (`title`),
FULLTEXT KEY `body` (`body`),
FULLTEXT KEY `allow_cid` (`allow_cid`),
@@ -520,18 +520,18 @@ CREATE TABLE IF NOT EXISTS `mail` (
`channel_id` int(10) unsigned NOT NULL,
`title` char(255) NOT NULL,
`body` mediumtext NOT NULL,
- `uri` char(255) NOT NULL,
- `parent_uri` char(255) NOT NULL,
+ `mid` char(255) NOT NULL,
+ `parent_mid` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
- KEY `uri` (`uri`),
KEY `created` (`created`),
KEY `mail_flags` (`mail_flags`),
KEY `account_id` (`account_id`),
KEY `channel_id` (`channel_id`),
- KEY `parent_uri` (`parent_uri`),
KEY `from_xchan` (`from_xchan`),
- KEY `to_xchan` (`to_xchan`)
+ KEY `to_xchan` (`to_xchan`),
+ KEY `mid` (`mid`),
+ KEY `parent_mid` (`parent_mid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `manage` (
diff --git a/install/update.php b/install/update.php
index 533fd63e5..493a5478b 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1037 );
+define( 'UPDATE_VERSION' , 1038 );
/**
*
@@ -464,5 +464,36 @@ KEY `k` ( `k` )
}
function update_r1036() {
- q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` ");
+ $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+
}
+
+
+function update_r1037() {
+ $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
+CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
+ DROP INDEX `uri` ,
+ADD INDEX `mid` ( `mid` ),
+DROP INDEX `parent_uri` ,
+ADD INDEX `parent_mid` ( `parent_mid` ),
+ DROP INDEX `uid_uri` ,
+ADD INDEX `uid_mid` ( `mid` , `uid` ) ");
+
+ $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
+CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
+DROP INDEX `uri` ,
+ADD INDEX `mid` ( `mid` ),
+ DROP INDEX `parent_uri` ,
+ADD INDEX `parent_mid` ( `parent_mid` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
+
+
+
+