diff options
Diffstat (limited to 'engine/schema')
25 files changed, 769 insertions, 0 deletions
diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql new file mode 100644 index 000000000..6c6e9db89 --- /dev/null +++ b/engine/schema/mysql.sql @@ -0,0 +1,454 @@ +-- MySQL dump 10.13 Distrib 5.1.37, for debian-linux-gnu (i486) +-- +-- Host: localhost Database: elgg +-- ------------------------------------------------------ +-- Server version 5.1.37-1ubuntu5 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `prefix_access_collection_membership` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_access_collection_membership` ( + `user_guid` int(11) NOT NULL, + `access_collection_id` int(11) NOT NULL, + PRIMARY KEY (`user_guid`,`access_collection_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_access_collections` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_access_collections` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text NOT NULL, + `owner_guid` bigint(20) unsigned NOT NULL, + `site_guid` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `owner_guid` (`owner_guid`), + KEY `site_guid` (`site_guid`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_annotations` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_annotations` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `entity_guid` bigint(20) unsigned NOT NULL, + `name_id` int(11) NOT NULL, + `value_id` int(11) NOT NULL, + `value_type` enum('integer','text') NOT NULL, + `owner_guid` bigint(20) unsigned NOT NULL, + `access_id` int(11) NOT NULL, + `time_created` int(11) NOT NULL, + `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', + PRIMARY KEY (`id`), + KEY `entity_guid` (`entity_guid`), + KEY `name_id` (`name_id`), + KEY `value_id` (`value_id`), + KEY `owner_guid` (`owner_guid`), + KEY `access_id` (`access_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_api_users` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_api_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `site_guid` bigint(20) unsigned DEFAULT NULL, + `api_key` varchar(40) DEFAULT NULL, + `secret` varchar(40) NOT NULL, + `active` int(1) DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `api_key` (`api_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_config` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_config` ( + `name` varchar(255) NOT NULL, + `value` text NOT NULL, + `site_guid` int(11) NOT NULL, + PRIMARY KEY (`name`,`site_guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_datalists` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_datalists` ( + `name` varchar(255) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_entities` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_entities` ( + `guid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `type` enum('object','user','group','site') NOT NULL, + `subtype` int(11) DEFAULT NULL, + `owner_guid` bigint(20) unsigned NOT NULL, + `site_guid` bigint(20) unsigned NOT NULL, + `container_guid` bigint(20) unsigned NOT NULL, + `access_id` int(11) NOT NULL, + `time_created` int(11) NOT NULL, + `time_updated` int(11) NOT NULL, + `last_action` int(11) NOT NULL DEFAULT '0', + `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', + PRIMARY KEY (`guid`), + KEY `type` (`type`), + KEY `subtype` (`subtype`), + KEY `owner_guid` (`owner_guid`), + KEY `site_guid` (`site_guid`), + KEY `container_guid` (`container_guid`), + KEY `access_id` (`access_id`), + KEY `time_created` (`time_created`), + KEY `time_updated` (`time_updated`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_entity_relationships` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_entity_relationships` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `guid_one` bigint(20) unsigned NOT NULL, + `relationship` varchar(50) NOT NULL, + `guid_two` bigint(20) unsigned NOT NULL, + `time_created` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `guid_one` (`guid_one`,`relationship`,`guid_two`), + KEY `relationship` (`relationship`), + KEY `guid_two` (`guid_two`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_entity_subtypes` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_entity_subtypes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` enum('object','user','group','site') NOT NULL, + `subtype` varchar(50) NOT NULL, + `class` varchar(50) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `type` (`type`,`subtype`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_geocode_cache` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_geocode_cache` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `location` varchar(128) DEFAULT NULL, + `lat` varchar(20) DEFAULT NULL, + `long` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `location` (`location`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_groups_entity` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_groups_entity` ( + `guid` bigint(20) unsigned NOT NULL, + `name` text NOT NULL, + `description` text NOT NULL, + PRIMARY KEY (`guid`), + KEY `name` (`name`(50)), + KEY `description` (`description`(50)), + FULLTEXT KEY `name_2` (`name`,`description`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_hmac_cache` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_hmac_cache` ( + `hmac` varchar(255) NOT NULL, + `ts` int(11) NOT NULL, + PRIMARY KEY (`hmac`), + KEY `ts` (`ts`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_metadata` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_metadata` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `entity_guid` bigint(20) unsigned NOT NULL, + `name_id` int(11) NOT NULL, + `value_id` int(11) NOT NULL, + `value_type` enum('integer','text') NOT NULL, + `owner_guid` bigint(20) unsigned NOT NULL, + `access_id` int(11) NOT NULL, + `time_created` int(11) NOT NULL, + `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', + PRIMARY KEY (`id`), + KEY `entity_guid` (`entity_guid`), + KEY `name_id` (`name_id`), + KEY `value_id` (`value_id`), + KEY `owner_guid` (`owner_guid`), + KEY `access_id` (`access_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_metastrings` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_metastrings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `string` text NOT NULL, + PRIMARY KEY (`id`), + KEY `string` (`string`(50)) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_objects_entity` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_objects_entity` ( + `guid` bigint(20) unsigned NOT NULL, + `title` text NOT NULL, + `description` text NOT NULL, + PRIMARY KEY (`guid`), + FULLTEXT KEY `title` (`title`,`description`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_private_settings` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_private_settings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `entity_guid` int(11) NOT NULL, + `name` varchar(128) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `entity_guid` (`entity_guid`,`name`), + KEY `name` (`name`), + KEY `value` (`value`(50)) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_river` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_river` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` varchar(8) NOT NULL, + `subtype` varchar(32) NOT NULL, + `action_type` varchar(32) NOT NULL, + `access_id` int(11) NOT NULL, + `view` text NOT NULL, + `subject_guid` int(11) NOT NULL, + `object_guid` int(11) NOT NULL, + `annotation_id` int(11) NOT NULL, + `posted` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `type` (`type`), + KEY `action_type` (`action_type`), + KEY `access_id` (`access_id`), + KEY `subject_guid` (`subject_guid`), + KEY `object_guid` (`object_guid`), + KEY `annotation_id` (`annotation_id`), + KEY `posted` (`posted`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_sites_entity` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_sites_entity` ( + `guid` bigint(20) unsigned NOT NULL, + `name` text NOT NULL, + `description` text NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`guid`), + UNIQUE KEY `url` (`url`), + FULLTEXT KEY `name` (`name`,`description`,`url`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_system_log` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_system_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `object_id` int(11) NOT NULL, + `object_class` varchar(50) NOT NULL, + `object_type` varchar(50) NOT NULL, + `object_subtype` varchar(50) NOT NULL, + `event` varchar(50) NOT NULL, + `performed_by_guid` int(11) NOT NULL, + `owner_guid` int(11) NOT NULL, + `access_id` int(11) NOT NULL, + `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', + `time_created` int(11) NOT NULL, + `ip_address` varchar(15) NOT NULL, + PRIMARY KEY (`id`), + KEY `object_id` (`object_id`), + KEY `object_class` (`object_class`), + KEY `object_type` (`object_type`), + KEY `object_subtype` (`object_subtype`), + KEY `event` (`event`), + KEY `performed_by_guid` (`performed_by_guid`), + KEY `access_id` (`access_id`), + KEY `time_created` (`time_created`), + KEY `river_key` (`object_type`,`object_subtype`,`event`) +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_users_apisessions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_users_apisessions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_guid` bigint(20) unsigned NOT NULL, + `site_guid` bigint(20) unsigned NOT NULL, + `token` varchar(40) DEFAULT NULL, + `expires` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_guid` (`user_guid`,`site_guid`), + KEY `token` (`token`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_users_entity` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_users_entity` ( + `guid` bigint(20) unsigned NOT NULL, + `name` text NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '', + `password` varchar(32) NOT NULL DEFAULT '', + `salt` varchar(8) NOT NULL DEFAULT '', + `email` text NOT NULL, + `language` varchar(6) NOT NULL DEFAULT '', + `code` varchar(32) NOT NULL DEFAULT '', + `banned` enum('yes','no') NOT NULL DEFAULT 'no', + `admin` enum('yes','no') NOT NULL DEFAULT 'no', + `last_action` int(11) NOT NULL DEFAULT '0', + `prev_last_action` int(11) NOT NULL DEFAULT '0', + `last_login` int(11) NOT NULL DEFAULT '0', + `prev_last_login` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`), + UNIQUE KEY `username` (`username`), + KEY `password` (`password`), + KEY `email` (`email`(50)), + KEY `code` (`code`), + KEY `last_action` (`last_action`), + KEY `last_login` (`last_login`), + KEY `admin` (`admin`), + FULLTEXT KEY `name` (`name`), + FULLTEXT KEY `name_2` (`name`,`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prefix_users_sessions` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prefix_users_sessions` ( + `session` varchar(255) NOT NULL, + `ts` int(11) unsigned NOT NULL DEFAULT '0', + `data` mediumblob, + PRIMARY KEY (`session`), + KEY `ts` (`ts`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2010-01-29 14:28:11 diff --git a/engine/schema/upgrades/2008092301.sql b/engine/schema/upgrades/2008092301.sql new file mode 100644 index 000000000..2ae52e0c9 --- /dev/null +++ b/engine/schema/upgrades/2008092301.sql @@ -0,0 +1,100 @@ +--- Ensure default character set is UTF8
+
+ALTER TABLE `prefix_config` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_entities` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_entity_subtypes` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_entity_relationships` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_access_collections` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_access_collection_membership` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_objects_entity` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_sites_entity` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_users_entity` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_groups_entity` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_annotations` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_metadata` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_metastrings` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_api_users` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_users_apisessions` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_datalists` DEFAULT CHARACTER SET utf8;
+ALTER TABLE `prefix_system_log` DEFAULT CHARACTER SET utf8;
+
+-- Drop keys to avoid errors (grr)
+
+ALTER TABLE `prefix_entities` DROP KEY `type`;
+ALTER TABLE `prefix_entities` DROP KEY `subtype`;
+ALTER TABLE `prefix_entities` DROP KEY `owner_guid`;
+ALTER TABLE `prefix_entities` DROP KEY `container_guid`;
+ALTER TABLE `prefix_entities` DROP KEY `access_id`;
+ALTER TABLE `prefix_entities` DROP KEY `time_created`;
+ALTER TABLE `prefix_entities` DROP KEY `time_updated`;
+
+ALTER TABLE `prefix_users_entity` DROP KEY `email`;
+ALTER TABLE `prefix_users_entity` DROP KEY `code`;
+
+ALTER TABLE `prefix_annotations` DROP KEY `entity_guid`;
+ALTER TABLE `prefix_annotations` DROP KEY `name_id`;
+ALTER TABLE `prefix_annotations` DROP KEY `value_id`;
+ALTER TABLE `prefix_annotations` DROP KEY `owner_guid`;
+ALTER TABLE `prefix_annotations` DROP KEY `access_id`;
+
+ALTER TABLE `prefix_metadata` DROP KEY `entity_guid`;
+ALTER TABLE `prefix_metadata` DROP KEY `name_id`;
+ALTER TABLE `prefix_metadata` DROP KEY `value_id`;
+ALTER TABLE `prefix_metadata` DROP KEY `owner_guid`;
+ALTER TABLE `prefix_metadata` DROP KEY `access_id`;
+
+ALTER TABLE `prefix_users_apisessions` DROP KEY `token`;
+
+ALTER TABLE `prefix_system_log` DROP KEY `object_id`;
+ALTER TABLE `prefix_system_log` DROP KEY `object_class`;
+ALTER TABLE `prefix_system_log` DROP KEY `event`;
+ALTER TABLE `prefix_system_log` DROP KEY `performed_by_guid`;
+ALTER TABLE `prefix_system_log` DROP KEY `time_created`;
+
+-- New keys
+
+ALTER TABLE `prefix_entities` ADD KEY `type` (`type`);
+ALTER TABLE `prefix_entities` ADD KEY `subtype` (`subtype`);
+ALTER TABLE `prefix_entities` ADD KEY `owner_guid` (`owner_guid`);
+ALTER TABLE `prefix_entities` ADD KEY `container_guid` (`container_guid`);
+ALTER TABLE `prefix_entities` ADD KEY `access_id` (`access_id`);
+ALTER TABLE `prefix_entities` ADD KEY `time_created` (`time_created`);
+ALTER TABLE `prefix_entities` ADD KEY `time_updated` (`time_updated`);
+
+ALTER TABLE `prefix_users_entity` ADD KEY `email` (`email`(50));
+ALTER TABLE `prefix_users_entity` ADD KEY `code` (`code`(50));
+
+ALTER TABLE `prefix_annotations` ADD KEY `entity_guid` (`entity_guid`);
+ALTER TABLE `prefix_annotations` ADD KEY `name_id` (`name_id`);
+ALTER TABLE `prefix_annotations` ADD KEY `value_id` (`value_id`);
+ALTER TABLE `prefix_annotations` ADD KEY `owner_guid` (`owner_guid`);
+ALTER TABLE `prefix_annotations` ADD KEY `access_id` (`access_id`);
+
+ALTER TABLE `prefix_metadata` ADD KEY `entity_guid` (`entity_guid`);
+ALTER TABLE `prefix_metadata` ADD KEY `name_id` (`name_id`);
+ALTER TABLE `prefix_metadata` ADD KEY `value_id` (`value_id`);
+ALTER TABLE `prefix_metadata` ADD KEY `owner_guid` (`owner_guid`);
+ALTER TABLE `prefix_metadata` ADD KEY `access_id` (`access_id`);
+
+ALTER TABLE `prefix_metastrings` DROP KEY `string`;
+ALTER TABLE `prefix_metastrings` ADD KEY `string` (`string`(50));
+
+ALTER TABLE `prefix_users_apisessions` ADD KEY `token` (`token`);
+
+ALTER TABLE `prefix_system_log` ADD KEY `object_id` (`object_id`);
+ALTER TABLE `prefix_system_log` ADD KEY `object_class` (`object_class`);
+ALTER TABLE `prefix_system_log` ADD KEY `event` (`event`);
+ALTER TABLE `prefix_system_log` ADD KEY `performed_by_guid` (`performed_by_guid`);
+ALTER TABLE `prefix_system_log` ADD KEY `time_created` (`time_created`);
+
+DROP TABLE `prefix_privileged_paths`;
+
+-- HMAC Cache protecting against Replay attacks
+
+CREATE TABLE IF NOT EXISTS `prefix_hmac_cache` (
+ `hmac` varchar(255) NOT NULL,
+ `ts` int(11) NOT NULL,
+
+ PRIMARY KEY (`hmac`),
+ KEY `ts` (`ts`)
+) ENGINE=MEMORY;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008100601.sql b/engine/schema/upgrades/2008100601.sql new file mode 100644 index 000000000..d02dd9f6c --- /dev/null +++ b/engine/schema/upgrades/2008100601.sql @@ -0,0 +1,14 @@ +ALTER TABLE `prefix_system_log` ADD COLUMN `object_type` varchar(50) NOT NULL AFTER `object_class`; +ALTER TABLE `prefix_system_log` ADD COLUMN `object_subtype` varchar(50) NOT NULL AFTER `object_type`; +ALTER TABLE `prefix_system_log` MODIFY `object_event` varchar(50) NOT NULL; +ALTER TABLE `prefix_system_log` MODIFY `object_class` varchar(50) NOT NULL; + + +ALTER TABLE `prefix_system_log` DROP KEY `object_type`; +ALTER TABLE `prefix_system_log` DROP KEY `object_subtype`; +ALTER TABLE `prefix_system_log` DROP KEY `river_key`; + +ALTER TABLE `prefix_system_log` ADD KEY `object_type` (`object_type`); +ALTER TABLE `prefix_system_log` ADD KEY `object_subtype` (`object_subtype`); + +ALTER TABLE `prefix_system_log` ADD KEY `river_key` (`object_type`, `object_subtype`, `event`);
\ No newline at end of file diff --git a/engine/schema/upgrades/2008101601.sql b/engine/schema/upgrades/2008101601.sql new file mode 100644 index 000000000..cd10eb024 --- /dev/null +++ b/engine/schema/upgrades/2008101601.sql @@ -0,0 +1,11 @@ +ALTER TABLE `prefix_system_log` ADD COLUMN `access_id` int(11) NOT NULL AFTER `performed_by_guid`; +ALTER TABLE `prefix_system_log` ADD COLUMN `enabled` enum ('yes', 'no') NOT NULL default 'yes' AFTER `access_id`; + +ALTER TABLE `prefix_system_log` DROP KEY `access_id`; +ALTER TABLE `prefix_system_log` ADD KEY `access_id` (`access_id`); + +ALTER TABLE `prefix_system_log` DROP KEY `enabled`; +ALTER TABLE `prefix_system_log` ADD KEY `enabled` (`enabled`); + +ALTER TABLE `prefix_system_log` DROP KEY `river_key`; +ALTER TABLE `prefix_system_log` ADD KEY `river_key` (`object_type`, `object_subtype`, `event`, `access_id`, `enabled`);
\ No newline at end of file diff --git a/engine/schema/upgrades/2008101701.sql b/engine/schema/upgrades/2008101701.sql new file mode 100644 index 000000000..3e6fc9653 --- /dev/null +++ b/engine/schema/upgrades/2008101701.sql @@ -0,0 +1,7 @@ +ALTER TABLE `prefix_system_log` ADD COLUMN `owner_guid` int(11) NOT NULL AFTER `performed_by_guid`; + +ALTER TABLE `prefix_system_log` DROP KEY `owner_guid`; +ALTER TABLE `prefix_system_log` ADD KEY `owner_guid` (`owner_guid`); + +ALTER TABLE `prefix_system_log` DROP KEY `river_key`; +ALTER TABLE `prefix_system_log` ADD KEY `river_key` (`object_type`, `object_subtype`, `event`, `access_id`); diff --git a/engine/schema/upgrades/2008102101.sql b/engine/schema/upgrades/2008102101.sql new file mode 100644 index 000000000..544f28d2f --- /dev/null +++ b/engine/schema/upgrades/2008102101.sql @@ -0,0 +1,9 @@ + +CREATE TABLE IF NOT EXISTS `prefix_users_sessions` ( + `session` varchar(255) NOT NULL, + `ts` int(11) unsigned NOT NULL default '0', + `data` mediumblob, + + PRIMARY KEY `session` (`session`), + KEY `ts` (`ts`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008110301.sql b/engine/schema/upgrades/2008110301.sql new file mode 100644 index 000000000..8fd0539d2 --- /dev/null +++ b/engine/schema/upgrades/2008110301.sql @@ -0,0 +1,17 @@ + +-- Based on slow query table feedback +ALTER TABLE `prefix_entity_relationships` DROP KEY `relationship`; +ALTER TABLE `prefix_entity_relationships` ADD KEY `relationship` (`relationship`); + +ALTER TABLE `prefix_entity_relationships` DROP KEY `guid_two`; +ALTER TABLE `prefix_entity_relationships` ADD KEY `guid_two` (`guid_two`); + +-- The following seemed to have been missed off upgrade +ALTER TABLE `prefix_users_entity` DROP KEY `code`; +ALTER TABLE `prefix_users_entity` ADD KEY `code` (`code`); + +-- Access collections missing keys +ALTER TABLE `prefix_access_collections` DROP KEY `site_guid`; +ALTER TABLE `prefix_access_collections` ADD KEY `site_guid` (`site_guid`); +ALTER TABLE `prefix_access_collections` DROP KEY `owner_guid`; +ALTER TABLE `prefix_access_collections` ADD KEY `owner_guid` (`owner_guid`); diff --git a/engine/schema/upgrades/2008110601.sql b/engine/schema/upgrades/2008110601.sql new file mode 100644 index 000000000..ddd80a91b --- /dev/null +++ b/engine/schema/upgrades/2008110601.sql @@ -0,0 +1,3 @@ +-- Alter datalists to have a primary key +ALTER TABLE `prefix_datalists` DROP KEY `name`; +ALTER TABLE `prefix_datalists` ADD PRIMARY KEY `name` (`name`); diff --git a/engine/schema/upgrades/2008111901.sql b/engine/schema/upgrades/2008111901.sql new file mode 100644 index 000000000..617678bb6 --- /dev/null +++ b/engine/schema/upgrades/2008111901.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS `prefix_private_settings` (
+ `id` INT NOT NULL auto_increment,
+ `entity_guid` INT NOT NULL ,
+ `name` VARCHAR( 128 ) NOT NULL ,
+ `value` TEXT NOT NULL ,
+ PRIMARY KEY ( `id` ) ,
+ UNIQUE KEY ( `entity_guid` , `name` )
+) ENGINE = MYISAM DEFAULT CHARSET=utf8;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008112001.sql b/engine/schema/upgrades/2008112001.sql new file mode 100644 index 000000000..9159e6c6f --- /dev/null +++ b/engine/schema/upgrades/2008112001.sql @@ -0,0 +1,24 @@ +-- Move plugin settings to private store +INSERT INTO `prefix_private_settings` (entity_guid, name, `value`) + SELECT e.guid as guid, name_string.string as name, value_string.string as `value` FROM `prefix_entities` e + JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid + JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id + JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id + WHERE + e.type='object' AND + e.subtype in (SELECT id from `prefix_entity_subtypes` WHERE subtype='plugin' and type='object'); + +-- Delete previous settings +CREATE TEMPORARY TABLE __upgrade_2008112001_1 ( + SELECT distinct meta.id as id from `prefix_metadata` meta + JOIN `prefix_private_settings` settings ON meta.entity_guid = settings.entity_guid + JOIN `prefix_entities` e ON e.guid = meta.entity_guid + JOIN `prefix_entity_subtypes` subtypes ON subtypes.id = e.subtype + WHERE + e.type='object' AND + subtypes.subtype = 'plugin' +); + +DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112001_1); + +DROP TABLE __upgrade_2008112001_1;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008112002.sql b/engine/schema/upgrades/2008112002.sql new file mode 100644 index 000000000..cdd308fe0 --- /dev/null +++ b/engine/schema/upgrades/2008112002.sql @@ -0,0 +1,29 @@ +-- Move user plugins settings to new data store +INSERT INTO `prefix_private_settings` (entity_guid, name, `value`) + SELECT e.guid as guid, name_string.string as name, value_string.string as value FROM `prefix_entities` e + JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid + JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id + JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id + WHERE + e.type='user' AND + name_string.string like 'plugin:settings:%'; + +-- Delete previous settings +CREATE TEMPORARY TABLE __upgrade_2008112002_1 ( + SELECT distinct meta.id as id from `prefix_metadata` meta + JOIN `prefix_private_settings` settings ON meta.entity_guid = settings.entity_guid + + JOIN `prefix_entities` e ON e.guid = meta.entity_guid + JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid + + JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id + JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id + WHERE + e.type='user' AND + name_string.string like 'plugin:settings:%' AND + meta.name_id = name_string.id +); + +DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112002_1); + +DROP TABLE __upgrade_2008112002_1;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008112501.sql b/engine/schema/upgrades/2008112501.sql new file mode 100644 index 000000000..41e41f93e --- /dev/null +++ b/engine/schema/upgrades/2008112501.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS `prefix_geocode_cache` ( + id int(11) auto_increment, + location varchar(128), + `lat` varchar(20), + `long` varchar(20), + + PRIMARY KEY (`id`), + KEY `location` (`location`) + +) ENGINE=MEMORY;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008112601.sql b/engine/schema/upgrades/2008112601.sql new file mode 100644 index 000000000..9ca9657de --- /dev/null +++ b/engine/schema/upgrades/2008112601.sql @@ -0,0 +1,27 @@ +-- We now are using a extended class to handle this +UPDATE `prefix_entity_subtypes` SET class='ElggPlugin' where type='object' and subtype='widget'; + +-- Move widget settings to private store +INSERT INTO `prefix_private_settings` (entity_guid, name, `value`) + SELECT e.guid as guid, name_string.string as name, value_string.string as `value` FROM `prefix_entities` e + JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid + JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id + JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id + WHERE + e.type='object' AND + e.subtype in (SELECT id from `prefix_entity_subtypes` WHERE subtype='widget' and type='object'); + +-- Delete previous settings +CREATE TEMPORARY TABLE __upgrade_2008112601 ( + SELECT distinct meta.id as id from `prefix_metadata` meta + JOIN `prefix_private_settings` settings ON meta.entity_guid = settings.entity_guid + JOIN `prefix_entities` e ON e.guid = meta.entity_guid + JOIN `prefix_entity_subtypes` subtypes ON subtypes.id = e.subtype + WHERE + e.type='object' AND + subtypes.subtype = 'widget' +); + +DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112601); + +DROP TABLE __upgrade_2008112001;
\ No newline at end of file diff --git a/engine/schema/upgrades/2008120501.sql b/engine/schema/upgrades/2008120501.sql new file mode 100644 index 000000000..dd44b96b0 --- /dev/null +++ b/engine/schema/upgrades/2008120501.sql @@ -0,0 +1,9 @@ +-- Modify field length in private settings (for people who upgraded while #611 present) +ALTER TABLE `prefix_private_settings` MODIFY `name` varchar(128) NOT NULL; + +-- While we're at it, add some more keys +ALTER TABLE `prefix_private_settings` DROP KEY `name`; +ALTER TABLE `prefix_private_settings` ADD KEY `name` (`name`); + +ALTER TABLE `prefix_private_settings` DROP KEY `value`; +ALTER TABLE `prefix_private_settings` ADD KEY `value` (`value` (50));
\ No newline at end of file diff --git a/engine/schema/upgrades/2009010801.sql b/engine/schema/upgrades/2009010801.sql new file mode 100644 index 000000000..1e7c020e8 --- /dev/null +++ b/engine/schema/upgrades/2009010801.sql @@ -0,0 +1,5 @@ +ALTER TABLE `prefix_users_entity` DROP KEY `last_action`; +ALTER TABLE `prefix_users_entity` ADD KEY `last_action` (`last_action`); + +ALTER TABLE `prefix_users_entity` DROP KEY `last_login`; +ALTER TABLE `prefix_users_entity` ADD KEY `last_login` (`last_login`);
\ No newline at end of file diff --git a/engine/schema/upgrades/2009010901.sql b/engine/schema/upgrades/2009010901.sql new file mode 100644 index 000000000..29eb68f29 --- /dev/null +++ b/engine/schema/upgrades/2009010901.sql @@ -0,0 +1,3 @@ +-- Add banned column refs #668 +ALTER TABLE `prefix_users_entity` ADD COLUMN `banned` enum ('yes', 'no') NOT NULL default 'no' AFTER `code`; + diff --git a/engine/schema/upgrades/2009021201.sql b/engine/schema/upgrades/2009021201.sql new file mode 100644 index 000000000..e3edf66ba --- /dev/null +++ b/engine/schema/upgrades/2009021201.sql @@ -0,0 +1,19 @@ +-- River
+ CREATE TABLE IF NOT EXISTS `prefix_river` (
+ `id` INT NOT NULL AUTO_INCREMENT ,
+ `type` VARCHAR( 8 ) NOT NULL ,
+ `subtype` VARCHAR( 32 ) NOT NULL ,
+ `action_type` VARCHAR( 32 ) NOT NULL ,
+ `access_id` INT NOT NULL ,
+ `view` TEXT NOT NULL ,
+ `subject_guid` INT NOT NULL ,
+ `object_guid` INT NOT NULL ,
+ `posted` INT NOT NULL ,
+ PRIMARY KEY ( `id` ) ,
+ KEY `type` (`type`),
+ KEY `action_type` (`action_type`),
+ KEY `access_id` (`access_id`),
+ KEY `subject_guid` (`subject_guid`),
+ KEY `object_guid` (`object_guid`),
+ KEY `posted` (`posted`)
+) ENGINE = MYISAM DEFAULT CHARSET=utf8;
\ No newline at end of file diff --git a/engine/schema/upgrades/2009021301.sql b/engine/schema/upgrades/2009021301.sql new file mode 100644 index 000000000..efec52b93 --- /dev/null +++ b/engine/schema/upgrades/2009021301.sql @@ -0,0 +1,2 @@ +-- Changing the ACLs on existing groups
+UPDATE `prefix_entities` SET access_id=2 WHERE type='group';
\ No newline at end of file diff --git a/engine/schema/upgrades/2009051401.sql b/engine/schema/upgrades/2009051401.sql new file mode 100644 index 000000000..57348968e --- /dev/null +++ b/engine/schema/upgrades/2009051401.sql @@ -0,0 +1,5 @@ +-- Fix error in geocode cache table +DELETE FROM `prefix_geocode_cache`; + +ALTER TABLE `prefix_geocode_cache` DROP KEY `location`; +ALTER TABLE `prefix_geocode_cache` ADD UNIQUE KEY `location` (`location`); diff --git a/engine/schema/upgrades/2009052201.sql b/engine/schema/upgrades/2009052201.sql new file mode 100644 index 000000000..b825f9936 --- /dev/null +++ b/engine/schema/upgrades/2009052201.sql @@ -0,0 +1,5 @@ +ALTER TABLE `prefix_groups_entity` DROP KEY `name`; +ALTER TABLE `prefix_groups_entity` ADD KEY `name` (`name`(50)); + +ALTER TABLE `prefix_groups_entity` DROP KEY `description`; +ALTER TABLE `prefix_groups_entity` ADD KEY `description` (`description`(50)); diff --git a/engine/schema/upgrades/2009091901.sql b/engine/schema/upgrades/2009091901.sql new file mode 100644 index 000000000..074d042c3 --- /dev/null +++ b/engine/schema/upgrades/2009091901.sql @@ -0,0 +1,3 @@ +-- add an additional column to the river table
+ALTER TABLE `prefix_river` ADD COLUMN `annotation_id` int(11) NOT NULL AFTER `object_guid`;
+ALTER TABLE `prefix_river` ADD KEY `annotation_id` (`annotation_id`);
\ No newline at end of file diff --git a/engine/schema/upgrades/2009100701.sql b/engine/schema/upgrades/2009100701.sql new file mode 100644 index 000000000..74249e901 --- /dev/null +++ b/engine/schema/upgrades/2009100701.sql @@ -0,0 +1,2 @@ +-- Previously was the UTF8 migration that is now in code at engine/lib/upgrades/2010033101.php +-- Keeping this file to force an overwrite and to avoid confusion with missing migrations. diff --git a/engine/schema/upgrades/2010012901.sql b/engine/schema/upgrades/2010012901.sql new file mode 100644 index 000000000..fe5cb6849 --- /dev/null +++ b/engine/schema/upgrades/2010012901.sql @@ -0,0 +1 @@ +ALTER TABLE `prefix_entities` ADD `last_action` INT( 11 ) NOT NULL AFTER `time_updated` diff --git a/engine/schema/upgrades/2010030101.sql b/engine/schema/upgrades/2010030101.sql new file mode 100644 index 000000000..cc7af98c9 --- /dev/null +++ b/engine/schema/upgrades/2010030101.sql @@ -0,0 +1 @@ +ALTER TABLE `prefix_entities` CHANGE `last_action` `last_action` INT( 11 ) NOT NULL DEFAULT '0' diff --git a/engine/schema/upgrades/2010062401.sql b/engine/schema/upgrades/2010062401.sql new file mode 100644 index 000000000..fbb49bfcf --- /dev/null +++ b/engine/schema/upgrades/2010062401.sql @@ -0,0 +1 @@ +ALTER TABLE `prefix_entity_relationships` ADD COLUMN `time_created` int(11) NOT NULL AFTER `guid_two`;
\ No newline at end of file |