diff --git a/changelogs/unreleased/ab-46530-mediumtext-for-gpg-keys.yml b/changelogs/unreleased/ab-46530-mediumtext-for-gpg-keys.yml new file mode 100644 index 00000000000..88ef62ebc0e --- /dev/null +++ b/changelogs/unreleased/ab-46530-mediumtext-for-gpg-keys.yml @@ -0,0 +1,5 @@ +--- +title: Increase text limit for GPG keys (mysql only). +merge_request: 19069 +author: +type: other diff --git a/db/migrate/20180521171529_increase_mysql_text_limit_for_gpg_keys.rb b/db/migrate/20180521171529_increase_mysql_text_limit_for_gpg_keys.rb new file mode 100644 index 00000000000..df84898003f --- /dev/null +++ b/db/migrate/20180521171529_increase_mysql_text_limit_for_gpg_keys.rb @@ -0,0 +1,2 @@ +# rubocop:disable all +require_relative 'gpg_keys_limits_to_mysql' diff --git a/db/migrate/gpg_keys_limits_to_mysql.rb b/db/migrate/gpg_keys_limits_to_mysql.rb new file mode 100644 index 00000000000..780340d0564 --- /dev/null +++ b/db/migrate/gpg_keys_limits_to_mysql.rb @@ -0,0 +1,15 @@ +class IncreaseMysqlTextLimitForGpgKeys < ActiveRecord::Migration + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + return unless Gitlab::Database.mysql? + + change_column :gpg_keys, :key, :text, limit: 16.megabytes - 1 + end + + def down + # no-op + end +end diff --git a/db/schema.rb b/db/schema.rb index c2e97f93160..37d336b9928 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180517082340) do +ActiveRecord::Schema.define(version: 20180521171529) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/lib/tasks/migrate/add_limits_mysql.rake b/lib/tasks/migrate/add_limits_mysql.rake index c6204f89de4..9b05876034c 100644 --- a/lib/tasks/migrate/add_limits_mysql.rake +++ b/lib/tasks/migrate/add_limits_mysql.rake @@ -2,6 +2,7 @@ require Rails.root.join('db/migrate/limits_to_mysql') require Rails.root.join('db/migrate/markdown_cache_limits_to_mysql') require Rails.root.join('db/migrate/merge_request_diff_file_limits_to_mysql') require Rails.root.join('db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql') +require Rails.root.join('db/migrate/gpg_keys_limits_to_mysql') desc "GitLab | Add limits to strings in mysql database" task add_limits_mysql: :environment do @@ -10,4 +11,5 @@ task add_limits_mysql: :environment do MarkdownCacheLimitsToMysql.new.up MergeRequestDiffFileLimitsToMysql.new.up LimitsCiBuildTraceChunksRawDataForMysql.new.up + IncreaseMysqlTextLimitForGpgKeys.new.up end