-- ------------------------------------------
-- Friendica 2023.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1531
+-- DB_UPDATE_VERSION 1532
-- ------------------------------------------
INDEX `owner-id` (`owner-id`),
INDEX `created` (`created`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
- FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
+ FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Engagement data per post';
--
`assigned-uid` mediumint unsigned COMMENT 'Assigned moderator user',
`status` tinyint unsigned NOT NULL COMMENT 'Status of the report, one of Entity\Report::STATUS_*',
`resolution` tinyint unsigned COMMENT 'Resolution of the report, one of Entity\Report::RESOLUTION_*',
- `created` datetime(6) NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
+ `created` datetime(6) NOT NULL DEFAULT '0001-01-01 00:00:00.000000' COMMENT '',
`edited` datetime(6) COMMENT 'Last time the report has been edited',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
Fields
------
-| Field | Description | Type | Null | Key | Default | Extra |
-| --------------- | ------------------------------------------------------------ | ------------------ | ---- | --- | ------------------- | -------------- |
-| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
-| uid | Reporting user | mediumint unsigned | YES | | NULL | |
-| reporter-id | Reporting contact | int unsigned | YES | | NULL | |
-| cid | Reported contact | int unsigned | NO | | NULL | |
-| gsid | Reported contact server | int unsigned | YES | | NULL | |
-| comment | Report | text | YES | | NULL | |
-| category-id | Report category, one of Entity\Report::CATEGORY_* | int unsigned | NO | | 1 | |
-| forward | Forward the report to the remote server | boolean | YES | | NULL | |
-| public-remarks | Remarks shared with the reporter | text | YES | | NULL | |
-| private-remarks | Remarks shared with the moderation team | text | YES | | NULL | |
-| last-editor-uid | Last editor user | mediumint unsigned | YES | | NULL | |
-| assigned-uid | Assigned moderator user | mediumint unsigned | YES | | NULL | |
-| status | Status of the report, one of Entity\Report::STATUS_* | tinyint unsigned | NO | | NULL | |
-| resolution | Resolution of the report, one of Entity\Report::RESOLUTION_* | tinyint unsigned | YES | | NULL | |
-| created | | datetime(6) | NO | | 0001-01-01 00:00:00 | |
-| edited | Last time the report has been edited | datetime(6) | YES | | NULL | |
+| Field | Description | Type | Null | Key | Default | Extra |
+| --------------- | ------------------------------------------------------------ | ------------------ | ---- | --- | -------------------------- | -------------- |
+| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
+| uid | Reporting user | mediumint unsigned | YES | | NULL | |
+| reporter-id | Reporting contact | int unsigned | YES | | NULL | |
+| cid | Reported contact | int unsigned | NO | | NULL | |
+| gsid | Reported contact server | int unsigned | YES | | NULL | |
+| comment | Report | text | YES | | NULL | |
+| category-id | Report category, one of Entity\Report::CATEGORY_* | int unsigned | NO | | 1 | |
+| forward | Forward the report to the remote server | boolean | YES | | NULL | |
+| public-remarks | Remarks shared with the reporter | text | YES | | NULL | |
+| private-remarks | Remarks shared with the moderation team | text | YES | | NULL | |
+| last-editor-uid | Last editor user | mediumint unsigned | YES | | NULL | |
+| assigned-uid | Assigned moderator user | mediumint unsigned | YES | | NULL | |
+| status | Status of the report, one of Entity\Report::STATUS_* | tinyint unsigned | NO | | NULL | |
+| resolution | Resolution of the report, one of Entity\Report::RESOLUTION_* | tinyint unsigned | YES | | NULL | |
+| created | | datetime(6) | NO | | 0001-01-01 00:00:00.000000 | |
+| edited | Last time the report has been edited | datetime(6) | YES | | NULL | |
Indexes
------------
*/
const NULL_DATETIME = '0001-01-01 00:00:00';
+ /**
+ * Lowest possible datetime(6) value
+ */
+ const NULL_DATETIME6 = '0001-01-01 00:00:00.000000';
+
public static function connect(): bool
{
return DI::dba()->connect();
echo $sql;
}
if ($action) {
- $r = DBA::e($sql);
+ $r = DBA::e(str_replace('\\', '\\\\', $sql));
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($name);
}
DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name));
}
- $r = DBA::e($sql3);
+ $r = DBA::e(str_replace('\\', '\\\\', $sql3));
if (!DBA::isResult($r)) {
$errors .= self::printUpdateError($sql3);
}
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1531);
+ define('DB_UPDATE_VERSION', 1532);
}
return [
"comment" => "Engagement data per post",
"fields" => [
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
- "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item owner"],
+ "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "Item owner"],
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"],
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
"language" => ["type" => "varbinary(128)", "comment" => "Language information about this post"],
"assigned-uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Assigned moderator user"],
"status" => ["type" => "tinyint unsigned", "not null" => "1", "comment" => "Status of the report, one of Entity\Report::STATUS_*"],
"resolution" => ["type" => "tinyint unsigned", "comment" => "Resolution of the report, one of Entity\Report::RESOLUTION_*"],
- "created" => ["type" => "datetime(6)", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
+ "created" => ["type" => "datetime(6)", "not null" => "1", "default" => DBA::NULL_DATETIME6, "comment" => ""],
"edited" => ["type" => "datetime(6)", "comment" => "Last time the report has been edited"],
],
"indexes" => [