[2.x] [Tags] Drop legacy unused background columns from tags table#4529
[2.x] [Tags] Drop legacy unused background columns from tags table#4529Abdooo2235 wants to merge 2 commits intoflarum:2.xfrom
Conversation
DavideIadeluca
left a comment
There was a problem hiding this comment.
Thanks for picking up the issue I opened. Have you considered using Flarum’s migration helper? The migration in the PR feels a bit more complex than necessary and could likely be simplified along these lines:
use Flarum\Database\Migration;
return Migration::dropColumns('tags', [
'background_path' => [..],
'background_mode' => [..],
]);Note that with Migration::dropColumns() you still need to specify the column constraints and metadata, similar to what you would define in the up migration.
Another thing that stood out in the PR is that the attributes are still present. If background_mode and background_path are no longer required, wouldn’t this effectively become dead code? It might be better to remove them entirely and go for a clean break.
Since Flarum 2 hasn’t been tagged as stable yet, a breaking change like this should still be acceptable without creating backwards compatibility concerns.
|
@DavideIadeluca thanks a lot for the thoughtful review and for opening this issue in the first place. Great call on both points. I updated the PR accordingly:
I agree with your reasoning about 2.x still being pre-stable, so I went with the clean break approach here. I also reran the tags integration suite after the update: Really appreciate the guidance. |
Summary
This PR removes two legacy columns from the
tagstable that are no longer used by current tags flows:background_pathbackground_modeFixes #4527.
What changed
Migration::dropColumns()to remove both legacy columns.backgroundUrlandbackgroundModefrom the tags API resource.Tagmodel.Backward compatibility
Scope note
An unrelated local change in
extensions/tags/js/tsconfig.jsonwas intentionally excluded from this PR to keep the fix focused.Testing
extensions/tags/tests/integration/api/tags/SchemaTest.phpphpunitis not available (sh: 1: phpunit: not found).