You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: remove double-transformation in trigger length validation
ValidateGhostTriggerLengthBelowMaxLength was calling GetGhostTriggerName
on an already-transformed name, adding the suffix twice. This caused valid
trigger names (ghost name <= 64 chars) to be falsely rejected.
The caller in inspect.go:627 already transforms the name via
GetGhostTriggerName before passing it, so the validation function
should check the length as-is.
Unit tests updated to reflect the correct call pattern: transform first
with GetGhostTriggerName, then validate the result. Added boundary tests
for exactly 64 and 65 char names.
* fix: return error from trigger creation during atomic cut-over
During atomic cut-over, if CreateTriggersOnGhost failed, the error was
logged but not returned. The migration continued and completed without
triggers, silently losing them.
The two-step cut-over (line 793) already correctly returns the error.
This aligns the atomic cut-over to do the same.
* fix: check trigger name uniqueness per schema, not per table
validateGhostTriggersDontExist was filtering by event_object_table,
only checking if the ghost trigger name existed on the original table.
MySQL trigger names are unique per schema, so a trigger with the same
name on any other table would block CREATE TRIGGER but pass validation.
Remove the event_object_table filter to check trigger_name + trigger_schema
only, matching MySQL's uniqueness constraint.
* fix: use parameterized query in GetTriggers to prevent SQL injection
GetTriggers used fmt.Sprintf with string interpolation for database and
table names, causing SQL syntax errors with special characters and
potential SQL injection. Switched to parameterized query with ? placeholders,
matching the safe pattern already used in inspect.go:553-559.
* test: add regression tests for trigger handling bugs
Add two integration tests:
- trigger-long-name-validation: verifies 60-char trigger names
(64-char ghost name) are not falsely rejected by double-transform
- trigger-ghost-name-conflict: verifies validation detects ghost
trigger name conflicts on other tables in the same schema
* style: gofmt context_test.go
---------
Co-authored-by: Yakir Gibraltar <yakir.g@taboola.com>
Co-authored-by: meiji163 <meiji163@github.com>
0 commit comments