mirror of
https://github.com/friendica/friendica
synced 2024-11-09 16:22:56 +00:00
"cascade" for "post-engagement" / fixes for "report" definition
This commit is contained in:
parent
8452d3fdf2
commit
8c9e4c46a0
5 changed files with 31 additions and 26 deletions
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2023.09-dev (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1531
|
||||
-- DB_UPDATE_VERSION 1532
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -1316,7 +1316,7 @@ CREATE TABLE IF NOT EXISTS `post-engagement` (
|
|||
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';
|
||||
|
||||
--
|
||||
|
@ -1741,7 +1741,7 @@ CREATE TABLE IF NOT EXISTS `report` (
|
|||
`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`),
|
||||
|
|
|
@ -7,7 +7,7 @@ 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 | |
|
||||
|
@ -22,7 +22,7 @@ Fields
|
|||
| 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 | |
|
||||
| created | | datetime(6) | NO | | 0001-01-01 00:00:00.000000 | |
|
||||
| edited | Last time the report has been edited | datetime(6) | YES | | NULL | |
|
||||
|
||||
Indexes
|
||||
|
|
|
@ -42,6 +42,11 @@ class DBA
|
|||
*/
|
||||
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();
|
||||
|
|
|
@ -284,7 +284,7 @@ class DBStructure
|
|||
echo $sql;
|
||||
}
|
||||
if ($action) {
|
||||
$r = DBA::e($sql);
|
||||
$r = DBA::e(str_replace('\\', '\\\\', $sql));
|
||||
if (!DBA::isResult($r)) {
|
||||
$errors .= self::printUpdateError($name);
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ class DBStructure
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
|||
|
||||
// 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 [
|
||||
|
@ -1328,7 +1328,7 @@ 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"],
|
||||
|
@ -1736,7 +1736,7 @@ return [
|
|||
"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" => [
|
||||
|
|
Loading…
Reference in a new issue