Add version migration support to rails 4
When switching to rails 5, we added migration version to all migration classes. This patch makes it possible to run versioned migrations also with rails 4
This commit is contained in:
parent
2e3dab3829
commit
4c6073974c
|
|
@ -26,6 +26,9 @@ module Gitlab
|
||||||
# setting disabled
|
# setting disabled
|
||||||
require_dependency Rails.root.join('lib/mysql_zero_date')
|
require_dependency Rails.root.join('lib/mysql_zero_date')
|
||||||
|
|
||||||
|
# This can be removed when we drop support for rails 4
|
||||||
|
require_dependency Rails.root.join('lib/rails4_migration_version')
|
||||||
|
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
# rubocop:disable Naming/FileName
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# When switching to rails 5, we added migration version to all migration
|
||||||
|
# classes. This patch makes it possible to run versioned migrations
|
||||||
|
# also with rails 4
|
||||||
|
|
||||||
|
unless Gitlab.rails5?
|
||||||
|
module ActiveRecord
|
||||||
|
class Migration
|
||||||
|
def self.[](version)
|
||||||
|
Migration
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue