forked from friendica/friendica-addons
Update to correct collation mode
This commit is contained in:
parent
e3488aab75
commit
6b658991a4
|
@ -6,11 +6,11 @@ CREATE TABLE IF NOT EXISTS `retriever_rule` (
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `uid` (`uid`),
|
KEY `uid` (`uid`),
|
||||||
KEY `contact-id` (`contact-id`)
|
KEY `contact-id` (`contact-id`)
|
||||||
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `retriever_item` (
|
CREATE TABLE IF NOT EXISTS `retriever_item` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`item-uri` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
`item-uri` varbinary(255) NOT NULL,
|
||||||
`item-uid` int(10) unsigned NOT NULL DEFAULT '0',
|
`item-uid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
|
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`resource` int(11) NOT NULL,
|
`resource` int(11) NOT NULL,
|
||||||
|
@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `retriever_item` (
|
||||||
KEY `item-uid` (`item-uid`),
|
KEY `item-uid` (`item-uid`),
|
||||||
KEY `all` (`item-uri`, `item-uid`, `contact-id`),
|
KEY `all` (`item-uri`, `item-uid`, `contact-id`),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `retriever_resource` (
|
CREATE TABLE IF NOT EXISTS `retriever_resource` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
@ -28,15 +28,15 @@ CREATE TABLE IF NOT EXISTS `retriever_resource` (
|
||||||
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
|
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`type` char(255) NULL DEFAULT NULL,
|
`type` char(255) NULL DEFAULT NULL,
|
||||||
`binary` int(1) NOT NULL DEFAULT 0,
|
`binary` int(1) NOT NULL DEFAULT 0,
|
||||||
`url` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
`url` varbinary(800) NOT NULL,
|
||||||
`created` timestamp NOT NULL DEFAULT now(),
|
`created` timestamp NOT NULL DEFAULT now(),
|
||||||
`completed` timestamp NULL DEFAULT NULL,
|
`completed` timestamp NULL DEFAULT NULL,
|
||||||
`last-try` timestamp NULL DEFAULT NULL,
|
`last-try` timestamp NULL DEFAULT NULL,
|
||||||
`num-tries` int(11) NOT NULL DEFAULT 0,
|
`num-tries` int(11) NOT NULL DEFAULT 0,
|
||||||
`data` mediumblob NULL DEFAULT NULL,
|
`data` mediumblob NULL DEFAULT NULL,
|
||||||
`http-code` smallint(1) unsigned NULL DEFAULT NULL,
|
`http-code` smallint(1) unsigned NULL DEFAULT NULL,
|
||||||
`redirect-url` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT NULL,
|
`redirect-url` varbinary(800) NOT NULL,
|
||||||
KEY `url` (`url`),
|
KEY `url` (`url`),
|
||||||
KEY `completed` (`completed`),
|
KEY `completed` (`completed`),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
|
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
|
@ -32,7 +32,19 @@ function retriever_install() {
|
||||||
Addon::registerHook('contact_photo_menu', 'addon/retriever/retriever.php', 'retriever_contact_photo_menu');
|
Addon::registerHook('contact_photo_menu', 'addon/retriever/retriever.php', 'retriever_contact_photo_menu');
|
||||||
Addon::registerHook('cron', 'addon/retriever/retriever.php', 'retriever_cron');
|
Addon::registerHook('cron', 'addon/retriever/retriever.php', 'retriever_cron');
|
||||||
|
|
||||||
if (DI::config()->get('retriever', 'dbversion') != '0.14') {
|
if (DI::config()->get('retriever', 'dbversion') == '0.14') {
|
||||||
|
if (!DBA::e("ALTER TABLE `retriever_rule` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci") ||
|
||||||
|
!DBA::e("ALTER TABLE `retriever_item` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci") ||
|
||||||
|
!DBA::e("ALTER TABLE `retriever_item` MODIFY `item-uri` varbinary(255) NOT NULL") ||
|
||||||
|
!DBA::e("ALTER TABLE `retriever_resource` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci") ||
|
||||||
|
!DBA::e("ALTER TABLE `retriever_resource` MODIFY `url` varbinary(800) NOT NULL") ||
|
||||||
|
!DBA::e("ALTER TABLE `retriever_resource` MODIFY `redirect-url` varbinary(800) NOT NULL")) {
|
||||||
|
Logger::warning('Unable to update database tables: ' . DBA::errorMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DI::config()->set('retriever', 'dbversion', '0.15');
|
||||||
|
}
|
||||||
|
if (DI::config()->get('retriever', 'dbversion') != '0.15') {
|
||||||
$schema = file_get_contents(dirname(__file__).'/database.sql');
|
$schema = file_get_contents(dirname(__file__).'/database.sql');
|
||||||
$tables = explode(';', $schema);
|
$tables = explode(';', $schema);
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
|
|
Loading…
Reference in a new issue