diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200123155929_remove_invalid_jira_data.rb | 25 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/db/post_migrate/20200123155929_remove_invalid_jira_data.rb b/db/post_migrate/20200123155929_remove_invalid_jira_data.rb new file mode 100644 index 00000000000..7ddac15c3fb --- /dev/null +++ b/db/post_migrate/20200123155929_remove_invalid_jira_data.rb @@ -0,0 +1,25 @@ +# 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 RemoveInvalidJiraData < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + sql = "DELETE FROM jira_tracker_data WHERE \ + (length(encrypted_api_url) > 0 AND encrypted_api_url_iv IS NULL) \ + OR (length(encrypted_url) > 0 AND encrypted_url_iv IS NULL) \ + OR (length(encrypted_username) > 0 AND encrypted_username_iv IS NULL) \ + OR (length(encrypted_password) > 0 AND encrypted_password_iv IS NULL)" + + execute(sql) + end + + def down + # We need to figure out why migrating data to jira_tracker_data table + # failed and then can recreate the data + end +end diff --git a/db/schema.rb b/db/schema.rb index f6b44f9de00..8ad4e080fe7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_01_21_132641) do +ActiveRecord::Schema.define(version: 2020_01_23_155929) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" |