diff options
author | Olivier van Helden <olivier@van-helden.net> | 2014-12-03 17:54:07 -0400 |
---|---|---|
committer | Olivier van Helden <olivier@van-helden.net> | 2014-12-03 17:54:07 -0400 |
commit | e523061b7261439a71bdacf8f46d4c614740b356 (patch) | |
tree | 1a0577c64197c4289ed154d2c2d5fdf48a7e5192 /install | |
parent | 13fd91d6f5723774a1b96257f8096acb2873b4ed (diff) | |
parent | b71b45aafc618d32d23c099a4d4db8bad2f09e54 (diff) | |
download | volse-hubzilla-e523061b7261439a71bdacf8f46d4c614740b356.tar.gz volse-hubzilla-e523061b7261439a71bdacf8f46d4c614740b356.tar.bz2 volse-hubzilla-e523061b7261439a71bdacf8f46d4c614740b356.zip |
Merge pull request #1 from friendica/master
Merge master from friendica
Diffstat (limited to 'install')
-rw-r--r-- | install/database-w-defaults-v1131.diff | 1914 | ||||
-rw-r--r-- | install/migrate-mypg.php | 357 | ||||
-rw-r--r-- | install/migrate_mypg_fixseq.sql | 55 | ||||
-rw-r--r-- | install/schema_mysql.sql (renamed from install/database.sql) | 743 | ||||
-rw-r--r-- | install/schema_postgres.sql | 1190 |
5 files changed, 4069 insertions, 190 deletions
diff --git a/install/database-w-defaults-v1131.diff b/install/database-w-defaults-v1131.diff new file mode 100644 index 000000000..c8870f9c4 --- /dev/null +++ b/install/database-w-defaults-v1131.diff @@ -0,0 +1,1914 @@ +*** database.sql Mon Sep 8 20:28:00 2014 +--- database-w-defaults.sql Sun Nov 9 19:20:32 2014 +*************** +*** 1,15 **** +! SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +! +! /*!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 */; + + + CREATE TABLE IF NOT EXISTS `abook` ( + `abook_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `abook_account` int(10) unsigned NOT NULL, +! `abook_channel` int(10) unsigned NOT NULL, + `abook_xchan` char(255) NOT NULL DEFAULT '', + `abook_my_perms` int(11) NOT NULL DEFAULT '0', + `abook_their_perms` int(11) NOT NULL DEFAULT '0', +--- 1,13 ---- +! -- -------------------------------------------------------- + ++ -- ++ -- Table structure for table `abook` ++ -- + + CREATE TABLE IF NOT EXISTS `abook` ( + `abook_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `abook_account` int(10) unsigned NOT NULL DEFAULT '0', +! `abook_channel` int(10) unsigned NOT NULL DEFAULT '0', + `abook_xchan` char(255) NOT NULL DEFAULT '', + `abook_my_perms` int(11) NOT NULL DEFAULT '0', + `abook_their_perms` int(11) NOT NULL DEFAULT '0', +*************** +*** 37,42 **** +--- 35,46 ---- + KEY `abook_rating` (`abook_rating`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `account` ++ -- ++ + CREATE TABLE IF NOT EXISTS `account` ( + `account_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `account_parent` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 70,79 **** + KEY `account_password_changed` (`account_password_changed`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `addon` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `name` char(255) NOT NULL, +! `version` char(255) NOT NULL, + `installed` tinyint(1) NOT NULL DEFAULT '0', + `hidden` tinyint(1) NOT NULL DEFAULT '0', + `timestamp` bigint(20) NOT NULL DEFAULT '0', +--- 74,89 ---- + KEY `account_password_changed` (`account_password_changed`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `addon` ++ -- ++ + CREATE TABLE IF NOT EXISTS `addon` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `name` char(255) NOT NULL DEFAULT '', +! `version` char(255) NOT NULL DEFAULT '', + `installed` tinyint(1) NOT NULL DEFAULT '0', + `hidden` tinyint(1) NOT NULL DEFAULT '0', + `timestamp` bigint(20) NOT NULL DEFAULT '0', +*************** +*** 84,89 **** +--- 94,104 ---- + KEY `installed` (`installed`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `app` ++ -- + + CREATE TABLE IF NOT EXISTS `app` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +*************** +*** 108,115 **** + KEY `app_version` (`app_version`), + KEY `app_channel` (`app_channel`), + KEY `app_price` (`app_price`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + + CREATE TABLE IF NOT EXISTS `attach` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +--- 123,135 ---- + KEY `app_version` (`app_version`), + KEY `app_channel` (`app_channel`), + KEY `app_price` (`app_price`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- + ++ -- ++ -- Table structure for table `attach` ++ -- + + CREATE TABLE IF NOT EXISTS `attach` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +*************** +*** 145,166 **** + KEY `creator` (`creator`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `auth_codes` ( +! `id` varchar(40) NOT NULL, +! `client_id` varchar(20) NOT NULL, +! `redirect_uri` varchar(200) NOT NULL, +! `expires` int(11) NOT NULL, +! `scope` varchar(250) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `cache` ( +! `k` char(255) NOT NULL, + `v` text NOT NULL, +! `updated` datetime NOT NULL, + PRIMARY KEY (`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `channel` ( + `channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `channel_account_id` int(10) unsigned NOT NULL DEFAULT '0', +--- 165,204 ---- + KEY `creator` (`creator`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `auth_codes` ++ -- ++ + CREATE TABLE IF NOT EXISTS `auth_codes` ( +! `id` varchar(40) NOT NULL DEFAULT '', +! `client_id` varchar(20) NOT NULL DEFAULT '', +! `redirect_uri` varchar(200) NOT NULL DEFAULT '', +! `expires` int(11) NOT NULL DEFAULT '0', +! `scope` varchar(250) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `cache` ++ -- ++ + CREATE TABLE IF NOT EXISTS `cache` ( +! `k` char(255) NOT NULL DEFAULT '', + `v` text NOT NULL, +! `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `channel` ++ -- ++ + CREATE TABLE IF NOT EXISTS `channel` ( + `channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `channel_account_id` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 189,212 **** + `channel_allow_gid` mediumtext NOT NULL, + `channel_deny_cid` mediumtext NOT NULL, + `channel_deny_gid` mediumtext NOT NULL, +! `channel_r_stream` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_r_profile` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_r_photos` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_r_abook` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_stream` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_wall` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_tagwall` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_comment` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_mail` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_photos` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_chat` int(10) unsigned NOT NULL DEFAULT '128', + `channel_a_delegate` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_storage` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_storage` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '128', +! `channel_w_like` int(10) unsigned NOT NULL DEFAULT '128', + PRIMARY KEY (`channel_id`), + UNIQUE KEY `channel_address_unique` (`channel_address`), + KEY `channel_account_id` (`channel_account_id`), +--- 227,250 ---- + `channel_allow_gid` mediumtext NOT NULL, + `channel_deny_cid` mediumtext NOT NULL, + `channel_deny_gid` mediumtext NOT NULL, +! `channel_r_stream` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_profile` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_photos` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_abook` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_stream` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_wall` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_tagwall` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_comment` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_mail` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_photos` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_chat` int(10) unsigned NOT NULL DEFAULT '0', + `channel_a_delegate` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_storage` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_storage` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_r_pages` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_w_like` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`channel_id`), + UNIQUE KEY `channel_address_unique` (`channel_address`), + KEY `channel_account_id` (`channel_account_id`), +*************** +*** 241,250 **** + KEY `channel_w_pages` (`channel_w_pages`), + KEY `channel_deleted` (`channel_deleted`), + KEY `channel_a_republish` (`channel_a_republish`), +! KEY `channel_w_like` (`channel_w_like`), +! KEY `channel_dirdate` (`channel_dirdate`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `chat` ( + `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `chat_room` int(10) unsigned NOT NULL DEFAULT '0', +--- 279,294 ---- + KEY `channel_w_pages` (`channel_w_pages`), + KEY `channel_deleted` (`channel_deleted`), + KEY `channel_a_republish` (`channel_a_republish`), +! KEY `channel_dirdate` (`channel_dirdate`), +! KEY `channel_w_like` (`channel_w_like`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `chat` ++ -- ++ + CREATE TABLE IF NOT EXISTS `chat` ( + `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `chat_room` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 255,275 **** + KEY `chat_room` (`chat_room`), + KEY `chat_xchan` (`chat_xchan`), + KEY `created` (`created`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `chatpresence` ( + `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `cp_room` int(10) unsigned NOT NULL DEFAULT '0', + `cp_xchan` char(255) NOT NULL DEFAULT '', + `cp_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `cp_status` char(255) NOT NULL, + `cp_client` char(128) NOT NULL DEFAULT '', + PRIMARY KEY (`cp_id`), + KEY `cp_room` (`cp_room`), + KEY `cp_xchan` (`cp_xchan`), + KEY `cp_last` (`cp_last`), + KEY `cp_status` (`cp_status`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `chatroom` ( + `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +--- 299,331 ---- + KEY `chat_room` (`chat_room`), + KEY `chat_xchan` (`chat_xchan`), + KEY `created` (`created`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `chatpresence` +! -- + + CREATE TABLE IF NOT EXISTS `chatpresence` ( + `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `cp_room` int(10) unsigned NOT NULL DEFAULT '0', + `cp_xchan` char(255) NOT NULL DEFAULT '', + `cp_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `cp_status` char(255) NOT NULL DEFAULT '', + `cp_client` char(128) NOT NULL DEFAULT '', + PRIMARY KEY (`cp_id`), + KEY `cp_room` (`cp_room`), + KEY `cp_xchan` (`cp_xchan`), + KEY `cp_last` (`cp_last`), + KEY `cp_status` (`cp_status`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `chatroom` +! -- + + CREATE TABLE IF NOT EXISTS `chatroom` ( + `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +*************** +*** 290,322 **** + KEY `cr_created` (`cr_created`), + KEY `cr_edited` (`cr_edited`), + KEY `cr_expire` (`cr_expire`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `clients` ( +! `client_id` varchar(20) NOT NULL, +! `pw` varchar(20) NOT NULL, +! `redirect_uri` varchar(200) NOT NULL, + `name` text, + `icon` text, + `uid` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`client_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `cat` char(255) CHARACTER SET ascii NOT NULL, +! `k` char(255) CHARACTER SET ascii NOT NULL, + `v` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `access` (`cat`,`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `conv` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `guid` char(255) NOT NULL, + `recips` mediumtext NOT NULL, +! `uid` int(11) NOT NULL, +! `creator` char(255) NOT NULL, + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `subject` mediumtext NOT NULL, +--- 346,396 ---- + KEY `cr_created` (`cr_created`), + KEY `cr_edited` (`cr_edited`), + KEY `cr_expire` (`cr_expire`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `clients` +! -- + + CREATE TABLE IF NOT EXISTS `clients` ( +! `client_id` varchar(20) NOT NULL DEFAULT '', +! `pw` varchar(20) NOT NULL DEFAULT '', +! `redirect_uri` varchar(200) NOT NULL DEFAULT '', + `name` text, + `icon` text, + `uid` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`client_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `config` ++ -- ++ + CREATE TABLE IF NOT EXISTS `config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `cat` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', +! `k` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', + `v` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `access` (`cat`,`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `conv` ++ -- ++ + CREATE TABLE IF NOT EXISTS `conv` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `guid` char(255) NOT NULL DEFAULT '', + `recips` mediumtext NOT NULL, +! `uid` int(11) NOT NULL DEFAULT '0', +! `creator` char(255) NOT NULL DEFAULT '', + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `subject` mediumtext NOT NULL, +*************** +*** 325,344 **** + KEY `updated` (`updated`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `event` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL, + `event_xchan` char(255) NOT NULL DEFAULT '', + `event_hash` char(255) NOT NULL DEFAULT '', +! `created` datetime NOT NULL, +! `edited` datetime NOT NULL, +! `start` datetime NOT NULL, +! `finish` datetime NOT NULL, + `summary` text NOT NULL, + `description` text NOT NULL, + `location` text NOT NULL, +! `type` char(255) NOT NULL, + `nofinish` tinyint(1) NOT NULL DEFAULT '0', + `adjust` tinyint(1) NOT NULL DEFAULT '1', + `ignore` tinyint(1) NOT NULL DEFAULT '0', +--- 399,424 ---- + KEY `updated` (`updated`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `event` ++ -- ++ + CREATE TABLE IF NOT EXISTS `event` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL DEFAULT '0', + `event_xchan` char(255) NOT NULL DEFAULT '', + `event_hash` 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', +! `start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `summary` text NOT NULL, + `description` text NOT NULL, + `location` text NOT NULL, +! `type` char(255) NOT NULL DEFAULT '', + `nofinish` tinyint(1) NOT NULL DEFAULT '0', + `adjust` tinyint(1) NOT NULL DEFAULT '1', + `ignore` tinyint(1) NOT NULL DEFAULT '0', +*************** +*** 357,363 **** + KEY `aid` (`aid`), + KEY `event_hash` (`event_hash`), + KEY `event_xchan` (`event_xchan`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `fcontact` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +--- 437,449 ---- + KEY `aid` (`aid`), + KEY `event_hash` (`event_hash`), + KEY `event_xchan` (`event_xchan`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `fcontact` +! -- + + CREATE TABLE IF NOT EXISTS `fcontact` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +*************** +*** 381,386 **** +--- 467,478 ---- + KEY `network` (`network`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `ffinder` ++ -- ++ + CREATE TABLE IF NOT EXISTS `ffinder` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uid` int(10) unsigned NOT NULL, +*************** +*** 392,427 **** + KEY `fid` (`fid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `fserver` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `server` char(255) NOT NULL, +! `posturl` char(255) NOT NULL, + `key` text NOT NULL, + PRIMARY KEY (`id`), + KEY `server` (`server`), + KEY `posturl` (`posturl`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `fsuggest` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL, +! `cid` int(11) NOT NULL, +! `name` char(255) NOT NULL, +! `url` char(255) NOT NULL, +! `request` char(255) NOT NULL, +! `photo` char(255) NOT NULL, + `note` text NOT NULL, +! `created` datetime NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash` char(255) NOT NULL DEFAULT '', +! `uid` int(10) unsigned NOT NULL, + `visible` tinyint(1) NOT NULL DEFAULT '0', + `deleted` tinyint(1) NOT NULL DEFAULT '0', +! `name` char(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `visible` (`visible`), +--- 484,537 ---- + KEY `fid` (`fid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `fserver` ++ -- ++ + CREATE TABLE IF NOT EXISTS `fserver` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `server` char(255) NOT NULL DEFAULT '', +! `posturl` char(255) NOT NULL DEFAULT '', + `key` text NOT NULL, + PRIMARY KEY (`id`), + KEY `server` (`server`), + KEY `posturl` (`posturl`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `fsuggest` ++ -- ++ + CREATE TABLE IF NOT EXISTS `fsuggest` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL DEFAULT '0', +! `cid` int(11) NOT NULL DEFAULT '0', +! `name` char(255) NOT NULL DEFAULT '', +! `url` char(255) NOT NULL DEFAULT '', +! `request` char(255) NOT NULL DEFAULT '', +! `photo` char(255) NOT NULL DEFAULT '', + `note` text NOT NULL, +! `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `groups` ++ -- ++ + CREATE TABLE IF NOT EXISTS `groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash` char(255) NOT NULL DEFAULT '', +! `uid` int(10) unsigned NOT NULL DEFAULT '0', + `visible` tinyint(1) NOT NULL DEFAULT '0', + `deleted` tinyint(1) NOT NULL DEFAULT '0', +! `name` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `visible` (`visible`), +*************** +*** 429,438 **** + KEY `hash` (`hash`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `group_member` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `uid` int(10) unsigned NOT NULL, +! `gid` int(10) unsigned NOT NULL, + `xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), +--- 539,554 ---- + KEY `hash` (`hash`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `group_member` ++ -- ++ + CREATE TABLE IF NOT EXISTS `group_member` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `uid` int(10) unsigned NOT NULL DEFAULT '0', +! `gid` int(10) unsigned NOT NULL DEFAULT '0', + `xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), +*************** +*** 440,460 **** + KEY `xchan` (`xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `hook` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `hook` char(255) NOT NULL, +! `file` char(255) NOT NULL, +! `function` char(255) NOT NULL, + `priority` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `hook` (`hook`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `hubloc` ( + `hubloc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hubloc_guid` char(255) NOT NULL DEFAULT '', + `hubloc_guid_sig` text NOT NULL, +! `hubloc_hash` char(255) NOT NULL, + `hubloc_addr` char(255) NOT NULL DEFAULT '', + `hubloc_network` char(32) NOT NULL DEFAULT '', + `hubloc_flags` int(10) unsigned NOT NULL DEFAULT '0', +--- 556,588 ---- + KEY `xchan` (`xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `hook` ++ -- ++ + CREATE TABLE IF NOT EXISTS `hook` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `hook` char(255) NOT NULL DEFAULT '', +! `file` char(255) NOT NULL DEFAULT '', +! `function` char(255) NOT NULL DEFAULT '', + `priority` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `hook` (`hook`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `hubloc` ++ -- ++ + CREATE TABLE IF NOT EXISTS `hubloc` ( + `hubloc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hubloc_guid` char(255) NOT NULL DEFAULT '', + `hubloc_guid_sig` text NOT NULL, +! `hubloc_hash` char(255) NOT NULL DEFAULT '', + `hubloc_addr` char(255) NOT NULL DEFAULT '', + `hubloc_network` char(32) NOT NULL DEFAULT '', + `hubloc_flags` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 474,493 **** + KEY `hubloc_connect` (`hubloc_connect`), + KEY `hubloc_host` (`hubloc_host`), + KEY `hubloc_addr` (`hubloc_addr`), +- KEY `hubloc_network` (`hubloc_network`), + KEY `hubloc_updated` (`hubloc_updated`), + KEY `hubloc_connected` (`hubloc_connected`), +! KEY `hubloc_status` (`hubloc_status`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `issue` ( + `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `issue_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `issue_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `issue_assigned` char(255) NOT NULL, +! `issue_priority` int(11) NOT NULL, +! `issue_status` int(11) NOT NULL, +! `issue_component` char(255) NOT NULL, + PRIMARY KEY (`issue_id`), + KEY `issue_created` (`issue_created`), + KEY `issue_updated` (`issue_updated`), +--- 602,627 ---- + KEY `hubloc_connect` (`hubloc_connect`), + KEY `hubloc_host` (`hubloc_host`), + KEY `hubloc_addr` (`hubloc_addr`), + KEY `hubloc_updated` (`hubloc_updated`), + KEY `hubloc_connected` (`hubloc_connected`), +! KEY `hubloc_status` (`hubloc_status`), +! KEY `hubloc_network` (`hubloc_network`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `issue` ++ -- ++ + CREATE TABLE IF NOT EXISTS `issue` ( + `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `issue_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `issue_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `issue_assigned` char(255) NOT NULL DEFAULT '', +! `issue_priority` int(11) NOT NULL DEFAULT '0', +! `issue_status` int(11) NOT NULL DEFAULT '0', +! `issue_component` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`issue_id`), + KEY `issue_created` (`issue_created`), + KEY `issue_updated` (`issue_updated`), +*************** +*** 497,502 **** +--- 631,642 ---- + KEY `issue_component` (`issue_component`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `item` ++ -- ++ + CREATE TABLE IF NOT EXISTS `item` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', +*************** +*** 516,549 **** + `author_xchan` char(255) NOT NULL DEFAULT '', + `source_xchan` char(255) NOT NULL DEFAULT '', + `mimetype` char(255) NOT NULL DEFAULT '', +! `title` text NOT NULL DEFAULT '', +! `body` mediumtext NOT NULL DEFAULT '', + `app` char(255) NOT NULL DEFAULT '', + `lang` char(64) NOT NULL DEFAULT '', + `revision` int(10) unsigned NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `obj_type` char(255) NOT NULL DEFAULT '', +! `object` text NOT NULL DEFAULT '', + `tgt_type` char(255) NOT NULL DEFAULT '', +! `target` text NOT NULL DEFAULT '', + `layout_mid` char(255) NOT NULL DEFAULT '', +! `postopts` text NOT NULL DEFAULT '', +! `route` text NOT NULL DEFAULT '', + `llink` char(255) NOT NULL DEFAULT '', + `plink` char(255) NOT NULL DEFAULT '', + `resource_id` char(255) NOT NULL DEFAULT '', + `resource_type` char(16) NOT NULL DEFAULT '', +! `attach` mediumtext NOT NULL DEFAULT '', +! `sig` text NOT NULL DEFAULT '', +! `diaspora_meta` mediumtext NOT NULL DEFAULT '', + `location` char(255) NOT NULL DEFAULT '', + `coord` char(255) NOT NULL DEFAULT '', + `public_policy` char(255) NOT NULL DEFAULT '', + `comment_policy` char(255) NOT NULL DEFAULT '', +! `allow_cid` mediumtext NOT NULL DEFAULT '', +! `allow_gid` mediumtext NOT NULL DEFAULT '', +! `deny_cid` mediumtext NOT NULL DEFAULT '', +! `deny_gid` mediumtext NOT NULL DEFAULT '', + `item_restrict` int(11) NOT NULL DEFAULT '0', + `item_flags` int(11) NOT NULL DEFAULT '0', + `item_private` tinyint(4) NOT NULL DEFAULT '0', +--- 656,689 ---- + `author_xchan` char(255) NOT NULL DEFAULT '', + `source_xchan` char(255) NOT NULL DEFAULT '', + `mimetype` char(255) NOT NULL DEFAULT '', +! `title` text NOT NULL, +! `body` mediumtext NOT NULL, + `app` char(255) NOT NULL DEFAULT '', + `lang` char(64) NOT NULL DEFAULT '', + `revision` int(10) unsigned NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `obj_type` char(255) NOT NULL DEFAULT '', +! `object` text NOT NULL, + `tgt_type` char(255) NOT NULL DEFAULT '', +! `target` text NOT NULL, + `layout_mid` char(255) NOT NULL DEFAULT '', +! `postopts` text NOT NULL, +! `route` text NOT NULL, + `llink` char(255) NOT NULL DEFAULT '', + `plink` char(255) NOT NULL DEFAULT '', + `resource_id` char(255) NOT NULL DEFAULT '', + `resource_type` char(16) NOT NULL DEFAULT '', +! `attach` mediumtext NOT NULL, +! `sig` text NOT NULL, +! `diaspora_meta` mediumtext NOT NULL, + `location` char(255) NOT NULL DEFAULT '', + `coord` char(255) NOT NULL DEFAULT '', + `public_policy` char(255) NOT NULL DEFAULT '', + `comment_policy` char(255) NOT NULL DEFAULT '', +! `allow_cid` mediumtext NOT NULL, +! `allow_gid` mediumtext NOT NULL, +! `deny_cid` mediumtext NOT NULL, +! `deny_gid` mediumtext NOT NULL, + `item_restrict` int(11) NOT NULL DEFAULT '0', + `item_flags` int(11) NOT NULL DEFAULT '0', + `item_private` tinyint(4) NOT NULL DEFAULT '0', +*************** +*** 555,562 **** + KEY `received` (`received`), + KEY `uid_commented` (`uid`,`commented`), + KEY `uid_created` (`uid`,`created`), +- KEY `changed` (`changed`), +- KEY `comments_closed` (`comments_closed`), + KEY `aid` (`aid`), + KEY `owner_xchan` (`owner_xchan`), + KEY `author_xchan` (`author_xchan`), +--- 695,700 ---- +*************** +*** 573,581 **** + KEY `mid` (`mid`), + KEY `parent_mid` (`parent_mid`), + KEY `uid_mid` (`mid`,`uid`), +- KEY `public_policy` (`public_policy`), + KEY `comment_policy` (`comment_policy`), + KEY `layout_mid` (`layout_mid`), + FULLTEXT KEY `title` (`title`), + FULLTEXT KEY `body` (`body`), + FULLTEXT KEY `allow_cid` (`allow_cid`), +--- 711,721 ---- + KEY `mid` (`mid`), + KEY `parent_mid` (`parent_mid`), + KEY `uid_mid` (`mid`,`uid`), + KEY `comment_policy` (`comment_policy`), + KEY `layout_mid` (`layout_mid`), ++ KEY `public_policy` (`public_policy`), ++ KEY `comments_closed` (`comments_closed`), ++ KEY `changed` (`changed`), + FULLTEXT KEY `title` (`title`), + FULLTEXT KEY `body` (`body`), + FULLTEXT KEY `allow_cid` (`allow_cid`), +*************** +*** 584,595 **** + FULLTEXT KEY `deny_gid` (`deny_gid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `item_id` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `iid` int(11) NOT NULL, +! `uid` int(11) NOT NULL, +! `sid` char(255) NOT NULL, +! `service` char(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `sid` (`sid`), +--- 724,741 ---- + FULLTEXT KEY `deny_gid` (`deny_gid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `item_id` ++ -- ++ + CREATE TABLE IF NOT EXISTS `item_id` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `iid` int(11) NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL DEFAULT '0', +! `sid` char(255) NOT NULL DEFAULT '', +! `service` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `sid` (`sid`), +*************** +*** 597,621 **** + KEY `iid` (`iid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `likes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `channel_id` int(11) unsigned NOT NULL DEFAULT '0', + `liker` char(128) NOT NULL DEFAULT '', + `likee` char(128) NOT NULL DEFAULT '', +! `iid` int(10) unsigned NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `target_type` char(255) NOT NULL DEFAULT '', + `target_id` char(128) NOT NULL DEFAULT '', + `target` mediumtext NOT NULL, + PRIMARY KEY (`id`), +- KEY `channel_id` (`channel_id`), + KEY `liker` (`liker`), + KEY `likee` (`likee`), + KEY `iid` (`iid`), + KEY `verb` (`verb`), + KEY `target_type` (`target_type`), + KEY `target_id` (`target_id`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `mail` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +--- 743,779 ---- + KEY `iid` (`iid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `likes` ++ -- ++ + CREATE TABLE IF NOT EXISTS `likes` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `channel_id` int(10) unsigned NOT NULL DEFAULT '0', + `liker` char(128) NOT NULL DEFAULT '', + `likee` char(128) NOT NULL DEFAULT '', +! `iid` int(11) unsigned NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `target_type` char(255) NOT NULL DEFAULT '', + `target_id` char(128) NOT NULL DEFAULT '', + `target` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `liker` (`liker`), + KEY `likee` (`likee`), + KEY `iid` (`iid`), + KEY `verb` (`verb`), + KEY `target_type` (`target_type`), ++ KEY `channel_id` (`channel_id`), + KEY `target_id` (`target_id`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `mail` +! -- + + CREATE TABLE IF NOT EXISTS `mail` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +*************** +*** 624,639 **** + `from_xchan` char(255) NOT NULL DEFAULT '', + `to_xchan` char(255) NOT NULL DEFAULT '', + `account_id` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_id` int(10) unsigned NOT NULL, + `title` text NOT NULL, + `body` mediumtext NOT NULL, + `attach` mediumtext NOT NULL, +! `mid` char(255) NOT NULL, +! `parent_mid` char(255) NOT NULL, + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), +- KEY `convid` (`convid`), + KEY `created` (`created`), + KEY `mail_flags` (`mail_flags`), + KEY `account_id` (`account_id`), +--- 782,796 ---- + `from_xchan` char(255) NOT NULL DEFAULT '', + `to_xchan` char(255) NOT NULL DEFAULT '', + `account_id` int(10) unsigned NOT NULL DEFAULT '0', +! `channel_id` int(10) unsigned NOT NULL DEFAULT '0', + `title` text NOT NULL, + `body` mediumtext NOT NULL, + `attach` mediumtext NOT NULL, +! `mid` char(255) NOT NULL DEFAULT '', +! `parent_mid` char(255) NOT NULL DEFAULT '', + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `created` (`created`), + KEY `mail_flags` (`mail_flags`), + KEY `account_id` (`account_id`), +*************** +*** 642,659 **** + KEY `to_xchan` (`to_xchan`), + KEY `mid` (`mid`), + KEY `parent_mid` (`parent_mid`), +! KEY `expires` (`expires`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `manage` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL, + `xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `xchan` (`xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `menu` ( + `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', +--- 799,829 ---- + KEY `to_xchan` (`to_xchan`), + KEY `mid` (`mid`), + KEY `parent_mid` (`parent_mid`), +! KEY `expires` (`expires`), +! KEY `convid` (`convid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `manage` ++ -- ++ + CREATE TABLE IF NOT EXISTS `manage` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL DEFAULT '0', + `xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `xchan` (`xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `menu` ++ -- ++ + CREATE TABLE IF NOT EXISTS `menu` ( + `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 666,671 **** +--- 836,847 ---- + KEY `menu_flags` (`menu_flags`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `menu_item` ++ -- ++ + CREATE TABLE IF NOT EXISTS `menu_item` ( + `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mitem_link` char(255) NOT NULL DEFAULT '', +*************** +*** 675,681 **** + `allow_gid` mediumtext NOT NULL, + `deny_cid` mediumtext NOT NULL, + `deny_gid` mediumtext NOT NULL, +! `mitem_channel_id` int(10) unsigned NOT NULL, + `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0', + `mitem_order` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`mitem_id`), +--- 851,857 ---- + `allow_gid` mediumtext NOT NULL, + `deny_cid` mediumtext NOT NULL, + `deny_gid` mediumtext NOT NULL, +! `mitem_channel_id` int(10) unsigned NOT NULL DEFAULT '0', + `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0', + `mitem_order` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`mitem_id`), +*************** +*** 684,705 **** + KEY `mitem_flags` (`mitem_flags`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `notify` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `hash` char(64) NOT NULL, +! `name` char(255) NOT NULL, +! `url` char(255) NOT NULL, +! `photo` char(255) NOT NULL, +! `date` datetime NOT NULL, + `msg` mediumtext NOT NULL, +! `aid` int(11) NOT NULL, +! `uid` int(11) NOT NULL, +! `link` char(255) NOT NULL, + `parent` char(255) NOT NULL DEFAULT '', + `seen` tinyint(1) NOT NULL DEFAULT '0', +! `type` int(11) NOT NULL, +! `verb` char(255) NOT NULL, +! `otype` char(16) NOT NULL, + PRIMARY KEY (`id`), + KEY `type` (`type`), + KEY `seen` (`seen`), +--- 860,887 ---- + KEY `mitem_flags` (`mitem_flags`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `notify` ++ -- ++ + CREATE TABLE IF NOT EXISTS `notify` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `hash` char(64) NOT NULL DEFAULT '', +! `name` char(255) NOT NULL DEFAULT '', +! `url` char(255) NOT NULL DEFAULT '', +! `photo` char(255) NOT NULL DEFAULT '', +! `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `msg` mediumtext NOT NULL, +! `aid` int(11) NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL DEFAULT '0', +! `link` char(255) NOT NULL DEFAULT '', + `parent` char(255) NOT NULL DEFAULT '', + `seen` tinyint(1) NOT NULL DEFAULT '0', +! `type` int(11) NOT NULL DEFAULT '0', +! `verb` char(255) NOT NULL DEFAULT '', +! `otype` char(16) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `type` (`type`), + KEY `seen` (`seen`), +*************** +*** 712,717 **** +--- 894,905 ---- + KEY `aid` (`aid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `obj` ++ -- ++ + CREATE TABLE IF NOT EXISTS `obj` ( + `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `obj_page` char(64) NOT NULL DEFAULT '', +*************** +*** 731,736 **** +--- 919,930 ---- + KEY `obj_obj` (`obj_obj`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `outq` ++ -- ++ + CREATE TABLE IF NOT EXISTS `outq` ( + `outq_hash` char(255) NOT NULL, + `outq_account` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 753,786 **** + KEY `outq_delivered` (`outq_delivered`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `pconfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uid` int(11) NOT NULL DEFAULT '0', +! `cat` char(255) CHARACTER SET ascii NOT NULL, +! `k` char(255) CHARACTER SET ascii NOT NULL, + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `access` (`uid`,`cat`,`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `photo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(10) unsigned NOT NULL, + `xchan` char(255) NOT NULL DEFAULT '', +! `resource_id` char(255) NOT NULL, +! `created` datetime NOT NULL, +! `edited` datetime NOT NULL, +! `title` char(255) NOT NULL, + `description` text NOT NULL, +! `album` char(255) NOT NULL, +! `filename` char(255) NOT NULL, + `type` char(128) NOT NULL DEFAULT 'image/jpeg', +! `height` smallint(6) NOT NULL, +! `width` smallint(6) NOT NULL, + `size` int(10) unsigned NOT NULL DEFAULT '0', + `data` mediumblob NOT NULL, +! `scale` tinyint(3) NOT NULL, + `profile` tinyint(1) NOT NULL DEFAULT '0', + `photo_flags` int(10) unsigned NOT NULL DEFAULT '0', + `allow_cid` mediumtext NOT NULL, +--- 947,992 ---- + KEY `outq_delivered` (`outq_delivered`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `pconfig` ++ -- ++ + CREATE TABLE IF NOT EXISTS `pconfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uid` int(11) NOT NULL DEFAULT '0', +! `cat` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', +! `k` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `access` (`uid`,`cat`,`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `photo` ++ -- ++ + CREATE TABLE IF NOT EXISTS `photo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(10) unsigned NOT NULL DEFAULT '0', + `xchan` char(255) NOT NULL DEFAULT '', +! `resource_id` 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', +! `title` char(255) NOT NULL DEFAULT '', + `description` text NOT NULL, +! `album` char(255) NOT NULL DEFAULT '', +! `filename` char(255) NOT NULL DEFAULT '', + `type` char(128) NOT NULL DEFAULT 'image/jpeg', +! `height` smallint(6) NOT NULL DEFAULT '0', +! `width` smallint(6) NOT NULL DEFAULT '0', + `size` int(10) unsigned NOT NULL DEFAULT '0', + `data` mediumblob NOT NULL, +! `scale` tinyint(3) NOT NULL DEFAULT '0', + `profile` tinyint(1) NOT NULL DEFAULT '0', + `photo_flags` int(10) unsigned NOT NULL DEFAULT '0', + `allow_cid` mediumtext NOT NULL, +*************** +*** 800,805 **** +--- 1006,1017 ---- + KEY `resource_id` (`resource_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `poll` ++ -- ++ + CREATE TABLE IF NOT EXISTS `poll` ( + `poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `poll_channel` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 812,817 **** +--- 1024,1035 ---- + KEY `poll_votes` (`poll_votes`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `poll_elm` ++ -- ++ + CREATE TABLE IF NOT EXISTS `poll_elm` ( + `pelm_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `pelm_poll` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 823,838 **** + KEY `pelm_result` (`pelm_result`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `profdef` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `field_name` char(255) NOT NULL DEFAULT '', + `field_type` char(16) NOT NULL DEFAULT '', + `field_desc` char(255) NOT NULL DEFAULT '', + `field_help` char(255) NOT NULL DEFAULT '', +! `field_inputs` mediumtext NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `field_name` (`field_name`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `profext` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +--- 1041,1068 ---- + KEY `pelm_result` (`pelm_result`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `profdef` ++ -- ++ + CREATE TABLE IF NOT EXISTS `profdef` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `field_name` char(255) NOT NULL DEFAULT '', + `field_type` char(16) NOT NULL DEFAULT '', + `field_desc` char(255) NOT NULL DEFAULT '', + `field_help` char(255) NOT NULL DEFAULT '', +! `field_inputs` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `field_name` (`field_name`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `profext` +! -- + + CREATE TABLE IF NOT EXISTS `profext` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +*************** +*** 844,882 **** + KEY `channel_id` (`channel_id`), + KEY `hash` (`hash`), + KEY `k` (`k`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `profile` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `profile_guid` char(64) NOT NULL DEFAULT '', + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL, +! `profile_name` char(255) NOT NULL, + `is_default` tinyint(1) NOT NULL DEFAULT '0', + `hide_friends` tinyint(1) NOT NULL DEFAULT '0', +! `name` char(255) NOT NULL, +! `pdesc` char(255) NOT NULL, + `chandesc` text NOT NULL, + `dob` char(32) NOT NULL DEFAULT '0000-00-00', + `dob_tz` char(255) NOT NULL DEFAULT 'UTC', +! `address` char(255) NOT NULL, +! `locality` char(255) NOT NULL, +! `region` char(255) NOT NULL, +! `postal_code` char(32) NOT NULL, +! `country_name` char(255) NOT NULL, +! `hometown` char(255) NOT NULL, +! `gender` char(32) NOT NULL, +! `marital` char(255) NOT NULL, + `with` text NOT NULL, + `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `sexual` char(255) NOT NULL, +! `politic` char(255) NOT NULL, +! `religion` char(255) NOT NULL, + `keywords` text NOT NULL, + `likes` text NOT NULL, + `dislikes` text NOT NULL, + `about` text NOT NULL, +! `summary` char(255) NOT NULL, + `music` text NOT NULL, + `book` text NOT NULL, + `tv` text NOT NULL, +--- 1074,1118 ---- + KEY `channel_id` (`channel_id`), + KEY `hash` (`hash`), + KEY `k` (`k`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `profile` +! -- + + CREATE TABLE IF NOT EXISTS `profile` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `profile_guid` char(64) NOT NULL DEFAULT '', + `aid` int(10) unsigned NOT NULL DEFAULT '0', +! `uid` int(11) NOT NULL DEFAULT '0', +! `profile_name` char(255) NOT NULL DEFAULT '', + `is_default` tinyint(1) NOT NULL DEFAULT '0', + `hide_friends` tinyint(1) NOT NULL DEFAULT '0', +! `name` char(255) NOT NULL DEFAULT '', +! `pdesc` char(255) NOT NULL DEFAULT '', + `chandesc` text NOT NULL, + `dob` char(32) NOT NULL DEFAULT '0000-00-00', + `dob_tz` char(255) NOT NULL DEFAULT 'UTC', +! `address` char(255) NOT NULL DEFAULT '', +! `locality` char(255) NOT NULL DEFAULT '', +! `region` char(255) NOT NULL DEFAULT '', +! `postal_code` char(32) NOT NULL DEFAULT '', +! `country_name` char(255) NOT NULL DEFAULT '', +! `hometown` char(255) NOT NULL DEFAULT '', +! `gender` char(32) NOT NULL DEFAULT '', +! `marital` char(255) NOT NULL DEFAULT '', + `with` text NOT NULL, + `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `sexual` char(255) NOT NULL DEFAULT '', +! `politic` char(255) NOT NULL DEFAULT '', +! `religion` char(255) NOT NULL DEFAULT '', + `keywords` text NOT NULL, + `likes` text NOT NULL, + `dislikes` text NOT NULL, + `about` text NOT NULL, +! `summary` char(255) NOT NULL DEFAULT '', + `music` text NOT NULL, + `book` text NOT NULL, + `tv` text NOT NULL, +*************** +*** 887,895 **** + `education` text NOT NULL, + `contact` text NOT NULL, + `channels` text NOT NULL, +! `homepage` char(255) NOT NULL, +! `photo` char(255) NOT NULL, +! `thumb` char(255) NOT NULL, + `publish` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `guid` (`profile_guid`,`uid`), +--- 1123,1131 ---- + `education` text NOT NULL, + `contact` text NOT NULL, + `channels` text NOT NULL, +! `homepage` char(255) NOT NULL DEFAULT '', +! `photo` char(255) NOT NULL DEFAULT '', +! `thumb` char(255) NOT NULL DEFAULT '', + `publish` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `guid` (`profile_guid`,`uid`), +*************** +*** 908,920 **** + KEY `profile_guid` (`profile_guid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `profile_check` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `uid` int(10) unsigned NOT NULL, + `cid` int(10) unsigned NOT NULL DEFAULT '0', +! `dfrn_id` char(255) NOT NULL, +! `sec` char(255) NOT NULL, +! `expire` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `cid` (`cid`), +--- 1144,1162 ---- + KEY `profile_guid` (`profile_guid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `profile_check` ++ -- ++ + CREATE TABLE IF NOT EXISTS `profile_check` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `uid` int(10) unsigned NOT NULL DEFAULT '0', + `cid` int(10) unsigned NOT NULL DEFAULT '0', +! `dfrn_id` char(255) NOT NULL DEFAULT '', +! `sec` char(255) NOT NULL DEFAULT '', +! `expire` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), + KEY `cid` (`cid`), +*************** +*** 923,951 **** + KEY `expire` (`expire`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `register` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `hash` char(255) NOT NULL, +! `created` datetime NOT NULL, +! `uid` int(10) unsigned NOT NULL, +! `password` char(255) NOT NULL, +! `language` char(16) NOT NULL, + PRIMARY KEY (`id`), + KEY `hash` (`hash`), + KEY `created` (`created`), + KEY `uid` (`uid`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `session` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +! `sid` char(255) NOT NULL, + `data` text NOT NULL, +! `expire` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `sid` (`sid`), + KEY `expire` (`expire`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `shares` ( + `share_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `share_type` int(11) NOT NULL DEFAULT '0', +--- 1165,1211 ---- + KEY `expire` (`expire`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `register` ++ -- ++ + CREATE TABLE IF NOT EXISTS `register` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `hash` char(255) NOT NULL DEFAULT '', +! `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +! `uid` int(10) unsigned NOT NULL DEFAULT '0', +! `password` char(255) NOT NULL DEFAULT '', +! `language` char(16) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `hash` (`hash`), + KEY `created` (`created`), + KEY `uid` (`uid`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `session` +! -- + + CREATE TABLE IF NOT EXISTS `session` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +! `sid` char(255) NOT NULL DEFAULT '', + `data` text NOT NULL, +! `expire` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `sid` (`sid`), + KEY `expire` (`expire`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `shares` ++ -- ++ + CREATE TABLE IF NOT EXISTS `shares` ( + `share_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `share_type` int(11) NOT NULL DEFAULT '0', +*************** +*** 957,974 **** + KEY `share_xchan` (`share_xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `sign` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `iid` int(10) unsigned NOT NULL DEFAULT '0', + `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', + `signed_text` mediumtext NOT NULL, + `signature` text NOT NULL, +! `signer` char(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `iid` (`iid`), + KEY `retract_iid` (`retract_iid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `site` ( + `site_url` char(255) NOT NULL, + `site_access` int(11) NOT NULL DEFAULT '0', +--- 1217,1246 ---- + KEY `share_xchan` (`share_xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `sign` ++ -- ++ + CREATE TABLE IF NOT EXISTS `sign` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `iid` int(10) unsigned NOT NULL DEFAULT '0', + `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', + `signed_text` mediumtext NOT NULL, + `signature` text NOT NULL, +! `signer` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `iid` (`iid`), + KEY `retract_iid` (`retract_iid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `site` ++ -- ++ + CREATE TABLE IF NOT EXISTS `site` ( + `site_url` char(255) NOT NULL, + `site_access` int(11) NOT NULL DEFAULT '0', +*************** +*** 988,996 **** +--- 1260,1275 ---- + KEY `site_register` (`site_register`), + KEY `site_access` (`site_access`), + KEY `site_sellpage` (`site_sellpage`), ++ KEY `site_pull` (`site_pull`), + KEY `site_realm` (`site_realm`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `source` ++ -- ++ + CREATE TABLE IF NOT EXISTS `source` ( + `src_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `src_channel_id` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 1003,1014 **** + KEY `src_xchan` (`src_xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `spam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL, + `spam` int(11) NOT NULL DEFAULT '0', + `ham` int(11) NOT NULL DEFAULT '0', +! `term` char(255) NOT NULL, + `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), +--- 1282,1299 ---- + KEY `src_xchan` (`src_xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `spam` ++ -- ++ + CREATE TABLE IF NOT EXISTS `spam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, +! `uid` int(11) NOT NULL DEFAULT '0', + `spam` int(11) NOT NULL DEFAULT '0', + `ham` int(11) NOT NULL DEFAULT '0', +! `term` char(255) NOT NULL DEFAULT '', + `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `uid` (`uid`), +*************** +*** 1017,1041 **** + KEY `term` (`term`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `sys_perms` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `cat` char(255) NOT NULL, +! `k` char(255) NOT NULL, + `v` mediumtext NOT NULL, +! `public_perm` tinyint(1) unsigned NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `term` ( + `tid` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', + `uid` int(10) unsigned NOT NULL DEFAULT '0', +! `oid` int(10) unsigned NOT NULL, +! `otype` tinyint(3) unsigned NOT NULL, +! `type` tinyint(3) unsigned NOT NULL, +! `term` char(255) NOT NULL, +! `url` char(255) NOT NULL, +! `imgurl` char(255) NOT NULL, + `term_hash` char(255) NOT NULL DEFAULT '', + `parent_hash` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`tid`), +--- 1302,1338 ---- + KEY `term` (`term`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `sys_perms` ++ -- ++ + CREATE TABLE IF NOT EXISTS `sys_perms` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `cat` char(255) NOT NULL DEFAULT '', +! `k` char(255) NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, +! `public_perm` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `term` ++ -- ++ + CREATE TABLE IF NOT EXISTS `term` ( + `tid` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aid` int(10) unsigned NOT NULL DEFAULT '0', + `uid` int(10) unsigned NOT NULL DEFAULT '0', +! `oid` int(10) unsigned NOT NULL DEFAULT '0', +! `otype` tinyint(3) unsigned NOT NULL DEFAULT '0', +! `type` tinyint(3) unsigned NOT NULL DEFAULT '0', +! `term` char(255) NOT NULL DEFAULT '', +! `url` char(255) NOT NULL DEFAULT '', +! `imgurl` char(255) NOT NULL DEFAULT '', + `term_hash` char(255) NOT NULL DEFAULT '', + `parent_hash` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`tid`), +*************** +*** 1050,1071 **** + KEY `parent_hash` (`parent_hash`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `tokens` ( +! `id` varchar(40) NOT NULL, + `secret` text NOT NULL, +! `client_id` varchar(20) NOT NULL, +! `expires` bigint(20) unsigned NOT NULL, +! `scope` varchar(200) NOT NULL, +! `uid` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `client_id` (`client_id`), + KEY `expires` (`expires`), + KEY `uid` (`uid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `updates` ( + `ud_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `ud_hash` char(128) NOT NULL, + `ud_guid` char(255) NOT NULL DEFAULT '', + `ud_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ud_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +--- 1347,1380 ---- + KEY `parent_hash` (`parent_hash`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `tokens` ++ -- ++ + CREATE TABLE IF NOT EXISTS `tokens` ( +! `id` varchar(40) NOT NULL DEFAULT '', + `secret` text NOT NULL, +! `client_id` varchar(20) NOT NULL DEFAULT '', +! `expires` bigint(20) unsigned NOT NULL DEFAULT '0', +! `scope` varchar(200) NOT NULL DEFAULT '', +! `uid` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `client_id` (`client_id`), + KEY `expires` (`expires`), + KEY `uid` (`uid`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `updates` ++ -- ++ + CREATE TABLE IF NOT EXISTS `updates` ( + `ud_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `ud_hash` char(128) NOT NULL DEFAULT '', + `ud_guid` char(255) NOT NULL DEFAULT '', + `ud_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ud_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +*************** +*** 1080,1085 **** +--- 1389,1400 ---- + KEY `ud_last` (`ud_last`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `verify` ++ -- ++ + CREATE TABLE IF NOT EXISTS `verify` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `channel` int(10) unsigned NOT NULL DEFAULT '0', +*************** +*** 1095,1100 **** +--- 1410,1421 ---- + KEY `created` (`created`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `vote` ++ -- ++ + CREATE TABLE IF NOT EXISTS `vote` ( + `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `vote_poll` int(11) NOT NULL DEFAULT '0', +*************** +*** 1107,1112 **** +--- 1428,1439 ---- + KEY `vote_element` (`vote_element`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xchan` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xchan` ( + `xchan_hash` char(255) NOT NULL, + `xchan_guid` char(255) NOT NULL DEFAULT '', +*************** +*** 1139,1144 **** +--- 1466,1477 ---- + KEY `xchan_follow` (`xchan_follow`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xchat` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xchat` ( + `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `xchat_url` char(255) NOT NULL DEFAULT '', +*************** +*** 1150,1162 **** + KEY `xchat_desc` (`xchat_desc`), + KEY `xchat_xchan` (`xchat_xchan`), + KEY `xchat_edited` (`xchat_edited`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `xconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `xchan` char(255) NOT NULL, +! `cat` char(255) NOT NULL, +! `k` char(255) NOT NULL, + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `xchan` (`xchan`), +--- 1483,1501 ---- + KEY `xchat_desc` (`xchat_desc`), + KEY `xchat_xchan` (`xchat_xchan`), + KEY `xchat_edited` (`xchat_edited`) +! ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +! +! -- -------------------------------------------------------- +! +! -- +! -- Table structure for table `xconfig` +! -- + + CREATE TABLE IF NOT EXISTS `xconfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `xchan` char(255) NOT NULL DEFAULT '', +! `cat` char(255) NOT NULL DEFAULT '', +! `k` char(255) NOT NULL DEFAULT '', + `v` mediumtext NOT NULL, + PRIMARY KEY (`id`), + KEY `xchan` (`xchan`), +*************** +*** 1164,1169 **** +--- 1503,1514 ---- + KEY `k` (`k`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xign` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xign` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uid` int(11) NOT NULL DEFAULT '0', +*************** +*** 1173,1178 **** +--- 1518,1529 ---- + KEY `xchan` (`xchan`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xlink` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xlink` ( + `xlink_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `xlink_xchan` char(255) NOT NULL DEFAULT '', +*************** +*** 1186,1191 **** +--- 1537,1548 ---- + KEY `xlink_rating` (`xlink_rating`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xprof` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xprof` ( + `xprof_hash` char(255) NOT NULL, + `xprof_age` tinyint(3) unsigned NOT NULL DEFAULT '0', +*************** +*** 1216,1224 **** + KEY `xprof_hometown` (`xprof_hometown`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + CREATE TABLE IF NOT EXISTS `xtag` ( + `xtag_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `xtag_hash` char(255) NOT NULL, + `xtag_term` char(255) NOT NULL DEFAULT '', + `xtag_flags` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`xtag_id`), +--- 1573,1587 ---- + KEY `xprof_hometown` (`xprof_hometown`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + ++ -- -------------------------------------------------------- ++ ++ -- ++ -- Table structure for table `xtag` ++ -- ++ + CREATE TABLE IF NOT EXISTS `xtag` ( + `xtag_id` int(10) unsigned NOT NULL AUTO_INCREMENT, +! `xtag_hash` char(255) NOT NULL DEFAULT '', + `xtag_term` char(255) NOT NULL DEFAULT '', + `xtag_flags` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`xtag_id`), diff --git a/install/migrate-mypg.php b/install/migrate-mypg.php new file mode 100644 index 000000000..10bf1e387 --- /dev/null +++ b/install/migrate-mypg.php @@ -0,0 +1,357 @@ +<?php +function ask_question($menu, $options, $default) { + $r=null; + while(!$r) { + echo $menu; + $str = substr(strtolower(fgets(STDIN)),0,-1); + if($str == '') + $r = $default; + else if(in_array($str, $options)) + $r = $str; + } + return $r; +} + +function get_data($prompt, $regex) { + do { + echo $prompt; + $r = substr(fgets(STDIN), 0, -1); + if(!preg_match($regex, $prompt)) + $r = ''; + } while($r === ''); + return $r; +} + +function parse_htconfig($file) { + if(!file_exists($file)) + return array(); + $conf = file_get_contents($file); + preg_match_all('/\$db\_(host|port|user|pass|data|type)\s*=\s*\'([[:print:]]+)\'/', $conf, $matches); + return array_combine($matches[1], $matches[2]); +} + +function get_configtype(array $data) { + if(!isset($data['host'], $data['user'], $data['pass'], $data['data'])) + return 'none'; + if($data['type'] == 1) + return 'pgsql'; + return 'mysql'; +} + +function phpquote($str) { + for($r = '', $x=0, $l=strlen($str); $x < $l; $x++) + if($str{$x} == '\'' || $str{$x} == '\\') + $r .= '\\' . $str{$x}; + else + $r .= $str{$x}; + return $r; +} + +function run_sql($file, $db, &$err, &$n) { + $sql = file_get_contents($file); + $sql = explode(';', $sql); + $err = 0; $n = 0; + $c = count($sql); + if(!$c) { + echo "Unknown error.\n"; + exit(); + } + foreach($sql as $stmt) { + if($stmt == '' || $stmt == "\n" || $stmt == "\n\n") { + $c--; + continue; + } + $r = $db->exec($stmt); + if($r===false) { + echo "\nError executing $stmt: ".var_export($db->errorInfo(), true)."\n"; + $err++; + } else { + $n++; + } + if($n % 5 == 0) + echo "\033[255DExecuting: $file, $n/$c\033[K"; + } + echo "\n"; +} + +$drivers=true; +if(!class_exists('PDO')) + $drivers=false; +if($drivers) { + $drivers = PDO::getAvailableDrivers(); + if(!in_array('pgsql', $drivers) || !in_array('mysql', $drivers)) + $drivers = false; +} +if(!$drivers) { + echo "Sorry. This migration tool requires both mysql and pgsql PDO drivers.\n"; + $r = ask_question("If you are on dreamhost you can enable them. This might work on other shared hosts too. Type 'n' to do it yourself.\nWould you like to try (Y/n)? ", array('y', 'n'), 'y'); + if($r=='y') { + $path = $_SERVER['HOME'] . '/.php/5.4'; + if(!file_exists($path)) + mkdir($path, 0770, true); + + $rcfile = $path . '/phprc'; + + $str = ''; + $mods = get_loaded_extensions(); + foreach(array('pdo_mysql','pdo_pgsql','pgsql') as $ext) + if(!in_array($ext, $mods)) + $str .= 'extension=' . $ext . ".so\n"; + + file_put_contents($rcfile, $str, FILE_APPEND ); + echo "drivers enabled.\nNow type: \033[1m/usr/local/bin/php-5.4 install/".basename($argv[0])."\033[0m\n"; + } + exit(); +} + +foreach(array('install','include','mod','view') as $dir) { + if(!file_exists($dir)) { + echo "You must execute from inside the webroot like the cron\n"; + exit(); + } +} + +$cfgfile = '.htconfig.php'; +if($argv[1] == '--resume') { + if($argc < 4) { + echo "Resume usage {$argv[0]} --resume <table> <row>\n"; + exit(); + } + $starttable = $argv[2]; + $startrow = $argv[3]; + $cfgfile = '.htconfig.php-mysql'; +} + +$cfg = parse_htconfig($cfgfile); +$type = get_configtype($cfg); +if($type != 'mysql') { + echo "Error. Must start with standard mysql installation in .htconfig.php.\n"; + exit(); +} + +if(!$cfg['port']) + $cfg['port'] = 3306; +try { + $mydb = new PDO("mysql:host={$cfg['host']};dbname={$cfg['data']};port={$cfg['port']}", $cfg['user'], $cfg['pass']); +} catch (PDOException $e) { + echo "Error connecting to mysql DB: " . $e->getMessage() . "\n"; + exit(); +} + +// mysql insists on buffering even when you use fetch() instead of fetchAll() for some stupid reason +// http://stackoverflow.com/questions/6895098/pdo-mysql-memory-consumption-with-large-result-set +$mydb->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); + +if(!file_exists('.htconfig.php-pgsql')) { + echo "Enter postgres server info:\n"; + $p['host'] = get_data("Hostname: ", '/[\w.]+/'); + $p['port'] = get_data("Enter port (0 for default): ", '/\d+/'); + $p['user'] = get_data("Username: ", '/\w+/'); + $p['pass'] = get_data("Password: ", '/[[:print:]]+/'); + $p['data'] = get_data("Database name: ", '/\w+/'); + $old = file_get_contents('.htconfig.php'); + $new = preg_replace( + array( + '/^(\$db_host\s*=\s*\')([\w.]+)(\';)$/m', + '/^(\$db_port\s*=\s*\')(\d+)(\';)$/m', + '/^(\$db_user\s*=\s*\')(\w+)(\';)$/m', + '/^(\$db_pass\s*=\s*\')([[:print:]]+)(\';)/m', + '/^(\$db_data\s*=\s*\')(\w+)(\';)$/m', + '/^(\$db_type\s*=\s*\')(\d)(\';)$/m' // in case they already have it + ), array( + "$1{$p['host']}$3", + "\${1}{$p['port']}$3", + "$1{$p['user']}$3", + "$1{$p['pass']}$3", + "$1{$p['data']}$3\n\$db_type = '1';\n", // they probably don't + "\${1}1$3" + ), + $old, + 1, + $repl + ); + if($new === false || $repl < 5) { + echo "Failed. Please make a postgres config file named .htconfig.php-pgsql - Be sure to add \"\$db_type = '1';\" to your config.\n"; + exit(); + } + file_put_contents('.htconfig.php-pgsql', $new); +} + +$pcfg = parse_htconfig('.htconfig.php-pgsql'); +$ptype = get_configtype($pcfg); +if($ptype != 'pgsql') { + echo "Error. Must have a valid pgsql config named .htconfig.php-pgsql. Be sure to add \"\$db_type = '1';\" to your config.\n"; + exit(); +} + +if(!$pcfg['port']) + $pcfg['port'] = 5432; +try { + $pgdb = new PDO("pgsql:host={$pcfg['host']};dbname={$pcfg['data']};port={$pcfg['port']}", $pcfg['user'], $pcfg['pass']); +} catch (PDOException $e) { + echo "Error connecting to pgsql DB: " . $e->getMessage() . "\n"; + echo "cfg string: " . "pgsql:host={$pcfg['host']};dbname={$pcfg['data']};port={$pcfg['port']}\n"; + exit(); +} +$B = "\033[0;34m"; +$H = "\033[0;35m"; +$W = "\033[1;37m"; +$M = "\033[1;31m"; +$N = "\033[0m"; + +if(isset($starttable)) { + $r = ask_question("Ready to migrate {$W}Red{$M}(#){$W}Matrix$N from mysql db @$B{$cfg['host']}$N/$B{$cfg['data']}$N to postgres db @$B{$pcfg['host']}$N/$B{$pcfg['data']}$N. + +Resuming failed migration ({$M}experimental$N) starting at table '$starttable' row $startrow. +Are you ready to begin (N/y)? ", + array('y', 'n'), + 'n' + ); + if($r == 'n') + exit(); +} else { + $r = ask_question("Ready to migrate {$W}Red{$M}(#){$W}Matrix$N from mysql db @$B{$cfg['host']}$N/$B{$cfg['data']}$N to postgres db @$B{$pcfg['host']}$N/$B{$pcfg['data']}$N. +The site will be disabled during the migration by moving the $H.htconfig.php$N file to $H.htconfig.php-mysql$N. +If for any reason the migration fails, you will need to move the config file back into place manually before trying again. + +Are you ready to begin (N/y)? ", array('y','n'), 'n' + ); + + if($r == 'n') + exit(); + + rename('.htconfig.php', '.htconfig.php-mysql'); + + run_sql('install/schema_postgres.sql', $pgdb, $err, $n); + if($err) { + echo "There were $err errors creating the pgsql schema. Unable to continue.\n"; + exit(); + } + + echo "pgsql schema created. $n queries executed successfully.\n"; +} + +$res = $pgdb->query("select relname, attname, pg_type.typname from ((pg_attribute inner join pg_class on attrelid=pg_class.oid) inner join pg_type on atttypid=pg_type.oid) inner join pg_namespace on relnamespace=pg_namespace.oid where nspname='public' and atttypid not in (26,27,28,29) and relkind='r' and attname <> 'item_search_vector';"); +if($res === false) { + echo "Error reading back schema. Unable to continue.\n"; + var_export($pgdb->errorInfo()); + exit(); +} +$schema = array(); +while(($row = $res->fetch()) !== false) + $schema[$row[0]][$row[1]] = $row[2]; + +$res = $pgdb->query("select relname, attname from pg_attribute inner join pg_class on attrelid=pg_class.oid inner join pg_constraint on conrelid=pg_class.oid and pg_attribute.attnum = any (conkey) where contype='p';"); +if($res === false) { + echo "Error reading back primary keys. Unable to continue.\n"; + var_export($pgdb->errorInfo()); + exit(); +} +$pkeys = array(); +while(($row = $res->fetch()) !== false) + $pkeys[$row[0]] = $row[1]; + +$err = 0; $n = 0; +$reserved = array('ignore','key','with'); +foreach($schema as $table=>$fields) { + if(isset($starttable) && !$n && $table != $starttable) { + echo "Skipping table $table\n"; + continue; + } + $fnames = array_keys($fields); + $pfnames = array_keys($fields); + + foreach($fnames as &$fname) + if(in_array($fname, $reserved)) + $fname = '`' . $fname . '`'; + $fstr = implode(',', $fnames); + + foreach($pfnames as &$pfname) + if(in_array($pfname, $reserved)) + $pfname = '"' . $pfname . '"'; + $pfstr = implode(',', $pfnames); + + $cres = $mydb->query("SELECT count(*) FROM $table;"); + if($cres === false) { + echo "Fatal error counting table $table: ".var_export($mydb->errorInfo(), true)."\n"; + exit(); + } + $nrows = $cres->fetchColumn(0); + $cres->closeCursor(); + + if(!$nrows) { + echo "TABLE $table has 0 rows in mysql db.\n"; + continue; + } + + $pstr = ''; + for($x=0, $c=count($fields); $x < $c; $x++) + $pstr .= ($x ? ',?' : '?'); + + if(isset($starttable) && $table == $starttable) { + $selectsql = "SELECT $fstr FROM $table ORDER BY {$pkeys[$table]} LIMIT $nrows OFFSET $startrow;"; + $crow = $startrow; + } else { + $selectsql = "SELECT $fstr FROM $table ORDER BY {$pkeys[$table]};"; + $crow = 0; + } + + echo "\033[255DTABLE: $table [$c fields] $crow/$nrows (".number_format(($crow/$nrows)*100,2)."%)\033[K"; + + $res = $mydb->query($selectsql); + if($res === false) { + echo "Fatal Error importing table $table: ".var_export($mydb->errorInfo(), true)."\n"; + exit(); + } + + $istmt = $pgdb->prepare("INSERT INTO $table ($pfstr) VALUES ($pstr);"); + if($istmt === false) { + echo "Fatal error preparing query. Aborting.\n"; + var_export($pgdb->errorInfo()); + exit(); + } + + while(($row = $res->fetch(PDO::FETCH_NUM)) !== false) { + foreach($row as $idx => &$val) + if(array_slice(array_values($fields),$idx,1)[0] == 'timestamp' && $val == '0000-00-00 00:00:00') + $istmt->bindParam($idx+1, ($nulldate='0001-01-01 00:00:00')); + else if(array_slice(array_values($fields),$idx,1)[0] == 'bytea') + $istmt->bindParam($idx+1, $val, PDO::PARAM_LOB); + else + $istmt->bindParam($idx+1, $val); + $r = $istmt->execute(); + if($r === false) { + $err++; + echo "Insert error: ".var_export(array($pgdb->errorInfo(), $table, $fields, $row), true)."\nResume with {$argv[0]} --resume $table $crow\n"; + exit(); + } else + $n++; + $crow++; + if(($crow % 10) == 0 || $crow == $nrows) + echo "\033[255DTABLE: $table [$c fields] $crow/$nrows (".number_format(($crow/$nrows)*100,2)."%)\033[K"; + } + $res->closeCursor(); + echo "\n"; +} + +echo "Done with $err errors and $n inserts.\n"; +if($err) { + echo "Migration had errors. Aborting.\n"; + exit(); +} + +run_sql('install/migrate_mypg_fixseq.sql', $pgdb, $err, $n); +echo "Sequences updated with $err errors and $n inserts.\n"; +if($err) + exit(); + +$r = ask_question("Everything successful. Once you connect up the pg database there is no going back. Do you want to make it live (N,y)?", array('y', 'n'), 'n'); +if($r == 'n') { + echo "You can make active by renaming .htconfig.php-pgsql to .htconfig.php, or start over by renaming .htconfig.php-mysql to .htconfig.php\n"; + exit(); +} + +rename('.htconfig.php-pgsql', '.htconfig.php'); +echo "Done. {$W}Red{$M}(#){$W}Matrix$N now running on postgres.\n"; + + diff --git a/install/migrate_mypg_fixseq.sql b/install/migrate_mypg_fixseq.sql new file mode 100644 index 000000000..806c5cf31 --- /dev/null +++ b/install/migrate_mypg_fixseq.sql @@ -0,0 +1,55 @@ + SELECT SETVAL('public.abook_abook_id_seq', COALESCE(MAX(abook_id), 1) ) FROM public.abook; + SELECT SETVAL('public.account_account_id_seq', COALESCE(MAX(account_id), 1) ) FROM public.account; + SELECT SETVAL('public.addon_id_seq', COALESCE(MAX(id), 1) ) FROM public.addon; + SELECT SETVAL('public.app_id_seq', COALESCE(MAX(id), 1) ) FROM public.app; + SELECT SETVAL('public.attach_id_seq', COALESCE(MAX(id), 1) ) FROM public.attach; + SELECT SETVAL('public.channel_channel_id_seq', COALESCE(MAX(channel_id), 1) ) FROM public.channel; + SELECT SETVAL('public.chat_chat_id_seq', COALESCE(MAX(chat_id), 1) ) FROM public.chat; + SELECT SETVAL('public.chatpresence_cp_id_seq', COALESCE(MAX(cp_id), 1) ) FROM public.chatpresence; + SELECT SETVAL('public.chatroom_cr_id_seq', COALESCE(MAX(cr_id), 1) ) FROM public.chatroom; + SELECT SETVAL('public.config_id_seq', COALESCE(MAX(id), 1) ) FROM public.config; + SELECT SETVAL('public.conv_id_seq', COALESCE(MAX(id), 1) ) FROM public.conv; + SELECT SETVAL('public.event_id_seq', COALESCE(MAX(id), 1) ) FROM public.event; + SELECT SETVAL('public.fcontact_id_seq', COALESCE(MAX(id), 1) ) FROM public.fcontact; + SELECT SETVAL('public.ffinder_id_seq', COALESCE(MAX(id), 1) ) FROM public.ffinder; + SELECT SETVAL('public.fserver_id_seq', COALESCE(MAX(id), 1) ) FROM public.fserver; + SELECT SETVAL('public.fsuggest_id_seq', COALESCE(MAX(id), 1) ) FROM public.fsuggest; + SELECT SETVAL('public.group_member_id_seq', COALESCE(MAX(id), 1) ) FROM public.group_member; + SELECT SETVAL('public.groups_id_seq', COALESCE(MAX(id), 1) ) FROM public.groups; + SELECT SETVAL('public.hook_id_seq', COALESCE(MAX(id), 1) ) FROM public.hook; + SELECT SETVAL('public.hubloc_hubloc_id_seq', COALESCE(MAX(hubloc_id), 1) ) FROM public.hubloc; + SELECT SETVAL('public.issue_issue_id_seq', COALESCE(MAX(issue_id), 1) ) FROM public.issue; + SELECT SETVAL('public.item_id_id_seq', COALESCE(MAX(id), 1) ) FROM public.item_id; + SELECT SETVAL('public.item_id_seq', COALESCE(MAX(id), 1) ) FROM public.item; + SELECT SETVAL('public.likes_id_seq', COALESCE(MAX(id), 1) ) FROM public.likes; + SELECT SETVAL('public.mail_id_seq', COALESCE(MAX(id), 1) ) FROM public.mail; + SELECT SETVAL('public.manage_id_seq', COALESCE(MAX(id), 1) ) FROM public.manage; + SELECT SETVAL('public.menu_item_mitem_id_seq', COALESCE(MAX(mitem_id), 1) ) FROM public.menu_item; + SELECT SETVAL('public.menu_menu_id_seq', COALESCE(MAX(menu_id), 1) ) FROM public.menu; + SELECT SETVAL('public.notify_id_seq', COALESCE(MAX(id), 1) ) FROM public.notify; + SELECT SETVAL('public.obj_obj_id_seq', COALESCE(MAX(obj_id), 1) ) FROM public.obj; + SELECT SETVAL('public.pconfig_id_seq', COALESCE(MAX(id), 1) ) FROM public.pconfig; + SELECT SETVAL('public.photo_id_seq', COALESCE(MAX(id), 1) ) FROM public.photo; + SELECT SETVAL('public.poll_elm_pelm_id_seq', COALESCE(MAX(pelm_id), 1) ) FROM public.poll_elm; + SELECT SETVAL('public.poll_poll_id_seq', COALESCE(MAX(poll_id), 1) ) FROM public.poll; + SELECT SETVAL('public.profdef_id_seq', COALESCE(MAX(id), 1) ) FROM public.profdef; + SELECT SETVAL('public.profext_id_seq', COALESCE(MAX(id), 1) ) FROM public.profext; + SELECT SETVAL('public.profile_check_id_seq', COALESCE(MAX(id), 1) ) FROM public.profile_check; + SELECT SETVAL('public.profile_id_seq', COALESCE(MAX(id), 1) ) FROM public.profile; + SELECT SETVAL('public.register_id_seq', COALESCE(MAX(id), 1) ) FROM public.register; + SELECT SETVAL('public.session_id_seq', COALESCE(MAX(id), 1) ) FROM public.session; + SELECT SETVAL('public.shares_share_id_seq', COALESCE(MAX(share_id), 1) ) FROM public.shares; + SELECT SETVAL('public.sign_id_seq', COALESCE(MAX(id), 1) ) FROM public.sign; + SELECT SETVAL('public.source_src_id_seq', COALESCE(MAX(src_id), 1) ) FROM public.source; + SELECT SETVAL('public.spam_id_seq', COALESCE(MAX(id), 1) ) FROM public.spam; + SELECT SETVAL('public.sys_perms_id_seq', COALESCE(MAX(id), 1) ) FROM public.sys_perms; + SELECT SETVAL('public.term_tid_seq', COALESCE(MAX(tid), 1) ) FROM public.term; + SELECT SETVAL('public.updates_ud_id_seq', COALESCE(MAX(ud_id), 1) ) FROM public.updates; + SELECT SETVAL('public.verify_id_seq', COALESCE(MAX(id), 1) ) FROM public.verify; + SELECT SETVAL('public.vote_vote_id_seq', COALESCE(MAX(vote_id), 1) ) FROM public.vote; + SELECT SETVAL('public.xchat_xchat_id_seq', COALESCE(MAX(xchat_id), 1) ) FROM public.xchat; + SELECT SETVAL('public.xconfig_id_seq', COALESCE(MAX(id), 1) ) FROM public.xconfig; + SELECT SETVAL('public.xign_id_seq', COALESCE(MAX(id), 1) ) FROM public.xign; + SELECT SETVAL('public.xlink_xlink_id_seq', COALESCE(MAX(xlink_id), 1) ) FROM public.xlink; + SELECT SETVAL('public.xtag_xtag_id_seq', COALESCE(MAX(xtag_id), 1) ) FROM public.xtag; + diff --git a/install/database.sql b/install/schema_mysql.sql index a49bd377c..ce3f07a89 100644 --- a/install/database.sql +++ b/install/schema_mysql.sql @@ -1,15 +1,13 @@ -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; - -/*!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 */; +-- -------------------------------------------------------- +-- +-- Table structure for table `abook` +-- CREATE TABLE IF NOT EXISTS `abook` ( `abook_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `abook_account` int(10) unsigned NOT NULL, - `abook_channel` int(10) unsigned NOT NULL, + `abook_account` int(10) unsigned NOT NULL DEFAULT '0', + `abook_channel` int(10) unsigned NOT NULL DEFAULT '0', `abook_xchan` char(255) NOT NULL DEFAULT '', `abook_my_perms` int(11) NOT NULL DEFAULT '0', `abook_their_perms` int(11) NOT NULL DEFAULT '0', @@ -37,6 +35,12 @@ CREATE TABLE IF NOT EXISTS `abook` ( KEY `abook_rating` (`abook_rating`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `account` +-- + CREATE TABLE IF NOT EXISTS `account` ( `account_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_parent` int(10) unsigned NOT NULL DEFAULT '0', @@ -70,10 +74,16 @@ CREATE TABLE IF NOT EXISTS `account` ( KEY `account_password_changed` (`account_password_changed`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `addon` +-- + CREATE TABLE IF NOT EXISTS `addon` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` char(255) NOT NULL, - `version` char(255) NOT NULL, + `name` char(255) NOT NULL DEFAULT '', + `version` char(255) NOT NULL DEFAULT '', `installed` tinyint(1) NOT NULL DEFAULT '0', `hidden` tinyint(1) NOT NULL DEFAULT '0', `timestamp` bigint(20) NOT NULL DEFAULT '0', @@ -84,6 +94,11 @@ CREATE TABLE IF NOT EXISTS `addon` ( KEY `installed` (`installed`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `app` +-- CREATE TABLE IF NOT EXISTS `app` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -108,8 +123,13 @@ CREATE TABLE IF NOT EXISTS `app` ( KEY `app_version` (`app_version`), KEY `app_channel` (`app_channel`), KEY `app_price` (`app_price`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- +-- +-- Table structure for table `attach` +-- CREATE TABLE IF NOT EXISTS `attach` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -145,22 +165,40 @@ CREATE TABLE IF NOT EXISTS `attach` ( KEY `creator` (`creator`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `auth_codes` +-- + CREATE TABLE IF NOT EXISTS `auth_codes` ( - `id` varchar(40) NOT NULL, - `client_id` varchar(20) NOT NULL, - `redirect_uri` varchar(200) NOT NULL, - `expires` int(11) NOT NULL, - `scope` varchar(250) NOT NULL, + `id` varchar(40) NOT NULL DEFAULT '', + `client_id` varchar(20) NOT NULL DEFAULT '', + `redirect_uri` varchar(200) NOT NULL DEFAULT '', + `expires` int(11) NOT NULL DEFAULT '0', + `scope` varchar(250) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `cache` +-- + CREATE TABLE IF NOT EXISTS `cache` ( - `k` char(255) NOT NULL, + `k` char(255) NOT NULL DEFAULT '', `v` text NOT NULL, - `updated` datetime NOT NULL, + `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `channel` +-- + CREATE TABLE IF NOT EXISTS `channel` ( `channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel_account_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -189,24 +227,24 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_allow_gid` mediumtext NOT NULL, `channel_deny_cid` mediumtext NOT NULL, `channel_deny_gid` mediumtext NOT NULL, - `channel_r_stream` int(10) unsigned NOT NULL DEFAULT '128', - `channel_r_profile` int(10) unsigned NOT NULL DEFAULT '128', - `channel_r_photos` int(10) unsigned NOT NULL DEFAULT '128', - `channel_r_abook` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_stream` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_wall` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_tagwall` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_comment` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_mail` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_photos` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_chat` int(10) unsigned NOT NULL DEFAULT '128', + `channel_r_stream` int(10) unsigned NOT NULL DEFAULT '0', + `channel_r_profile` int(10) unsigned NOT NULL DEFAULT '0', + `channel_r_photos` int(10) unsigned NOT NULL DEFAULT '0', + `channel_r_abook` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_stream` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_wall` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_tagwall` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_comment` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_mail` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_photos` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_chat` int(10) unsigned NOT NULL DEFAULT '0', `channel_a_delegate` int(10) unsigned NOT NULL DEFAULT '0', - `channel_r_storage` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_storage` int(10) unsigned NOT NULL DEFAULT '128', - `channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128', - `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '128', - `channel_w_like` int(10) unsigned NOT NULL DEFAULT '128', + `channel_r_storage` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_storage` int(10) unsigned NOT NULL DEFAULT '0', + `channel_r_pages` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '0', + `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '0', + `channel_w_like` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`channel_id`), UNIQUE KEY `channel_address_unique` (`channel_address`), KEY `channel_account_id` (`channel_account_id`), @@ -241,10 +279,16 @@ CREATE TABLE IF NOT EXISTS `channel` ( KEY `channel_w_pages` (`channel_w_pages`), KEY `channel_deleted` (`channel_deleted`), KEY `channel_a_republish` (`channel_a_republish`), - KEY `channel_w_like` (`channel_w_like`), - KEY `channel_dirdate` (`channel_dirdate`) + KEY `channel_dirdate` (`channel_dirdate`), + KEY `channel_w_like` (`channel_w_like`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `chat` +-- + CREATE TABLE IF NOT EXISTS `chat` ( `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `chat_room` int(10) unsigned NOT NULL DEFAULT '0', @@ -255,21 +299,33 @@ CREATE TABLE IF NOT EXISTS `chat` ( KEY `chat_room` (`chat_room`), KEY `chat_xchan` (`chat_xchan`), KEY `created` (`created`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `chatpresence` +-- CREATE TABLE IF NOT EXISTS `chatpresence` ( `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cp_room` int(10) unsigned NOT NULL DEFAULT '0', `cp_xchan` char(255) NOT NULL DEFAULT '', `cp_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `cp_status` char(255) NOT NULL, + `cp_status` char(255) NOT NULL DEFAULT '', `cp_client` char(128) NOT NULL DEFAULT '', PRIMARY KEY (`cp_id`), KEY `cp_room` (`cp_room`), KEY `cp_xchan` (`cp_xchan`), KEY `cp_last` (`cp_last`), KEY `cp_status` (`cp_status`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `chatroom` +-- CREATE TABLE IF NOT EXISTS `chatroom` ( `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -290,33 +346,51 @@ CREATE TABLE IF NOT EXISTS `chatroom` ( KEY `cr_created` (`cr_created`), KEY `cr_edited` (`cr_edited`), KEY `cr_expire` (`cr_expire`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `clients` +-- CREATE TABLE IF NOT EXISTS `clients` ( - `client_id` varchar(20) NOT NULL, - `pw` varchar(20) NOT NULL, - `redirect_uri` varchar(200) NOT NULL, + `client_id` varchar(20) NOT NULL DEFAULT '', + `pw` varchar(20) NOT NULL DEFAULT '', + `redirect_uri` varchar(200) NOT NULL DEFAULT '', `name` text, `icon` text, `uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`client_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `config` +-- + CREATE TABLE IF NOT EXISTS `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cat` char(255) CHARACTER SET ascii NOT NULL, - `k` char(255) CHARACTER SET ascii NOT NULL, + `cat` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', + `k` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', `v` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `access` (`cat`,`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `conv` +-- + CREATE TABLE IF NOT EXISTS `conv` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `guid` char(255) NOT NULL, + `guid` char(255) NOT NULL DEFAULT '', `recips` mediumtext NOT NULL, - `uid` int(11) NOT NULL, - `creator` char(255) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', + `creator` char(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `subject` mediumtext NOT NULL, @@ -325,20 +399,26 @@ CREATE TABLE IF NOT EXISTS `conv` ( KEY `updated` (`updated`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `event` +-- + CREATE TABLE IF NOT EXISTS `event` ( `id` int(11) NOT NULL AUTO_INCREMENT, `aid` int(10) unsigned NOT NULL DEFAULT '0', - `uid` int(11) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', `event_xchan` char(255) NOT NULL DEFAULT '', `event_hash` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL, - `edited` datetime NOT NULL, - `start` datetime NOT NULL, - `finish` datetime NOT NULL, + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `finish` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `summary` text NOT NULL, `description` text NOT NULL, `location` text NOT NULL, - `type` char(255) NOT NULL, + `type` char(255) NOT NULL DEFAULT '', `nofinish` tinyint(1) NOT NULL DEFAULT '0', `adjust` tinyint(1) NOT NULL DEFAULT '1', `ignore` tinyint(1) NOT NULL DEFAULT '0', @@ -357,7 +437,13 @@ CREATE TABLE IF NOT EXISTS `event` ( KEY `aid` (`aid`), KEY `event_hash` (`event_hash`), KEY `event_xchan` (`event_xchan`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `fcontact` +-- CREATE TABLE IF NOT EXISTS `fcontact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -381,6 +467,12 @@ CREATE TABLE IF NOT EXISTS `fcontact` ( KEY `network` (`network`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `ffinder` +-- + CREATE TABLE IF NOT EXISTS `ffinder` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL, @@ -392,36 +484,54 @@ CREATE TABLE IF NOT EXISTS `ffinder` ( KEY `fid` (`fid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `fserver` +-- + CREATE TABLE IF NOT EXISTS `fserver` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `server` char(255) NOT NULL, - `posturl` char(255) NOT NULL, + `server` char(255) NOT NULL DEFAULT '', + `posturl` char(255) NOT NULL DEFAULT '', `key` text NOT NULL, PRIMARY KEY (`id`), KEY `server` (`server`), KEY `posturl` (`posturl`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `fsuggest` +-- + CREATE TABLE IF NOT EXISTS `fsuggest` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, - `cid` int(11) NOT NULL, - `name` char(255) NOT NULL, - `url` char(255) NOT NULL, - `request` char(255) NOT NULL, - `photo` char(255) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', + `cid` int(11) NOT NULL DEFAULT '0', + `name` char(255) NOT NULL DEFAULT '', + `url` char(255) NOT NULL DEFAULT '', + `request` char(255) NOT NULL DEFAULT '', + `photo` char(255) NOT NULL DEFAULT '', `note` text NOT NULL, - `created` datetime NOT NULL, + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups` +-- + CREATE TABLE IF NOT EXISTS `groups` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(255) NOT NULL DEFAULT '', - `uid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL DEFAULT '0', `visible` tinyint(1) NOT NULL DEFAULT '0', `deleted` tinyint(1) NOT NULL DEFAULT '0', - `name` char(255) NOT NULL, + `name` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `visible` (`visible`), @@ -429,10 +539,16 @@ CREATE TABLE IF NOT EXISTS `groups` ( KEY `hash` (`hash`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `group_member` +-- + CREATE TABLE IF NOT EXISTS `group_member` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `uid` int(10) unsigned NOT NULL, - `gid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL DEFAULT '0', + `gid` int(10) unsigned NOT NULL DEFAULT '0', `xchan` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `uid` (`uid`), @@ -440,21 +556,33 @@ CREATE TABLE IF NOT EXISTS `group_member` ( KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `hook` +-- + CREATE TABLE IF NOT EXISTS `hook` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `hook` char(255) NOT NULL, - `file` char(255) NOT NULL, - `function` char(255) NOT NULL, + `hook` char(255) NOT NULL DEFAULT '', + `file` char(255) NOT NULL DEFAULT '', + `function` char(255) NOT NULL DEFAULT '', `priority` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `hook` (`hook`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `hubloc` +-- + CREATE TABLE IF NOT EXISTS `hubloc` ( `hubloc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hubloc_guid` char(255) NOT NULL DEFAULT '', `hubloc_guid_sig` text NOT NULL, - `hubloc_hash` char(255) NOT NULL, + `hubloc_hash` char(255) NOT NULL DEFAULT '', `hubloc_addr` char(255) NOT NULL DEFAULT '', `hubloc_network` char(32) NOT NULL DEFAULT '', `hubloc_flags` int(10) unsigned NOT NULL DEFAULT '0', @@ -474,20 +602,26 @@ CREATE TABLE IF NOT EXISTS `hubloc` ( KEY `hubloc_connect` (`hubloc_connect`), KEY `hubloc_host` (`hubloc_host`), KEY `hubloc_addr` (`hubloc_addr`), - KEY `hubloc_network` (`hubloc_network`), KEY `hubloc_updated` (`hubloc_updated`), KEY `hubloc_connected` (`hubloc_connected`), - KEY `hubloc_status` (`hubloc_status`) + KEY `hubloc_status` (`hubloc_status`), + KEY `hubloc_network` (`hubloc_network`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `issue` +-- + CREATE TABLE IF NOT EXISTS `issue` ( `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `issue_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `issue_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `issue_assigned` char(255) NOT NULL, - `issue_priority` int(11) NOT NULL, - `issue_status` int(11) NOT NULL, - `issue_component` char(255) NOT NULL, + `issue_assigned` char(255) NOT NULL DEFAULT '', + `issue_priority` int(11) NOT NULL DEFAULT '0', + `issue_status` int(11) NOT NULL DEFAULT '0', + `issue_component` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`issue_id`), KEY `issue_created` (`issue_created`), KEY `issue_updated` (`issue_updated`), @@ -497,6 +631,12 @@ CREATE TABLE IF NOT EXISTS `issue` ( KEY `issue_component` (`issue_component`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `item` +-- + CREATE TABLE IF NOT EXISTS `item` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', @@ -516,34 +656,34 @@ CREATE TABLE IF NOT EXISTS `item` ( `author_xchan` char(255) NOT NULL DEFAULT '', `source_xchan` char(255) NOT NULL DEFAULT '', `mimetype` char(255) NOT NULL DEFAULT '', - `title` text NOT NULL DEFAULT '', - `body` mediumtext NOT NULL DEFAULT '', + `title` text NOT NULL, + `body` mediumtext NOT NULL, `app` char(255) NOT NULL DEFAULT '', `lang` char(64) NOT NULL DEFAULT '', `revision` int(10) unsigned NOT NULL DEFAULT '0', `verb` char(255) NOT NULL DEFAULT '', `obj_type` char(255) NOT NULL DEFAULT '', - `object` text NOT NULL DEFAULT '', + `object` text NOT NULL, `tgt_type` char(255) NOT NULL DEFAULT '', - `target` text NOT NULL DEFAULT '', + `target` text NOT NULL, `layout_mid` char(255) NOT NULL DEFAULT '', - `postopts` text NOT NULL DEFAULT '', - `route` text NOT NULL DEFAULT '', + `postopts` text NOT NULL, + `route` text NOT NULL, `llink` char(255) NOT NULL DEFAULT '', `plink` char(255) NOT NULL DEFAULT '', `resource_id` char(255) NOT NULL DEFAULT '', `resource_type` char(16) NOT NULL DEFAULT '', - `attach` mediumtext NOT NULL DEFAULT '', - `sig` text NOT NULL DEFAULT '', - `diaspora_meta` mediumtext NOT NULL DEFAULT '', + `attach` mediumtext NOT NULL, + `sig` text NOT NULL, + `diaspora_meta` mediumtext NOT NULL, `location` char(255) NOT NULL DEFAULT '', `coord` char(255) NOT NULL DEFAULT '', `public_policy` char(255) NOT NULL DEFAULT '', `comment_policy` char(255) NOT NULL DEFAULT '', - `allow_cid` mediumtext NOT NULL DEFAULT '', - `allow_gid` mediumtext NOT NULL DEFAULT '', - `deny_cid` mediumtext NOT NULL DEFAULT '', - `deny_gid` mediumtext NOT NULL DEFAULT '', + `allow_cid` mediumtext NOT NULL, + `allow_gid` mediumtext NOT NULL, + `deny_cid` mediumtext NOT NULL, + `deny_gid` mediumtext NOT NULL, `item_restrict` int(11) NOT NULL DEFAULT '0', `item_flags` int(11) NOT NULL DEFAULT '0', `item_private` tinyint(4) NOT NULL DEFAULT '0', @@ -555,8 +695,6 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `received` (`received`), KEY `uid_commented` (`uid`,`commented`), KEY `uid_created` (`uid`,`created`), - KEY `changed` (`changed`), - KEY `comments_closed` (`comments_closed`), KEY `aid` (`aid`), KEY `owner_xchan` (`owner_xchan`), KEY `author_xchan` (`author_xchan`), @@ -573,9 +711,11 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `mid` (`mid`), KEY `parent_mid` (`parent_mid`), KEY `uid_mid` (`mid`,`uid`), - KEY `public_policy` (`public_policy`), KEY `comment_policy` (`comment_policy`), KEY `layout_mid` (`layout_mid`), + KEY `public_policy` (`public_policy`), + KEY `comments_closed` (`comments_closed`), + KEY `changed` (`changed`), FULLTEXT KEY `title` (`title`), FULLTEXT KEY `body` (`body`), FULLTEXT KEY `allow_cid` (`allow_cid`), @@ -584,12 +724,18 @@ CREATE TABLE IF NOT EXISTS `item` ( FULLTEXT KEY `deny_gid` (`deny_gid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `item_id` +-- + CREATE TABLE IF NOT EXISTS `item_id` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `iid` int(11) NOT NULL, - `uid` int(11) NOT NULL, - `sid` char(255) NOT NULL, - `service` char(255) NOT NULL, + `iid` int(11) NOT NULL DEFAULT '0', + `uid` int(11) NOT NULL DEFAULT '0', + `sid` char(255) NOT NULL DEFAULT '', + `service` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `sid` (`sid`), @@ -597,25 +743,37 @@ CREATE TABLE IF NOT EXISTS `item_id` ( KEY `iid` (`iid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `likes` +-- + CREATE TABLE IF NOT EXISTS `likes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `channel_id` int(11) unsigned NOT NULL DEFAULT '0', + `channel_id` int(10) unsigned NOT NULL DEFAULT '0', `liker` char(128) NOT NULL DEFAULT '', `likee` char(128) NOT NULL DEFAULT '', - `iid` int(10) unsigned NOT NULL DEFAULT '0', + `iid` int(11) unsigned NOT NULL DEFAULT '0', `verb` char(255) NOT NULL DEFAULT '', `target_type` char(255) NOT NULL DEFAULT '', `target_id` char(128) NOT NULL DEFAULT '', `target` mediumtext NOT NULL, PRIMARY KEY (`id`), - KEY `channel_id` (`channel_id`), KEY `liker` (`liker`), KEY `likee` (`likee`), KEY `iid` (`iid`), KEY `verb` (`verb`), KEY `target_type` (`target_type`), + KEY `channel_id` (`channel_id`), KEY `target_id` (`target_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail` +-- CREATE TABLE IF NOT EXISTS `mail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -624,16 +782,15 @@ CREATE TABLE IF NOT EXISTS `mail` ( `from_xchan` char(255) NOT NULL DEFAULT '', `to_xchan` char(255) NOT NULL DEFAULT '', `account_id` int(10) unsigned NOT NULL DEFAULT '0', - `channel_id` int(10) unsigned NOT NULL, + `channel_id` int(10) unsigned NOT NULL DEFAULT '0', `title` text NOT NULL, `body` mediumtext NOT NULL, `attach` mediumtext NOT NULL, - `mid` char(255) NOT NULL, - `parent_mid` char(255) NOT NULL, + `mid` char(255) NOT NULL DEFAULT '', + `parent_mid` char(255) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), - KEY `convid` (`convid`), KEY `created` (`created`), KEY `mail_flags` (`mail_flags`), KEY `account_id` (`account_id`), @@ -642,18 +799,31 @@ CREATE TABLE IF NOT EXISTS `mail` ( KEY `to_xchan` (`to_xchan`), KEY `mid` (`mid`), KEY `parent_mid` (`parent_mid`), - KEY `expires` (`expires`) + KEY `expires` (`expires`), + KEY `convid` (`convid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `manage` +-- + CREATE TABLE IF NOT EXISTS `manage` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', `xchan` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `menu` +-- + CREATE TABLE IF NOT EXISTS `menu` ( `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -666,6 +836,12 @@ CREATE TABLE IF NOT EXISTS `menu` ( KEY `menu_flags` (`menu_flags`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `menu_item` +-- + CREATE TABLE IF NOT EXISTS `menu_item` ( `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mitem_link` char(255) NOT NULL DEFAULT '', @@ -675,7 +851,7 @@ CREATE TABLE IF NOT EXISTS `menu_item` ( `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, `deny_gid` mediumtext NOT NULL, - `mitem_channel_id` int(10) unsigned NOT NULL, + `mitem_channel_id` int(10) unsigned NOT NULL DEFAULT '0', `mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0', `mitem_order` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`mitem_id`), @@ -684,22 +860,28 @@ CREATE TABLE IF NOT EXISTS `menu_item` ( KEY `mitem_flags` (`mitem_flags`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `notify` +-- + CREATE TABLE IF NOT EXISTS `notify` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `hash` char(64) NOT NULL, - `name` char(255) NOT NULL, - `url` char(255) NOT NULL, - `photo` char(255) NOT NULL, - `date` datetime NOT NULL, + `hash` char(64) NOT NULL DEFAULT '', + `name` char(255) NOT NULL DEFAULT '', + `url` char(255) NOT NULL DEFAULT '', + `photo` char(255) NOT NULL DEFAULT '', + `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `msg` mediumtext NOT NULL, - `aid` int(11) NOT NULL, - `uid` int(11) NOT NULL, - `link` char(255) NOT NULL, + `aid` int(11) NOT NULL DEFAULT '0', + `uid` int(11) NOT NULL DEFAULT '0', + `link` char(255) NOT NULL DEFAULT '', `parent` char(255) NOT NULL DEFAULT '', `seen` tinyint(1) NOT NULL DEFAULT '0', - `type` int(11) NOT NULL, - `verb` char(255) NOT NULL, - `otype` char(16) NOT NULL, + `type` int(11) NOT NULL DEFAULT '0', + `verb` char(255) NOT NULL DEFAULT '', + `otype` char(16) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `type` (`type`), KEY `seen` (`seen`), @@ -712,6 +894,12 @@ CREATE TABLE IF NOT EXISTS `notify` ( KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `obj` +-- + CREATE TABLE IF NOT EXISTS `obj` ( `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `obj_page` char(64) NOT NULL DEFAULT '', @@ -731,6 +919,12 @@ CREATE TABLE IF NOT EXISTS `obj` ( KEY `obj_obj` (`obj_obj`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `outq` +-- + CREATE TABLE IF NOT EXISTS `outq` ( `outq_hash` char(255) NOT NULL, `outq_account` int(10) unsigned NOT NULL DEFAULT '0', @@ -753,34 +947,46 @@ CREATE TABLE IF NOT EXISTS `outq` ( KEY `outq_delivered` (`outq_delivered`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `pconfig` +-- + CREATE TABLE IF NOT EXISTS `pconfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', - `cat` char(255) CHARACTER SET ascii NOT NULL, - `k` char(255) CHARACTER SET ascii NOT NULL, + `cat` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', + `k` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', `v` mediumtext NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `access` (`uid`,`cat`,`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `photo` +-- + CREATE TABLE IF NOT EXISTS `photo` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `aid` int(10) unsigned NOT NULL DEFAULT '0', - `uid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL DEFAULT '0', `xchan` char(255) NOT NULL DEFAULT '', - `resource_id` char(255) NOT NULL, - `created` datetime NOT NULL, - `edited` datetime NOT NULL, - `title` char(255) NOT NULL, + `resource_id` 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', + `title` char(255) NOT NULL DEFAULT '', `description` text NOT NULL, - `album` char(255) NOT NULL, - `filename` char(255) NOT NULL, + `album` char(255) NOT NULL DEFAULT '', + `filename` char(255) NOT NULL DEFAULT '', `type` char(128) NOT NULL DEFAULT 'image/jpeg', - `height` smallint(6) NOT NULL, - `width` smallint(6) NOT NULL, + `height` smallint(6) NOT NULL DEFAULT '0', + `width` smallint(6) NOT NULL DEFAULT '0', `size` int(10) unsigned NOT NULL DEFAULT '0', `data` mediumblob NOT NULL, - `scale` tinyint(3) NOT NULL, + `scale` tinyint(3) NOT NULL DEFAULT '0', `profile` tinyint(1) NOT NULL DEFAULT '0', `photo_flags` int(10) unsigned NOT NULL DEFAULT '0', `allow_cid` mediumtext NOT NULL, @@ -800,6 +1006,12 @@ CREATE TABLE IF NOT EXISTS `photo` ( KEY `resource_id` (`resource_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `poll` +-- + CREATE TABLE IF NOT EXISTS `poll` ( `poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `poll_channel` int(10) unsigned NOT NULL DEFAULT '0', @@ -812,6 +1024,12 @@ CREATE TABLE IF NOT EXISTS `poll` ( KEY `poll_votes` (`poll_votes`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `poll_elm` +-- + CREATE TABLE IF NOT EXISTS `poll_elm` ( `pelm_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pelm_poll` int(10) unsigned NOT NULL DEFAULT '0', @@ -823,16 +1041,28 @@ CREATE TABLE IF NOT EXISTS `poll_elm` ( KEY `pelm_result` (`pelm_result`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `profdef` +-- + CREATE TABLE IF NOT EXISTS `profdef` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `field_name` char(255) NOT NULL DEFAULT '', `field_type` char(16) NOT NULL DEFAULT '', `field_desc` char(255) NOT NULL DEFAULT '', `field_help` char(255) NOT NULL DEFAULT '', - `field_inputs` mediumtext NOT NULL DEFAULT '', + `field_inputs` mediumtext NOT NULL, PRIMARY KEY (`id`), KEY `field_name` (`field_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `profext` +-- CREATE TABLE IF NOT EXISTS `profext` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -844,39 +1074,45 @@ CREATE TABLE IF NOT EXISTS `profext` ( KEY `channel_id` (`channel_id`), KEY `hash` (`hash`), KEY `k` (`k`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `profile` +-- CREATE TABLE IF NOT EXISTS `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `profile_guid` char(64) NOT NULL DEFAULT '', `aid` int(10) unsigned NOT NULL DEFAULT '0', - `uid` int(11) NOT NULL, - `profile_name` char(255) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', + `profile_name` char(255) NOT NULL DEFAULT '', `is_default` tinyint(1) NOT NULL DEFAULT '0', `hide_friends` tinyint(1) NOT NULL DEFAULT '0', - `name` char(255) NOT NULL, - `pdesc` char(255) NOT NULL, + `name` char(255) NOT NULL DEFAULT '', + `pdesc` char(255) NOT NULL DEFAULT '', `chandesc` text NOT NULL, `dob` char(32) NOT NULL DEFAULT '0000-00-00', `dob_tz` char(255) NOT NULL DEFAULT 'UTC', - `address` char(255) NOT NULL, - `locality` char(255) NOT NULL, - `region` char(255) NOT NULL, - `postal_code` char(32) NOT NULL, - `country_name` char(255) NOT NULL, - `hometown` char(255) NOT NULL, - `gender` char(32) NOT NULL, - `marital` char(255) NOT NULL, + `address` char(255) NOT NULL DEFAULT '', + `locality` char(255) NOT NULL DEFAULT '', + `region` char(255) NOT NULL DEFAULT '', + `postal_code` char(32) NOT NULL DEFAULT '', + `country_name` char(255) NOT NULL DEFAULT '', + `hometown` char(255) NOT NULL DEFAULT '', + `gender` char(32) NOT NULL DEFAULT '', + `marital` char(255) NOT NULL DEFAULT '', `with` text NOT NULL, `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `sexual` char(255) NOT NULL, - `politic` char(255) NOT NULL, - `religion` char(255) NOT NULL, + `sexual` char(255) NOT NULL DEFAULT '', + `politic` char(255) NOT NULL DEFAULT '', + `religion` char(255) NOT NULL DEFAULT '', `keywords` text NOT NULL, `likes` text NOT NULL, `dislikes` text NOT NULL, `about` text NOT NULL, - `summary` char(255) NOT NULL, + `summary` char(255) NOT NULL DEFAULT '', `music` text NOT NULL, `book` text NOT NULL, `tv` text NOT NULL, @@ -887,9 +1123,9 @@ CREATE TABLE IF NOT EXISTS `profile` ( `education` text NOT NULL, `contact` text NOT NULL, `channels` text NOT NULL, - `homepage` char(255) NOT NULL, - `photo` char(255) NOT NULL, - `thumb` char(255) NOT NULL, + `homepage` char(255) NOT NULL DEFAULT '', + `photo` char(255) NOT NULL DEFAULT '', + `thumb` char(255) NOT NULL DEFAULT '', `publish` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `guid` (`profile_guid`,`uid`), @@ -908,13 +1144,19 @@ CREATE TABLE IF NOT EXISTS `profile` ( KEY `profile_guid` (`profile_guid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `profile_check` +-- + CREATE TABLE IF NOT EXISTS `profile_check` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `uid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL DEFAULT '0', `cid` int(10) unsigned NOT NULL DEFAULT '0', - `dfrn_id` char(255) NOT NULL, - `sec` char(255) NOT NULL, - `expire` int(11) NOT NULL, + `dfrn_id` char(255) NOT NULL DEFAULT '', + `sec` char(255) NOT NULL DEFAULT '', + `expire` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `cid` (`cid`), @@ -923,29 +1165,47 @@ CREATE TABLE IF NOT EXISTS `profile_check` ( KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `register` +-- + CREATE TABLE IF NOT EXISTS `register` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `hash` char(255) NOT NULL, - `created` datetime NOT NULL, - `uid` int(10) unsigned NOT NULL, - `password` char(255) NOT NULL, - `language` char(16) NOT NULL, + `hash` char(255) NOT NULL DEFAULT '', + `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `uid` int(10) unsigned NOT NULL DEFAULT '0', + `password` char(255) NOT NULL DEFAULT '', + `language` char(16) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `hash` (`hash`), KEY `created` (`created`), KEY `uid` (`uid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `session` +-- CREATE TABLE IF NOT EXISTS `session` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `sid` char(255) NOT NULL, + `sid` char(255) NOT NULL DEFAULT '', `data` text NOT NULL, - `expire` bigint(20) unsigned NOT NULL, + `expire` bigint(20) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `sid` (`sid`), KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `shares` +-- + CREATE TABLE IF NOT EXISTS `shares` ( `share_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `share_type` int(11) NOT NULL DEFAULT '0', @@ -957,18 +1217,30 @@ CREATE TABLE IF NOT EXISTS `shares` ( KEY `share_xchan` (`share_xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `sign` +-- + CREATE TABLE IF NOT EXISTS `sign` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `iid` int(10) unsigned NOT NULL DEFAULT '0', `retract_iid` int(10) unsigned NOT NULL DEFAULT '0', `signed_text` mediumtext NOT NULL, `signature` text NOT NULL, - `signer` char(255) NOT NULL, + `signer` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `iid` (`iid`), KEY `retract_iid` (`retract_iid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `site` +-- + CREATE TABLE IF NOT EXISTS `site` ( `site_url` char(255) NOT NULL, `site_access` int(11) NOT NULL DEFAULT '0', @@ -988,9 +1260,16 @@ CREATE TABLE IF NOT EXISTS `site` ( KEY `site_register` (`site_register`), KEY `site_access` (`site_access`), KEY `site_sellpage` (`site_sellpage`), + KEY `site_pull` (`site_pull`), KEY `site_realm` (`site_realm`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `source` +-- + CREATE TABLE IF NOT EXISTS `source` ( `src_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `src_channel_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -1003,12 +1282,18 @@ CREATE TABLE IF NOT EXISTS `source` ( KEY `src_xchan` (`src_xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `spam` +-- + CREATE TABLE IF NOT EXISTS `spam` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `uid` int(11) NOT NULL, + `uid` int(11) NOT NULL DEFAULT '0', `spam` int(11) NOT NULL DEFAULT '0', `ham` int(11) NOT NULL DEFAULT '0', - `term` char(255) NOT NULL, + `term` char(255) NOT NULL DEFAULT '', `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `uid` (`uid`), @@ -1017,25 +1302,37 @@ CREATE TABLE IF NOT EXISTS `spam` ( KEY `term` (`term`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_perms` +-- + CREATE TABLE IF NOT EXISTS `sys_perms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cat` char(255) NOT NULL, - `k` char(255) NOT NULL, + `cat` char(255) NOT NULL DEFAULT '', + `k` char(255) NOT NULL DEFAULT '', `v` mediumtext NOT NULL, - `public_perm` tinyint(1) unsigned NOT NULL, + `public_perm` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `term` +-- + CREATE TABLE IF NOT EXISTS `term` ( `tid` int(10) unsigned NOT NULL AUTO_INCREMENT, `aid` int(10) unsigned NOT NULL DEFAULT '0', `uid` int(10) unsigned NOT NULL DEFAULT '0', - `oid` int(10) unsigned NOT NULL, - `otype` tinyint(3) unsigned NOT NULL, - `type` tinyint(3) unsigned NOT NULL, - `term` char(255) NOT NULL, - `url` char(255) NOT NULL, - `imgurl` char(255) NOT NULL, + `oid` int(10) unsigned NOT NULL DEFAULT '0', + `otype` tinyint(3) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `term` char(255) NOT NULL DEFAULT '', + `url` char(255) NOT NULL DEFAULT '', + `imgurl` char(255) NOT NULL DEFAULT '', `term_hash` char(255) NOT NULL DEFAULT '', `parent_hash` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`tid`), @@ -1050,22 +1347,34 @@ CREATE TABLE IF NOT EXISTS `term` ( KEY `parent_hash` (`parent_hash`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `tokens` +-- + CREATE TABLE IF NOT EXISTS `tokens` ( - `id` varchar(40) NOT NULL, + `id` varchar(40) NOT NULL DEFAULT '', `secret` text NOT NULL, - `client_id` varchar(20) NOT NULL, - `expires` bigint(20) unsigned NOT NULL, - `scope` varchar(200) NOT NULL, - `uid` int(11) NOT NULL, + `client_id` varchar(20) NOT NULL DEFAULT '', + `expires` bigint(20) unsigned NOT NULL DEFAULT '0', + `scope` varchar(200) NOT NULL DEFAULT '', + `uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `client_id` (`client_id`), KEY `expires` (`expires`), KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `updates` +-- + CREATE TABLE IF NOT EXISTS `updates` ( `ud_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `ud_hash` char(128) NOT NULL, + `ud_hash` char(128) NOT NULL DEFAULT '', `ud_guid` char(255) NOT NULL DEFAULT '', `ud_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `ud_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -1080,6 +1389,12 @@ CREATE TABLE IF NOT EXISTS `updates` ( KEY `ud_last` (`ud_last`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `verify` +-- + CREATE TABLE IF NOT EXISTS `verify` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel` int(10) unsigned NOT NULL DEFAULT '0', @@ -1095,6 +1410,12 @@ CREATE TABLE IF NOT EXISTS `verify` ( KEY `created` (`created`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `vote` +-- + CREATE TABLE IF NOT EXISTS `vote` ( `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `vote_poll` int(11) NOT NULL DEFAULT '0', @@ -1107,6 +1428,12 @@ CREATE TABLE IF NOT EXISTS `vote` ( KEY `vote_element` (`vote_element`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xchan` +-- + CREATE TABLE IF NOT EXISTS `xchan` ( `xchan_hash` char(255) NOT NULL, `xchan_guid` char(255) NOT NULL DEFAULT '', @@ -1139,6 +1466,12 @@ CREATE TABLE IF NOT EXISTS `xchan` ( KEY `xchan_follow` (`xchan_follow`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xchat` +-- + CREATE TABLE IF NOT EXISTS `xchat` ( `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xchat_url` char(255) NOT NULL DEFAULT '', @@ -1150,13 +1483,19 @@ CREATE TABLE IF NOT EXISTS `xchat` ( KEY `xchat_desc` (`xchat_desc`), KEY `xchat_xchan` (`xchat_xchan`), KEY `xchat_edited` (`xchat_edited`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `xconfig` +-- CREATE TABLE IF NOT EXISTS `xconfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `xchan` char(255) NOT NULL, - `cat` char(255) NOT NULL, - `k` char(255) NOT NULL, + `xchan` char(255) NOT NULL DEFAULT '', + `cat` char(255) NOT NULL DEFAULT '', + `k` char(255) NOT NULL DEFAULT '', `v` mediumtext NOT NULL, PRIMARY KEY (`id`), KEY `xchan` (`xchan`), @@ -1164,6 +1503,12 @@ CREATE TABLE IF NOT EXISTS `xconfig` ( KEY `k` (`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xign` +-- + CREATE TABLE IF NOT EXISTS `xign` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', @@ -1173,6 +1518,12 @@ CREATE TABLE IF NOT EXISTS `xign` ( KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xlink` +-- + CREATE TABLE IF NOT EXISTS `xlink` ( `xlink_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xlink_xchan` char(255) NOT NULL DEFAULT '', @@ -1186,6 +1537,12 @@ CREATE TABLE IF NOT EXISTS `xlink` ( KEY `xlink_rating` (`xlink_rating`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xprof` +-- + CREATE TABLE IF NOT EXISTS `xprof` ( `xprof_hash` char(255) NOT NULL, `xprof_age` tinyint(3) unsigned NOT NULL DEFAULT '0', @@ -1216,9 +1573,15 @@ CREATE TABLE IF NOT EXISTS `xprof` ( KEY `xprof_hometown` (`xprof_hometown`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xtag` +-- + CREATE TABLE IF NOT EXISTS `xtag` ( `xtag_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `xtag_hash` char(255) NOT NULL, + `xtag_hash` char(255) NOT NULL DEFAULT '', `xtag_term` char(255) NOT NULL DEFAULT '', `xtag_flags` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`xtag_id`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql new file mode 100644 index 000000000..85eb802d2 --- /dev/null +++ b/install/schema_postgres.sql @@ -0,0 +1,1190 @@ +CREATE TABLE "abook" ( + "abook_id" serial NOT NULL, + "abook_account" bigint NOT NULL, + "abook_channel" bigint NOT NULL, + "abook_xchan" text NOT NULL DEFAULT '', + "abook_my_perms" bigint NOT NULL DEFAULT '0', + "abook_their_perms" bigint NOT NULL DEFAULT '0', + "abook_closeness" numeric(3) NOT NULL DEFAULT '99', + "abook_rating" bigint NOT NULL DEFAULT '0', + "abook_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "abook_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "abook_connected" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "abook_dob" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "abook_flags" bigint NOT NULL DEFAULT '0', + "abook_profile" char(64) NOT NULL DEFAULT '', + PRIMARY KEY ("abook_id") +); + create index "abook_account" on abook ("abook_account"); + create index "abook_channel" on abook ("abook_channel"); + create index "abook_xchan" on abook ("abook_xchan"); + create index "abook_my_perms" on abook ("abook_my_perms"); + create index "abook_their_perms" on abook ("abook_their_perms"); + create index "abook_closeness" on abook ("abook_closeness"); + create index "abook_created" on abook ("abook_created"); + create index "abook_updated" on abook ("abook_updated"); + create index "abook_flags" on abook ("abook_flags"); + create index "abook_profile" on abook ("abook_profile"); + create index "abook_dob" on abook ("abook_dob"); + create index "abook_connected" on abook ("abook_connected"); + create index "abook_rating" on abook ("abook_rating"); + +CREATE TABLE "account" ( + "account_id" serial NOT NULL, + "account_parent" bigint NOT NULL DEFAULT '0', + "account_default_channel" bigint NOT NULL DEFAULT '0', + "account_salt" char(32) NOT NULL DEFAULT '', + "account_password" text NOT NULL DEFAULT '', + "account_email" text NOT NULL DEFAULT '', + "account_external" text NOT NULL DEFAULT '', + "account_language" varchar(16) NOT NULL DEFAULT 'en', + "account_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "account_lastlog" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "account_flags" bigint NOT NULL DEFAULT '0', + "account_roles" bigint NOT NULL DEFAULT '0', + "account_reset" text NOT NULL DEFAULT '', + "account_expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "account_expire_notified" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "account_service_class" varchar(32) NOT NULL DEFAULT '', + "account_level" bigint NOT NULL DEFAULT '0', + "account_password_changed" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("account_id") +); +create index "account_email" on account ("account_email"); +create index "account_service_class" on account ("account_service_class"); +create index "account_parent" on account ("account_parent"); +create index "account_flags" on account ("account_flags"); +create index "account_roles" on account ("account_roles"); +create index "account_lastlog" on account ("account_lastlog"); +create index "account_expires" on account ("account_expires"); +create index "account_default_channel" on account ("account_default_channel"); +create index "account_external" on account ("account_external"); +create index "account_level" on account ("account_level"); +create index "account_password_changed" on account ("account_password_changed"); +CREATE TABLE "addon" ( + "id" serial NOT NULL, + "name" text NOT NULL, + "version" text NOT NULL DEFAULT '0', + "installed" numeric(1) NOT NULL DEFAULT '0', + "hidden" numeric(1) NOT NULL DEFAULT '0', + "timestamp" numeric(20) NOT NULL DEFAULT '0', + "plugin_admin" numeric(1) NOT NULL DEFAULT '0', + PRIMARY KEY ("id") +); +create index "addon_hidden_idx" on addon ("hidden"); +create index "addon_name_idx" on addon ("name"); +create index "addon_installed_idx" on addon ("installed"); +CREATE TABLE "app" ( + "id" serial NOT NULL, + "app_id" text NOT NULL DEFAULT '', + "app_sig" text NOT NULL DEFAULT '', + "app_author" text NOT NULL DEFAULT '', + "app_name" text NOT NULL DEFAULT '', + "app_desc" text NOT NULL, + "app_url" text NOT NULL DEFAULT '', + "app_photo" text NOT NULL DEFAULT '', + "app_version" text NOT NULL DEFAULT '', + "app_channel" bigint NOT NULL DEFAULT '0', + "app_addr" text NOT NULL DEFAULT '', + "app_price" text NOT NULL DEFAULT '', + "app_page" text NOT NULL DEFAULT '', + "app_requires" text NOT NULL DEFAULT '', + PRIMARY KEY ("id") +); +create index "app_id" on app ("app_id"); +create index "app_name" on app ("app_name"); +create index "app_url" on app ("app_url"); +create index "app_photo" on app ("app_photo"); +create index "app_version" on app ("app_version"); +create index "app_channel" on app ("app_channel"); +create index "app_price" on app ("app_price"); +CREATE TABLE "attach" ( + "id" serial NOT NULL, + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL DEFAULT '0', + "hash" varchar(64) NOT NULL DEFAULT '', + "creator" varchar(128) NOT NULL DEFAULT '', + "filename" text NOT NULL DEFAULT '', + "filetype" varchar(64) NOT NULL DEFAULT '', + "filesize" bigint NOT NULL DEFAULT '0', + "revision" bigint NOT NULL DEFAULT '0', + "folder" varchar(64) NOT NULL DEFAULT '', + "flags" bigint NOT NULL DEFAULT '0', + "data" bytea NOT NULL, + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + PRIMARY KEY ("id") + +); +create index "attach_aid_idx" on attach ("aid"); +create index "attach_uid_idx" on attach ("uid"); +create index "attach_hash_idx" on attach ("hash"); +create index "attach_filename_idx" on attach ("filename"); +create index "attach_filetype_idx" on attach ("filetype"); +create index "attach_filesize_idx" on attach ("filesize"); +create index "attach_created_idx" on attach ("created"); +create index "attach_edited_idx" on attach ("edited"); +create index "attach_revision_idx" on attach ("revision"); +create index "attach_folder_idx" on attach ("folder"); +create index "attach_flags_idx" on attach ("flags"); +create index "attach_creator_idx" on attach ("creator"); +CREATE TABLE "auth_codes" ( + "id" varchar(40) NOT NULL, + "client_id" varchar(20) NOT NULL, + "redirect_uri" varchar(200) NOT NULL, + "expires" bigint NOT NULL, + "scope" varchar(250) NOT NULL, + PRIMARY KEY ("id") +); +CREATE TABLE "cache" ( + "k" text NOT NULL, + "v" text NOT NULL, + "updated" timestamp NOT NULL, + PRIMARY KEY ("k") +); +CREATE TABLE "channel" ( + "channel_id" serial NOT NULL, + "channel_account_id" bigint NOT NULL DEFAULT '0', + "channel_primary" numeric(1) NOT NULL DEFAULT '0', + "channel_name" text NOT NULL DEFAULT '', + "channel_address" text NOT NULL DEFAULT '', + "channel_guid" text NOT NULL DEFAULT '', + "channel_guid_sig" text NOT NULL, + "channel_hash" text NOT NULL DEFAULT '', + "channel_timezone" varchar(128) NOT NULL DEFAULT 'UTC', + "channel_location" text NOT NULL DEFAULT '', + "channel_theme" text NOT NULL DEFAULT '', + "channel_startpage" text NOT NULL DEFAULT '', + "channel_pubkey" text NOT NULL, + "channel_prvkey" text NOT NULL, + "channel_notifyflags" bigint NOT NULL DEFAULT '65535', + "channel_pageflags" bigint NOT NULL DEFAULT '0', + "channel_dirdate" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "channel_deleted" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "channel_max_anon_mail" bigint NOT NULL DEFAULT '10', + "channel_max_friend_req" bigint NOT NULL DEFAULT '10', + "channel_expire_days" bigint NOT NULL DEFAULT '0', + "channel_passwd_reset" text NOT NULL DEFAULT '', + "channel_default_group" text NOT NULL DEFAULT '', + "channel_allow_cid" text , + "channel_allow_gid" text , + "channel_deny_cid" text , + "channel_deny_gid" text , + "channel_r_stream" bigint NOT NULL DEFAULT '128', + "channel_r_profile" bigint NOT NULL DEFAULT '128', + "channel_r_photos" bigint NOT NULL DEFAULT '128', + "channel_r_abook" bigint NOT NULL DEFAULT '128', + "channel_w_stream" bigint NOT NULL DEFAULT '128', + "channel_w_wall" bigint NOT NULL DEFAULT '128', + "channel_w_tagwall" bigint NOT NULL DEFAULT '128', + "channel_w_comment" bigint NOT NULL DEFAULT '128', + "channel_w_mail" bigint NOT NULL DEFAULT '128', + "channel_w_photos" bigint NOT NULL DEFAULT '128', + "channel_w_chat" bigint NOT NULL DEFAULT '128', + "channel_a_delegate" bigint NOT NULL DEFAULT '0', + "channel_r_storage" bigint NOT NULL DEFAULT '128', + "channel_w_storage" bigint NOT NULL DEFAULT '128', + "channel_r_pages" bigint NOT NULL DEFAULT '128', + "channel_w_pages" bigint NOT NULL DEFAULT '128', + "channel_a_republish" bigint NOT NULL DEFAULT '128', + "channel_w_like" bigint NOT NULL DEFAULT '128', + PRIMARY KEY ("channel_id"), + UNIQUE ("channel_address") +); +create index "channel_account_id" on channel ("channel_account_id"); +create index "channel_primary" on channel ("channel_primary"); +create index "channel_name" on channel ("channel_name"); +create index "channel_timezone" on channel ("channel_timezone"); +create index "channel_location" on channel ("channel_location"); +create index "channel_theme" on channel ("channel_theme"); +create index "channel_notifyflags" on channel ("channel_notifyflags"); +create index "channel_pageflags" on channel ("channel_pageflags"); +create index "channel_max_anon_mail" on channel ("channel_max_anon_mail"); +create index "channel_max_friend_req" on channel ("channel_max_friend_req"); +create index "channel_default_gid" on channel ("channel_default_group"); +create index "channel_r_stream" on channel ("channel_r_stream"); +create index "channel_r_profile" on channel ("channel_r_profile"); +create index "channel_r_photos" on channel ("channel_r_photos"); +create index "channel_r_abook" on channel ("channel_r_abook"); +create index "channel_w_stream" on channel ("channel_w_stream"); +create index "channel_w_wall" on channel ("channel_w_wall"); +create index "channel_w_tagwall" on channel ("channel_w_tagwall"); +create index "channel_w_comment" on channel ("channel_w_comment"); +create index "channel_w_mail" on channel ("channel_w_mail"); +create index "channel_w_photos" on channel ("channel_w_photos"); +create index "channel_w_chat" on channel ("channel_w_chat"); +create index "channel_guid" on channel ("channel_guid"); +create index "channel_hash" on channel ("channel_hash"); +create index "channel_expire_days" on channel ("channel_expire_days"); +create index "channel_a_delegate" on channel ("channel_a_delegate"); +create index "channel_r_storage" on channel ("channel_r_storage"); +create index "channel_w_storage" on channel ("channel_w_storage"); +create index "channel_r_pages" on channel ("channel_r_pages"); +create index "channel_w_pages" on channel ("channel_w_pages"); +create index "channel_deleted" on channel ("channel_deleted"); +create index "channel_a_republish" on channel ("channel_a_republish"); +create index "channel_w_like" on channel ("channel_w_like"); +create index "channel_dirdate" on channel ("channel_dirdate"); +CREATE TABLE "chat" ( + "chat_id" serial NOT NULL, + "chat_room" bigint NOT NULL DEFAULT '0', + "chat_xchan" text NOT NULL DEFAULT '', + "chat_text" text NOT NULL, + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("chat_id") +); +create index "chat_room_idx" on chat ("chat_room"); +create index "chat_xchan_idx" on chat ("chat_xchan"); +create index "chat_created_idx" on chat ("created"); +CREATE TABLE "chatpresence" ( + "cp_id" serial NOT NULL, + "cp_room" bigint NOT NULL DEFAULT '0', + "cp_xchan" text NOT NULL DEFAULT '', + "cp_last" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "cp_status" text NOT NULL, + "cp_client" char(128) NOT NULL DEFAULT '', + PRIMARY KEY ("cp_id") +); +create index "cp_room" on chatpresence ("cp_room"); +create index "cp_xchan" on chatpresence ("cp_xchan"); +create index "cp_last" on chatpresence ("cp_last"); +create index "cp_status" on chatpresence ("cp_status"); + +CREATE TABLE "chatroom" ( + "cr_id" serial NOT NULL, + "cr_aid" bigint NOT NULL DEFAULT '0', + "cr_uid" bigint NOT NULL DEFAULT '0', + "cr_name" text NOT NULL DEFAULT '', + "cr_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "cr_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "cr_expire" bigint NOT NULL DEFAULT '0', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + PRIMARY KEY ("cr_id") +); +create index "cr_aid" on chatroom ("cr_aid"); +create index "cr_uid" on chatroom ("cr_uid"); +create index "cr_name" on chatroom ("cr_name"); +create index "cr_created" on chatroom ("cr_created"); +create index "cr_edited" on chatroom ("cr_edited"); +create index "cr_expire" on chatroom ("cr_expire"); +CREATE TABLE "clients" ( + "client_id" varchar(20) NOT NULL, + "pw" varchar(20) NOT NULL, + "redirect_uri" varchar(200) NOT NULL, + "name" text, + "icon" text, + "uid" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("client_id") +); +CREATE TABLE "config" ( + "id" serial NOT NULL, + "cat" text NOT NULL, + "k" text NOT NULL, + "v" text NOT NULL, + PRIMARY KEY ("id"), + UNIQUE ("cat","k") +); +CREATE TABLE "conv" ( + "id" serial NOT NULL, + "guid" text NOT NULL, + "recips" text NOT NULL, + "uid" bigint NOT NULL, + "creator" text NOT NULL, + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "subject" text NOT NULL, + PRIMARY KEY ("id") +); +create index "conv_created_idx" on conv ("created"); +create index "conv_updated_idx" on conv ("updated"); + +CREATE TABLE "event" ( + "id" serial NOT NULL, + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL, + "event_xchan" text NOT NULL DEFAULT '', + "event_hash" text NOT NULL DEFAULT '', + "created" timestamp NOT NULL, + "edited" timestamp NOT NULL, + "start" timestamp NOT NULL, + "finish" timestamp NOT NULL, + "summary" text NOT NULL, + "description" text NOT NULL, + "location" text NOT NULL, + "type" text NOT NULL, + "nofinish" numeric(1) NOT NULL DEFAULT '0', + "adjust" numeric(1) NOT NULL DEFAULT '1', + "ignore" numeric(1) NOT NULL DEFAULT '0', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + PRIMARY KEY ("id") +); +create index "event_uid_idx" on event ("uid"); +create index "event_type_idx" on event ("type"); +create index "event_start_idx" on event ("start"); +create index "event_finish_idx" on event ("finish"); +create index "event_adjust_idx" on event ("adjust"); +create index "event_nofinish_idx" on event ("nofinish"); +create index "event_ignore_idx" on event ("ignore"); +create index "event_aid_idx" on event ("aid"); +create index "event_hash_idx" on event ("event_hash"); +create index "event_xchan_idx" on event ("event_xchan"); + + +CREATE TABLE "fcontact" ( + "id" serial NOT NULL, + "url" text NOT NULL, + "name" text NOT NULL, + "photo" text NOT NULL, + "request" text NOT NULL, + "nick" text NOT NULL, + "addr" text NOT NULL, + "batch" text NOT NULL, + "notify" text NOT NULL, + "poll" text NOT NULL, + "confirm" text NOT NULL, + "priority" numeric(1) NOT NULL, + "network" varchar(32) NOT NULL DEFAULT '', + "alias" text NOT NULL, + "pubkey" text NOT NULL, + "updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("id") +); +create index "fcontact_addr_idx" on fcontact ("addr"); +create index "fcontact_network_idx" on fcontact ("network"); + +CREATE TABLE "ffinder" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "cid" bigint NOT NULL, + "fid" bigint NOT NULL, + PRIMARY KEY ("id") +); +create index "ffinder_uid_idx" on ffinder ("uid"); +create index "ffinder_cid_idx" on ffinder ("cid"); +create index "ffinder_fid_idx" on ffinder ("fid"); + +CREATE TABLE "fserver" ( + "id" serial NOT NULL, + "server" text NOT NULL, + "posturl" text NOT NULL, + "key" text NOT NULL, + PRIMARY KEY ("id") +); +create index "fserver_server_idx" on fserver ("server"); +create index "fserver_posturl_idx" on fserver ("posturl"); + +CREATE TABLE "fsuggest" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "cid" bigint NOT NULL, + "name" text NOT NULL, + "url" text NOT NULL, + "request" text NOT NULL, + "photo" text NOT NULL, + "note" text NOT NULL, + "created" timestamp NOT NULL, + PRIMARY KEY ("id") +); +CREATE TABLE "group_member" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "gid" bigint NOT NULL, + "xchan" text NOT NULL DEFAULT '', + PRIMARY KEY ("id") +); +create index "groupmember_uid" on group_member ("uid"); +create index "groupmember_gid" on group_member ("gid"); +create index "groupmember_xchan" on group_member ("xchan"); + +CREATE TABLE "groups" ( + "id" serial NOT NULL, + "hash" text NOT NULL DEFAULT '', + "uid" bigint NOT NULL, + "visible" numeric(1) NOT NULL DEFAULT '0', + "deleted" numeric(1) NOT NULL DEFAULT '0', + "name" text NOT NULL, + PRIMARY KEY ("id") + +); +create index "groups_uid_idx" on groups ("uid"); +create index "groups_visible_idx" on groups ("visible"); +create index "groups_deleted_idx" on groups ("deleted"); +create index "groups_hash_idx" on groups ("hash"); + +CREATE TABLE "hook" ( + "id" serial NOT NULL, + "hook" text NOT NULL, + "file" text NOT NULL, + "function" text NOT NULL, + "priority" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("id") + +); +create index "hook_idx" on hook ("hook"); +CREATE TABLE "hubloc" ( + "hubloc_id" serial NOT NULL, + "hubloc_guid" text NOT NULL DEFAULT '', + "hubloc_guid_sig" text NOT NULL DEFAULT '', + "hubloc_hash" text NOT NULL, + "hubloc_addr" text NOT NULL DEFAULT '', + "hubloc_network" text NOT NULL DEFAULT '', + "hubloc_flags" bigint NOT NULL DEFAULT '0', + "hubloc_status" bigint NOT NULL DEFAULT '0', + "hubloc_url" text NOT NULL DEFAULT '', + "hubloc_url_sig" text NOT NULL DEFAULT '', + "hubloc_host" text NOT NULL DEFAULT '', + "hubloc_callback" text NOT NULL DEFAULT '', + "hubloc_connect" text NOT NULL DEFAULT '', + "hubloc_sitekey" text NOT NULL DEFAULT '', + "hubloc_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "hubloc_connected" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("hubloc_id") +); +create index "hubloc_url" on hubloc ("hubloc_url"); +create index "hubloc_guid" on hubloc ("hubloc_guid"); +create index "hubloc_flags" on hubloc ("hubloc_flags"); +create index "hubloc_connect" on hubloc ("hubloc_connect"); +create index "hubloc_host" on hubloc ("hubloc_host"); +create index "hubloc_addr" on hubloc ("hubloc_addr"); +create index "hubloc_network" on hubloc ("hubloc_network"); +create index "hubloc_updated" on hubloc ("hubloc_updated"); +create index "hubloc_connected" on hubloc ("hubloc_connected"); +create index "hubloc_status" on hubloc ("hubloc_status"); +CREATE TABLE "issue" ( + "issue_id" serial NOT NULL, + "issue_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "issue_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "issue_assigned" text NOT NULL, + "issue_priority" bigint NOT NULL, + "issue_status" bigint NOT NULL, + "issue_component" text NOT NULL, + PRIMARY KEY ("issue_id") +); +create index "issue_created" on issue ("issue_created"); +create index "issue_updated" on issue ("issue_updated"); +create index "issue_assigned" on issue ("issue_assigned"); +create index "issue_priority" on issue ("issue_priority"); +create index "issue_status" on issue ("issue_status"); +create index "issue_component" on issue ("issue_component"); + +CREATE TABLE "item" ( + "id" serial NOT NULL, + "mid" text NOT NULL DEFAULT '', + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL DEFAULT '0', + "parent" bigint NOT NULL DEFAULT '0', + "parent_mid" text NOT NULL DEFAULT '', + "thr_parent" text NOT NULL DEFAULT '', + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "commented" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "received" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "changed" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "comments_closed" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "owner_xchan" text NOT NULL DEFAULT '', + "author_xchan" text NOT NULL DEFAULT '', + "source_xchan" text NOT NULL DEFAULT '', + "mimetype" text NOT NULL DEFAULT '', + "title" text NOT NULL, + "body" text NOT NULL, + "app" text NOT NULL DEFAULT '', + "lang" varchar(64) NOT NULL DEFAULT '', + "revision" bigint NOT NULL DEFAULT '0', + "verb" text NOT NULL DEFAULT '', + "obj_type" text NOT NULL DEFAULT '', + "object" text NOT NULL, + "tgt_type" text NOT NULL DEFAULT '', + "target" text NOT NULL, + "layout_mid" text NOT NULL DEFAULT '', + "postopts" text NOT NULL DEFAULT '', + "route" text NOT NULL DEFAULT '', + "llink" text NOT NULL DEFAULT '', + "plink" text NOT NULL DEFAULT '', + "resource_id" text NOT NULL DEFAULT '', + "resource_type" varchar(16) NOT NULL DEFAULT '', + "attach" text NOT NULL, + "sig" text NOT NULL DEFAULT '', + "diaspora_meta" text NOT NULL DEFAULT '', + "location" text NOT NULL DEFAULT '', + "coord" text NOT NULL DEFAULT '', + "public_policy" text NOT NULL DEFAULT '', + "comment_policy" text NOT NULL DEFAULT '', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + "item_restrict" bigint NOT NULL DEFAULT '0', + "item_flags" bigint NOT NULL DEFAULT '0', + "item_private" numeric(4) NOT NULL DEFAULT '0', + "item_search_vector" tsvector, + PRIMARY KEY ("id") +); +create index "item_uid" on item ("uid"); +create index "item_parent" on item ("parent"); +create index "item_created" on item ("created"); +create index "item_edited" on item ("edited"); +create index "item_received" on item ("received"); +create index "item_uid_commented" on item ("uid","commented"); +create index "item_uid_created" on item ("uid","created"); +create index "item_changed" on item ("changed"); +create index "item_comments_closed" on item ("comments_closed"); +create index "item_aid" on item ("aid"); +create index "item_owner_xchan" on item ("owner_xchan"); +create index "item_author_xchan" on item ("author_xchan"); +create index "item_resource_type" on item ("resource_type"); +create index "item_restrict" on item ("item_restrict"); +create index "item_flags" on item ("item_flags"); +create index "item_commented" on item ("commented"); +create index "item_verb" on item ("verb"); +create index "item_private" on item ("item_private"); +create index "item_llink" on item ("llink"); +create index "item_expires" on item ("expires"); +create index "item_revision" on item ("revision"); +create index "item_mimetype" on item ("mimetype"); +create index "item_mid" on item ("mid"); +create index "item_parent_mid" on item ("parent_mid"); +create index "item_uid_mid" on item ("mid","uid"); +create index "item_public_policy" on item ("public_policy"); +create index "item_comment_policy" on item ("comment_policy"); +create index "item_layout_mid" on item ("layout_mid"); + +-- fulltext indexes +create index "item_search_idx" on item USING gist("item_search_vector"); +create index "item_allow_cid" on item ("allow_cid"); +create index "item_allow_gid" on item ("allow_gid"); +create index "item_deny_cid" on item ("deny_cid"); +create index "item_deny_gid" on item ("deny_gid"); + +CREATE TABLE "item_id" ( + "id" serial NOT NULL, + "iid" bigint NOT NULL, + "uid" bigint NOT NULL, + "sid" text NOT NULL, + "service" text NOT NULL, + PRIMARY KEY ("id") + +); +create index "itemid_uid" on item_id ("uid"); +create index "itemid_sid" on item_id ("sid"); +create index "itemid_service" on item_id ("service"); +create index "itemid_iid" on item_id ("iid"); +CREATE TABLE "likes" ( + "id" serial NOT NULL, + "channel_id" bigint NOT NULL DEFAULT '0', + "liker" char(128) NOT NULL DEFAULT '', + "likee" char(128) NOT NULL DEFAULT '', + "iid" bigint NOT NULL DEFAULT '0', + "verb" text NOT NULL DEFAULT '', + "target_type" text NOT NULL DEFAULT '', + "target_id" char(128) NOT NULL DEFAULT '', + "target" text NOT NULL, + PRIMARY KEY ("id") +); +create index "likes_channel_id" on likes ("channel_id"); +create index "likes_liker" on likes ("liker"); +create index "likes_likee" on likes ("likee"); +create index "likes_iid" on likes ("iid"); +create index "likes_verb" on likes ("verb"); +create index "likes_target_type" on likes ("target_type"); +create index "likes_target_id" on likes ("target_id"); +CREATE TABLE "mail" ( + "id" serial NOT NULL, + "convid" bigint NOT NULL DEFAULT '0', + "mail_flags" bigint NOT NULL DEFAULT '0', + "from_xchan" text NOT NULL DEFAULT '', + "to_xchan" text NOT NULL DEFAULT '', + "account_id" bigint NOT NULL DEFAULT '0', + "channel_id" bigint NOT NULL, + "title" text NOT NULL, + "body" text NOT NULL, + "attach" text NOT NULL DEFAULT '', + "mid" text NOT NULL, + "parent_mid" text NOT NULL, + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("id") +); +create index "mail_convid" on mail ("convid"); +create index "mail_created" on mail ("created"); +create index "mail_flags" on mail ("mail_flags"); +create index "mail_account_id" on mail ("account_id"); +create index "mail_channel_id" on mail ("channel_id"); +create index "mail_from_xchan" on mail ("from_xchan"); +create index "mail_to_xchan" on mail ("to_xchan"); +create index "mail_mid" on mail ("mid"); +create index "mail_parent_mid" on mail ("parent_mid"); +create index "mail_expires" on mail ("expires"); +CREATE TABLE "manage" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "xchan" text NOT NULL DEFAULT '', + PRIMARY KEY ("id") + +); +create index "manage_uid" on manage ("uid"); +create index "manage_xchan" on manage ("xchan"); +CREATE TABLE "menu" ( + "menu_id" serial NOT NULL, + "menu_channel_id" bigint NOT NULL DEFAULT '0', + "menu_name" text NOT NULL DEFAULT '', + "menu_desc" text NOT NULL DEFAULT '', + "menu_flags" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("menu_id") +); +create index "menu_channel_id" on menu ("menu_channel_id"); +create index "menu_name" on menu ("menu_name"); +create index "menu_flags" on menu ("menu_flags"); +CREATE TABLE "menu_item" ( + "mitem_id" serial NOT NULL, + "mitem_link" text NOT NULL DEFAULT '', + "mitem_desc" text NOT NULL DEFAULT '', + "mitem_flags" bigint NOT NULL DEFAULT '0', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + "mitem_channel_id" bigint NOT NULL, + "mitem_menu_id" bigint NOT NULL DEFAULT '0', + "mitem_order" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("mitem_id") + +); +create index "mitem_channel_id" on menu_item ("mitem_channel_id"); +create index "mitem_menu_id" on menu_item ("mitem_menu_id"); +create index "mitem_flags" on menu_item ("mitem_flags"); +CREATE TABLE "notify" ( + "id" serial NOT NULL, + "hash" char(64) NOT NULL, + "name" text NOT NULL, + "url" text NOT NULL, + "photo" text NOT NULL, + "date" timestamp NOT NULL, + "msg" text NOT NULL DEFAULT '', + "aid" bigint NOT NULL, + "uid" bigint NOT NULL, + "link" text NOT NULL, + "parent" text NOT NULL DEFAULT '', + "seen" numeric(1) NOT NULL DEFAULT '0', + "type" bigint NOT NULL, + "verb" text NOT NULL, + "otype" varchar(16) NOT NULL, + PRIMARY KEY ("id") +); +create index "notify_type" on notify ("type"); +create index "notify_seen" on notify ("seen"); +create index "notify_uid" on notify ("uid"); +create index "notify_date" on notify ("date"); +create index "notify_hash" on notify ("hash"); +create index "notify_parent" on notify ("parent"); +create index "notify_link" on notify ("link"); +create index "notify_otype" on notify ("otype"); +create index "notify_aid" on notify ("aid"); +CREATE TABLE "obj" ( + "obj_id" serial NOT NULL, + "obj_page" char(64) NOT NULL DEFAULT '', + "obj_verb" text NOT NULL DEFAULT '', + "obj_type" bigint NOT NULL DEFAULT '0', + "obj_obj" text NOT NULL DEFAULT '', + "obj_channel" bigint NOT NULL DEFAULT '0', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + PRIMARY KEY ("obj_id") + +); +create index "obj_verb" on obj ("obj_verb"); +create index "obj_page" on obj ("obj_page"); +create index "obj_type" on obj ("obj_type"); +create index "obj_channel" on obj ("obj_channel"); +create index "obj_obj" on obj ("obj_obj"); + +CREATE TABLE "outq" ( + "outq_hash" text NOT NULL, + "outq_account" bigint NOT NULL DEFAULT '0', + "outq_channel" bigint NOT NULL DEFAULT '0', + "outq_driver" varchar(32) NOT NULL DEFAULT '', + "outq_posturl" text NOT NULL DEFAULT '', + "outq_async" numeric(1) NOT NULL DEFAULT '0', + "outq_delivered" numeric(1) NOT NULL DEFAULT '0', + "outq_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "outq_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "outq_notify" text NOT NULL, + "outq_msg" text NOT NULL, + PRIMARY KEY ("outq_hash") +); +create index "outq_account" on outq ("outq_account"); +create index "outq_channel" on outq ("outq_channel"); +create index "outq_hub" on outq ("outq_posturl"); +create index "outq_created" on outq ("outq_created"); +create index "outq_updated" on outq ("outq_updated"); +create index "outq_async" on outq ("outq_async"); +create index "outq_delivered" on outq ("outq_delivered"); + +CREATE TABLE "pconfig" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL DEFAULT '0', + "cat" text NOT NULL, + "k" text NOT NULL, + "v" text NOT NULL, + PRIMARY KEY ("id"), + UNIQUE ("uid","cat","k") +); +CREATE TABLE "photo" ( + "id" serial NOT NULL, + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL, + "xchan" text NOT NULL DEFAULT '', + "resource_id" text NOT NULL, + "created" timestamp NOT NULL, + "edited" timestamp NOT NULL, + "title" text NOT NULL, + "description" text NOT NULL, + "album" text NOT NULL, + "filename" text NOT NULL, + "type" varchar(128) NOT NULL DEFAULT 'image/jpeg', + "height" numeric(6) NOT NULL, + "width" numeric(6) NOT NULL, + "size" bigint NOT NULL DEFAULT '0', + "data" bytea NOT NULL, + "scale" numeric(3) NOT NULL, + "profile" numeric(1) NOT NULL DEFAULT '0', + "photo_flags" bigint NOT NULL DEFAULT '0', + "allow_cid" text NOT NULL, + "allow_gid" text NOT NULL, + "deny_cid" text NOT NULL, + "deny_gid" text NOT NULL, + PRIMARY KEY ("id") +); +create index "photo_uid" on photo ("uid"); +create index "photo_album" on photo ("album"); +create index "photo_scale" on photo ("scale"); +create index "photo_profile" on photo ("profile"); +create index "photo_flags" on photo ("photo_flags"); +create index "photo_type" on photo ("type"); +create index "photo_aid" on photo ("aid"); +create index "photo_xchan" on photo ("xchan"); +create index "photo_size" on photo ("size"); +create index "photo_resource_id" on photo ("resource_id"); + +CREATE TABLE "poll" ( + "poll_id" serial NOT NULL, + "poll_channel" bigint NOT NULL DEFAULT '0', + "poll_desc" text NOT NULL, + "poll_flags" bigint NOT NULL DEFAULT '0', + "poll_votes" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("poll_id") + +); +create index "poll_channel" on poll ("poll_channel"); +create index "poll_flags" on poll ("poll_flags"); +create index "poll_votes" on poll ("poll_votes"); +CREATE TABLE "poll_elm" ( + "pelm_id" serial NOT NULL, + "pelm_poll" bigint NOT NULL DEFAULT '0', + "pelm_desc" text NOT NULL, + "pelm_flags" bigint NOT NULL DEFAULT '0', + "pelm_result" float NOT NULL DEFAULT '0', + PRIMARY KEY ("pelm_id") +); +create index "pelm_poll" on poll_elm ("pelm_poll"); +create index "pelm_result" on poll_elm ("pelm_result"); + +CREATE TABLE "profdef" ( + "id" serial NOT NULL, + "field_name" text NOT NULL DEFAULT '', + "field_type" varchar(16) NOT NULL DEFAULT '', + "field_desc" text NOT NULL DEFAULT '', + "field_help" text NOT NULL DEFAULT '', + "field_inputs" text NOT NULL, + PRIMARY KEY ("id") +); +create index "profdef_field_name" on profdef ("field_name"); +CREATE TABLE "profext" ( + "id" serial NOT NULL, + "channel_id" bigint NOT NULL DEFAULT '0', + "hash" text NOT NULL DEFAULT '', + "k" text NOT NULL DEFAULT '', + "v" text NOT NULL, + PRIMARY KEY ("id") +); +create index "profext_channel_id" on profext ("channel_id"); +create index "profext_hash" on profext ("hash"); +create index "profext_k" on profext ("k"); + +CREATE TABLE "profile" ( + "id" serial NOT NULL, + "profile_guid" char(64) NOT NULL DEFAULT '', + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL, + "profile_name" text NOT NULL, + "is_default" numeric(1) NOT NULL DEFAULT '0', + "hide_friends" numeric(1) NOT NULL DEFAULT '0', + "name" text NOT NULL, + "pdesc" text NOT NULL DEFAULT '', + "chandesc" text NOT NULL DEFAULT '', + "dob" varchar(32) NOT NULL DEFAULT '', + "dob_tz" text NOT NULL DEFAULT 'UTC', + "address" text NOT NULL DEFAULT '', + "locality" text NOT NULL DEFAULT '', + "region" text NOT NULL DEFAULT '', + "postal_code" varchar(32) NOT NULL DEFAULT '', + "country_name" text NOT NULL DEFAULT '', + "hometown" text NOT NULL DEFAULT '', + "gender" varchar(32) NOT NULL DEFAULT '', + "marital" text NOT NULL DEFAULT '', + "with" text NOT NULL DEFAULT '', + "howlong" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "sexual" text NOT NULL DEFAULT '', + "politic" text NOT NULL DEFAULT '', + "religion" text NOT NULL DEFAULT '', + "keywords" text NOT NULL DEFAULT '', + "likes" text NOT NULL DEFAULT '', + "dislikes" text NOT NULL DEFAULT '', + "about" text NOT NULL DEFAULT '', + "summary" text NOT NULL DEFAULT '', + "music" text NOT NULL DEFAULT '', + "book" text NOT NULL DEFAULT '', + "tv" text NOT NULL DEFAULT '', + "film" text NOT NULL DEFAULT '', + "interest" text NOT NULL DEFAULT '', + "romance" text NOT NULL DEFAULT '', + "work" text NOT NULL DEFAULT '', + "education" text NOT NULL DEFAULT '', + "contact" text NOT NULL DEFAULT '', + "channels" text NOT NULL DEFAULT '', + "homepage" text NOT NULL DEFAULT '', + "photo" text NOT NULL, + "thumb" text NOT NULL, + "publish" numeric(1) NOT NULL DEFAULT '0', + PRIMARY KEY ("id"), + UNIQUE ("profile_guid","uid") + +); +create index "profile_uid" on profile ("uid"); +create index "profile_locality" on profile ("locality"); +create index "profile_hometown" on profile ("hometown"); +create index "profile_gender" on profile ("gender"); +create index "profile_marital" on profile ("marital"); +create index "profile_sexual" on profile ("sexual"); +create index "profile_publish" on profile ("publish"); +create index "profile_aid" on profile ("aid"); +create index "profile_is_default" on profile ("is_default"); +create index "profile_hide_friends" on profile ("hide_friends"); +create index "profile_postal_code" on profile ("postal_code"); +create index "profile_country_name" on profile ("country_name"); +create index "profile_guid" on profile ("profile_guid"); +CREATE TABLE "profile_check" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "cid" bigint NOT NULL DEFAULT '0', + "dfrn_id" text NOT NULL, + "sec" text NOT NULL, + "expire" bigint NOT NULL, + PRIMARY KEY ("id") +); +create index "pc_uid" on profile_check ("uid"); +create index "pc_cid" on profile_check ("cid"); +create index "pc_dfrn_id" on profile_check ("dfrn_id"); +create index "pc_sec" on profile_check ("sec"); +create index "pc_expire" on profile_check ("expire"); + +CREATE TABLE "register" ( + "id" serial NOT NULL, + "hash" text NOT NULL, + "created" timestamp NOT NULL, + "uid" bigint NOT NULL, + "password" text NOT NULL, + "language" varchar(16) NOT NULL, + PRIMARY KEY ("id") +); +create index "reg_hash" on register ("hash"); +create index "reg_created" on register ("created"); +create index "reg_uid" on register ("uid"); +CREATE TABLE "session" ( + "id" serial, + "sid" text NOT NULL, + "data" text NOT NULL, + "expire" numeric(20) NOT NULL, + PRIMARY KEY ("id") +); +create index "session_sid" on session ("sid"); +create index "session_expire" on session ("expire"); +CREATE TABLE "shares" ( + "share_id" serial NOT NULL, + "share_type" bigint NOT NULL DEFAULT '0', + "share_target" bigint NOT NULL DEFAULT '0', + "share_xchan" text NOT NULL DEFAULT '', + PRIMARY KEY ("share_id") +); +create index "share_type" on shares ("share_type"); +create index "share_target" on shares ("share_target"); +create index "share_xchan" on shares ("share_xchan"); + +CREATE TABLE "sign" ( + "id" serial NOT NULL, + "iid" bigint NOT NULL DEFAULT '0', + "retract_iid" bigint NOT NULL DEFAULT '0', + "signed_text" text NOT NULL, + "signature" text NOT NULL, + "signer" text NOT NULL, + PRIMARY KEY ("id") +); +create index "sign_iid" on "sign" ("iid"); +create index "sign_retract_iid" on "sign" ("retract_iid"); + +CREATE TABLE "site" ( + "site_url" text NOT NULL, + "site_access" bigint NOT NULL DEFAULT '0', + "site_flags" bigint NOT NULL DEFAULT '0', + "site_update" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "site_pull" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "site_sync" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "site_directory" text NOT NULL DEFAULT '', + "site_register" bigint NOT NULL DEFAULT '0', + "site_sellpage" text NOT NULL DEFAULT '', + "site_location" text NOT NULL DEFAULT '', + "site_realm" text NOT NULL DEFAULT '', + PRIMARY KEY ("site_url") +); +create index "site_flags" on site ("site_flags"); +create index "site_update" on site ("site_update"); +create index "site_directory" on site ("site_directory"); +create index "site_register" on site ("site_register"); +create index "site_access" on site ("site_access"); +create index "site_sellpage" on site ("site_sellpage"); +create index "site_realm" on site ("site_realm"); + +CREATE TABLE "source" ( + "src_id" serial NOT NULL, + "src_channel_id" bigint NOT NULL DEFAULT '0', + "src_channel_xchan" text NOT NULL DEFAULT '', + "src_xchan" text NOT NULL DEFAULT '', + "src_patt" text NOT NULL, + PRIMARY KEY ("src_id") +); +create index "src_channel_id" on "source" ("src_channel_id"); +create index "src_channel_xchan" on "source" ("src_channel_xchan"); +create index "src_xchan" on "source" ("src_xchan"); +CREATE TABLE "spam" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL, + "spam" bigint NOT NULL DEFAULT '0', + "ham" bigint NOT NULL DEFAULT '0', + "term" text NOT NULL, + "date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("id") +); +create index "spam_uid" on spam ("uid"); +create index "spam_spam" on spam ("spam"); +create index "spam_ham" on spam ("ham"); +create index "spam_term" on spam ("term"); +CREATE TABLE "sys_perms" ( + "id" serial NOT NULL, + "cat" text NOT NULL, + "k" text NOT NULL, + "v" text NOT NULL, + "public_perm" numeric(1) NOT NULL, + PRIMARY KEY ("id") +); +CREATE TABLE "term" ( + "tid" serial NOT NULL, + "aid" bigint NOT NULL DEFAULT '0', + "uid" bigint NOT NULL DEFAULT '0', + "oid" bigint NOT NULL, + "otype" numeric(3) NOT NULL, + "type" numeric(3) NOT NULL, + "term" text NOT NULL, + "url" text NOT NULL, + "imgurl" text NOT NULL DEFAULT '', + "term_hash" text NOT NULL DEFAULT '', + "parent_hash" text NOT NULL DEFAULT '', + PRIMARY KEY ("tid") +); +create index "term_oid" on term ("oid"); +create index "term_otype" on term ("otype"); +create index "term_type" on term ("type"); +create index "term_term" on term ("term"); +create index "term_uid" on term ("uid"); +create index "term_aid" on term ("aid"); +create index "term_imgurl" on term ("imgurl"); +create index "term_hash" on term ("term_hash"); +create index "term_parent_hash" on term ("parent_hash"); +CREATE TABLE "tokens" ( + "id" varchar(40) NOT NULL, + "secret" text NOT NULL, + "client_id" varchar(20) NOT NULL, + "expires" numeric(20) NOT NULL, + "scope" varchar(200) NOT NULL, + "uid" bigint NOT NULL, + PRIMARY KEY ("id") +); +create index "tokens_client_id" on tokens ("client_id"); +create index "tokens_expires" on tokens ("expires"); +create index "tokens_uid" on tokens ("uid"); + +CREATE TABLE "updates" ( + "ud_id" serial NOT NULL, + "ud_hash" char(128) NOT NULL, + "ud_guid" text NOT NULL DEFAULT '', + "ud_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "ud_last" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "ud_flags" bigint NOT NULL DEFAULT '0', + "ud_addr" text NOT NULL DEFAULT '', + PRIMARY KEY ("ud_id") +); +create index "ud_date" on updates ("ud_date"); +create index "ud_guid" on updates ("ud_guid"); +create index "ud_hash" on updates ("ud_hash"); +create index "ud_flags" on updates ("ud_flags"); +create index "ud_addr" on updates ("ud_addr"); +create index "ud_last" on updates ("ud_last"); +CREATE TABLE "verify" ( + "id" serial NOT NULL, + "channel" bigint NOT NULL DEFAULT '0', + "type" varchar(32) NOT NULL DEFAULT '', + "token" text NOT NULL DEFAULT '', + "meta" text NOT NULL DEFAULT '', + "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("id") +); +create index "verify_channel" on verify ("channel"); +create index "verify_type" on verify ("type"); +create index "verify_token" on verify ("token"); +create index "verify_meta" on verify ("meta"); +create index "verify_created" on verify ("created"); +CREATE TABLE "vote" ( + "vote_id" serial NOT NULL, + "vote_poll" bigint NOT NULL DEFAULT '0', + "vote_element" bigint NOT NULL DEFAULT '0', + "vote_result" text NOT NULL, + "vote_xchan" text NOT NULL DEFAULT '', + PRIMARY KEY ("vote_id"), + UNIQUE ("vote_poll","vote_element","vote_xchan") +); +create index "vote_poll" on vote ("vote_poll"); +create index "vote_element" on vote ("vote_element"); +CREATE TABLE "xchan" ( + "xchan_hash" text NOT NULL, + "xchan_guid" text NOT NULL DEFAULT '', + "xchan_guid_sig" text NOT NULL DEFAULT '', + "xchan_pubkey" text NOT NULL DEFAULT '', + "xchan_photo_mimetype" text NOT NULL DEFAULT 'image/jpeg', + "xchan_photo_l" text NOT NULL DEFAULT '', + "xchan_photo_m" text NOT NULL DEFAULT '', + "xchan_photo_s" text NOT NULL DEFAULT '', + "xchan_addr" text NOT NULL DEFAULT '', + "xchan_url" text NOT NULL DEFAULT '', + "xchan_connurl" text NOT NULL DEFAULT '', + "xchan_follow" text NOT NULL DEFAULT '', + "xchan_connpage" text NOT NULL DEFAULT '', + "xchan_name" text NOT NULL DEFAULT '', + "xchan_network" text NOT NULL DEFAULT '', + "xchan_instance_url" text NOT NULL DEFAULT '', + "xchan_flags" bigint NOT NULL DEFAULT '0', + "xchan_photo_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "xchan_name_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("xchan_hash") +); +create index "xchan_guid" on xchan ("xchan_guid"); +create index "xchan_addr" on xchan ("xchan_addr"); +create index "xchan_name" on xchan ("xchan_name"); +create index "xchan_network" on xchan ("xchan_network"); +create index "xchan_url" on xchan ("xchan_url"); +create index "xchan_flags" on xchan ("xchan_flags"); +create index "xchan_connurl" on xchan ("xchan_connurl"); +create index "xchan_instance_url" on xchan ("xchan_instance_url"); +create index "xchan_follow" on xchan ("xchan_follow"); +CREATE TABLE "xchat" ( + "xchat_id" serial NOT NULL, + "xchat_url" text NOT NULL DEFAULT '', + "xchat_desc" text NOT NULL DEFAULT '', + "xchat_xchan" text NOT NULL DEFAULT '', + "xchat_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("xchat_id") +); +create index "xchat_url" on xchat ("xchat_url"); +create index "xchat_desc" on xchat ("xchat_desc"); +create index "xchat_xchan" on xchat ("xchat_xchan"); +create index "xchat_edited" on xchat ("xchat_edited"); +CREATE TABLE "xconfig" ( + "id" serial NOT NULL, + "xchan" text NOT NULL, + "cat" text NOT NULL, + "k" text NOT NULL, + "v" text NOT NULL, + PRIMARY KEY ("id") +); +create index "xconfig_xchan" on xconfig ("xchan"); +create index "xconfig_cat" on xconfig ("cat"); +create index "xconfig_k" on xconfig ("k"); +CREATE TABLE "xign" ( + "id" serial NOT NULL, + "uid" bigint NOT NULL DEFAULT '0', + "xchan" text NOT NULL DEFAULT '', + PRIMARY KEY ("id") +); +create index "xign_uid" on xign ("uid"); +create index "xign_xchan" on xign ("xchan"); +CREATE TABLE "xlink" ( + "xlink_id" serial NOT NULL, + "xlink_xchan" text NOT NULL DEFAULT '', + "xlink_link" text NOT NULL DEFAULT '', + "xlink_rating" bigint NOT NULL DEFAULT '0', + "xlink_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + PRIMARY KEY ("xlink_id") +); +create index "xlink_xchan" on xlink ("xlink_xchan"); +create index "xlink_link" on xlink ("xlink_link"); +create index "xlink_updated" on xlink ("xlink_updated"); +create index "xlink_rating" on xlink ("xlink_rating"); +CREATE TABLE "xprof" ( + "xprof_hash" text NOT NULL, + "xprof_age" numeric(3) NOT NULL DEFAULT '0', + "xprof_desc" text NOT NULL DEFAULT '', + "xprof_dob" varchar(12) NOT NULL DEFAULT '', + "xprof_gender" text NOT NULL DEFAULT '', + "xprof_marital" text NOT NULL DEFAULT '', + "xprof_sexual" text NOT NULL DEFAULT '', + "xprof_locale" text NOT NULL DEFAULT '', + "xprof_region" text NOT NULL DEFAULT '', + "xprof_postcode" varchar(32) NOT NULL DEFAULT '', + "xprof_country" text NOT NULL DEFAULT '', + "xprof_keywords" text NOT NULL, + "xprof_about" text NOT NULL, + "xprof_homepage" text NOT NULL DEFAULT '', + "xprof_hometown" text NOT NULL DEFAULT '', + PRIMARY KEY ("xprof_hash") +); +create index "xprof_desc" on xprof ("xprof_desc"); +create index "xprof_dob" on xprof ("xprof_dob"); +create index "xprof_gender" on xprof ("xprof_gender"); +create index "xprof_marital" on xprof ("xprof_marital"); +create index "xprof_sexual" on xprof ("xprof_sexual"); +create index "xprof_locale" on xprof ("xprof_locale"); +create index "xprof_region" on xprof ("xprof_region"); +create index "xprof_postcode" on xprof ("xprof_postcode"); +create index "xprof_country" on xprof ("xprof_country"); +create index "xprof_age" on xprof ("xprof_age"); +create index "xprof_hometown" on xprof ("xprof_hometown"); +CREATE TABLE "xtag" ( + "xtag_id" serial NOT NULL, + "xtag_hash" text NOT NULL, + "xtag_term" text NOT NULL DEFAULT '', + "xtag_flags" bigint NOT NULL DEFAULT '0', + PRIMARY KEY ("xtag_id") +); +create index "xtag_term" on xtag ("xtag_term"); +create index "xtag_hash" on xtag ("xtag_hash"); +create index "xtag_flags" on xtag ("xtag_flags"); |