123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- --
- -- Elgg database schema
- --
- -- record membership in an access collection
- 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;
- -- define an access collection
- 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;
- -- store an annotation on an entity
- 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;
- -- api keys for old web services
- 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;
- -- site specific configuration
- 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;
- -- application specific configuration
- CREATE TABLE `prefix_datalists` (
- `name` varchar(255) NOT NULL,
- `value` text NOT NULL,
- PRIMARY KEY (`name`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- -- primary entity table
- 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;
- -- relationships between entities
- 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;
- -- entity type/subtype pairs
- 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;
- -- cache lookups of latitude and longitude for place names
- 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=utf8;
- -- secondary table for group entities
- 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;
- -- cache for hmac signatures for old web services
- 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=utf8;
- -- metadata that describes an entity
- 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;
- -- string normalization table for metadata and annotations
- 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;
- -- secondary table for object entities
- 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;
- -- settings for an entity
- 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;
- -- queue for asynchronous operations
- CREATE TABLE `prefix_queue` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL,
- `data` mediumblob NOT NULL,
- `timestamp` int(11) NOT NULL,
- `worker` varchar(32) NULL,
- PRIMARY KEY (`id`),
- KEY `name` (`name`),
- KEY `retrieve` (`timestamp`,`worker`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- -- activity stream
- 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,
- `target_guid` int(11) NOT NULL,
- `annotation_id` int(11) NOT NULL,
- `posted` int(11) NOT NULL,
- `enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
- 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 `target_guid` (`target_guid`),
- KEY `annotation_id` (`annotation_id`),
- KEY `posted` (`posted`)
- ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
- -- secondary table for site entities
- 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;
- -- log activity for the admin
- 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(46) 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;
- -- session table for old web services
- 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=utf8;
- -- secondary table for user entities
- 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 '' COMMENT 'Legacy password hashes',
- `salt` varchar(8) NOT NULL DEFAULT '' COMMENT 'Legacy password salts',
- -- 255 chars is recommended by PHP.net to hold future hash formats
- `password_hash` varchar(255) NOT NULL DEFAULT '',
- `email` text NOT NULL,
- `language` varchar(6) 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 `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;
- -- user remember me cookies
- CREATE TABLE `prefix_users_remember_me_cookies` (
- `code` varchar(32) NOT NULL,
- `guid` bigint(20) unsigned NOT NULL,
- `timestamp` int(11) unsigned NOT NULL,
- PRIMARY KEY (`code`),
- KEY `timestamp` (`timestamp`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- -- user sessions
- 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;
|