diff options
-rw-r--r-- | changelogs/unreleased/31647-fix-snippet-content_html.yml | 4 | ||||
-rw-r--r-- | db/migrate/20170502091007_markdown_cache_limits_to_mysql.rb | 2 | ||||
-rw-r--r-- | db/migrate/markdown_cache_limits_to_mysql.rb | 13 | ||||
-rw-r--r-- | db/schema.rb | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/db.rake | 1 | ||||
-rw-r--r-- | lib/tasks/migrate/add_limits_mysql.rake | 2 |
6 files changed, 23 insertions, 1 deletions
diff --git a/changelogs/unreleased/31647-fix-snippet-content_html.yml b/changelogs/unreleased/31647-fix-snippet-content_html.yml new file mode 100644 index 00000000000..db6d45926fd --- /dev/null +++ b/changelogs/unreleased/31647-fix-snippet-content_html.yml @@ -0,0 +1,4 @@ +--- +title: Fix caching large snippet HTML content on MySQL databases +merge_request: 11024 +author: diff --git a/db/migrate/20170502091007_markdown_cache_limits_to_mysql.rb b/db/migrate/20170502091007_markdown_cache_limits_to_mysql.rb new file mode 100644 index 00000000000..008a94d8334 --- /dev/null +++ b/db/migrate/20170502091007_markdown_cache_limits_to_mysql.rb @@ -0,0 +1,2 @@ +# rubocop:disable all +require_relative 'markdown_cache_limits_to_mysql' diff --git a/db/migrate/markdown_cache_limits_to_mysql.rb b/db/migrate/markdown_cache_limits_to_mysql.rb new file mode 100644 index 00000000000..f6686db3dc0 --- /dev/null +++ b/db/migrate/markdown_cache_limits_to_mysql.rb @@ -0,0 +1,13 @@ +class MarkdownCacheLimitsToMysql < ActiveRecord::Migration + DOWNTIME = false + + def up + return unless Gitlab::Database.mysql? + + change_column :snippets, :content_html, :text, limit: 2147483647 + end + + def down + # no-op + end +end diff --git a/db/schema.rb b/db/schema.rb index be6684f3a6b..01c0f00c924 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: 20170426181740) do +ActiveRecord::Schema.define(version: 20170502091007) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 5476438b8fa..139ab70e125 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -65,6 +65,7 @@ namespace :gitlab do migrations = `git diff #{ref}.. --diff-filter=A --name-only -- db/migrate`.lines .map { |file| Rails.root.join(file.strip).to_s } .select { |file| File.file?(file) } + .select { |file| /\A[0-9]+.*\.rb\z/ =~ File.basename(file) } Gitlab::DowntimeCheck.new.check_and_print(migrations) end diff --git a/lib/tasks/migrate/add_limits_mysql.rake b/lib/tasks/migrate/add_limits_mysql.rake index 6ded519aff2..761f275d42a 100644 --- a/lib/tasks/migrate/add_limits_mysql.rake +++ b/lib/tasks/migrate/add_limits_mysql.rake @@ -1,7 +1,9 @@ require Rails.root.join('db/migrate/limits_to_mysql') +require Rails.root.join('db/migrate/markdown_cache_limits_to_mysql') desc "GitLab | Add limits to strings in mysql database" task add_limits_mysql: :environment do puts "Adding limits to schema.rb for mysql" LimitsToMysql.new.up + MarkdownCacheLimitsToMysql.new.up end |