Skip to content

Use `CREATE OR REPLACE FUNCTION` to define vulnerability reads triggers

Mehmet Emin INAC requested to merge 368428_use_create_or_replace_function into master

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;

  1. Take a backup of the DB
  2. Upgrade the GitLab application to the latest version
  3. Restore the backup(Content of the schema_migrations table will be changed so the migration which creates the function will run again)
  4. 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.

Edited by Mehmet Emin INAC

Merge request reports