Fix IntColumnHandler::delete

Created on 14 July 2016, almost 9 years ago
Updated 13 May 2025, 6 days ago

So let's think on delete.

On MySQL / SQLite, not much needs to be done. When a dedicated table field gets dropped, the trigger is gone with it, no cleanup is necessary. When a shared table has two columns and one gets dropped then the trigger needs to be recreated but that's all, the same code can handle this. Changing the if (!$schema->fieldExists($table, $column_int)) { to

$int_exists = $schema->fieldExists($table, $column_int); 
if ($schema->fieldExists($table, $column) != $int_exists)) {
  $changed[] = $column_int; 
}
if (!$int_exists) {
  $schema->addField($table, $column_int, $spec);
}

is enough here. However, we need the test for the multiple column case before this can happen.

On PgSQL, table drop equally drops the trigger vs a column drop needs the relevant trigger dropped. The relevant function always needs to be dropped, though.

And this is not optional, if you drop a column in a shared table then the triggers will break the DB. However, that's insanely rare so I am not worried. This will be done in a few days.

📌 Task
Status

Active

Version

4.0

Component

Code

Created by

🇨🇦Canada jibran Toronto, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024