Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200127090233_remove_invalid_issue_tracker_data.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6d64dd3d0d1098d45742976096ed3988aa356b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class RemoveInvalidIssueTrackerData < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    sql = "DELETE FROM issue_tracker_data WHERE \
        (length(encrypted_issues_url) > 0 AND encrypted_issues_url_iv IS NULL) \
        OR (length(encrypted_new_issue_url) > 0 AND encrypted_new_issue_url_iv IS NULL) \
        OR (length(encrypted_project_url) > 0 AND encrypted_project_url_iv IS NULL)"

    execute(sql)
  end

  def down
    # We need to figure out why migrating data to issue_tracker_data table
    # failed and then can recreate the data
  end
end