Remove sync namespace details triggers
What does this MR do and why?
This MR removes the database triggers that were added to sync namespace description fields to the namespace_details table. These triggers are no longer needed as the synchronization is now handled at the application level.
Closes: #545723
Implementation Details
The migration removes the following database objects:
-
trigger_update_details_on_namespace_update- trigger on namespace updates -
trigger_update_details_on_namespace_insert- trigger on namespace inserts -
update_namespace_details_from_namespaces()- PostgreSQL function used by the triggers
Important: This migration only removes the namespace table triggers and preserves the project table triggers as requested in the issue.
Database Migration
The migration follows the pattern described in the issue by "switching the up and down methods" of the original CreateSyncNamespaceDetailsTrigger migration:
- Up method: Removes the triggers and function
- Down method: Recreates the triggers and function for rollback purposes
Migration Output
-- Up migration
DROP TRIGGER IF EXISTS trigger_update_details_on_namespace_update ON namespaces;
DROP TRIGGER IF EXISTS trigger_update_details_on_namespace_insert ON namespaces;
DROP FUNCTION IF EXISTS update_namespace_details_from_namespaces();
How to set up and validate locally
- Run the migration:
rails db:migrate - Verify triggers are removed:
SELECT * FROM information_schema.triggers WHERE trigger_name LIKE '%namespace%'; - Test rollback:
rails db:migrate:down VERSION=20250901122000 - Verify triggers are recreated after rollback
MR acceptance checklist
-
I have evaluated the MR acceptance checklist for this MR. -
This MR only removes namespace table triggers, preserving project table triggers as requested -
Migration includes proper rollback functionality -
Migration follows GitLab database migration guidelines