Sanitize id value passed to async background migration
This commit is contained in:
parent
4fa822ae9d
commit
84d9789d57
|
|
@ -2,15 +2,13 @@ module Gitlab
|
|||
module BackgroundMigration
|
||||
class MigrateBuildStageIdReference
|
||||
def perform(id)
|
||||
raise ArgumentError unless id.present?
|
||||
|
||||
sql = <<-SQL.strip_heredoc
|
||||
UPDATE "ci_builds"
|
||||
SET "stage_id" =
|
||||
(SELECT id FROM ci_stages
|
||||
WHERE ci_stages.pipeline_id = ci_builds.commit_id
|
||||
AND ci_stages.name = ci_builds.stage)
|
||||
WHERE "ci_builds"."id" = #{id}
|
||||
WHERE "ci_builds"."id" = #{id.to_i}
|
||||
AND "ci_builds"."stage_id" IS NULL
|
||||
SQL
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue