Use `CREATE OR REPLACE FUNCTION` to define vulnerability reads triggers
What does this MR do and why?
If we don't use CREATE OR REPLACE FUNCTION
and drop the existing trigger before trying to create it, the following scenario does not work;
- Take a backup of the DB
- Upgrade the GitLab application to the latest version
- Restore the backup(Content of the
schema_migrations
table will be changed so the migration which creates the function will run again) - Upgrade the GitLab application again to the latest version(fails as it tries creating the already existing function)
Related to Upgrades after db restore of 15.1.x fails with ... (#368428 - closed).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Mehmet Emin INAC