classAddForeignKeyToCiVariables<ActiveRecord::MigrationincludeGitlab::Database::MigrationHelpersDOWNTIME=falsedisable_ddl_transaction!defupexecute<<~SQL DELETE FROM ci_variables WHERE NOT EXISTS ( SELECT true FROM projects WHERE projects.id = ci_variables.project_id ) SQLadd_concurrent_foreign_key(:ci_variables,:projects,column: :project_id)enddefdownremove_foreign_key(:ci_variables,column: :project_id)endend