From 1ff189ee907e6465dfb35118f789f10e714d38a1 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Thu, 21 Apr 2016 17:03:05 -0700
Subject: new hook interface (the old one still works but requires handlers to
 have two calling arguments; the first of which is no longer used). The new
 interface is called from Zotlabs\Extend\Hook::register() and allows you to
 specify which hook version to use. The default will be the new interface with
 one function argument. We also implement the hook priority field which was
 always there but needed to be set manually in the DB. This provides a way for
 two hook handlers that implement the same hook interface to determine which
 order to be called in the event of conflicts.

---
 install/schema_mysql.sql | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 01cf97674..c36bfaa57 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -517,8 +517,10 @@ CREATE TABLE IF NOT EXISTS `hook` (
   `file` char(255) NOT NULL DEFAULT '',
   `function` char(255) NOT NULL DEFAULT '',
   `priority` int(11) unsigned NOT NULL DEFAULT '0',
+  `hook_version` int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
-  KEY `hook` (`hook`)
+  KEY `hook` (`hook`),
+  KEY `hook_version` (`hook_version`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `hubloc` (
-- 
cgit v1.2.3


From bd2f11ed8b0be4fb611c33e85b568048f79b7090 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Sun, 1 May 2016 21:00:02 -0700
Subject: db schema change to add tags to content sources

---
 install/schema_mysql.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index c36bfaa57..2305d4a0b 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1181,6 +1181,7 @@ CREATE TABLE IF NOT EXISTS `source` (
   `src_channel_xchan` char(255) NOT NULL DEFAULT '',
   `src_xchan` char(255) NOT NULL DEFAULT '',
   `src_patt` mediumtext NOT NULL,
+  `src_tag` mediumtext NOT NULL,
   PRIMARY KEY (`src_id`),
   KEY `src_channel_id` (`src_channel_id`),
   KEY `src_channel_xchan` (`src_channel_xchan`),
-- 
cgit v1.2.3


From 3df0bb55221317a17d6e898415ba5d33ede7715d Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Tue, 3 May 2016 18:41:16 -0700
Subject: some preliminary structural work for app organisation

---
 install/schema_mysql.sql | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 2305d4a0b..4751106da 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -123,6 +123,8 @@ CREATE TABLE IF NOT EXISTS `app` (
   `app_price` char(255) NOT NULL DEFAULT '',
   `app_page` char(255) NOT NULL DEFAULT '',
   `app_requires` char(255) NOT NULL DEFAULT '',
+  `app_deleted` int(11) NOT NULL DEFAULT '0',
+  `app_system` int(11) NOT NULL DEFAULT '0',
   `app_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `app_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   PRIMARY KEY (`id`),
@@ -134,6 +136,8 @@ CREATE TABLE IF NOT EXISTS `app` (
   KEY `app_channel` (`app_channel`),
   KEY `app_price` (`app_price`),
   KEY `app_created` (`app_created`),
+  KEY `app_deleted` (`app_deleted`),
+  KEY `app_system` (`app_system`),
   KEY `app_edited` (`app_edited`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
-- 
cgit v1.2.3


From ac4688eac087854bf8cb0c893d7a79052ad63a20 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Fri, 27 May 2016 23:57:47 -0700
Subject: allow objs to represent inventory

---
 install/schema_mysql.sql | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 4751106da..a674ab8c4 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -883,6 +883,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
   `obj_imgurl` char(255) NOT NULL DEFAULT '',
   `obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `obj_quantity` int(11) NOT NULL DEFAULT '0',
   `allow_cid` mediumtext NOT NULL,
   `allow_gid` mediumtext NOT NULL,
   `deny_cid` mediumtext NOT NULL,
@@ -897,6 +898,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
   KEY `obj_imgurl` (`obj_imgurl`),
   KEY `obj_created` (`obj_created`),
   KEY `obj_edited` (`obj_edited`),
+  KEY `obj_quantity` (`obj_quantity`),
   KEY `obj_obj` (`obj_obj`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
-- 
cgit v1.2.3


From 6602ff83dd54d0e17c985a5f527654fc2ed83eea Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Mon, 30 May 2016 19:44:30 -0700
Subject: start removing reserved words from database column names (this run:
 addon and hook)

---
 install/schema_mysql.sql | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index a674ab8c4..68b739f7a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -96,15 +96,15 @@ CREATE TABLE IF NOT EXISTS `account` (
 
 CREATE TABLE IF NOT EXISTS `addon` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` char(255) NOT NULL DEFAULT '',
+  `aname` 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',
+  `tstamp` bigint(20) NOT NULL DEFAULT '0',
   `plugin_admin` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
   KEY `hidden` (`hidden`),
-  KEY `name` (`name`),
+  KEY `aname` (`aname`),
   KEY `installed` (`installed`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
@@ -519,7 +519,7 @@ 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 '',
+  `fn` char(255) NOT NULL DEFAULT '',
   `priority` int(11) unsigned NOT NULL DEFAULT '0',
   `hook_version` int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
-- 
cgit v1.2.3


From ca78374f30bd1b3a98b8b82552741a54b131cbf8 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Mon, 30 May 2016 22:41:45 -0700
Subject: remove unused tables

---
 install/schema_mysql.sql | 70 ------------------------------------------------
 1 file changed, 70 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 68b739f7a..63be37f80 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -434,62 +434,6 @@ CREATE TABLE IF NOT EXISTS `event` (
   KEY `event_priority` (`event_priority`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
-CREATE TABLE IF NOT EXISTS `fcontact` (
-  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `url` char(255) NOT NULL,
-  `name` char(255) NOT NULL,
-  `photo` char(255) NOT NULL,
-  `request` char(255) NOT NULL,
-  `nick` char(255) NOT NULL,
-  `addr` char(255) NOT NULL,
-  `batch` char(255) NOT NULL,
-  `notify` char(255) NOT NULL,
-  `poll` char(255) NOT NULL,
-  `confirm` char(255) NOT NULL,
-  `priority` tinyint(1) NOT NULL,
-  `network` char(32) NOT NULL,
-  `alias` char(255) NOT NULL,
-  `pubkey` text NOT NULL,
-  `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
-  PRIMARY KEY (`id`),
-  KEY `addr` (`addr`),
-  KEY `network` (`network`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-CREATE TABLE IF NOT EXISTS `ffinder` (
-  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `uid` int(10) unsigned NOT NULL,
-  `cid` int(10) unsigned NOT NULL,
-  `fid` int(10) unsigned NOT NULL,
-  PRIMARY KEY (`id`),
-  KEY `uid` (`uid`),
-  KEY `cid` (`cid`),
-  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 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;
-
-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;
-
 CREATE TABLE IF NOT EXISTS `groups` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `hash` char(255) NOT NULL DEFAULT '',
@@ -1194,20 +1138,6 @@ CREATE TABLE IF NOT EXISTS `source` (
   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 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`),
-  KEY `spam` (`spam`),
-  KEY `ham` (`ham`),
-  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 DEFAULT '',
-- 
cgit v1.2.3


From dfb6255f59980835d364402b372dd39f2b41ee7c Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Tue, 31 May 2016 17:50:47 -0700
Subject: more removal of reserved words from DB schemas

---
 install/schema_mysql.sql | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 63be37f80..2b48afe98 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -188,7 +188,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
   `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 '',
+  `auth_scope` varchar(512) NOT NULL DEFAULT '',
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
@@ -342,7 +342,7 @@ 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,
+  `clname` text,
   `icon` text,
   `uid` int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (`client_id`)
@@ -1054,7 +1054,7 @@ CREATE TABLE IF NOT EXISTS `register` (
   `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 '',
+  `lang` char(16) NOT NULL DEFAULT '',
   PRIMARY KEY (`id`),
   KEY `hash` (`hash`),
   KEY `created` (`created`),
@@ -1064,7 +1064,7 @@ CREATE TABLE IF NOT EXISTS `register` (
 CREATE TABLE IF NOT EXISTS `session` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `sid` char(255) NOT NULL DEFAULT '',
-  `data` text NOT NULL,
+  `sess_data` text NOT NULL,
   `expire` bigint(20) unsigned NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
   KEY `sid` (`sid`),
@@ -1176,7 +1176,7 @@ CREATE TABLE IF NOT EXISTS `tokens` (
   `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 '',
+  `auth_scope` varchar(512) NOT NULL DEFAULT '',
   `uid` int(11) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
   KEY `client_id` (`client_id`),
@@ -1204,13 +1204,13 @@ CREATE TABLE IF NOT EXISTS `updates` (
 CREATE TABLE IF NOT EXISTS `verify` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `channel` int(10) unsigned NOT NULL DEFAULT '0',
-  `type` char(32) NOT NULL DEFAULT '',
+  `vtype` char(32) NOT NULL DEFAULT '',
   `token` char(255) NOT NULL DEFAULT '',
   `meta` char(255) NOT NULL DEFAULT '',
   `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   PRIMARY KEY (`id`),
   KEY `channel` (`channel`),
-  KEY `type` (`type`),
+  KEY `vtype` (`vtype`),
   KEY `token` (`token`),
   KEY `meta` (`meta`),
   KEY `created` (`created`)
-- 
cgit v1.2.3


From b1259876bf398880e7b0c1b44d90f94983243e72 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Tue, 31 May 2016 21:45:33 -0700
Subject: more db column renames

---
 install/schema_mysql.sql | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 2b48afe98..e5bb7b889 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -440,12 +440,13 @@ CREATE TABLE IF NOT EXISTS `groups` (
   `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 '',
+  `gname` char(255) NOT NULL DEFAULT '',
   PRIMARY KEY (`id`),
   KEY `uid` (`uid`),
   KEY `visible` (`visible`),
   KEY `deleted` (`deleted`),
-  KEY `hash` (`hash`)
+  KEY `hash` (`hash`),
+  KEY `gname` (`gname`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `group_member` (
@@ -979,7 +980,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
   `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 '',
+  `fullname` char(255) NOT NULL DEFAULT '',
   `pdesc` char(255) NOT NULL DEFAULT '',
   `chandesc` text NOT NULL,
   `dob` char(32) NOT NULL DEFAULT '0000-00-00',
@@ -992,7 +993,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
   `hometown` char(255) NOT NULL DEFAULT '',
   `gender` char(32) NOT NULL DEFAULT '',
   `marital` char(255) NOT NULL DEFAULT '',
-  `with` text NOT NULL,
+  `partner` 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 '',
@@ -1008,7 +1009,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
   `film` text NOT NULL,
   `interest` text NOT NULL,
   `romance` text NOT NULL,
-  `work` text NOT NULL,
+  `employment` text NOT NULL,
   `education` text NOT NULL,
   `contact` text NOT NULL,
   `channels` text NOT NULL,
@@ -1153,7 +1154,7 @@ CREATE TABLE IF NOT EXISTS `term` (
   `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',
+  `ttype` 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 '',
@@ -1162,7 +1163,7 @@ CREATE TABLE IF NOT EXISTS `term` (
   PRIMARY KEY (`tid`),
   KEY `oid` (`oid`),
   KEY `otype` (`otype`),
-  KEY `type` (`type`),
+  KEY `ttype` (`ttype`),
   KEY `term` (`term`),
   KEY `uid` (`uid`),
   KEY `aid` (`aid`),
-- 
cgit v1.2.3


From a9d7acda279ebb7f2b3cd61a91a5e1d8b590dcf2 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Wed, 1 Jun 2016 21:48:54 -0700
Subject: the rest of the schema updates - WARNING: some third party plugins
 may fail; e.g. embedphotos and chess. $item['object'] is now $item['obj'] and
 $photo['type'] is $photo['mimetype'], $photo['scale'] is $photo['imgscale']
 and $photo['data'] is now $photo['content']. There are a number of other
 changes, but these are the ones noted to cause issues with third-party
 plugins. The project plugins have been updated. Please note any new issues as
 this effort touched a lot of code in a lot of files.

---
 install/schema_mysql.sql | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index e5bb7b889..a536c3f9a 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -158,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `attach` (
   `os_storage` tinyint(1) NOT NULL DEFAULT '0',
   `os_path` mediumtext NOT NULL,
   `display_path` mediumtext NOT NULL,
-  `data` longblob NOT NULL,
+  `content` longblob NOT NULL,
   `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `allow_cid` mediumtext NOT NULL,
@@ -398,15 +398,15 @@ CREATE TABLE IF NOT EXISTS `event` (
   `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',
+  `dtstart` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `dtend` 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 '',
+  `etype` 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',
+  `dismissed` tinyint(1) NOT NULL DEFAULT '0',
   `allow_cid` mediumtext NOT NULL,
   `allow_gid` mediumtext NOT NULL,
   `deny_cid` mediumtext NOT NULL,
@@ -420,12 +420,12 @@ CREATE TABLE IF NOT EXISTS `event` (
   `event_vdata` text NOT NULL,
   PRIMARY KEY (`id`),
   KEY `uid` (`uid`),
-  KEY `type` (`type`),
-  KEY `start` (`start`),
-  KEY `finish` (`finish`),
+  KEY `etype` (`etype`),
+  KEY `dtstart` (`dtstart`),
+  KEY `dtend` (`dtend`),
   KEY `adjust` (`adjust`),
   KEY `nofinish` (`nofinish`),
-  KEY `ignore` (`ignore`),
+  KEY `dismissed` (`dismissed`),
   KEY `aid` (`aid`),
   KEY `event_hash` (`event_hash`),
   KEY `event_xchan` (`event_xchan`),
@@ -569,7 +569,7 @@ CREATE TABLE IF NOT EXISTS `item` (
   `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,
+  `obj` text NOT NULL,
   `tgt_type` char(255) NOT NULL DEFAULT '',
   `target` text NOT NULL,
   `layout_mid` char(255) NOT NULL DEFAULT '',
@@ -791,24 +791,24 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
 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 '',
+  `xname` 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',
+  `created` 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',
+  `ntype` 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 `ntype` (`ntype`),
   KEY `seen` (`seen`),
   KEY `uid` (`uid`),
-  KEY `date` (`date`),
+  KEY `created` (`created`),
   KEY `hash` (`hash`),
   KEY `parent` (`parent`),
   KEY `link` (`link`),
@@ -893,12 +893,12 @@ CREATE TABLE IF NOT EXISTS `photo` (
   `description` text NOT NULL,
   `album` char(255) NOT NULL DEFAULT '',
   `filename` char(255) NOT NULL DEFAULT '',
-  `type` char(128) NOT NULL DEFAULT 'image/jpeg',
+  `mimetype` 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',
+  `filesize` int(10) unsigned NOT NULL DEFAULT '0',
+  `content` mediumblob NOT NULL,
+  `imgscale` tinyint(3) NOT NULL DEFAULT '0',
   `photo_usage` smallint(6) NOT NULL DEFAULT '0',
   `profile` tinyint(1) NOT NULL DEFAULT '0',
   `is_nsfw` tinyint(1) NOT NULL DEFAULT '0',
@@ -913,13 +913,13 @@ CREATE TABLE IF NOT EXISTS `photo` (
   PRIMARY KEY (`id`),
   KEY `uid` (`uid`),
   KEY `album` (`album`),
-  KEY `scale` (`scale`),
+  KEY `imgscale` (`imgscale`),
   KEY `profile` (`profile`),
   KEY `photo_flags` (`photo_flags`),
-  KEY `type` (`type`),
+  KEY `mimetype` (`mimetype`),
   KEY `aid` (`aid`),
   KEY `xchan` (`xchan`),
-  KEY `size` (`size`),
+  KEY `filesize` (`filesize`),
   KEY `resource_id` (`resource_id`),
   KEY `is_nsfw` (`is_nsfw`),
   KEY `os_storage` (`os_storage`),
-- 
cgit v1.2.3


From dbb0a0283f8398d02d2be92dab182ee5103b3651 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Sat, 18 Jun 2016 15:33:47 -0700
Subject: schema changes needed for the caldav client bit

---
 install/schema_mysql.sql | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index a536c3f9a..13fc54aba 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -199,6 +199,26 @@ CREATE TABLE IF NOT EXISTS `cache` (
   PRIMARY KEY (`k`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+CREATE TABLE IF NOT EXISTS `cal` (
+  `cal_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `cal_aid` int(10) unsigned NOT NULL DEFAULT '0',
+  `cal_uid` int(10) unsigned NOT NULL DEFAULT '0',
+  `cal_hash` varchar(255) NOT NULL DEFAULT '',
+  `cal_name` varchar(255) NOT NULL DEFAULT '',
+  `uri` varchar(255) NOT NULL DEFAULT '',
+  `logname` varchar(255) NOT NULL DEFAULT '',
+  `pass` varchar(255) NOT NULL DEFAULT '',
+  `ctag` varchar(255) NOT NULL DEFAULT '',
+  `synctoken` varchar(255) NOT NULL DEFAULT '',
+  `cal_types` varchar(255) NOT NULL DEFAULT '',
+  PRIMARY KEY (`cal_id`),
+  KEY `cal_aid` (`cal_aid`),
+  KEY `cal_uid` (`cal_uid`),
+  KEY `cal_hash` (`cal_hash`),
+  KEY `cal_name` (`cal_name`),
+  KEY `cal_types` (`cal_types`)
+) 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',
@@ -394,6 +414,7 @@ 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',
+  `cal_id` int(11) unsigned 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',
@@ -420,6 +441,7 @@ CREATE TABLE IF NOT EXISTS `event` (
   `event_vdata` text NOT NULL,
   PRIMARY KEY (`id`),
   KEY `uid` (`uid`),
+  KEY `cal_id` (`cal_id`),
   KEY `etype` (`etype`),
   KEY `dtstart` (`dtstart`),
   KEY `dtend` (`dtend`),
-- 
cgit v1.2.3


From 51e2ef39c221a6f8cd89f8bb9e85a8f374f1fd6c Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Thu, 23 Jun 2016 18:35:01 -0700
Subject: db update for abconfig transition

---
 install/schema_mysql.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 13fc54aba..d2a5ac85e 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1,7 +1,7 @@
 
 CREATE TABLE IF NOT EXISTS `abconfig` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `chan` char(255) NOT NULL DEFAULT '',
+  `chan` int(10) unsigned NOT NULL DEFAULT '',
   `xchan` char(255) NOT NULL DEFAULT '',
   `cat` char(255) NOT NULL DEFAULT '',
   `k` char(255) NOT NULL DEFAULT '',
-- 
cgit v1.2.3


From c918bbba255c4566dcd6c85c06e19646bd178183 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Sun, 3 Jul 2016 17:10:00 -0700
Subject: more work on x permissions

---
 install/schema_mysql.sql | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index d2a5ac85e..223f94162 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -903,6 +903,19 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
   UNIQUE KEY `access` (`uid`,`cat`,`k`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
+
+create table if not exists perm_limits {
+	id int(10) not null AUTO_INCREMENT,
+	perm varchar(64) not null default '',
+	channel_id int(10) unsigned not null default 0,
+	perm_limit int(10) unsigned not null default 0,
+	PRIMARY KEY (`id`),
+  	KEY `perm` (`perm`),
+  	KEY `channel_id` (`channel_id`),
+	KEY `perm_limit` (`perm_limit`)
+) 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',
-- 
cgit v1.2.3


From e11330a5c8e5111d08d6aee1f4dc6dda6f7c7f2a Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Thu, 7 Jul 2016 16:44:58 -0700
Subject: revise how we store perm_limits

---
 install/schema_mysql.sql | 12 ------------
 1 file changed, 12 deletions(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index 223f94162..9a67cada0 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -904,18 +904,6 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
 
-create table if not exists perm_limits {
-	id int(10) not null AUTO_INCREMENT,
-	perm varchar(64) not null default '',
-	channel_id int(10) unsigned not null default 0,
-	perm_limit int(10) unsigned not null default 0,
-	PRIMARY KEY (`id`),
-  	KEY `perm` (`perm`),
-  	KEY `channel_id` (`channel_id`),
-	KEY `perm_limit` (`perm_limit`)
-) 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',
-- 
cgit v1.2.3


From b6987b4287bb2492b8f4000bdef08b376aa5f265 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Tue, 12 Jul 2016 13:15:20 -0700
Subject: the abconfig defaults weren't changed in the schema files when they
 were changed in the code

---
 install/schema_mysql.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index d2a5ac85e..b43ead050 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -1,7 +1,7 @@
 
 CREATE TABLE IF NOT EXISTS `abconfig` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `chan` int(10) unsigned NOT NULL DEFAULT '',
+  `chan` int(10) unsigned NOT NULL DEFAULT '0',
   `xchan` char(255) NOT NULL DEFAULT '',
   `cat` char(255) NOT NULL DEFAULT '',
   `k` char(255) NOT NULL DEFAULT '',
-- 
cgit v1.2.3


From 94bd53c0f1faa333991786684028e347ab17cfb9 Mon Sep 17 00:00:00 2001
From: redmatrix <git@macgirvin.com>
Date: Thu, 14 Jul 2016 20:51:15 -0700
Subject: schema updates for zot access tokens

---
 install/schema_mysql.sql | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'install/schema_mysql.sql')

diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql
index b43ead050..5335c231e 100644
--- a/install/schema_mysql.sql
+++ b/install/schema_mysql.sql
@@ -141,6 +141,23 @@ CREATE TABLE IF NOT EXISTS `app` (
   KEY `app_edited` (`app_edited`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+
+CREATE TABLE IF NOT EXISTS `atoken` (
+  `atoken_id` int(11) NOT NULL AUTO_INCREMENT,
+  `atoken_aid` int(11) NOT NULL DEFAULT 0,
+  `atoken_uid` int(11) NOT NULL DEFAULT 0,
+  `atoken_name` char(255) NOT NULL DEFAULT '',
+  `atoken_token` char(255) NOT NULL DEFAULT '',
+  `atoken_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (`atoken_id`),
+  KEY `atoken_aid` (`atoken_aid`),
+  KEY `atoken_uid` (`atoken_uid`),
+  KEY `atoken_uid_2` (`atoken_uid`),
+  KEY `atoken_name` (`atoken_name`),
+  KEY `atoken_token` (`atoken_token`),
+  KEY `atoken_expires` (`atoken_expires`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 CREATE TABLE IF NOT EXISTS `attach` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `aid` int(10) unsigned NOT NULL DEFAULT '0',
-- 
cgit v1.2.3

