Commit 1a168dc7 authored by Nick Thomas's avatar Nick Thomas

Fix caching large snippet HTML content on MySQL databases

parent 6201f4c2
---
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 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
......
...@@ -65,6 +65,7 @@ namespace :gitlab do ...@@ -65,6 +65,7 @@ namespace :gitlab do
migrations = `git diff #{ref}.. --diff-filter=A --name-only -- db/migrate`.lines migrations = `git diff #{ref}.. --diff-filter=A --name-only -- db/migrate`.lines
.map { |file| Rails.root.join(file.strip).to_s } .map { |file| Rails.root.join(file.strip).to_s }
.select { |file| File.file?(file) } .select { |file| File.file?(file) }
.select { |file| /\A[0-9]+.*\.rb\z/ =~ File.basename(file) }
Gitlab::DowntimeCheck.new.check_and_print(migrations) Gitlab::DowntimeCheck.new.check_and_print(migrations)
end end
......
require Rails.root.join('db/migrate/limits_to_mysql') 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" desc "GitLab | Add limits to strings in mysql database"
task add_limits_mysql: :environment do task add_limits_mysql: :environment do
puts "Adding limits to schema.rb for mysql" puts "Adding limits to schema.rb for mysql"
LimitsToMysql.new.up LimitsToMysql.new.up
MarkdownCacheLimitsToMysql.new.up
end 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