diff --git a/Sources/Db/Schema/v3_0/LogReportedComments.php b/Sources/Db/Schema/v3_0/LogReportedComments.php index f78886777a..0aede744f0 100644 --- a/Sources/Db/Schema/v3_0/LogReportedComments.php +++ b/Sources/Db/Schema/v3_0/LogReportedComments.php @@ -69,10 +69,8 @@ public function __construct() ), 'comment' => new Column( name: 'comment', - type: 'varchar', - size: 255, + type: 'text', not_null: true, - default: '', ), 'time_sent' => new Column( name: 'time_sent', diff --git a/Sources/Maintenance/Migration/v3_0/ReportCommentLength.php b/Sources/Maintenance/Migration/v3_0/ReportCommentLength.php new file mode 100644 index 0000000000..6602f41336 --- /dev/null +++ b/Sources/Maintenance/Migration/v3_0/ReportCommentLength.php @@ -0,0 +1,71 @@ +getCurrentStructure(); + + foreach ($existing_structure['columns'] as $column) { + if ($column['name'] === 'comment') { + return $column['type'] !== $table->columns['comment']->type; + } + } + + return false; + } + + /** + * + */ + public function execute(): bool + { + $table = new Schema\v3_0\LogReportedComments(); + + foreach ($table->columns as $column) { + if ($column->name === 'comment') { + // A text column takes no default, so the varchar one has to go. + $column->drop_default = true; + + $table->alterColumn($column); + } + } + + return true; + } +} diff --git a/Sources/Maintenance/Tools/Upgrade.php b/Sources/Maintenance/Tools/Upgrade.php index bda39f8ca0..7a0b80ea18 100644 --- a/Sources/Maintenance/Tools/Upgrade.php +++ b/Sources/Maintenance/Tools/Upgrade.php @@ -182,6 +182,7 @@ class Upgrade extends ToolsBase implements ToolsInterface Migration\v3_0\PermissionChanges::class, Migration\v3_0\BoardPostsCount::class, Migration\v3_0\ValidationCodeLength::class, + Migration\v3_0\ReportCommentLength::class, ], ];