Commit 8983ade2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '31647-fix-snippet-content_html' into 'master'

Fix caching large snippet HTML content on MySQL databases

Closes #31647

See merge request !11024
parents 12c34c1c 1a168dc7
---
title: Fix caching large snippet HTML content on MySQL databases
merge_request: 11024
author:
# rubocop:disable all
require_relative 'markdown_cache_limits_to_mysql'
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
......@@ -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"
......
......@@ -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
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment