hubloc DB changes needed for z6

This commit is contained in:
zotlabs 2018-08-13 21:18:20 -07:00
parent 62925c4c3f
commit f15c1c4e54
5 changed files with 44 additions and 2 deletions

31
Zotlabs/Update/_1218.php Normal file
View file

@ -0,0 +1,31 @@
<?php
namespace Zotlabs\Update;
class _1218 {
function run() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("ALTER TABLE hubloc add hubloc_id_url text NOT NULL");
$r2 = q("create index \"hubloc_id_url\" on hubloc (\"hubloc_id_url\")");
$r3 = q("ALTER TABLE hubloc add hubloc_site_id text NOT NULL");
$r4 = q("create index \"hubloc_site_id\" on hubloc (\"hubloc_site_id\")");
$r = $r1 && $r2 && $r3 && $r4;
}
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
$r1 = q("ALTER TABLE hubloc add hubloc_id_url varchar(191) NOT NULL, ADD INDEX hubloc_id_url (hubloc_id_url)");
$r2 = q("ALTER TABLE hubloc add hubloc_site_id varchar(191) NOT NULL, ADD INDEX hubloc_site_id (hubloc_site_id)");
$r = $r1 && $r2;
}
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
}

View file

@ -54,7 +54,7 @@ define ( 'STD_VERSION', '3.7.1' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1217 );
define ( 'DB_UPDATE_VERSION', 1218 );
define ( 'PROJECT_BASE', __DIR__ );

View file

@ -24,6 +24,8 @@ function hubloc_store_lowlevel($arr) {
'hubloc_status' => ((array_key_exists('hubloc_status',$arr)) ? $arr['hubloc_status'] : 0),
'hubloc_url' => ((array_key_exists('hubloc_url',$arr)) ? $arr['hubloc_url'] : ''),
'hubloc_url_sig' => ((array_key_exists('hubloc_url_sig',$arr)) ? $arr['hubloc_url_sig'] : ''),
'hubloc_id_url' => ((array_key_exists('hubloc_id_url',$arr)) ? $arr['hubloc_id_url'] : ''),
'hubloc_site_id' => ((array_key_exists('hubloc_site_id',$arr)) ? $arr['hubloc_site_id'] : ''),
'hubloc_host' => ((array_key_exists('hubloc_host',$arr)) ? $arr['hubloc_host'] : ''),
'hubloc_callback' => ((array_key_exists('hubloc_callback',$arr)) ? $arr['hubloc_callback'] : ''),
'hubloc_connect' => ((array_key_exists('hubloc_connect',$arr)) ? $arr['hubloc_connect'] : ''),

View file

@ -501,10 +501,12 @@ CREATE TABLE IF NOT EXISTS `hook` (
KEY `hook_version` (`hook_version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `hubloc` (
`hubloc_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hubloc_guid` char(191) NOT NULL DEFAULT '',
`hubloc_guid_sig` text NOT NULL,
`hubloc_id_url` char(191) NOT NULL DEFAULT '0',
`hubloc_hash` char(191) NOT NULL DEFAULT '',
`hubloc_addr` char(191) NOT NULL DEFAULT '',
`hubloc_network` char(32) NOT NULL DEFAULT '',
@ -512,6 +514,7 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
`hubloc_status` int(10) unsigned NOT NULL DEFAULT 0 ,
`hubloc_url` char(191) NOT NULL DEFAULT '',
`hubloc_url_sig` text NOT NULL,
`hubloc_site_id` char(191) NOT NULL DEFAULT '',
`hubloc_host` char(191) NOT NULL DEFAULT '',
`hubloc_callback` char(191) NOT NULL DEFAULT '',
`hubloc_connect` char(191) NOT NULL DEFAULT '',
@ -524,7 +527,9 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
`hubloc_deleted` tinyint(1) NOT NULL DEFAULT 0 ,
PRIMARY KEY (`hubloc_id`),
KEY `hubloc_url` (`hubloc_url`),
KEY `hubloc_site_id` (`hubloc_site_id`),
KEY `hubloc_guid` (`hubloc_guid`),
KEY `hubloc_id_url` (`hubloc_id_url`),
KEY `hubloc_hash` (`hubloc_hash`),
KEY `hubloc_flags` (`hubloc_flags`),
KEY `hubloc_connect` (`hubloc_connect`),
@ -540,7 +545,6 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
KEY `hubloc_error` (`hubloc_error`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `iconfig` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iid` int(11) NOT NULL DEFAULT 0 ,

View file

@ -474,10 +474,12 @@ create index "hook_idx" on hook ("hook");
create index "hook_version_idx" on hook ("hook_version");
create index "hook_priority_idx" on hook ("priority");
CREATE TABLE "hubloc" (
"hubloc_id" serial NOT NULL,
"hubloc_guid" text NOT NULL DEFAULT '',
"hubloc_guid_sig" text NOT NULL DEFAULT '',
"hubloc_id_url" text NOT NULL DEFAULT '',
"hubloc_hash" text NOT NULL,
"hubloc_addr" text NOT NULL DEFAULT '',
"hubloc_network" text NOT NULL DEFAULT '',
@ -485,6 +487,7 @@ CREATE TABLE "hubloc" (
"hubloc_status" bigint NOT NULL DEFAULT '0',
"hubloc_url" text NOT NULL DEFAULT '',
"hubloc_url_sig" text NOT NULL DEFAULT '',
"hubloc_site_id" text NOT NULL DEFAULT '',
"hubloc_host" text NOT NULL DEFAULT '',
"hubloc_callback" text NOT NULL DEFAULT '',
"hubloc_connect" text NOT NULL DEFAULT '',
@ -498,7 +501,9 @@ CREATE TABLE "hubloc" (
PRIMARY KEY ("hubloc_id")
);
create index "hubloc_url" on hubloc ("hubloc_url");
create index "hubloc_site_id" on hubloc ("hubloc_site_id");
create index "hubloc_guid" on hubloc ("hubloc_guid");
create index "hubloc_id_url" on hubloc ("hubloc_id_url");
create index "hubloc_flags" on hubloc ("hubloc_flags");
create index "hubloc_connect" on hubloc ("hubloc_connect");
create index "hubloc_host" on hubloc ("hubloc_host");