diff --git a/config/application.rb b/config/application.rb
index 1ad647bbb5cf78ea42b27452a7ced0984066772b..e67ae371afeb592195f6056cd1341d57591f3d6e 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -28,6 +28,9 @@ class Application < Rails::Application
     # setting disabled
     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.
     # Application configuration should go into files in config/initializers
     # -- all .rb files in that directory are automatically loaded.
diff --git a/db/migrate/20140313092127_init_schema.rb b/db/migrate/20140313092127_init_schema.rb
index 29fb386ad764e14ae6530acdad4f38c266cc89a5..4188599b4b46825f8b25a4210ff7671b089d3be6 100644
--- a/db/migrate/20140313092127_init_schema.rb
+++ b/db/migrate/20140313092127_init_schema.rb
@@ -1,4 +1,4 @@
-class InitSchema < ActiveRecord::Migration
+class InitSchema < ActiveRecord::Migration[4.2]
   DOWNTIME = true
 
   # rubocop:disable Metrics/AbcSize
diff --git a/db/migrate/20140407135544_fix_namespaces.rb b/db/migrate/20140407135544_fix_namespaces.rb
index 3d2ca5c13c4e6392aabab6d640af73728e8ac8d5..b16d65c4b5118358969fa2251eb48a59f1eca677 100644
--- a/db/migrate/20140407135544_fix_namespaces.rb
+++ b/db/migrate/20140407135544_fix_namespaces.rb
@@ -1,4 +1,4 @@
-class FixNamespaces < ActiveRecord::Migration
+class FixNamespaces < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb
index fb9c7a6636e8fedf89656a9728bcf7293fcffdf2..148b46f88308b7982083584a68cbd9c339fd4a9b 100644
--- a/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb
+++ b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration
+class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration[4.2]
   def up
     change_column :merge_request_diffs, :state, :string, null: true,
                   default: nil
diff --git a/db/migrate/20140416074002_add_index_on_iid.rb b/db/migrate/20140416074002_add_index_on_iid.rb
index 6cdaa5a3c08e3c3479d2810bd4b0491df6f17850..c7f707ca123f0beaf6a5e5099bc653d5d598e785 100644
--- a/db/migrate/20140416074002_add_index_on_iid.rb
+++ b/db/migrate/20140416074002_add_index_on_iid.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexOnIid < ActiveRecord::Migration
+class AddIndexOnIid < ActiveRecord::Migration[4.2]
   def change
     RemoveDuplicateIid.clean(Issue)
     RemoveDuplicateIid.clean(MergeRequest, 'target_project_id')
diff --git a/db/migrate/20140416185734_index_on_current_sign_in_at.rb b/db/migrate/20140416185734_index_on_current_sign_in_at.rb
index 8c620b545bd5c2e758a4df25c2e94127c412c7a4..7dabcb937b3085c6fee11228249a17f03085c186 100644
--- a/db/migrate/20140416185734_index_on_current_sign_in_at.rb
+++ b/db/migrate/20140416185734_index_on_current_sign_in_at.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class IndexOnCurrentSignInAt < ActiveRecord::Migration
+class IndexOnCurrentSignInAt < ActiveRecord::Migration[4.2]
   def change
     add_index :users, :current_sign_in_at
   end
diff --git a/db/migrate/20140428105831_add_notes_index_updated_at.rb b/db/migrate/20140428105831_add_notes_index_updated_at.rb
index 0589101af9385888703332b4b4675e6c11bba1b2..25bdf477e24f4eae2153bb7936b61942fa718bb6 100644
--- a/db/migrate/20140428105831_add_notes_index_updated_at.rb
+++ b/db/migrate/20140428105831_add_notes_index_updated_at.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddNotesIndexUpdatedAt < ActiveRecord::Migration
+class AddNotesIndexUpdatedAt < ActiveRecord::Migration[4.2]
   def change
     add_index :notes, :updated_at
   end
diff --git a/db/migrate/20140502115131_add_repo_size_to_db.rb b/db/migrate/20140502115131_add_repo_size_to_db.rb
index 090b30a4f26938398537e1bb78c0f10f13adc629..4cb7a01bbf2e77a36ea4e520345a2f13eabeaf98 100644
--- a/db/migrate/20140502115131_add_repo_size_to_db.rb
+++ b/db/migrate/20140502115131_add_repo_size_to_db.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddRepoSizeToDb < ActiveRecord::Migration
+class AddRepoSizeToDb < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :repository_size, :float, default: 0
   end
diff --git a/db/migrate/20140502125220_migrate_repo_size.rb b/db/migrate/20140502125220_migrate_repo_size.rb
index ca1b054600c64a29913623c9f5f349a594b13a0f..a69b02cddc4600391084ddd79d6cb73d4b0b0521 100644
--- a/db/migrate/20140502125220_migrate_repo_size.rb
+++ b/db/migrate/20140502125220_migrate_repo_size.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateRepoSize < ActiveRecord::Migration
+class MigrateRepoSize < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20140611135229_add_position_to_merge_request.rb b/db/migrate/20140611135229_add_position_to_merge_request.rb
index 3a7d2f7c359be201075cff5e7179f5a7d1c9d245..6ec644eeccecd8bf53fc2c18dda73fe6133d120d 100644
--- a/db/migrate/20140611135229_add_position_to_merge_request.rb
+++ b/db/migrate/20140611135229_add_position_to_merge_request.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPositionToMergeRequest < ActiveRecord::Migration
+class AddPositionToMergeRequest < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :position, :integer, default: 0
   end
diff --git a/db/migrate/20140625115202_create_users_star_projects.rb b/db/migrate/20140625115202_create_users_star_projects.rb
index d4f3fe5ac6226bf03fbc5666d3b4b446c5ce3f63..2237927fc787f056e98ea01980820c3979a7e39b 100644
--- a/db/migrate/20140625115202_create_users_star_projects.rb
+++ b/db/migrate/20140625115202_create_users_star_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateUsersStarProjects < ActiveRecord::Migration
+class CreateUsersStarProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20140729134820_create_labels.rb b/db/migrate/20140729134820_create_labels.rb
index 66d20e741a6e3b63f5316ecdf27058336e8703f3..1060610b660dfb440c8fcf0e3cce9d03e551e0a0 100644
--- a/db/migrate/20140729134820_create_labels.rb
+++ b/db/migrate/20140729134820_create_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateLabels < ActiveRecord::Migration
+class CreateLabels < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20140729140420_create_label_links.rb b/db/migrate/20140729140420_create_label_links.rb
index dacd9f2e4b6a9d9eba6075733976d94c5cc7062b..b8596a44a2188550eaf3cd6b4a770349dac55ab6 100644
--- a/db/migrate/20140729140420_create_label_links.rb
+++ b/db/migrate/20140729140420_create_label_links.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateLabelLinks < ActiveRecord::Migration
+class CreateLabelLinks < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20140729145339_migrate_project_tags.rb b/db/migrate/20140729145339_migrate_project_tags.rb
index 5760e4bfeaa85054dc04c24741d60f588b972a27..711a2d262aa0b351520a2f36d19e6a3c9748c594 100644
--- a/db/migrate/20140729145339_migrate_project_tags.rb
+++ b/db/migrate/20140729145339_migrate_project_tags.rb
@@ -1,4 +1,4 @@
-class MigrateProjectTags < ActiveRecord::Migration
+class MigrateProjectTags < ActiveRecord::Migration[4.2]
   def up
     ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags')
   end
diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb
index 04cdc6beaddcad8e88fc07db03890bb2dbfce565..a8bf8022dfcc1f2bc8e3d64f29fb246857dd9ba0 100644
--- a/db/migrate/20140729152420_migrate_taggable_labels.rb
+++ b/db/migrate/20140729152420_migrate_taggable_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateTaggableLabels < ActiveRecord::Migration
+class MigrateTaggableLabels < ActiveRecord::Migration[4.2]
   def up
     taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
     taggings.find_each(batch_size: 500) do |tagging|
diff --git a/db/migrate/20140730111702_add_index_to_labels.rb b/db/migrate/20140730111702_add_index_to_labels.rb
index cc7ac1fc449cf3fa27112936f6cf1386b562865d..21f9dfd5d47bde3d3ad7056e54e962d3156763da 100644
--- a/db/migrate/20140730111702_add_index_to_labels.rb
+++ b/db/migrate/20140730111702_add_index_to_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexToLabels < ActiveRecord::Migration
+class AddIndexToLabels < ActiveRecord::Migration[4.2]
   def change
     add_index "labels", :project_id
     add_index "label_links", :label_id
diff --git a/db/migrate/20140903115954_migrate_to_new_shell.rb b/db/migrate/20140903115954_migrate_to_new_shell.rb
index 04acf24284b77b68ef81cdde0c3abfdce9cf496c..cc0cce483b166bd55aea2319b544384967e429dd 100644
--- a/db/migrate/20140903115954_migrate_to_new_shell.rb
+++ b/db/migrate/20140903115954_migrate_to_new_shell.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateToNewShell < ActiveRecord::Migration
+class MigrateToNewShell < ActiveRecord::Migration[4.2]
   def change
     return if Rails.env.test?
 
diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb
index c2d67fad0abe2f8c387f266075abbcb4e6dedfca..bf94c64654b3ed80f932384d6770ef1b4e4044db 100644
--- a/db/migrate/20140907220153_serialize_service_properties.rb
+++ b/db/migrate/20140907220153_serialize_service_properties.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class SerializeServiceProperties < ActiveRecord::Migration
+class SerializeServiceProperties < ActiveRecord::Migration[4.2]
   def change
     unless column_exists?(:services, :properties)
       add_column :services, :properties, :text
diff --git a/db/migrate/20140914113604_add_members_table.rb b/db/migrate/20140914113604_add_members_table.rb
index 0f76bb0ef7960f4c9918b314a294e2fefc745da6..312ea1b94df6c8ae09e1775b83f7a0a9d3068222 100644
--- a/db/migrate/20140914113604_add_members_table.rb
+++ b/db/migrate/20140914113604_add_members_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMembersTable < ActiveRecord::Migration
+class AddMembersTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20140914145549_migrate_to_new_members_model.rb b/db/migrate/20140914145549_migrate_to_new_members_model.rb
index b4c98f016d0e29fa61d91f501e12eddeb419c809..22d8b3d651b39567faf04b73a55c8caa0b494666 100644
--- a/db/migrate/20140914145549_migrate_to_new_members_model.rb
+++ b/db/migrate/20140914145549_migrate_to_new_members_model.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateToNewMembersModel < ActiveRecord::Migration
+class MigrateToNewMembersModel < ActiveRecord::Migration[4.2]
   def up
     execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Namespace', group_access, notification_level, 'GroupMember' FROM users_groups"
     execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects"
diff --git a/db/migrate/20140914173417_remove_old_member_tables.rb b/db/migrate/20140914173417_remove_old_member_tables.rb
index d2ab326ef1fb936ee7a46f6f78c9f1a17f9416e4..edd69caa4705cfff6458894b2c72ee37b2ecd4c6 100644
--- a/db/migrate/20140914173417_remove_old_member_tables.rb
+++ b/db/migrate/20140914173417_remove_old_member_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveOldMemberTables < ActiveRecord::Migration
+class RemoveOldMemberTables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20141006143943_move_slack_service_to_webhook.rb b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
index 561184615cc6ce4def4c2170d5d641291995a6c1..1c9a1a74a4eb91c1502d0735fd1afc2001340414 100644
--- a/db/migrate/20141006143943_move_slack_service_to_webhook.rb
+++ b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MoveSlackServiceToWebhook < ActiveRecord::Migration
+class MoveSlackServiceToWebhook < ActiveRecord::Migration[4.2]
 
   DOWNTIME = true
   DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"'
diff --git a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb
index 0c14f75c154872270e43d87fbedf2e999449b7ff..9501aed8931e1b6ff2882c50c0cab4bdab23711e 100644
--- a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb
+++ b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddVisibilityLevelToSnippet < ActiveRecord::Migration
+class AddVisibilityLevelToSnippet < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20141118150935_add_audit_event.rb b/db/migrate/20141118150935_add_audit_event.rb
index 52d70b4a0ac693ae75bac5a4e719acd33d64db20..1e7dba568c943e5f426a37250494b526009ab5b1 100644
--- a/db/migrate/20141118150935_add_audit_event.rb
+++ b/db/migrate/20141118150935_add_audit_event.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddAuditEvent < ActiveRecord::Migration
+class AddAuditEvent < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20141121133009_add_timestamps_to_members.rb b/db/migrate/20141121133009_add_timestamps_to_members.rb
index ef6d4dedf32c95a69f85cc471def6bd66b392f36..cb575fc9ed7c971cb31e73b57a4d2c7fd549f7fe 100644
--- a/db/migrate/20141121133009_add_timestamps_to_members.rb
+++ b/db/migrate/20141121133009_add_timestamps_to_members.rb
@@ -3,7 +3,7 @@
 # became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which
 # was added in GitLab 7.5. With this migration we ensure that all rows in
 # 'members' have at least some created_at and updated_at timestamp.
-class AddTimestampsToMembers < ActiveRecord::Migration
+class AddTimestampsToMembers < ActiveRecord::Migration[4.2]
   def up
     execute "UPDATE members SET created_at = NOW() WHERE created_at is NULL"
     execute "UPDATE members SET updated_at = NOW() WHERE updated_at is NULL"
diff --git a/db/migrate/20141121161704_add_identity_table.rb b/db/migrate/20141121161704_add_identity_table.rb
index 5a399f0d325229a9353b214d7c515221cb510167..92f7a568077ef35045270d7e77b8b7fec24d8f92 100644
--- a/db/migrate/20141121161704_add_identity_table.rb
+++ b/db/migrate/20141121161704_add_identity_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIdentityTable < ActiveRecord::Migration
+class AddIdentityTable < ActiveRecord::Migration[4.2]
   def up
     create_table :identities do |t|
       t.string :extern_uid
diff --git a/db/migrate/20141126120926_add_merge_request_rebase_enabled_to_projects.rb b/db/migrate/20141126120926_add_merge_request_rebase_enabled_to_projects.rb
index 3dafdf0fde40e5d397be1ab1f024c28dff4545da..b9d8a5cb4359d445691c884bd0f09faf7d59cb8f 100644
--- a/db/migrate/20141126120926_add_merge_request_rebase_enabled_to_projects.rb
+++ b/db/migrate/20141126120926_add_merge_request_rebase_enabled_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration
+class AddMergeRequestRebaseEnabledToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20141205134006_add_locked_at_to_merge_request.rb b/db/migrate/20141205134006_add_locked_at_to_merge_request.rb
index 5aa91c7587afac05c8ce19ba59c49960907c0b57..6fdfb3eb974e419d2090d892fd3b5e4cec9d38b6 100644
--- a/db/migrate/20141205134006_add_locked_at_to_merge_request.rb
+++ b/db/migrate/20141205134006_add_locked_at_to_merge_request.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddLockedAtToMergeRequest < ActiveRecord::Migration
+class AddLockedAtToMergeRequest < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :locked_at, :datetime
   end
diff --git a/db/migrate/20141216155758_create_doorkeeper_tables.rb b/db/migrate/20141216155758_create_doorkeeper_tables.rb
index 17e45a77291ffc41cc5c0e04407ba0623d0e9b57..7bd0a15e7f519df7a2d901f679927a9ac59c2aea 100644
--- a/db/migrate/20141216155758_create_doorkeeper_tables.rb
+++ b/db/migrate/20141216155758_create_doorkeeper_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateDoorkeeperTables < ActiveRecord::Migration
+class CreateDoorkeeperTables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20141217125223_add_owner_to_application.rb b/db/migrate/20141217125223_add_owner_to_application.rb
index e5a669ab4d8b64be6e632a9d7b84b9563059d521..482a53f3ad542f8171a8b9a4f710a1df7d0037df 100644
--- a/db/migrate/20141217125223_add_owner_to_application.rb
+++ b/db/migrate/20141217125223_add_owner_to_application.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddOwnerToApplication < ActiveRecord::Migration
+class AddOwnerToApplication < ActiveRecord::Migration[4.2]
   def change
     add_column :oauth_applications, :owner_id, :integer, null: true
     add_column :oauth_applications, :owner_type, :string, null: true
diff --git a/db/migrate/20141223135007_add_import_data_to_project_table.rb b/db/migrate/20141223135007_add_import_data_to_project_table.rb
index 5db78f94cc978c3a06511aa76ff6ccd9339bf58a..516f58d645e794a1fbf918cd73dc1a5376907853 100644
--- a/db/migrate/20141223135007_add_import_data_to_project_table.rb
+++ b/db/migrate/20141223135007_add_import_data_to_project_table.rb
@@ -1,4 +1,4 @@
-class AddImportDataToProjectTable < ActiveRecord::Migration
+class AddImportDataToProjectTable < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :import_type, :string
     add_column :projects, :import_source, :string
diff --git a/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb
index a18b2f4974dd37719f64c130d0845a8ba8bd3dc9..43b7de85228296a9acf58101097015a3102e1353 100644
--- a/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb
+++ b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration
+class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration[4.2]
   def change
     add_column :protected_branches, :developers_can_push, :boolean, default: false, null: false
   end
diff --git a/db/migrate/20150108073740_create_application_settings.rb b/db/migrate/20150108073740_create_application_settings.rb
index 0e4c66ca8c02a6194de16ac240878d247249442a..be139fee63a391cf8045a3aca75e1e87344cdc29 100644
--- a/db/migrate/20150108073740_create_application_settings.rb
+++ b/db/migrate/20150108073740_create_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateApplicationSettings < ActiveRecord::Migration
+class CreateApplicationSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb
index aa179ce3a4d29ec0ff236cb74a4c219afb47701e..e630e2cc87875d778660225c75e3f44376518ca8 100644
--- a/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb
+++ b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb
@@ -1,4 +1,4 @@
-class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration
+class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :home_page_url, :string
   end
diff --git a/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb b/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
index c28ba3197ac80a5caa7931aa55540367ec3429d0..673628e106b9c24400a205baa1c33809018fa8a9 100644
--- a/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
+++ b/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb
@@ -1,4 +1,4 @@
-class AddGitlabAccessTokenToUser < ActiveRecord::Migration
+class AddGitlabAccessTokenToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :gitlab_access_token, :string
   end
diff --git a/db/migrate/20150125163100_add_default_branch_protection_setting.rb b/db/migrate/20150125163100_add_default_branch_protection_setting.rb
index 7ca3116d35440db2dc058952d4641394ccf3cae0..f6bfa422124fb8a47b88c1296b5c9e376fd81856 100644
--- a/db/migrate/20150125163100_add_default_branch_protection_setting.rb
+++ b/db/migrate/20150125163100_add_default_branch_protection_setting.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDefaultBranchProtectionSetting < ActiveRecord::Migration
+class AddDefaultBranchProtectionSetting < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :default_branch_protection, :integer, :default => 2
   end
diff --git a/db/migrate/20150205211843_add_timestamps_to_identities.rb b/db/migrate/20150205211843_add_timestamps_to_identities.rb
index a78e28eb4ebcec5a6396b01676f1d10318560f5d..c535a7ec78136933589e215f290511f49d6b0865 100644
--- a/db/migrate/20150205211843_add_timestamps_to_identities.rb
+++ b/db/migrate/20150205211843_add_timestamps_to_identities.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTimestampsToIdentities < ActiveRecord::Migration
+class AddTimestampsToIdentities < ActiveRecord::Migration[4.2]
   def change
     add_timestamps(:identities)
   end
diff --git a/db/migrate/20150206181414_add_index_to_created_at.rb b/db/migrate/20150206181414_add_index_to_created_at.rb
index a161fad79dca64ab0a34754546bcb4c5aba7c2cf..501acd6a7205a970ddcfd8d388e6639e86f5277d 100644
--- a/db/migrate/20150206181414_add_index_to_created_at.rb
+++ b/db/migrate/20150206181414_add_index_to_created_at.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexToCreatedAt < ActiveRecord::Migration
+class AddIndexToCreatedAt < ActiveRecord::Migration[4.2]
   def change
     add_index "users", [:created_at, :id]
     add_index "members", [:created_at, :id]
diff --git a/db/migrate/20150206222854_add_notification_email_to_user.rb b/db/migrate/20150206222854_add_notification_email_to_user.rb
index ab80f7e582f3022d75e3c0e6f734f44bc73293a2..7b0c251db4f26403cae5178f5bf90cb4fa68eb2b 100644
--- a/db/migrate/20150206222854_add_notification_email_to_user.rb
+++ b/db/migrate/20150206222854_add_notification_email_to_user.rb
@@ -1,4 +1,4 @@
-class AddNotificationEmailToUser < ActiveRecord::Migration
+class AddNotificationEmailToUser < ActiveRecord::Migration[4.2]
   def up
     add_column :users, :notification_email, :string
 
diff --git a/db/migrate/20150209222013_add_missing_index.rb b/db/migrate/20150209222013_add_missing_index.rb
index 18e3ac2cbbb76b3a937ac9b22cc170420d9ac563..99544ab3928a7ae74c1c123feba154f6ceb6a2da 100644
--- a/db/migrate/20150209222013_add_missing_index.rb
+++ b/db/migrate/20150209222013_add_missing_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMissingIndex < ActiveRecord::Migration
+class AddMissingIndex < ActiveRecord::Migration[4.2]
   def change
     add_index "services", [:created_at, :id]
   end
diff --git a/db/migrate/20150211172122_add_template_to_service.rb b/db/migrate/20150211172122_add_template_to_service.rb
index a3e96b25c567d450ff50a5b113d532f6dc1b527e..dd192a0fe763592c07bfcacd7d21f0759554904d 100644
--- a/db/migrate/20150211172122_add_template_to_service.rb
+++ b/db/migrate/20150211172122_add_template_to_service.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTemplateToService < ActiveRecord::Migration
+class AddTemplateToService < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :template, :boolean, default: false
   end
diff --git a/db/migrate/20150211174341_allow_null_in_services_project_id.rb b/db/migrate/20150211174341_allow_null_in_services_project_id.rb
index 68f0281279159537ca2cbb2990e967fd3d3d7277..4c90bf9c419735b9435ce206f54dd8e6080f7ec8 100644
--- a/db/migrate/20150211174341_allow_null_in_services_project_id.rb
+++ b/db/migrate/20150211174341_allow_null_in_services_project_id.rb
@@ -1,4 +1,4 @@
-class AllowNullInServicesProjectId < ActiveRecord::Migration
+class AllowNullInServicesProjectId < ActiveRecord::Migration[4.2]
   def change
     change_column :services, :project_id, :integer, null: true
   end
diff --git a/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb b/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
index 334020376e40c0afb3a7a08c9f85664373137800..7d7b9242cd6e2bf2b535138f126203196cb60e8d 100644
--- a/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
+++ b/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration
+class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true
   end
diff --git a/db/migrate/20150213114800_add_hide_no_password_to_user.rb b/db/migrate/20150213114800_add_hide_no_password_to_user.rb
index a2af3510b9c1c98b5f3ce022966fb34199e81704..348c0d22aba49a4a9b08e4a9ac1f57a41b45f2d1 100644
--- a/db/migrate/20150213114800_add_hide_no_password_to_user.rb
+++ b/db/migrate/20150213114800_add_hide_no_password_to_user.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddHideNoPasswordToUser < ActiveRecord::Migration
+class AddHideNoPasswordToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :hide_no_password, :boolean, default: false
   end
diff --git a/db/migrate/20150213121042_add_password_automatically_set_to_user.rb b/db/migrate/20150213121042_add_password_automatically_set_to_user.rb
index 4e84a13f0d2aca282078b12baffc218c758031d4..d0eb753b887bed51fb9f09e42aca093dd5247e04 100644
--- a/db/migrate/20150213121042_add_password_automatically_set_to_user.rb
+++ b/db/migrate/20150213121042_add_password_automatically_set_to_user.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration
+class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :password_automatically_set, :boolean, default: false
   end
diff --git a/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb b/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb
index 23ac1b399ec4007dc91ff6ab893015979ecbb1cb..639644174ca44ca888cea96013fa01e0d24f3633 100644
--- a/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb
+++ b/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb
@@ -1,4 +1,4 @@
-class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration
+class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :bitbucket_access_token, :string
     add_column :users, :bitbucket_access_token_secret, :string
diff --git a/db/migrate/20150219004514_add_events_to_services.rb b/db/migrate/20150219004514_add_events_to_services.rb
index 560382c3fa1e026a56618319cd47436597772127..7072056adcb3db2cc11606c5f7e54f84dd9fb187 100644
--- a/db/migrate/20150219004514_add_events_to_services.rb
+++ b/db/migrate/20150219004514_add_events_to_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddEventsToServices < ActiveRecord::Migration
+class AddEventsToServices < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :push_events, :boolean, :default => true
     add_column :services, :issues_events, :boolean, :default => true
diff --git a/db/migrate/20150223022001_set_missing_last_activity_at.rb b/db/migrate/20150223022001_set_missing_last_activity_at.rb
index 3f6d4d83474f639fa4fdfa102576051b020c76f4..c77ffbd4ebdd939d5b4e5fee8216249c33da427c 100644
--- a/db/migrate/20150223022001_set_missing_last_activity_at.rb
+++ b/db/migrate/20150223022001_set_missing_last_activity_at.rb
@@ -1,4 +1,4 @@
-class SetMissingLastActivityAt < ActiveRecord::Migration
+class SetMissingLastActivityAt < ActiveRecord::Migration[4.2]
   def up
     execute "UPDATE projects SET last_activity_at = updated_at WHERE last_activity_at IS NULL"
   end
diff --git a/db/migrate/20150225065047_add_note_events_to_services.rb b/db/migrate/20150225065047_add_note_events_to_services.rb
index 7843cabc43b477f52e8270938cc66cd2c2c5b26c..32c538e8681d0a4b8db1711e07fc859890e4c924 100644
--- a/db/migrate/20150225065047_add_note_events_to_services.rb
+++ b/db/migrate/20150225065047_add_note_events_to_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddNoteEventsToServices < ActiveRecord::Migration
+class AddNoteEventsToServices < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :note_events, :boolean, default: true, null: false
   end
diff --git a/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb b/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb
index 494c3033bfff79c57151b773fe72abb2a8195860..3091790f199dc3896f0b81eaa00be2bf78c84f4e 100644
--- a/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb
+++ b/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration
+class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :restricted_visibility_levels, :text
   end
diff --git a/db/migrate/20150306023106_fix_namespace_duplication.rb b/db/migrate/20150306023106_fix_namespace_duplication.rb
index ea53a9d71f23e32677e48888b4962e8a0a3595d7..49be152a75c116a7642bbd6dda32b067d6efddfb 100644
--- a/db/migrate/20150306023106_fix_namespace_duplication.rb
+++ b/db/migrate/20150306023106_fix_namespace_duplication.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class FixNamespaceDuplication < ActiveRecord::Migration
+class FixNamespaceDuplication < ActiveRecord::Migration[4.2]
   def up
     #fixes path duplication
     select_all('SELECT MAX(id) max, COUNT(id) cnt, path FROM namespaces GROUP BY path HAVING COUNT(id) > 1').each do |nms|
diff --git a/db/migrate/20150306023112_add_unique_index_to_namespace.rb b/db/migrate/20150306023112_add_unique_index_to_namespace.rb
index f293a9b643fbe212531c3227ff7f892a6e25731d..11472324cbf3e4467bcbd21b08aab0f7f57a8077 100644
--- a/db/migrate/20150306023112_add_unique_index_to_namespace.rb
+++ b/db/migrate/20150306023112_add_unique_index_to_namespace.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddUniqueIndexToNamespace < ActiveRecord::Migration
+class AddUniqueIndexToNamespace < ActiveRecord::Migration[4.2]
   def change
     remove_index :namespaces, column: :name if index_exists?(:namespaces, :name)
     remove_index :namespaces, column: :path if index_exists?(:namespaces, :path)
diff --git a/db/migrate/20150310194358_add_version_check_to_application_settings.rb b/db/migrate/20150310194358_add_version_check_to_application_settings.rb
index 5d3dae6e7d80b9cb0d7ac9517d169b8b4d272eb1..cc1b19f302ed64c08352f90d88d8164efc791d06 100644
--- a/db/migrate/20150310194358_add_version_check_to_application_settings.rb
+++ b/db/migrate/20150310194358_add_version_check_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddVersionCheckToApplicationSettings < ActiveRecord::Migration
+class AddVersionCheckToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :version_check_enabled, :boolean, default: true
   end
diff --git a/db/migrate/20150313012111_create_subscriptions_table.rb b/db/migrate/20150313012111_create_subscriptions_table.rb
index a9a8435330df2f34b8a69a2029dc4be00e8bfaae..37011504b49d0cbd6053778a528a80d2fc219870 100644
--- a/db/migrate/20150313012111_create_subscriptions_table.rb
+++ b/db/migrate/20150313012111_create_subscriptions_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateSubscriptionsTable < ActiveRecord::Migration
+class CreateSubscriptionsTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20150320234437_add_location_to_user.rb b/db/migrate/20150320234437_add_location_to_user.rb
index 32731d37d7558c4a01a3577372ea9ea8463f11d2..cf273ff916ea05f70a8ccda1cf1d47aa210e65f4 100644
--- a/db/migrate/20150320234437_add_location_to_user.rb
+++ b/db/migrate/20150320234437_add_location_to_user.rb
@@ -1,4 +1,4 @@
-class AddLocationToUser < ActiveRecord::Migration
+class AddLocationToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :location, :string
   end
diff --git a/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb b/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb
index 42dc8173e46ee315b46d68c8a2ed3a040427956e..a895d5f24f5e3128b325e5db2477bb9255685598 100644
--- a/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb
+++ b/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb
@@ -1,4 +1,4 @@
-class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration
+class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration[4.2]
   def up
     execute "UPDATE issues SET assignee_id = NULL WHERE assignee_id = -1"
     execute "UPDATE merge_requests SET assignee_id = NULL WHERE assignee_id = -1"
diff --git a/db/migrate/20150327122227_add_public_to_key.rb b/db/migrate/20150327122227_add_public_to_key.rb
index 33c20d65e034314cb2216ec4f130b15f2bb2d3db..58d8c16476f70a8fc5ecb4f52bac2cdb485f8662 100644
--- a/db/migrate/20150327122227_add_public_to_key.rb
+++ b/db/migrate/20150327122227_add_public_to_key.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPublicToKey < ActiveRecord::Migration
+class AddPublicToKey < ActiveRecord::Migration[4.2]
   def change
     add_column :keys, :public, :boolean, default: false, null: false
   end
diff --git a/db/migrate/20150327150017_add_import_data_to_project.rb b/db/migrate/20150327150017_add_import_data_to_project.rb
index 12c00339eec41f067b0e254788c0f7045c8a79c2..5d393364ee6667ae01d4898524279cf3fd5bf491 100644
--- a/db/migrate/20150327150017_add_import_data_to_project.rb
+++ b/db/migrate/20150327150017_add_import_data_to_project.rb
@@ -1,4 +1,4 @@
-class AddImportDataToProject < ActiveRecord::Migration
+class AddImportDataToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :import_data, :text
   end
diff --git a/db/migrate/20150327223628_add_devise_two_factor_to_users.rb b/db/migrate/20150327223628_add_devise_two_factor_to_users.rb
index 11b026ee8f3470d790b93c8190c84ab6c7f28e81..22202796547c0ddcd7c918045b26520a8d0b8dd9 100644
--- a/db/migrate/20150327223628_add_devise_two_factor_to_users.rb
+++ b/db/migrate/20150327223628_add_devise_two_factor_to_users.rb
@@ -1,4 +1,4 @@
-class AddDeviseTwoFactorToUsers < ActiveRecord::Migration
+class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :encrypted_otp_secret, :string
     add_column :users, :encrypted_otp_secret_iv, :string
diff --git a/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb b/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb
index 1d161674a9a90a5a285e0545dd557d756a3872e8..4ce60a257cb52e23a7a647fc82978ef33482f656 100644
--- a/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb
+++ b/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration
+class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :max_attachment_size, :integer, default: 10, null: false
   end
diff --git a/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb b/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb
index 913958db7c589b8c363fa019644ec6a29c493f8a..792b98c91f062869164f0e043f9c225a1e72a96a 100644
--- a/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb
+++ b/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb
@@ -1,4 +1,4 @@
-class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration
+class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :otp_backup_codes, :text
   end
diff --git a/db/migrate/20150406133311_add_invite_data_to_member.rb b/db/migrate/20150406133311_add_invite_data_to_member.rb
index 63d0f184f32dde1d4eb2f681277647a37c73039b..eee991185aba8a219fda0f47bdc410944d735134 100644
--- a/db/migrate/20150406133311_add_invite_data_to_member.rb
+++ b/db/migrate/20150406133311_add_invite_data_to_member.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddInviteDataToMember < ActiveRecord::Migration
+class AddInviteDataToMember < ActiveRecord::Migration[4.2]
   def up
     add_column :members, :created_by_id, :integer
     add_column :members, :invite_email, :string
diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb
index d9051f9fffdc0004da8de01fc026b13a2e25529b..a449fc51eccff61a7e8372ca13228fe5e94a8669 100644
--- a/db/migrate/20150411000035_fix_identities.rb
+++ b/db/migrate/20150411000035_fix_identities.rb
@@ -1,4 +1,4 @@
-class FixIdentities < ActiveRecord::Migration
+class FixIdentities < ActiveRecord::Migration[4.2]
   def up
     # Up until now, legacy 'ldap' references in the database were charitably
     # interpreted to point to the first LDAP server specified in the GitLab
diff --git a/db/migrate/20150411180045_rename_buildbox_service.rb b/db/migrate/20150411180045_rename_buildbox_service.rb
index 5a0b5d07e50f91ee6c23ae445affafd56c7232ef..ac4ccdfb723c09c034b42f81c1ccef6952784699 100644
--- a/db/migrate/20150411180045_rename_buildbox_service.rb
+++ b/db/migrate/20150411180045_rename_buildbox_service.rb
@@ -1,4 +1,4 @@
-class RenameBuildboxService < ActiveRecord::Migration
+class RenameBuildboxService < ActiveRecord::Migration[4.2]
   def up
     execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';"
   end
diff --git a/db/migrate/20150413192223_add_public_email_to_users.rb b/db/migrate/20150413192223_add_public_email_to_users.rb
index 0fed5eaf4616ab6b4187d47cbca17ba1800e4e25..991f0c668c333f2e4e243a87d2979219005ae930 100644
--- a/db/migrate/20150413192223_add_public_email_to_users.rb
+++ b/db/migrate/20150413192223_add_public_email_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPublicEmailToUsers < ActiveRecord::Migration
+class AddPublicEmailToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :public_email, :string, default: "", null: false
   end
diff --git a/db/migrate/20150417121913_create_project_import_data.rb b/db/migrate/20150417121913_create_project_import_data.rb
index c78f5fde85e0598ff39cc508f2c0d4af5020501b..383f64fd2c6a4b282fd3524e791d3e844654f845 100644
--- a/db/migrate/20150417121913_create_project_import_data.rb
+++ b/db/migrate/20150417121913_create_project_import_data.rb
@@ -1,4 +1,4 @@
-class CreateProjectImportData < ActiveRecord::Migration
+class CreateProjectImportData < ActiveRecord::Migration[4.2]
   def change
     create_table :project_import_data do |t|
       t.references :project
diff --git a/db/migrate/20150417122318_remove_import_data_from_project.rb b/db/migrate/20150417122318_remove_import_data_from_project.rb
index 5a008218fa5f34f24f721c1356a56c8a112135cf..c9a225a9d17b8c196ad845e4072e9c00270caa73 100644
--- a/db/migrate/20150417122318_remove_import_data_from_project.rb
+++ b/db/migrate/20150417122318_remove_import_data_from_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveImportDataFromProject < ActiveRecord::Migration
+class RemoveImportDataFromProject < ActiveRecord::Migration[4.2]
   def up
     remove_column :projects, :import_data
   end
diff --git a/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb b/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb
index 3445e9ce59e20e7cbdfab36845ee0e5cb4713fc2..d2e7656c9d49123e51578c12012275f2e4084b3c 100644
--- a/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb
+++ b/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
+class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration[4.2]
   include Gitlab::ShellAdapter
 
   class Namespace < ActiveRecord::Base
diff --git a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
index 50a9b2439e0934612fb80946c6ed9b6feed02abc..e0f35da422a2b88b6675eb9466b65630835e0e87 100644
--- a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
+++ b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration
+class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :default_project_visibility, :integer
     visibility = Settings.gitlab.default_projects_features['visibility_level']
diff --git a/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
index 281c88d2a7d401c21a5455d20e4b24742c1cda4b..5b2e692eb17b9326fa04de67bdabcb7a1e9b293b 100644
--- a/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
@@ -1,7 +1,7 @@
 # This migration is a duplicate of 20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
 # It shold be applied before the index additions to ensure that `name` is case sensitive.
 
-class GitlabChangeCollationForTagNames < ActiveRecord::Migration
+class GitlabChangeCollationForTagNames < ActiveRecord::Migration[4.2]
   def up
     if ActsAsTaggableOn::Utils.using_mysql?
       execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
diff --git a/db/migrate/20150425164647_remove_duplicate_tags.rb b/db/migrate/20150425164647_remove_duplicate_tags.rb
index e77623bf5078f070bbc5571cbdcc51f3e14a996a..5165eb65695f1d092f1814c6341699b1c280fdad 100644
--- a/db/migrate/20150425164647_remove_duplicate_tags.rb
+++ b/db/migrate/20150425164647_remove_duplicate_tags.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveDuplicateTags < ActiveRecord::Migration
+class RemoveDuplicateTags < ActiveRecord::Migration[4.2]
   def up
     select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag|
       tag_name = quote_string(tag["name"])
diff --git a/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb
index cbff98cdbc449c80a524a480fa7da4bc8d9b504d..d1951f640bb1bba05da0ee8c144bcd25d48365bb 100644
--- a/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb
@@ -1,6 +1,6 @@
 # rubocop:disable all
 # This migration comes from acts_as_taggable_on_engine (originally 2)
-class AddMissingUniqueIndices < ActiveRecord::Migration
+class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]
   def self.up
     add_index :tags, :name, unique: true
 
diff --git a/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
index 1568d2dd4ceaeaf45bb3e5693a0222da8fa6a1cc..b9af394f09b8e773f84f56526f888d389702ecb7 100644
--- a/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
@@ -1,6 +1,6 @@
 # rubocop:disable all
 # This migration comes from acts_as_taggable_on_engine (originally 3)
-class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
+class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]
   def self.up
     add_column :tags, :taggings_count, :integer, default: 0
 
diff --git a/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb
index 71f2d7f43309d0628ec0120e211c945559c46846..f28737615d7793a120768c304fa7462ea0b12743 100644
--- a/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb
@@ -1,5 +1,5 @@
 # This migration comes from acts_as_taggable_on_engine (originally 4)
-class AddMissingTaggableIndex < ActiveRecord::Migration
+class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]
   def self.up
     add_index :taggings, [:taggable_id, :taggable_type, :context]
   end
diff --git a/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
index bfb06bc7cda48c12580961fc53373a6153ac7f68..4c144a8693f9aa51d78917c756b62e849d2691c7 100644
--- a/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
+++ b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
@@ -1,7 +1,7 @@
 # This migration comes from acts_as_taggable_on_engine (originally 5)
 # This migration is added to circumvent issue #623 and have special characters
 # work properly
-class ChangeCollationForTagNames < ActiveRecord::Migration
+class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]
   def up
     if ActsAsTaggableOn::Utils.using_mysql?
       execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
diff --git a/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb b/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb
index 8f1b0cc8935aa7f19727b035495dca2f8d5d84c4..a3a86d26767588034660987bebbdd6f2e54ca939 100644
--- a/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb
+++ b/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb
@@ -1,4 +1,4 @@
-class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration
+class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :default_snippet_visibility, :integer
     visibility = Settings.gitlab.default_projects_features['visibility_level']
diff --git a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
index 244637e1c4a1263255db97f3c77acba3efab0fa2..370b807dd50e83c69591fdb3e9709b510d46e853 100644
--- a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
+++ b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb
@@ -1,4 +1,4 @@
-class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration
+class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration[4.2]
   def up
     execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\
         SELECT id FROM namespaces WHERE type='Group')")
diff --git a/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb b/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb
index 184e26536109e3b380959e59efd311a3c5388a53..df777263ecbfc25cdc11855c916ba90ea46e7adc 100644
--- a/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb
+++ b/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration
+class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :restricted_signup_domains, :text
   end
diff --git a/db/migrate/20150509180749_convert_legacy_reference_notes.rb b/db/migrate/20150509180749_convert_legacy_reference_notes.rb
index b02605489be33f3c7607b7dd3f3f8e1b721aefe7..a44a908c2f50cef73002a50f7b04bb922ca41100 100644
--- a/db/migrate/20150509180749_convert_legacy_reference_notes.rb
+++ b/db/migrate/20150509180749_convert_legacy_reference_notes.rb
@@ -5,7 +5,7 @@
 # becomes
 #
 #   mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666
-class ConvertLegacyReferenceNotes < ActiveRecord::Migration
+class ConvertLegacyReferenceNotes < ActiveRecord::Migration[4.2]
   def up
     execute %q{UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'}
   end
diff --git a/db/migrate/20150516060434_add_note_events_to_web_hooks.rb b/db/migrate/20150516060434_add_note_events_to_web_hooks.rb
index bf72e5e2e3adc3c5d5f6f4649569001a02b8c07d..ddf26240b8b2fc1cc6b110802da372bcfb24c64f 100644
--- a/db/migrate/20150516060434_add_note_events_to_web_hooks.rb
+++ b/db/migrate/20150516060434_add_note_events_to_web_hooks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddNoteEventsToWebHooks < ActiveRecord::Migration
+class AddNoteEventsToWebHooks < ActiveRecord::Migration[4.2]
   def up
     add_column :web_hooks, :note_events, :boolean, default: false, null: false
   end
diff --git a/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb b/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb
index 6a78294f0b2985d668dda2233033f4e934bcc37e..507e905acd699ca5cd82c085d750175b62c02d5d 100644
--- a/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb
+++ b/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration
+class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :user_oauth_applications, :bool, default: true
   end
diff --git a/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb b/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb
index 833c36de52d5e0526aa80890397669519ed3ff58..f43f20def5b6913cf7b0cea4d05fc1c398f15537 100644
--- a/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb
+++ b/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration
+class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :after_sign_out_path, :string
   end
diff --git a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb
index 61ff0af41f4c9dce2143c666833a3e641399ac07..93959a9010f56a0e3dda7d25f6ea768449002f79 100644
--- a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb
+++ b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb
@@ -1,4 +1,4 @@
-class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration
+class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     unless column_exists?(:application_settings, :session_expire_delay)
       add_column :application_settings, :session_expire_delay, :integer, default: 10080, null: false
diff --git a/db/migrate/20150610065936_add_dashboard_to_users.rb b/db/migrate/20150610065936_add_dashboard_to_users.rb
index df38472f89332236cffe6447e30e3ad2842741af..a0bf5f31f0009dd373d99808a0b2c315b3b58cb7 100644
--- a/db/migrate/20150610065936_add_dashboard_to_users.rb
+++ b/db/migrate/20150610065936_add_dashboard_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDashboardToUsers < ActiveRecord::Migration
+class AddDashboardToUsers < ActiveRecord::Migration[4.2]
   def up
     add_column :users, :dashboard, :integer, default: 0
   end
diff --git a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
index 8eed8678b2f0a5b9f92639858d91334e98b36659..4a085ff06f30a1293c3e17185fb3f5b545749f9e 100644
--- a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
+++ b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
@@ -1,4 +1,4 @@
-class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration
+class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration[4.2]
   def up
     execute %q{UPDATE users SET otp_required_for_login = FALSE WHERE otp_required_for_login IS NULL}
 
diff --git a/db/migrate/20150713160110_add_project_view_to_users.rb b/db/migrate/20150713160110_add_project_view_to_users.rb
index 0de5a93035c369a27027b74bac19ec29893dd2d9..fea63576187e54a0736baf4e6ef91b95a7c1050b 100644
--- a/db/migrate/20150713160110_add_project_view_to_users.rb
+++ b/db/migrate/20150713160110_add_project_view_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddProjectViewToUsers < ActiveRecord::Migration
+class AddProjectViewToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :project_view, :integer, default: 0
   end
diff --git a/db/migrate/20150717130904_add_commits_count_to_project.rb b/db/migrate/20150717130904_add_commits_count_to_project.rb
index 5799e068c693c0f5aee55685d621be83b221f1f0..df6c88f29613e25a0365a38490a496b89b377ceb 100644
--- a/db/migrate/20150717130904_add_commits_count_to_project.rb
+++ b/db/migrate/20150717130904_add_commits_count_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCommitsCountToProject < ActiveRecord::Migration
+class AddCommitsCountToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :commit_count, :integer, default: 0
   end
diff --git a/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb b/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb
index 78d45c7f96b8dbad7e5f36b1ea0b7ceca7499096..fab126c3d04627648edb4c2cc6cbde8cdbc99ef3 100644
--- a/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb
+++ b/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb
@@ -1,4 +1,4 @@
-class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration
+class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration[4.2]
   def change
     add_column :notes, :updated_by_id, :integer
     add_column :issues, :updated_by_id, :integer
diff --git a/db/migrate/20150806104937_create_abuse_reports.rb b/db/migrate/20150806104937_create_abuse_reports.rb
index 52aed9e1d1d79faaa814db60b6fc41449e0c58b5..be4fe8d1cfdcc599f6c37132bb6b0e2fdb5d69c4 100644
--- a/db/migrate/20150806104937_create_abuse_reports.rb
+++ b/db/migrate/20150806104937_create_abuse_reports.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateAbuseReports < ActiveRecord::Migration
+class CreateAbuseReports < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20150812080800_add_settings_import_sources.rb b/db/migrate/20150812080800_add_settings_import_sources.rb
index 07f417fa3e3100a3e73cd06fea4f8135482de8f1..59db31c868abb32b442437c8d2df1d0dfdb51eec 100644
--- a/db/migrate/20150812080800_add_settings_import_sources.rb
+++ b/db/migrate/20150812080800_add_settings_import_sources.rb
@@ -1,7 +1,7 @@
 # rubocop:disable all
 require 'yaml'
 
-class AddSettingsImportSources < ActiveRecord::Migration
+class AddSettingsImportSources < ActiveRecord::Migration[4.2]
   def change
     unless column_exists?(:application_settings, :import_sources)
       add_column :application_settings, :import_sources, :text
diff --git a/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb b/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb
index 7eaa7eda311308a117ba8f10ec91977af2dbf3bf..f0080ee0b464d50b9ec429d2cef3d57a05cdf0ed 100644
--- a/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb
+++ b/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveOauthTokensFromUsers < ActiveRecord::Migration
+class RemoveOauthTokensFromUsers < ActiveRecord::Migration[4.2]
   def change
     remove_column :users, :github_access_token, :string
     remove_column :users, :gitlab_access_token, :string
diff --git a/db/migrate/20150817163600_deduplicate_user_identities.rb b/db/migrate/20150817163600_deduplicate_user_identities.rb
index b0cfad7d20f299ed86b7beffbb81b3dffb28b96b..973a87e07eafd04fb2092549b4ec7596e1f086e9 100644
--- a/db/migrate/20150817163600_deduplicate_user_identities.rb
+++ b/db/migrate/20150817163600_deduplicate_user_identities.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class DeduplicateUserIdentities < ActiveRecord::Migration
+class DeduplicateUserIdentities < ActiveRecord::Migration[4.2]
   def change
     execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
     execute 'CREATE TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;'
diff --git a/db/migrate/20150818213832_add_sent_notifications.rb b/db/migrate/20150818213832_add_sent_notifications.rb
index 43e8d6a1a82e2d620e41ba6b14326424e383ec0f..45e95a843e1c9ca2c4dca6517e193259cdcec2fe 100644
--- a/db/migrate/20150818213832_add_sent_notifications.rb
+++ b/db/migrate/20150818213832_add_sent_notifications.rb
@@ -1,4 +1,4 @@
-class AddSentNotifications < ActiveRecord::Migration
+class AddSentNotifications < ActiveRecord::Migration[4.2]
   def change
     create_table :sent_notifications do |t|
       t.references :project
diff --git a/db/migrate/20150824002011_add_enable_ssl_verification.rb b/db/migrate/20150824002011_add_enable_ssl_verification.rb
index 6e992f0883429ff406bd08018f1dc314e4db8c86..2d877914f3967d7d14d7a0deb8f656cdb99083b6 100644
--- a/db/migrate/20150824002011_add_enable_ssl_verification.rb
+++ b/db/migrate/20150824002011_add_enable_ssl_verification.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddEnableSslVerification < ActiveRecord::Migration
+class AddEnableSslVerification < ActiveRecord::Migration[4.2]
   def change
     add_column :web_hooks, :enable_ssl_verification, :boolean, default: false
   end
diff --git a/db/migrate/20150826001931_add_ci_tables.rb b/db/migrate/20150826001931_add_ci_tables.rb
index d1f8506d1fe182f9213514c63e8e0c6ea43dee2d..aa2af44a15b98720e165d45e323108f7242754be 100644
--- a/db/migrate/20150826001931_add_ci_tables.rb
+++ b/db/migrate/20150826001931_add_ci_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiTables < ActiveRecord::Migration
+class AddCiTables < ActiveRecord::Migration[4.2]
   def change
     create_table "ci_application_settings", force: true do |t|
       t.boolean  "all_broken_builds"
diff --git a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
index 35df121519e2274eee9b541d826bed51b8a4e379..bf7db2fb12b671847cd8fdd15d25936a31868109 100644
--- a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
+++ b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddFastForwardOptionToProject < ActiveRecord::Migration
+class AddFastForwardOptionToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20150902001023_add_template_to_label.rb b/db/migrate/20150902001023_add_template_to_label.rb
index 0f6ae8d6cc3ea23d076a32de2874910ba0411d98..10769f29baae38491e91fc4c3b40b2316a3d40ff 100644
--- a/db/migrate/20150902001023_add_template_to_label.rb
+++ b/db/migrate/20150902001023_add_template_to_label.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTemplateToLabel < ActiveRecord::Migration
+class AddTemplateToLabel < ActiveRecord::Migration[4.2]
   def change
     add_column :labels, :template, :boolean, default: false
   end
diff --git a/db/migrate/20150914215247_add_ci_tags.rb b/db/migrate/20150914215247_add_ci_tags.rb
index b647bc9c8a2f87a0db0e4c15ddcc08131dd4beab..9afa45405401cfb4c3b5aa00f2921967a0b83d82 100644
--- a/db/migrate/20150914215247_add_ci_tags.rb
+++ b/db/migrate/20150914215247_add_ci_tags.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiTags < ActiveRecord::Migration
+class AddCiTags < ActiveRecord::Migration[4.2]
   def change
     create_table "ci_taggings", force: true do |t|
       t.integer  "tag_id"
diff --git a/db/migrate/20150915001905_enable_ssl_verification_by_default.rb b/db/migrate/20150915001905_enable_ssl_verification_by_default.rb
index 6e924262a13eaa65cc65626b6cd0f26522e33121..ddd071797533f4f7e411c45cfa7558a5daf541d1 100644
--- a/db/migrate/20150915001905_enable_ssl_verification_by_default.rb
+++ b/db/migrate/20150915001905_enable_ssl_verification_by_default.rb
@@ -1,4 +1,4 @@
-class EnableSslVerificationByDefault < ActiveRecord::Migration
+class EnableSslVerificationByDefault < ActiveRecord::Migration[4.2]
   def change
     change_column :web_hooks, :enable_ssl_verification, :boolean, default: true
   end
diff --git a/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb b/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb
index 90ce6c2db3da1ea6ccf7f48bbad547e813f77538..49081c9d7495ae2a102bb164989efd5aac66c1bc 100644
--- a/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb
+++ b/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb
@@ -1,4 +1,4 @@
-class EnableSslVerificationForWebHooks < ActiveRecord::Migration
+class EnableSslVerificationForWebHooks < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE web_hooks SET enable_ssl_verification = true")
   end
diff --git a/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb b/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb
index 37a27f11935c39640fb8a8ffffddff9831a05894..52867632880bd6b59f63261ac3498ca9a8cbea3a 100644
--- a/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb
+++ b/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddHelpPageTextToApplicationSettings < ActiveRecord::Migration
+class AddHelpPageTextToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :help_page_text, :text
   end
diff --git a/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb b/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb
index a18ed93cf37b032c9b62086fd6fc9c68973ab6e6..bf78aacd9f4c8357bb7775d6b11aa73db3678c14 100644
--- a/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb
+++ b/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexForCommittedAtAndId < ActiveRecord::Migration
+class AddIndexForCommittedAtAndId < ActiveRecord::Migration[4.2]
   def change
     add_index :ci_commits, [:project_id, :committed_at, :id]
   end
diff --git a/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb b/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb
index 6cf668a170e763748efa225a59d87818d5494789..153c1a798c33fdba1018cac95f172ce9f70d7243 100644
--- a/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb
+++ b/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddCiEnabledToApplicationSettings < ActiveRecord::Migration
+class AddCiEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :ci_enabled, :boolean, null: false, default: true
   end
diff --git a/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb
index 0aad6fe5e6e3a9176222c3f7b360d1e8c7ef1ba8..52651e1632404964d98941ca758a6644e118ba5c 100644
--- a/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb
+++ b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb
@@ -1,4 +1,4 @@
-class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration
+class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE merge_requests SET milestone_id = NULL where milestone_id NOT IN (SELECT id FROM milestones)")
   end
diff --git a/db/migrate/20150920010715_add_consumed_timestep_to_users.rb b/db/migrate/20150920010715_add_consumed_timestep_to_users.rb
index c8438b3f6aabd9caa9a4921b303323552f64554b..c69944b1e94922f1ea8286a42badcc473bf0b367 100644
--- a/db/migrate/20150920010715_add_consumed_timestep_to_users.rb
+++ b/db/migrate/20150920010715_add_consumed_timestep_to_users.rb
@@ -1,4 +1,4 @@
-class AddConsumedTimestepToUsers < ActiveRecord::Migration
+class AddConsumedTimestepToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :consumed_timestep, :integer
   end
diff --git a/db/migrate/20150920161119_add_line_code_to_sent_notification.rb b/db/migrate/20150920161119_add_line_code_to_sent_notification.rb
index d9af4e71751f886e94336f84d9b325fbeb020a15..671476f0b07f65dc6679c6341b9edaa37710d3f3 100644
--- a/db/migrate/20150920161119_add_line_code_to_sent_notification.rb
+++ b/db/migrate/20150920161119_add_line_code_to_sent_notification.rb
@@ -1,4 +1,4 @@
-class AddLineCodeToSentNotification < ActiveRecord::Migration
+class AddLineCodeToSentNotification < ActiveRecord::Migration[4.2]
   def change
     add_column :sent_notifications, :line_code, :string
   end
diff --git a/db/migrate/20150924125150_add_project_id_to_ci_commit.rb b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb
index 1a761fe0f863f057b676bef372fb33cd094020a1..c9f16b0f3f9c980a5570f8f5ce0c2e7945c54f01 100644
--- a/db/migrate/20150924125150_add_project_id_to_ci_commit.rb
+++ b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb
@@ -1,4 +1,4 @@
-class AddProjectIdToCiCommit < ActiveRecord::Migration
+class AddProjectIdToCiCommit < ActiveRecord::Migration[4.2]
   def up
     add_column :ci_commits, :gl_project_id, :integer
   end
diff --git a/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb
index 2be57b6062ebac7e17848c8ee3e8ca9485360b4b..ff31e70874ff77e3da4dfd433e4ece80d604c440 100644
--- a/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb
+++ b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb
@@ -1,4 +1,4 @@
-class MigrateProjectIdForCiCommits < ActiveRecord::Migration
+class MigrateProjectIdForCiCommits < ActiveRecord::Migration[4.2]
   def up
     subquery = 'SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = ci_commits.project_id'
     execute("UPDATE ci_commits SET gl_project_id=(#{subquery}) WHERE gl_project_id IS NULL")
diff --git a/db/migrate/20150930001110_merge_request_error_field.rb b/db/migrate/20150930001110_merge_request_error_field.rb
index c2ee498ef3ffe8d64e1b117273c70c1b5fea0102..30f012b0a92b9fdb3ca336270e243c9e2d71cb56 100644
--- a/db/migrate/20150930001110_merge_request_error_field.rb
+++ b/db/migrate/20150930001110_merge_request_error_field.rb
@@ -1,4 +1,4 @@
-class MergeRequestErrorField < ActiveRecord::Migration
+class MergeRequestErrorField < ActiveRecord::Migration[4.2]
   def up
     add_column :merge_requests, :merge_error, :string
   end
diff --git a/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb b/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb
index 8d47dac6441e87339cbe3a0a710d1f9e9a3391b2..181f9f059ac3e10554f67a0e6db1cc1e7fb4ab82 100644
--- a/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb
+++ b/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb
@@ -1,4 +1,4 @@
-class AddNullToNameForCiProjects < ActiveRecord::Migration
+class AddNullToNameForCiProjects < ActiveRecord::Migration[4.2]
   def up
     change_column_null :ci_projects, :name, true
   end
diff --git a/db/migrate/20150930110012_add_group_share_lock.rb b/db/migrate/20150930110012_add_group_share_lock.rb
index 96938bf9ab64b8ff5810a771e4e859aae477b47f..627557654571e4a79e871995c3d43386034e0abb 100644
--- a/db/migrate/20150930110012_add_group_share_lock.rb
+++ b/db/migrate/20150930110012_add_group_share_lock.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddGroupShareLock < ActiveRecord::Migration
+class AddGroupShareLock < ActiveRecord::Migration[4.2]
   def change
     add_column :namespaces, :share_with_group_lock, :boolean, default: false
   end
diff --git a/db/migrate/20151002112914_add_stage_idx_to_builds.rb b/db/migrate/20151002112914_add_stage_idx_to_builds.rb
index 68a745ffef49d6c1839964560013d6d274ff9434..f73df9dc284aa94b6e2db67b4783a42899a6ca98 100644
--- a/db/migrate/20151002112914_add_stage_idx_to_builds.rb
+++ b/db/migrate/20151002112914_add_stage_idx_to_builds.rb
@@ -1,4 +1,4 @@
-class AddStageIdxToBuilds < ActiveRecord::Migration
+class AddStageIdxToBuilds < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :stage_idx, :integer
   end
diff --git a/db/migrate/20151002121400_add_index_for_builds.rb b/db/migrate/20151002121400_add_index_for_builds.rb
index bd945c54540a9f306befd2ca231c18dd7f98927a..5e6f80a1d3df36e71e229bb1227d34962bfe096a 100644
--- a/db/migrate/20151002121400_add_index_for_builds.rb
+++ b/db/migrate/20151002121400_add_index_for_builds.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexForBuilds < ActiveRecord::Migration
+class AddIndexForBuilds < ActiveRecord::Migration[4.2]
   def up
     add_index :ci_builds, [:commit_id, :stage_idx, :created_at]
   end
diff --git a/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb b/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb
index e3d2ac1cea5cc43e34d52e07a1a055b5dbc20693..ea41921b6ee5404a28880036947b2fd8f9b65207 100644
--- a/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb
+++ b/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb
@@ -1,4 +1,4 @@
-class AddRefAndTagToBuilds < ActiveRecord::Migration
+class AddRefAndTagToBuilds < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :tag, :boolean
     add_column :ci_builds, :ref, :string
diff --git a/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb b/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb
index 52217ce5af2c04de40e233133d09f7406681b915..b4038e6fa8337e187253cd14c9b453dc32d6ca04 100644
--- a/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb
+++ b/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateRefAndTagToBuild < ActiveRecord::Migration
+class MigrateRefAndTagToBuild < ActiveRecord::Migration[4.2]
   def change
     execute('UPDATE ci_builds SET ref=(SELECT ref FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE ref IS NULL')
     execute('UPDATE ci_builds SET tag=(SELECT tag FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE tag IS NULL')
diff --git a/db/migrate/20151005075649_add_user_id_to_build.rb b/db/migrate/20151005075649_add_user_id_to_build.rb
index 0f4b92b8b79f3d587772627bf6cfea01c7125518..45372bf7cba02fd916fe1715306bb571fd224351 100644
--- a/db/migrate/20151005075649_add_user_id_to_build.rb
+++ b/db/migrate/20151005075649_add_user_id_to_build.rb
@@ -1,4 +1,4 @@
-class AddUserIdToBuild < ActiveRecord::Migration
+class AddUserIdToBuild < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :user_id, :integer
   end
diff --git a/db/migrate/20151005150751_add_layout_option_for_users.rb b/db/migrate/20151005150751_add_layout_option_for_users.rb
index 7e68606969f29f3dbe6523f90485b0d397c2e554..66cba21320aec0f038a10a58593cde8dfe62e5c8 100644
--- a/db/migrate/20151005150751_add_layout_option_for_users.rb
+++ b/db/migrate/20151005150751_add_layout_option_for_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddLayoutOptionForUsers < ActiveRecord::Migration
+class AddLayoutOptionForUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :layout, :integer, default: 0
   end
diff --git a/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb b/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb
index 07dba598749d5386f0768d8b521fa6794c1d9c74..a8e6e54062a10fe3cc7bedd0f0c28e17fb238017 100644
--- a/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb
+++ b/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveCiEnabledFromApplicationSettings < ActiveRecord::Migration
+class RemoveCiEnabledFromApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     remove_column :application_settings, :ci_enabled, :boolean, null: false, default: true
   end
diff --git a/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb b/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb
index 38208e598041a420df60094b6c04d0053857db77..d6c21bf86393b5fbdd27de87eb8199d9102931f2 100644
--- a/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb
+++ b/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration
+class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def up
diff --git a/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb b/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb
index 6080d2a0fcfa9eb9ad02a624606ae3b720485341..2ba1a6146e2da3bfa7f69329144e21d7170aee55 100644
--- a/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb
+++ b/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration
+class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def up
diff --git a/db/migrate/20151008123042_add_type_and_description_to_builds.rb b/db/migrate/20151008123042_add_type_and_description_to_builds.rb
index a19eb6c6c49bb30c3a42d2a13bd8c19022c3b63b..309655cf1955aed998f9bf7f5beaed85e5044483 100644
--- a/db/migrate/20151008123042_add_type_and_description_to_builds.rb
+++ b/db/migrate/20151008123042_add_type_and_description_to_builds.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTypeAndDescriptionToBuilds < ActiveRecord::Migration
+class AddTypeAndDescriptionToBuilds < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :type, :string
     add_column :ci_builds, :target_url, :string
diff --git a/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb b/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb
index 306fa7092ea7f879e06ba8ebbeb99499ccfe0c9a..f4445277a6f6aa5f2c9b7b80cfee20d839fc9248 100644
--- a/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb
+++ b/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateNameToDescriptionForBuilds < ActiveRecord::Migration
+class MigrateNameToDescriptionForBuilds < ActiveRecord::Migration[4.2]
   def change
     execute("UPDATE ci_builds SET type='Ci::Build' WHERE type IS NULL")
   end
diff --git a/db/migrate/20151008143519_add_admin_notification_email_setting.rb b/db/migrate/20151008143519_add_admin_notification_email_setting.rb
index 0bb581efe2c56d70d3041c17c065b7e631b00a11..60e0986e5a89f8f3de6891930da8f0133502cd16 100644
--- a/db/migrate/20151008143519_add_admin_notification_email_setting.rb
+++ b/db/migrate/20151008143519_add_admin_notification_email_setting.rb
@@ -1,4 +1,4 @@
-class AddAdminNotificationEmailSetting < ActiveRecord::Migration
+class AddAdminNotificationEmailSetting < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :admin_notification_email, :string
   end
diff --git a/db/migrate/20151012173029_set_jira_service_api_url.rb b/db/migrate/20151012173029_set_jira_service_api_url.rb
index 2b6f61428c013c9b4998de3bf64371cb383e2f2d..91cc6bbc78344e3aeab8d669159735084c2217c6 100644
--- a/db/migrate/20151012173029_set_jira_service_api_url.rb
+++ b/db/migrate/20151012173029_set_jira_service_api_url.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class SetJiraServiceApiUrl < ActiveRecord::Migration
+class SetJiraServiceApiUrl < ActiveRecord::Migration[4.2]
   # This migration can be performed online without errors, but some Jira API calls may be missed
   # when doing so because api_url is not yet available.
 
diff --git a/db/migrate/20151013092124_add_artifacts_file_to_builds.rb b/db/migrate/20151013092124_add_artifacts_file_to_builds.rb
index 5a299f7b26dd011909c83d5aea552f6bc1460d74..3936386a2c0feca2a406c0839bf091ddb87ef783 100644
--- a/db/migrate/20151013092124_add_artifacts_file_to_builds.rb
+++ b/db/migrate/20151013092124_add_artifacts_file_to_builds.rb
@@ -1,4 +1,4 @@
-class AddArtifactsFileToBuilds < ActiveRecord::Migration
+class AddArtifactsFileToBuilds < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :artifacts_file, :text
   end
diff --git a/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb b/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb
index eb3351eb767eb88ce79a9907e1bfeca496211f44..a9290fef11a2e2fa37bf61545851097c42931faf 100644
--- a/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb
+++ b/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiProjectsGlProjectIdIndex < ActiveRecord::Migration
+class AddCiProjectsGlProjectIdIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :ci_commits, :gl_project_id
   end
diff --git a/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb b/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb
index 899e004d61018db427b365e8cc3543f815225a20..c8a79f25ae509056ad986d43bf1b1b6721b8839a 100644
--- a/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb
+++ b/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiBuildsAndProjectsIndexes < ActiveRecord::Migration
+class AddCiBuildsAndProjectsIndexes < ActiveRecord::Migration[4.2]
   def change
     add_index :ci_projects, :gitlab_id
     add_index :ci_projects, :shared_runners_enabled
diff --git a/db/migrate/20151016195706_add_notes_line_code_index.rb b/db/migrate/20151016195706_add_notes_line_code_index.rb
index 3298630c1e8b95e41ae166c9c104a459530495c7..0a3ad103009f71d678d53c115f61e1db09c398de 100644
--- a/db/migrate/20151016195706_add_notes_line_code_index.rb
+++ b/db/migrate/20151016195706_add_notes_line_code_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddNotesLineCodeIndex < ActiveRecord::Migration
+class AddNotesLineCodeIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :notes, :line_code
   end
diff --git a/db/migrate/20151019111551_fix_build_tags.rb b/db/migrate/20151019111551_fix_build_tags.rb
index 299a24b0a7c5a75ce171f4cd5bf5765ee0336ac2..3c64388314d2df297796809f1b2f0828f9ff2a87 100644
--- a/db/migrate/20151019111551_fix_build_tags.rb
+++ b/db/migrate/20151019111551_fix_build_tags.rb
@@ -1,4 +1,4 @@
-class FixBuildTags < ActiveRecord::Migration
+class FixBuildTags < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE taggings SET taggable_type='CommitStatus' WHERE taggable_type='Ci::Build'")
   end
diff --git a/db/migrate/20151019111703_fail_build_without_names.rb b/db/migrate/20151019111703_fail_build_without_names.rb
index dcdb5d1b25ddcd5adb0744ce9d143b8814d4ea02..2dc9ffa32b979eb6bc0cb5d9b03e83aab4656db3 100644
--- a/db/migrate/20151019111703_fail_build_without_names.rb
+++ b/db/migrate/20151019111703_fail_build_without_names.rb
@@ -1,4 +1,4 @@
-class FailBuildWithoutNames < ActiveRecord::Migration
+class FailBuildWithoutNames < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE ci_builds SET status='failed' WHERE name IS NULL AND status='pending'")
   end
diff --git a/db/migrate/20151020145526_add_services_template_index.rb b/db/migrate/20151020145526_add_services_template_index.rb
index 14ff07bd726572c541a4a81503e1d4edf55a2109..24c373855e2460e27e58a7a9f26d73cd9a1af94a 100644
--- a/db/migrate/20151020145526_add_services_template_index.rb
+++ b/db/migrate/20151020145526_add_services_template_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddServicesTemplateIndex < ActiveRecord::Migration
+class AddServicesTemplateIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :services, :template
   end
diff --git a/db/migrate/20151020173516_ci_limits_to_mysql.rb b/db/migrate/20151020173516_ci_limits_to_mysql.rb
index 9bb960082f58befe42999d26e654750eae9db8c9..573922b851b4e000251be9c92efed808260c0e3a 100644
--- a/db/migrate/20151020173516_ci_limits_to_mysql.rb
+++ b/db/migrate/20151020173516_ci_limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class CiLimitsToMysql < ActiveRecord::Migration
+class CiLimitsToMysql < ActiveRecord::Migration[4.2]
   def change
     return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
 
diff --git a/db/migrate/20151020173906_add_ci_builds_index_for_status.rb b/db/migrate/20151020173906_add_ci_builds_index_for_status.rb
index 81a31e46ff88f95b349215bf6b3f84bc860718d4..231fc4f2a17d78b58048c473548b6268a6cf9eb1 100644
--- a/db/migrate/20151020173906_add_ci_builds_index_for_status.rb
+++ b/db/migrate/20151020173906_add_ci_builds_index_for_status.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiBuildsIndexForStatus < ActiveRecord::Migration
+class AddCiBuildsIndexForStatus < ActiveRecord::Migration[4.2]
   def change
     add_index :ci_builds, [:commit_id, :status, :type]
   end
diff --git a/db/migrate/20151023112551_fail_build_with_empty_name.rb b/db/migrate/20151023112551_fail_build_with_empty_name.rb
index 41c0f0649cd6192211e9a219abf24eba2f562fd0..28f531463bcafe593cd6402067f6d940fe8a6311 100644
--- a/db/migrate/20151023112551_fail_build_with_empty_name.rb
+++ b/db/migrate/20151023112551_fail_build_with_empty_name.rb
@@ -1,4 +1,4 @@
-class FailBuildWithEmptyName < ActiveRecord::Migration
+class FailBuildWithEmptyName < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE ci_builds SET status='failed' WHERE (name IS NULL OR name='') AND status='pending'")
   end
diff --git a/db/migrate/20151023144219_remove_satellites.rb b/db/migrate/20151023144219_remove_satellites.rb
index e73f300028ac8a2f2c47d0b9ae5e42c16e286834..2d1310b0208c12c1d201081f91b78bb82ad69c6e 100644
--- a/db/migrate/20151023144219_remove_satellites.rb
+++ b/db/migrate/20151023144219_remove_satellites.rb
@@ -1,6 +1,6 @@
 require 'fileutils'
 
-class RemoveSatellites < ActiveRecord::Migration
+class RemoveSatellites < ActiveRecord::Migration[4.2]
   def up
     satellites = Gitlab.config['satellites']
     return if satellites.nil?
diff --git a/db/migrate/20151026182941_add_project_path_index.rb b/db/migrate/20151026182941_add_project_path_index.rb
index 117f65c1a1b2dd803beb82ce05e922a356476168..bf0444450cd3ea8e1b7a5852b3322e170bb51ad8 100644
--- a/db/migrate/20151026182941_add_project_path_index.rb
+++ b/db/migrate/20151026182941_add_project_path_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddProjectPathIndex < ActiveRecord::Migration
+class AddProjectPathIndex < ActiveRecord::Migration[4.2]
   def up
     add_index :projects, :path
   end
diff --git a/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb b/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb
index 4a989669464af9daf65f7d5129f0516dd9bc673e..5b11a430e3005b814ebe1ffe3ad88bfb3ba2282b 100644
--- a/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb
+++ b/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMergeWhenBuildSucceedsToMergeRequest < ActiveRecord::Migration
+class AddMergeWhenBuildSucceedsToMergeRequest < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :merge_params, :text
     add_column :merge_requests, :merge_when_build_succeeds, :boolean, default: false, null: false
diff --git a/db/migrate/20151103001141_add_public_to_group.rb b/db/migrate/20151103001141_add_public_to_group.rb
index ba1f7c27832d1690c4233d9f65f324bdc7b7abd2..a5590bc1adc42893cd38532d26d722feae436922 100644
--- a/db/migrate/20151103001141_add_public_to_group.rb
+++ b/db/migrate/20151103001141_add_public_to_group.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPublicToGroup < ActiveRecord::Migration
+class AddPublicToGroup < ActiveRecord::Migration[4.2]
   def change
     add_column :namespaces, :public, :boolean, default: false
   end
diff --git a/db/migrate/20151103133339_add_shared_runners_setting.rb b/db/migrate/20151103133339_add_shared_runners_setting.rb
index 4231dfd5c2e81a00f4ffd2f41acf00dd5fc59137..6fc845d13962f3477cf17f77bd79353eef1130c9 100644
--- a/db/migrate/20151103133339_add_shared_runners_setting.rb
+++ b/db/migrate/20151103133339_add_shared_runners_setting.rb
@@ -1,4 +1,4 @@
-class AddSharedRunnersSetting < ActiveRecord::Migration
+class AddSharedRunnersSetting < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :shared_runners_enabled, :boolean, default: true, null: false
   end
diff --git a/db/migrate/20151103134857_create_lfs_objects.rb b/db/migrate/20151103134857_create_lfs_objects.rb
index db6fa27199bd9a2edb8d73c84411b5247952a893..2ba77e431a17a3b966f42b4b14af78185edc7803 100644
--- a/db/migrate/20151103134857_create_lfs_objects.rb
+++ b/db/migrate/20151103134857_create_lfs_objects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateLfsObjects < ActiveRecord::Migration
+class CreateLfsObjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20151103134958_create_lfs_objects_projects.rb b/db/migrate/20151103134958_create_lfs_objects_projects.rb
index 5af1c39fd9cfcf7e7a49895b3759b9e7e7c02d8e..6f8488463b09db974ca3cb7008d76aa5222ab516 100644
--- a/db/migrate/20151103134958_create_lfs_objects_projects.rb
+++ b/db/migrate/20151103134958_create_lfs_objects_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateLfsObjectsProjects < ActiveRecord::Migration
+class CreateLfsObjectsProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20151104105513_add_file_to_lfs_objects.rb b/db/migrate/20151104105513_add_file_to_lfs_objects.rb
index 7c57f3f0df655017afcd6ed4acba5af3b415973a..050b1e0750394dced9ef50058dabdf073aa9ff9c 100644
--- a/db/migrate/20151104105513_add_file_to_lfs_objects.rb
+++ b/db/migrate/20151104105513_add_file_to_lfs_objects.rb
@@ -1,4 +1,4 @@
-class AddFileToLfsObjects < ActiveRecord::Migration
+class AddFileToLfsObjects < ActiveRecord::Migration[4.2]
   def change
     add_column :lfs_objects, :file, :string
   end
diff --git a/db/migrate/20151105094515_create_releases.rb b/db/migrate/20151105094515_create_releases.rb
index 34dd7a10942bbc67a846ba2a2e54d0af6601494a..4b180a59486a36b10cabc9ccedc23e50e71fd1fb 100644
--- a/db/migrate/20151105094515_create_releases.rb
+++ b/db/migrate/20151105094515_create_releases.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateReleases < ActiveRecord::Migration
+class CreateReleases < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20151106000015_add_is_award_to_notes.rb b/db/migrate/20151106000015_add_is_award_to_notes.rb
index b463d939b78d44b9be049bd85ac1dbbe4163f6ab..1d866fb321384fdc6467f15dc6bf2dd93e502a51 100644
--- a/db/migrate/20151106000015_add_is_award_to_notes.rb
+++ b/db/migrate/20151106000015_add_is_award_to_notes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIsAwardToNotes < ActiveRecord::Migration
+class AddIsAwardToNotes < ActiveRecord::Migration[4.2]
   def change
     add_column :notes, :is_award, :boolean, default: false, null: false
     add_index :notes, :is_award
diff --git a/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb b/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb
index 01d8c0f043eb7f1c4987056d87b4f64b1581dea3..9c14cfd4656250cea1a2a82524981f7e7b3c935f 100644
--- a/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb
+++ b/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddMaxArtifactsSizeToApplicationSettings < ActiveRecord::Migration
+class AddMaxArtifactsSizeToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :max_artifacts_size, :integer, default: 100, null: false
   end
diff --git a/db/migrate/20151109134526_add_issues_state_index.rb b/db/migrate/20151109134526_add_issues_state_index.rb
index 7a9970e85914eccf85823c57d1e2f47a3adba6af..c77ca90a0d6240f56e9238a51ebdcde83fd8cb30 100644
--- a/db/migrate/20151109134526_add_issues_state_index.rb
+++ b/db/migrate/20151109134526_add_issues_state_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIssuesStateIndex < ActiveRecord::Migration
+class AddIssuesStateIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :issues, :state
   end
diff --git a/db/migrate/20151109134916_add_projects_visibility_level_index.rb b/db/migrate/20151109134916_add_projects_visibility_level_index.rb
index 471db437b111ee9e930bd4843456a934435b51e7..1e945f0e56f0ba29bfe592e8b20080e4590debed 100644
--- a/db/migrate/20151109134916_add_projects_visibility_level_index.rb
+++ b/db/migrate/20151109134916_add_projects_visibility_level_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddProjectsVisibilityLevelIndex < ActiveRecord::Migration
+class AddProjectsVisibilityLevelIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :projects, :visibility_level
   end
diff --git a/db/migrate/20151110125604_add_import_error_to_project.rb b/db/migrate/20151110125604_add_import_error_to_project.rb
index 7fc990f8d0a9f56316c566ae421b158e8d26d268..48a15ad073700bf0fcff4519d05e57179832b788 100644
--- a/db/migrate/20151110125604_add_import_error_to_project.rb
+++ b/db/migrate/20151110125604_add_import_error_to_project.rb
@@ -1,4 +1,4 @@
-class AddImportErrorToProject < ActiveRecord::Migration
+class AddImportErrorToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :import_error, :text
   end
diff --git a/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb b/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb
index 00a4c74ffbcc0a58af4e7a56c750bf01ccbc95d3..f2788117cc2d8b81b0f5574f47c77f8a1f5c65e8 100644
--- a/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb
+++ b/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexForLfsOidAndSize < ActiveRecord::Migration
+class AddIndexForLfsOidAndSize < ActiveRecord::Migration[4.2]
   def change
     add_index :lfs_objects, :oid
     add_index :lfs_objects, [:oid, :size]
diff --git a/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb b/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb
index 1f192544ea155d9e04094c126d1f2b02ac75b772..3bfbae67119c5b6c80c26d63b0699a010e1212b6 100644
--- a/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb
+++ b/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddUniqueForLfsOidIndex < ActiveRecord::Migration
+class AddUniqueForLfsOidIndex < ActiveRecord::Migration[4.2]
   def change
     remove_index :lfs_objects, :oid
     remove_index :lfs_objects, [:oid, :size]
diff --git a/db/migrate/20151118162244_add_projects_public_index.rb b/db/migrate/20151118162244_add_projects_public_index.rb
index 589f124c21e674c8bd2fae0f4dad5201b1b5d6a0..3a525c69ad06c1640580b99f5230237302ff3145 100644
--- a/db/migrate/20151118162244_add_projects_public_index.rb
+++ b/db/migrate/20151118162244_add_projects_public_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddProjectsPublicIndex < ActiveRecord::Migration
+class AddProjectsPublicIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :namespaces, :public
   end
diff --git a/db/migrate/20151201203948_raise_hook_url_limit.rb b/db/migrate/20151201203948_raise_hook_url_limit.rb
index 98a7fca6f6f3eb256ffd78c312a72dd244361d8e..c1a4974b8c9a480b183a7ceb7931badbee47731b 100644
--- a/db/migrate/20151201203948_raise_hook_url_limit.rb
+++ b/db/migrate/20151201203948_raise_hook_url_limit.rb
@@ -1,4 +1,4 @@
-class RaiseHookUrlLimit < ActiveRecord::Migration
+class RaiseHookUrlLimit < ActiveRecord::Migration[4.2]
   def change
     change_column :web_hooks, :url, :string, limit: 2000
   end
diff --git a/db/migrate/20151203162133_add_hide_project_limit_to_users.rb b/db/migrate/20151203162133_add_hide_project_limit_to_users.rb
index 5dc6d8bf44527f34fe9708e7c7cfd9a85c88ac7f..1b96a0dc55017474f882528c86baedb28623aa11 100644
--- a/db/migrate/20151203162133_add_hide_project_limit_to_users.rb
+++ b/db/migrate/20151203162133_add_hide_project_limit_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddHideProjectLimitToUsers < ActiveRecord::Migration
+class AddHideProjectLimitToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :hide_project_limit, :boolean, default: false
   end
diff --git a/db/migrate/20151203162134_add_build_events_to_services.rb b/db/migrate/20151203162134_add_build_events_to_services.rb
index 455882e5ec06b69626fe6588cff9ee6620cab1ba..c49604f8b61ed1ef3125cf7ddb0c27364faf01dc 100644
--- a/db/migrate/20151203162134_add_build_events_to_services.rb
+++ b/db/migrate/20151203162134_add_build_events_to_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddBuildEventsToServices < ActiveRecord::Migration
+class AddBuildEventsToServices < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :build_events, :boolean, default: false, null: false
     add_column :web_hooks, :build_events, :boolean, default: false, null: false
diff --git a/db/migrate/20151209144329_migrate_ci_web_hooks.rb b/db/migrate/20151209144329_migrate_ci_web_hooks.rb
index e1e4729f821045ac07532783245c09b6ec5e6aef..7562735cb1e167c06927a1ffe8e99a0f67ba66e9 100644
--- a/db/migrate/20151209144329_migrate_ci_web_hooks.rb
+++ b/db/migrate/20151209144329_migrate_ci_web_hooks.rb
@@ -1,4 +1,4 @@
-class MigrateCiWebHooks < ActiveRecord::Migration
+class MigrateCiWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20151209145909_migrate_ci_emails.rb b/db/migrate/20151209145909_migrate_ci_emails.rb
index e1d92f0157ea12709429856a7568f7bf573f0968..a1f51c55a55157a63f05e9954eef7776120be3f3 100644
--- a/db/migrate/20151209145909_migrate_ci_emails.rb
+++ b/db/migrate/20151209145909_migrate_ci_emails.rb
@@ -1,4 +1,4 @@
-class MigrateCiEmails < ActiveRecord::Migration
+class MigrateCiEmails < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20151210030143_add_unlock_token_to_user.rb b/db/migrate/20151210030143_add_unlock_token_to_user.rb
index 0ea66ba65dfa6df8896b219dcedbb9aac460b9cd..28b736adfb57ea23834e5291e80e43c908a4bf64 100644
--- a/db/migrate/20151210030143_add_unlock_token_to_user.rb
+++ b/db/migrate/20151210030143_add_unlock_token_to_user.rb
@@ -1,4 +1,4 @@
-class AddUnlockTokenToUser < ActiveRecord::Migration
+class AddUnlockTokenToUser < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :unlock_token, :string
   end
diff --git a/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb b/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb
index 00f88180e46ab07536689ad373ea221e213e1037..5da33149b5920dae5cb5264ad80ca8a36cd4374f 100644
--- a/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb
+++ b/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRunnersRegistrationTokenToApplicationSettings < ActiveRecord::Migration
+class AddRunnersRegistrationTokenToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :runners_registration_token, :string
   end
diff --git a/db/migrate/20151210125232_migrate_ci_slack_service.rb b/db/migrate/20151210125232_migrate_ci_slack_service.rb
index e6dca4c0008ed0dbe6fe69232a27c7d24e2a5a30..72c90f92377f696596f1b57e8113da70a080264f 100644
--- a/db/migrate/20151210125232_migrate_ci_slack_service.rb
+++ b/db/migrate/20151210125232_migrate_ci_slack_service.rb
@@ -1,4 +1,4 @@
-class MigrateCiSlackService < ActiveRecord::Migration
+class MigrateCiSlackService < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
index 72fcebf2959a4273cca90cd13d385134defb06bb..5ec0798c38fb5068bb26b0ebae182c62606bc11e 100644
--- a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
+++ b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb
@@ -1,4 +1,4 @@
-class MigrateCiHipChatService < ActiveRecord::Migration
+class MigrateCiHipChatService < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20151210125928_add_ci_to_project.rb b/db/migrate/20151210125928_add_ci_to_project.rb
index a9ff49a3f7e1d384f5b1ea9b049c8034d176799f..182f1e17b9a0d11c0634ea274780c2b2141bc8d1 100644
--- a/db/migrate/20151210125928_add_ci_to_project.rb
+++ b/db/migrate/20151210125928_add_ci_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiToProject < ActiveRecord::Migration
+class AddCiToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :ci_id, :integer
     add_column :projects, :builds_enabled, :boolean, default: true, null: false
diff --git a/db/migrate/20151210125929_add_project_id_to_ci.rb b/db/migrate/20151210125929_add_project_id_to_ci.rb
index 84273591fa2ede4f606e2ab9cae2418330e00cf1..f5f2c353f4a04e5ee78a664cc7dd413eb8cc590f 100644
--- a/db/migrate/20151210125929_add_project_id_to_ci.rb
+++ b/db/migrate/20151210125929_add_project_id_to_ci.rb
@@ -1,4 +1,4 @@
-class AddProjectIdToCi < ActiveRecord::Migration
+class AddProjectIdToCi < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :gl_project_id, :integer
     add_column :ci_runner_projects, :gl_project_id, :integer
diff --git a/db/migrate/20151210125930_migrate_ci_to_project.rb b/db/migrate/20151210125930_migrate_ci_to_project.rb
index c32c7feb1931443f5e28b1ee0d56eae5cbe71674..f7573ad1a8d0345d4f0b64ac3b99efada5961943 100644
--- a/db/migrate/20151210125930_migrate_ci_to_project.rb
+++ b/db/migrate/20151210125930_migrate_ci_to_project.rb
@@ -1,4 +1,4 @@
-class MigrateCiToProject < ActiveRecord::Migration
+class MigrateCiToProject < ActiveRecord::Migration[4.2]
   def up
     migrate_project_id_for_table('ci_runner_projects')
     migrate_project_id_for_table('ci_triggers')
diff --git a/db/migrate/20151210125931_add_index_to_ci_tables.rb b/db/migrate/20151210125931_add_index_to_ci_tables.rb
index d87d335cf6b1093af2f3fd9413b5ce321ec2cb0a..2cbc5b505388275a873a2c6cf66bfe2998f674ec 100644
--- a/db/migrate/20151210125931_add_index_to_ci_tables.rb
+++ b/db/migrate/20151210125931_add_index_to_ci_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexToCiTables < ActiveRecord::Migration
+class AddIndexToCiTables < ActiveRecord::Migration[4.2]
   def change
     add_index :ci_builds, :gl_project_id
     add_index :ci_runner_projects, :gl_project_id
diff --git a/db/migrate/20151210125932_drop_null_for_ci_tables.rb b/db/migrate/20151210125932_drop_null_for_ci_tables.rb
index e1a0a964589adad0e6e766a303bfe837ca8b4eb9..b48fef4b749f66e3d71f9fd41774814e0fa321f0 100644
--- a/db/migrate/20151210125932_drop_null_for_ci_tables.rb
+++ b/db/migrate/20151210125932_drop_null_for_ci_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class DropNullForCiTables < ActiveRecord::Migration
+class DropNullForCiTables < ActiveRecord::Migration[4.2]
   def change
     remove_index :ci_variables, :project_id
     remove_index :ci_runner_projects, :project_id
diff --git a/db/migrate/20151215132013_add_pages_size_to_application_settings.rb b/db/migrate/20151215132013_add_pages_size_to_application_settings.rb
index f3a663f805bd8ed78bbae7e508970fe8cb241c94..7190d476dc74986fd2435dd42b8c6992d0b4145e 100644
--- a/db/migrate/20151215132013_add_pages_size_to_application_settings.rb
+++ b/db/migrate/20151215132013_add_pages_size_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddPagesSizeToApplicationSettings < ActiveRecord::Migration
+class AddPagesSizeToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20151218154042_add_tfa_to_application_settings.rb b/db/migrate/20151218154042_add_tfa_to_application_settings.rb
index dd95db775c5e5e548b8d567223fd8c9dc2607de0..a981fe2720f9a83bfde4f8ba5dfebf6b81600c78 100644
--- a/db/migrate/20151218154042_add_tfa_to_application_settings.rb
+++ b/db/migrate/20151218154042_add_tfa_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddTfaToApplicationSettings < ActiveRecord::Migration
+class AddTfaToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     change_table :application_settings do |t|
       t.boolean :require_two_factor_authentication, default: false
diff --git a/db/migrate/20151221234414_add_tfa_additional_fields.rb b/db/migrate/20151221234414_add_tfa_additional_fields.rb
index c16df47932f6e902d58e5758bc5ff86047cfdfc8..fed734f77f40009c04b46a109a810c07df93fde8 100644
--- a/db/migrate/20151221234414_add_tfa_additional_fields.rb
+++ b/db/migrate/20151221234414_add_tfa_additional_fields.rb
@@ -1,4 +1,4 @@
-class AddTfaAdditionalFields < ActiveRecord::Migration
+class AddTfaAdditionalFields < ActiveRecord::Migration[4.2]
   def change
     change_table :users do |t|
       t.datetime :otp_grace_period_started_at, null: true
diff --git a/db/migrate/20151224123230_rename_emojis.rb b/db/migrate/20151224123230_rename_emojis.rb
index 62d921dfdcce3e26b7efd0afd2a3dd192bddeead..f1e4b1fe1815088d2c8b2ca206984ce03dae427f 100644
--- a/db/migrate/20151224123230_rename_emojis.rb
+++ b/db/migrate/20151224123230_rename_emojis.rb
@@ -1,5 +1,5 @@
 # Migration type: online without errors (works on previous version and new one)
-class RenameEmojis < ActiveRecord::Migration
+class RenameEmojis < ActiveRecord::Migration[4.2]
   def up
     # Renames aliases to main names
     execute("UPDATE notes SET note ='thumbsup' WHERE is_award = true AND note = '+1'")
diff --git a/db/migrate/20151228111122_remove_public_from_namespace.rb b/db/migrate/20151228111122_remove_public_from_namespace.rb
index bcb322d9cba3441fd9625ea09b481eb847b84969..ad922e3fc58e7d382c491c5fa4cb93581fd45515 100644
--- a/db/migrate/20151228111122_remove_public_from_namespace.rb
+++ b/db/migrate/20151228111122_remove_public_from_namespace.rb
@@ -1,6 +1,6 @@
 # rubocop:disable all
 # Migration type: online
-class RemovePublicFromNamespace < ActiveRecord::Migration
+class RemovePublicFromNamespace < ActiveRecord::Migration[4.2]
   def change
     remove_column :namespaces, :public, :boolean
   end
diff --git a/db/migrate/20151228150906_influxdb_settings.rb b/db/migrate/20151228150906_influxdb_settings.rb
index 2e080a02e6a8c5b62b99ac9b3c8c113951f9b883..8266e3c50447f28b25e76b50a3be636258b0de8f 100644
--- a/db/migrate/20151228150906_influxdb_settings.rb
+++ b/db/migrate/20151228150906_influxdb_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class InfluxdbSettings < ActiveRecord::Migration
+class InfluxdbSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :metrics_enabled, :boolean, default: false
 
diff --git a/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb b/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb
index 259fd0248d2914c52f95a8353668458b8d0d9ce7..523f2cae0925bcfdf7df22f2394b108c879bb1a8 100644
--- a/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb
+++ b/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRecaptchaToApplicationSettings < ActiveRecord::Migration
+class AddRecaptchaToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     change_table :application_settings do |t|
       t.boolean :recaptcha_enabled, default: false
diff --git a/db/migrate/20151229102248_influxdb_udp_port_setting.rb b/db/migrate/20151229102248_influxdb_udp_port_setting.rb
index ae0499f936d6fcfd719c3c231e2ecabf975c4f26..da37e3bc148e578edf4b3574ec6205199e9bf459 100644
--- a/db/migrate/20151229102248_influxdb_udp_port_setting.rb
+++ b/db/migrate/20151229102248_influxdb_udp_port_setting.rb
@@ -1,4 +1,4 @@
-class InfluxdbUdpPortSetting < ActiveRecord::Migration
+class InfluxdbUdpPortSetting < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :metrics_port, :integer, default: 8089
   end
diff --git a/db/migrate/20151229112614_influxdb_remote_database_setting.rb b/db/migrate/20151229112614_influxdb_remote_database_setting.rb
index d2ac906ead335af0c367d67cdea5e8b0918641ec..5fdf4c6d4cbd5dbba1cbff8ba26790f19bb0c8eb 100644
--- a/db/migrate/20151229112614_influxdb_remote_database_setting.rb
+++ b/db/migrate/20151229112614_influxdb_remote_database_setting.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class InfluxdbRemoteDatabaseSetting < ActiveRecord::Migration
+class InfluxdbRemoteDatabaseSetting < ActiveRecord::Migration[4.2]
   def change
     remove_column :application_settings, :metrics_database
   end
diff --git a/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb b/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb
index 6c282fc50394eb6daa761c1344acd338c94848d5..61a3d6486f3f5740dee66a5ba7208df2f8026946 100644
--- a/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb
+++ b/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb
@@ -1,4 +1,4 @@
-class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration
+class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :artifacts_metadata, :text
   end
diff --git a/db/migrate/20151231152326_add_akismet_to_application_settings.rb b/db/migrate/20151231152326_add_akismet_to_application_settings.rb
index 3f52c758f9a9a59262efadac25acc08696d6e4d7..ef51ea03a5bf9da5d25cf36224780c0ea0a4d674 100644
--- a/db/migrate/20151231152326_add_akismet_to_application_settings.rb
+++ b/db/migrate/20151231152326_add_akismet_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddAkismetToApplicationSettings < ActiveRecord::Migration
+class AddAkismetToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     change_table :application_settings do |t|
       t.boolean :akismet_enabled, default: false
diff --git a/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb b/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb
index 0bdd639eb214060dddb939e225c8c923b98f22d5..2d8b44840f013d3fb3d29ad8a40f026095574e17 100644
--- a/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb
+++ b/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveAlertTypeFromBroadcastMessages < ActiveRecord::Migration
+class RemoveAlertTypeFromBroadcastMessages < ActiveRecord::Migration[4.2]
   def change
     remove_column :broadcast_messages, :alert_type, :integer
   end
diff --git a/db/migrate/20160106162223_add_index_milestones_title.rb b/db/migrate/20160106162223_add_index_milestones_title.rb
index 9b9b6445a08392371c2a80dee043f967368fb54e..d42bddefe643e3d80239f1deae92b8cfd336b2bc 100644
--- a/db/migrate/20160106162223_add_index_milestones_title.rb
+++ b/db/migrate/20160106162223_add_index_milestones_title.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexMilestonesTitle < ActiveRecord::Migration
+class AddIndexMilestonesTitle < ActiveRecord::Migration[4.2]
   def change
     add_index :milestones, :title
   end
diff --git a/db/migrate/20160106164438_remove_influxdb_credentials.rb b/db/migrate/20160106164438_remove_influxdb_credentials.rb
index 987d75d6fdab412f16ff02e014a299b0d131d196..569d5a0cf36d9c8b8b29c6eb02b352c729b94444 100644
--- a/db/migrate/20160106164438_remove_influxdb_credentials.rb
+++ b/db/migrate/20160106164438_remove_influxdb_credentials.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveInfluxdbCredentials < ActiveRecord::Migration
+class RemoveInfluxdbCredentials < ActiveRecord::Migration[4.2]
   def change
     remove_column :application_settings, :metrics_username, :string
     remove_column :application_settings, :metrics_password, :string
diff --git a/db/migrate/20160109054846_create_spam_logs.rb b/db/migrate/20160109054846_create_spam_logs.rb
index f710327663919856063098ff06e013db5f00f605..dc97d03f7fff2aede5a4093019f5e8b8bbd8d75f 100644
--- a/db/migrate/20160109054846_create_spam_logs.rb
+++ b/db/migrate/20160109054846_create_spam_logs.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateSpamLogs < ActiveRecord::Migration
+class CreateSpamLogs < ActiveRecord::Migration[4.2]
   def change
     create_table :spam_logs do |t|
       t.integer :user_id
diff --git a/db/migrate/20160113111034_add_metrics_sample_interval.rb b/db/migrate/20160113111034_add_metrics_sample_interval.rb
index b741f5d2c758db6ff093b3d55e995458f8d50fbb..9c3377571aa2bf4b25a3839ff227c2e405cc7ea8 100644
--- a/db/migrate/20160113111034_add_metrics_sample_interval.rb
+++ b/db/migrate/20160113111034_add_metrics_sample_interval.rb
@@ -1,4 +1,4 @@
-class AddMetricsSampleInterval < ActiveRecord::Migration
+class AddMetricsSampleInterval < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :metrics_sample_interval, :integer,
       default: 15
diff --git a/db/migrate/20160118155830_add_sentry_to_application_settings.rb b/db/migrate/20160118155830_add_sentry_to_application_settings.rb
index fa7ff9d92289c54297abc4f1424f21ea0d3b5a03..20f3925b964cd69e77af36d6aaf8d2f45f423525 100644
--- a/db/migrate/20160118155830_add_sentry_to_application_settings.rb
+++ b/db/migrate/20160118155830_add_sentry_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddSentryToApplicationSettings < ActiveRecord::Migration
+class AddSentryToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     change_table :application_settings do |t|
       t.boolean :sentry_enabled, default: false
diff --git a/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb b/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb
index 19ea40b5547e4f76e796c253907e449265410520..809a6cceef51d21a27c8f84a4cf4db1c46ef69fc 100644
--- a/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb
+++ b/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIpBlockingSettingsToApplicationSettings < ActiveRecord::Migration
+class AddIpBlockingSettingsToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :ip_blocking_enabled, :boolean, default: false
     add_column :application_settings, :dnsbl_servers_list, :text
diff --git a/db/migrate/20160119111158_add_services_category.rb b/db/migrate/20160119111158_add_services_category.rb
index f77484b2f9685fd09ba3d19cff83ac0af61403d6..979a48584a935f386b5b8ee3ce88658404ee91a5 100644
--- a/db/migrate/20160119111158_add_services_category.rb
+++ b/db/migrate/20160119111158_add_services_category.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddServicesCategory < ActiveRecord::Migration
+class AddServicesCategory < ActiveRecord::Migration[4.2]
   def up
     add_column :services, :category, :string, default: 'common', null: false
 
diff --git a/db/migrate/20160119112418_add_services_default.rb b/db/migrate/20160119112418_add_services_default.rb
index 7fa531899fedfcf458ccdf6b8a2546b5c0c9d2f1..41ba5d98afe7724d41b7e4a80dd0dcedca9c2879 100644
--- a/db/migrate/20160119112418_add_services_default.rb
+++ b/db/migrate/20160119112418_add_services_default.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddServicesDefault < ActiveRecord::Migration
+class AddServicesDefault < ActiveRecord::Migration[4.2]
   def up
     add_column :services, :default, :boolean, default: false
 
diff --git a/db/migrate/20160119145451_add_ldap_email_to_users.rb b/db/migrate/20160119145451_add_ldap_email_to_users.rb
index 5b2b0bd31cad9eeb83740042d9fc9d0dff95559b..bf8c27900b8ee40cb17059b5f6f6523bb3ea3498 100644
--- a/db/migrate/20160119145451_add_ldap_email_to_users.rb
+++ b/db/migrate/20160119145451_add_ldap_email_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddLdapEmailToUsers < ActiveRecord::Migration
+class AddLdapEmailToUsers < ActiveRecord::Migration[4.2]
   def up
     add_column :users, :ldap_email, :boolean, default: false, null: false
 
diff --git a/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb b/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb
index d6c6aa4a4e83d112f6ff044f9549139644d4e69e..9c0a91758f599da55d1ea9d66d65ad1a324271ca 100644
--- a/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb
+++ b/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb
@@ -1,4 +1,4 @@
-class AddBaseCommitShaToMergeRequestDiffs < ActiveRecord::Migration
+class AddBaseCommitShaToMergeRequestDiffs < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_request_diffs, :base_commit_sha, :string
   end
diff --git a/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb b/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb
index 9a2570ae54486eeb4dc939995bee7bdf42d44d6b..0cb1fbe864157323491bf52141c50dbe99677bcf 100644
--- a/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb
+++ b/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddEmailAuthorInBodyToApplicationSettings < ActiveRecord::Migration
+class AddEmailAuthorInBodyToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :email_author_in_body, :boolean, default: false
   end
diff --git a/db/migrate/20160122185421_add_pending_delete_to_project.rb b/db/migrate/20160122185421_add_pending_delete_to_project.rb
index 61db852843fe087c85d9cfceff11d3780f05e9df..8db0adc922178428edfd0098f17e8ff3f505599b 100644
--- a/db/migrate/20160122185421_add_pending_delete_to_project.rb
+++ b/db/migrate/20160122185421_add_pending_delete_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPendingDeleteToProject < ActiveRecord::Migration
+class AddPendingDeleteToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :pending_delete, :boolean, default: false
   end
diff --git a/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb b/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb
index 60ecda998dd8359fa3433c6ccbda6d6b219928a2..e76f0249ae58b8bf6e165f29588d961311437428 100644
--- a/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb
+++ b/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveIpBlockingSettingsFromApplicationSettings < ActiveRecord::Migration
+class RemoveIpBlockingSettingsFromApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     remove_column :application_settings, :ip_blocking_enabled, :boolean, default: false
     remove_column :application_settings, :dnsbl_servers_list, :text
diff --git a/db/migrate/20160128233227_change_lfs_objects_size_column.rb b/db/migrate/20160128233227_change_lfs_objects_size_column.rb
index e7fd1f71777790be3a0faed121fff101207be8d7..65aaf2d9a0b417042719a9032b8a741a626332e5 100644
--- a/db/migrate/20160128233227_change_lfs_objects_size_column.rb
+++ b/db/migrate/20160128233227_change_lfs_objects_size_column.rb
@@ -1,4 +1,4 @@
-class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration
+class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration[4.2]
   def change
     change_column :lfs_objects, :size, :integer, limit: 8
   end
diff --git a/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb b/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb
index d3ea956952e7d5599af7f64cbddf4b3eb30df02a..6254017615b8bf65177d72aef6a2540154539f89 100644
--- a/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb
+++ b/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb
@@ -1,4 +1,4 @@
-class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration
+class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration[4.2]
   include Gitlab::ShellAdapter
 
   class ProjectPath
diff --git a/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb b/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb
index f0d942265148372a5712f337f0cf8ac34a575961..8b84705ce7d06434bfc5f0c308366fa2c425e728 100644
--- a/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb
+++ b/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddMergeCommitShaToMergeRequests < ActiveRecord::Migration
+class AddMergeCommitShaToMergeRequests < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :merge_commit_sha, :string
   end
diff --git a/db/migrate/20160202091601_add_erasable_to_ci_build.rb b/db/migrate/20160202091601_add_erasable_to_ci_build.rb
index 767ae160d0855631a1dcaf620cf4fcd8159d6789..214028bd8d3e9fbe7c134bd0c47e0813c090c443 100644
--- a/db/migrate/20160202091601_add_erasable_to_ci_build.rb
+++ b/db/migrate/20160202091601_add_erasable_to_ci_build.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddErasableToCiBuild < ActiveRecord::Migration
+class AddErasableToCiBuild < ActiveRecord::Migration[4.2]
   def change
     add_reference :ci_builds, :erased_by, references: :users, index: true
     add_column :ci_builds, :erased_at, :datetime
diff --git a/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb b/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb
index 2c5cb307fada31aba3a3a2be7a06089577d46f5c..542f94379114e45cb34abfb0c7c6d3c0186ecae7 100644
--- a/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb
+++ b/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddAllowGuestToAccessBuildsProject < ActiveRecord::Migration
+class AddAllowGuestToAccessBuildsProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :public_builds, :boolean, default: true, null: false
   end
diff --git a/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb b/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb
index f996ae74dca170a52daf6a89ee504d7045800d03..c1f1faf0279185182b8e405323b717dfa97dd759 100644
--- a/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb
+++ b/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb
@@ -1,4 +1,4 @@
-class AddRealSizeToMergeRequestDiffs < ActiveRecord::Migration
+class AddRealSizeToMergeRequestDiffs < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_request_diffs, :real_size, :string
   end
diff --git a/db/migrate/20160209130428_add_index_to_snippet.rb b/db/migrate/20160209130428_add_index_to_snippet.rb
index 4d17c3a2917b1df52338b5f2c1cf24e62737de9c..480ac193d634a73bbc1b16a66483c2b62b533a66 100644
--- a/db/migrate/20160209130428_add_index_to_snippet.rb
+++ b/db/migrate/20160209130428_add_index_to_snippet.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexToSnippet < ActiveRecord::Migration
+class AddIndexToSnippet < ActiveRecord::Migration[4.2]
   def change
     add_index :snippets, :updated_at
   end
diff --git a/db/migrate/20160210105555_create_pages_domain.rb b/db/migrate/20160210105555_create_pages_domain.rb
index 0e8507c7e9ad678210f991b5ab04ee1f6633ddbe..a46906d64caa0af48f306fd31c63486b18766543 100644
--- a/db/migrate/20160210105555_create_pages_domain.rb
+++ b/db/migrate/20160210105555_create_pages_domain.rb
@@ -1,4 +1,4 @@
-class CreatePagesDomain < ActiveRecord::Migration
+class CreatePagesDomain < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160212123307_create_tasks.rb b/db/migrate/20160212123307_create_tasks.rb
index cd3ad0e4cd8d9137712bdb49591d6adc9e2d9bb6..33acc8af91ff1e552b3c686e1da4ce3f2f1018bd 100644
--- a/db/migrate/20160212123307_create_tasks.rb
+++ b/db/migrate/20160212123307_create_tasks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateTasks < ActiveRecord::Migration
+class CreateTasks < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160217100506_add_description_to_label.rb b/db/migrate/20160217100506_add_description_to_label.rb
index eed6d1f236aa16cc8032c94c01ecf57ae4f4d16b..116de8ddfa9a9487512356e560d0e7f381e4a281 100644
--- a/db/migrate/20160217100506_add_description_to_label.rb
+++ b/db/migrate/20160217100506_add_description_to_label.rb
@@ -1,4 +1,4 @@
-class AddDescriptionToLabel < ActiveRecord::Migration
+class AddDescriptionToLabel < ActiveRecord::Migration[4.2]
   def change
     add_column :labels, :description, :string
   end
diff --git a/db/migrate/20160217174422_add_note_to_tasks.rb b/db/migrate/20160217174422_add_note_to_tasks.rb
index da5cb2e05db693fdd8f3b5b72c71eabfac39e53c..c2a42ce5dd886e22281eb65d524016f611bff566 100644
--- a/db/migrate/20160217174422_add_note_to_tasks.rb
+++ b/db/migrate/20160217174422_add_note_to_tasks.rb
@@ -1,4 +1,4 @@
-class AddNoteToTasks < ActiveRecord::Migration
+class AddNoteToTasks < ActiveRecord::Migration[4.2]
   def change
     add_reference :tasks, :note, index: true
   end
diff --git a/db/migrate/20160220123949_rename_tasks_to_todos.rb b/db/migrate/20160220123949_rename_tasks_to_todos.rb
index 30c10d27146e7a8a356630eadaf33660b7a631a8..0cc110a0a1a27fd96cbd8100fd2697e3a15112e7 100644
--- a/db/migrate/20160220123949_rename_tasks_to_todos.rb
+++ b/db/migrate/20160220123949_rename_tasks_to_todos.rb
@@ -1,4 +1,4 @@
-class RenameTasksToTodos < ActiveRecord::Migration
+class RenameTasksToTodos < ActiveRecord::Migration[4.2]
   def change
     rename_table :tasks, :todos
   end
diff --git a/db/migrate/20160222153918_create_appearances_ce.rb b/db/migrate/20160222153918_create_appearances_ce.rb
index b2d5949b23f52c00a76322685c432da736ee8bb2..37bbe62ad3dc59ad748b60171ff0093a7ad82d03 100644
--- a/db/migrate/20160222153918_create_appearances_ce.rb
+++ b/db/migrate/20160222153918_create_appearances_ce.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateAppearancesCe < ActiveRecord::Migration
+class CreateAppearancesCe < ActiveRecord::Migration[4.2]
   def change
     unless table_exists?(:appearances)
       create_table :appearances do |t|
diff --git a/db/migrate/20160223192159_add_confidential_to_issues.rb b/db/migrate/20160223192159_add_confidential_to_issues.rb
index 5b99ce30e9f06d477693995e2fdab28b2affd44b..ca029f12337d846d50049d292f57756ab66bc3e0 100644
--- a/db/migrate/20160223192159_add_confidential_to_issues.rb
+++ b/db/migrate/20160223192159_add_confidential_to_issues.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddConfidentialToIssues < ActiveRecord::Migration
+class AddConfidentialToIssues < ActiveRecord::Migration[4.2]
   def change
     add_column :issues, :confidential, :boolean, default: false
     add_index :issues, :confidential
diff --git a/db/migrate/20160225090018_add_delete_at_to_issues.rb b/db/migrate/20160225090018_add_delete_at_to_issues.rb
index 139f911e1c90beb5684de806349790ab7b5bb3a7..3ae74f491f6f4ff41379c0f33d9d3e473fd0d3b0 100644
--- a/db/migrate/20160225090018_add_delete_at_to_issues.rb
+++ b/db/migrate/20160225090018_add_delete_at_to_issues.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDeleteAtToIssues < ActiveRecord::Migration
+class AddDeleteAtToIssues < ActiveRecord::Migration[4.2]
   def change
     add_column :issues, :deleted_at, :datetime
     add_index :issues, :deleted_at
diff --git a/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb b/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb
index 4ca3f0dcdc522bc2b47d2ea25641c2292f06d807..ce8657ba88cc4877161d899de78dc21288723d37 100644
--- a/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb
+++ b/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDeleteAtToMergeRequests < ActiveRecord::Migration
+class AddDeleteAtToMergeRequests < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :deleted_at, :datetime
     add_index :merge_requests, :deleted_at
diff --git a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
index 7aa79bf5e02cde87e3a0136643cb68103eb93e9f..82b54c552e0f3610a60d0c72cecefadb7b82a02f 100644
--- a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
+++ b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddTrigramIndexesForSearching < ActiveRecord::Migration
+class AddTrigramIndexesForSearching < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def up
diff --git a/db/migrate/20160227120001_add_event_field_for_web_hook.rb b/db/migrate/20160227120001_add_event_field_for_web_hook.rb
index 89910893ee1b10e82acdea4f5613de58967ddabb..22bbd73114f8993cdda245cfd7bbdcb97230ad8d 100644
--- a/db/migrate/20160227120001_add_event_field_for_web_hook.rb
+++ b/db/migrate/20160227120001_add_event_field_for_web_hook.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddEventFieldForWebHook < ActiveRecord::Migration
+class AddEventFieldForWebHook < ActiveRecord::Migration[4.2]
   def change
     add_column :web_hooks, :wiki_page_events, :boolean, default: false, null: false
   end
diff --git a/db/migrate/20160227120047_add_event_to_services.rb b/db/migrate/20160227120047_add_event_to_services.rb
index fe7c54ca4eb915e92db1caa056d7eb1cc78920ef..a3b94734ec2f3ea2b4d145fdf65b35b39a4afe58 100644
--- a/db/migrate/20160227120047_add_event_to_services.rb
+++ b/db/migrate/20160227120047_add_event_to_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddEventToServices < ActiveRecord::Migration
+class AddEventToServices < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :wiki_page_events, :boolean, default: true
   end
diff --git a/db/migrate/20160229193553_add_main_language_to_repository.rb b/db/migrate/20160229193553_add_main_language_to_repository.rb
index b5446c6a4472c43f5eaf69a83487cc0a95d9edec..15f9a3828027efe08b94252e61d3ebdffaf36988 100644
--- a/db/migrate/20160229193553_add_main_language_to_repository.rb
+++ b/db/migrate/20160229193553_add_main_language_to_repository.rb
@@ -1,4 +1,4 @@
-class AddMainLanguageToRepository < ActiveRecord::Migration
+class AddMainLanguageToRepository < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :main_language, :string
   end
diff --git a/db/migrate/20160301124843_add_visibility_level_to_groups.rb b/db/migrate/20160301124843_add_visibility_level_to_groups.rb
index a874e6758dd232ca8dcc04c884925fe33610a9f2..ed4bca4f1bac38426d025bb9c82b14d231dbcaa7 100644
--- a/db/migrate/20160301124843_add_visibility_level_to_groups.rb
+++ b/db/migrate/20160301124843_add_visibility_level_to_groups.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddVisibilityLevelToGroups < ActiveRecord::Migration
+class AddVisibilityLevelToGroups < ActiveRecord::Migration[4.2]
   def up
     add_column :namespaces, :visibility_level, :integer, null: false, default: Gitlab::VisibilityLevel::PUBLIC
     add_index :namespaces, :visibility_level
diff --git a/db/migrate/20160301174731_add_fingerprint_index.rb b/db/migrate/20160301174731_add_fingerprint_index.rb
index f2c3d1ba1eadbcc79bf6fdeb3ad18a74e1745d5c..b13373a04684705e7cbafccc0cdcdcb57b6b0246 100644
--- a/db/migrate/20160301174731_add_fingerprint_index.rb
+++ b/db/migrate/20160301174731_add_fingerprint_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddFingerprintIndex < ActiveRecord::Migration
+class AddFingerprintIndex < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   DOWNTIME = false
diff --git a/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb b/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb
index ffcd64266e3801b4676c67eab19ca98e3bf4cf05..b0ea05bd6e1540d8773d4f7de714484b5baf3c14 100644
--- a/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb
+++ b/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb
@@ -1,4 +1,4 @@
-class AddImportCredentialsToProjectImportData < ActiveRecord::Migration
+class AddImportCredentialsToProjectImportData < ActiveRecord::Migration[4.2]
   def change
     add_column :project_import_data, :encrypted_credentials, :text
     add_column :project_import_data, :encrypted_credentials_iv, :string
diff --git a/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb b/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb
index 951051187646cafc891d5cec7ff74e1e03cfe31b..8a319554c281f7921721414523269c06416d2d86 100644
--- a/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb
+++ b/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb
@@ -2,7 +2,7 @@
 # Loops through old importer projects that kept a token/password in the import URL
 # and encrypts the credentials into a separate field in project#import_data
 # #down method not supported
-class RemoveWrongImportUrlFromProjects < ActiveRecord::Migration
+class RemoveWrongImportUrlFromProjects < ActiveRecord::Migration[4.2]
 
   class ProjectImportDataFake
     extend AttrEncrypted
diff --git a/db/migrate/20160305220806_remove_expires_at_from_snippets.rb b/db/migrate/20160305220806_remove_expires_at_from_snippets.rb
index cac78703bc22bcb17e7c67e9a8a1350ff5e2fb8d..6835f534926ace9b62633bc63b04faa78b884c8f 100644
--- a/db/migrate/20160305220806_remove_expires_at_from_snippets.rb
+++ b/db/migrate/20160305220806_remove_expires_at_from_snippets.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveExpiresAtFromSnippets < ActiveRecord::Migration
+class RemoveExpiresAtFromSnippets < ActiveRecord::Migration[4.2]
   def change
     remove_column :snippets, :expires_at, :datetime
   end
diff --git a/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb b/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb
index 49e787d9a9a598ecb877d5e6e0fb97fadcc0c3e8..26b65ef7037aacbd2bdcdf544a18d728dc150049 100644
--- a/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb
+++ b/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb
@@ -1,4 +1,4 @@
-class DisallowBlankLineCodeOnNote < ActiveRecord::Migration
+class DisallowBlankLineCodeOnNote < ActiveRecord::Migration[4.2]
   def up
     execute("UPDATE notes SET line_code = NULL WHERE line_code = ''")
   end
diff --git a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
index 92c0a1e088e9ac692de13b64fff77cff1b43b5cf..16053408fe0fc1771669f07911a5326b3cfea81e 100644
--- a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
+++ b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
@@ -3,7 +3,7 @@
 # Sets default_visibility_level to value on settings if not restricted
 # If value is restricted takes higher visibility level allowed
 
-class AddDefaultGroupVisibilityToApplicationSettings < ActiveRecord::Migration
+class AddDefaultGroupVisibilityToApplicationSettings < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :default_group_visibility, :integer
     # Unfortunately, this can't be a `default`, since we don't want the configuration specific
diff --git a/db/migrate/20160309140734_fix_todos.rb b/db/migrate/20160309140734_fix_todos.rb
index 94fe1e4fdc300071bf95c5ed6723e0418e7c387e..917055f5036c19fe06d844a67d3c0a8da3af54b1 100644
--- a/db/migrate/20160309140734_fix_todos.rb
+++ b/db/migrate/20160309140734_fix_todos.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class FixTodos < ActiveRecord::Migration
+class FixTodos < ActiveRecord::Migration[4.2]
  def up
     execute <<-SQL
       DELETE FROM todos
diff --git a/db/migrate/20160310124959_add_due_date_to_issues.rb b/db/migrate/20160310124959_add_due_date_to_issues.rb
index a4eb6aaee63ed0e1256daba27defc532c449d158..8da38ea60b15c3d421340ad282c33016ed4ceb20 100644
--- a/db/migrate/20160310124959_add_due_date_to_issues.rb
+++ b/db/migrate/20160310124959_add_due_date_to_issues.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddDueDateToIssues < ActiveRecord::Migration
+class AddDueDateToIssues < ActiveRecord::Migration[4.2]
   def change
     add_column :issues, :due_date, :date
     add_index :issues, :due_date
diff --git a/db/migrate/20160310185910_add_external_flag_to_users.rb b/db/migrate/20160310185910_add_external_flag_to_users.rb
index 209496dc7861aa42e9a990b3aa7c89cb97dbc83b..768bbe4cd42e7b002667ea9413b5103d65f45b1e 100644
--- a/db/migrate/20160310185910_add_external_flag_to_users.rb
+++ b/db/migrate/20160310185910_add_external_flag_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddExternalFlagToUsers < ActiveRecord::Migration
+class AddExternalFlagToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :external, :boolean, default: false
   end
diff --git a/db/migrate/20160314094147_add_priority_to_label.rb b/db/migrate/20160314094147_add_priority_to_label.rb
index 7fb23cba4c90ee8c04b062d05a2475514761e7be..8e2aaf5010918314585ddb4dc30af909ca59ca5a 100644
--- a/db/migrate/20160314094147_add_priority_to_label.rb
+++ b/db/migrate/20160314094147_add_priority_to_label.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddPriorityToLabel < ActiveRecord::Migration
+class AddPriorityToLabel < ActiveRecord::Migration[4.2]
   def change
     add_column :labels, :priority, :integer
     add_index :labels, :priority
diff --git a/db/migrate/20160314114439_add_requested_at_to_members.rb b/db/migrate/20160314114439_add_requested_at_to_members.rb
index 76c8b8a1a24fc26be9a91d283fbb601e89ba5dff..e7e03f96ef8b7f703251021c2ba1b4a2b1e2f75d 100644
--- a/db/migrate/20160314114439_add_requested_at_to_members.rb
+++ b/db/migrate/20160314114439_add_requested_at_to_members.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddRequestedAtToMembers < ActiveRecord::Migration
+class AddRequestedAtToMembers < ActiveRecord::Migration[4.2]
   def change
     add_column :members, :requested_at, :datetime
   end
diff --git a/db/migrate/20160314143402_projects_add_pushes_since_gc.rb b/db/migrate/20160314143402_projects_add_pushes_since_gc.rb
index 9f8ffe073a316dbb5f771aa8dec7dffa7f707a08..e64093d39cfc7ed28d9e91c35a76f23ca1909bdf 100644
--- a/db/migrate/20160314143402_projects_add_pushes_since_gc.rb
+++ b/db/migrate/20160314143402_projects_add_pushes_since_gc.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class ProjectsAddPushesSinceGc < ActiveRecord::Migration
+class ProjectsAddPushesSinceGc < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :pushes_since_gc, :integer, default: 0
   end
diff --git a/db/migrate/20160315135439_project_add_repository_check.rb b/db/migrate/20160315135439_project_add_repository_check.rb
index 8fe649246c7478f063a48565d9fb62dbae136000..c03d8bb041c63f5b9471b19393f5f9e668ed3b4a 100644
--- a/db/migrate/20160315135439_project_add_repository_check.rb
+++ b/db/migrate/20160315135439_project_add_repository_check.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class ProjectAddRepositoryCheck < ActiveRecord::Migration
+class ProjectAddRepositoryCheck < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :last_repository_check_failed, :boolean
     add_index :projects, :last_repository_check_failed
diff --git a/db/migrate/20160316123110_ci_runners_token_index.rb b/db/migrate/20160316123110_ci_runners_token_index.rb
index ff3d36d68ee21caf4add6e88745d2a7e8c2cc395..026846e6464655b4fd50b81b95953770ea8cc75c 100644
--- a/db/migrate/20160316123110_ci_runners_token_index.rb
+++ b/db/migrate/20160316123110_ci_runners_token_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CiRunnersTokenIndex < ActiveRecord::Migration
+class CiRunnersTokenIndex < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def change
diff --git a/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb b/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb
index 6871b3920df145b0d609cddb8b7ba8dc881f0851..488c3d4945c2e12ccd2de6d6f707c089f06c470b 100644
--- a/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb
+++ b/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb
@@ -1,4 +1,4 @@
-class ChangeTargetIdToNullOnTodos < ActiveRecord::Migration
+class ChangeTargetIdToNullOnTodos < ActiveRecord::Migration[4.2]
   def change
     change_column_null :todos, :target_id, true
   end
diff --git a/db/migrate/20160316204731_add_commit_id_to_todos.rb b/db/migrate/20160316204731_add_commit_id_to_todos.rb
index d79858fc920d06ee14caef0f8be95e91e09533e2..d1c004b2ced6695a9d41802efaf71f118673d152 100644
--- a/db/migrate/20160316204731_add_commit_id_to_todos.rb
+++ b/db/migrate/20160316204731_add_commit_id_to_todos.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCommitIdToTodos < ActiveRecord::Migration
+class AddCommitIdToTodos < ActiveRecord::Migration[4.2]
   def change
     add_column :todos, :commit_id, :string
     add_index :todos, :commit_id
diff --git a/db/migrate/20160317092222_add_moved_to_to_issue.rb b/db/migrate/20160317092222_add_moved_to_to_issue.rb
index 2bf549d7ecdaee67d3db865e4ae7bd3ab73bd367..8d81d84fd2022a7c441e0d6cef96629fbb1bba7c 100644
--- a/db/migrate/20160317092222_add_moved_to_to_issue.rb
+++ b/db/migrate/20160317092222_add_moved_to_to_issue.rb
@@ -1,4 +1,4 @@
-class AddMovedToToIssue < ActiveRecord::Migration
+class AddMovedToToIssue < ActiveRecord::Migration[4.2]
   def change
     add_reference :issues, :moved_to, references: :issues # rubocop:disable Migration/AddReference
   end
diff --git a/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb b/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb
index 07ae7c95477d6cec99150d6ab374332188fc2ee4..9692def430cd04bda0da43e413d496eccd9fd287 100644
--- a/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb
+++ b/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration
+class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration[4.2]
   def change
     unless index_exists?(:namespaces, :visibility_level)
       add_index :namespaces, :visibility_level
diff --git a/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb b/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb
index 1fff9759d1e387944baee32d957bb39fbbfb0dfa..a25d15a81efcdd4de6f05b59ecbad18028542188 100644
--- a/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb
+++ b/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb
@@ -1,4 +1,4 @@
-class RemoveTodosForDeletedIssues < ActiveRecord::Migration
+class RemoveTodosForDeletedIssues < ActiveRecord::Migration[4.2]
   def up
     execute <<-SQL
       DELETE FROM todos
diff --git a/db/migrate/20160328112808_create_notification_settings.rb b/db/migrate/20160328112808_create_notification_settings.rb
index 7d77e8004baf04c26f8496b645a898f781fb517f..db19d2e370c4236bb11e1e43e0edae44034e75b0 100644
--- a/db/migrate/20160328112808_create_notification_settings.rb
+++ b/db/migrate/20160328112808_create_notification_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateNotificationSettings < ActiveRecord::Migration
+class CreateNotificationSettings < ActiveRecord::Migration[4.2]
   def change
     create_table :notification_settings do |t|
       t.references :user, null: false
diff --git a/db/migrate/20160328115649_migrate_new_notification_setting.rb b/db/migrate/20160328115649_migrate_new_notification_setting.rb
index 3c81b2c37bfe558724b4663f3fdbdf585874cc3f..5ba09e75145d836f1b2cdc6611f03ca42b1305aa 100644
--- a/db/migrate/20160328115649_migrate_new_notification_setting.rb
+++ b/db/migrate/20160328115649_migrate_new_notification_setting.rb
@@ -5,7 +5,7 @@
 # - during migration some users will receive notifications based on their global settings (project/group settings will be ignored)
 # - its possible to get duplicate records for notification settings since we don't create uniq index yet
 #
-class MigrateNewNotificationSetting < ActiveRecord::Migration
+class MigrateNewNotificationSetting < ActiveRecord::Migration[4.2]
   def up
     timestamp = Time.now.strftime('%F %T')
     execute "INSERT INTO notification_settings ( user_id, source_id, source_type, level, created_at, updated_at ) SELECT user_id, source_id, source_type, notification_level, '#{timestamp}', '#{timestamp}' FROM members WHERE user_id IS NOT NULL"
diff --git a/db/migrate/20160328121138_add_notification_setting_index.rb b/db/migrate/20160328121138_add_notification_setting_index.rb
index 667270d6b048880aec06738be8e4a350074e8a7b..ed82b17229671d87103dbe070f2a5616c2ca3d8b 100644
--- a/db/migrate/20160328121138_add_notification_setting_index.rb
+++ b/db/migrate/20160328121138_add_notification_setting_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddNotificationSettingIndex < ActiveRecord::Migration
+class AddNotificationSettingIndex < ActiveRecord::Migration[4.2]
   def change
     add_index :notification_settings, :user_id
     add_index :notification_settings, [:source_id, :source_type]
diff --git a/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb b/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb
index a3df8fb4e2ec23a8499379382a14ce6f79a96468..15c44f74451a70a42a49e028b5fa095a56fa4eea 100644
--- a/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb
+++ b/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexOnPendingDeleteProjects < ActiveRecord::Migration
+class AddIndexOnPendingDeleteProjects < ActiveRecord::Migration[4.2]
   def change
     add_index :projects, :pending_delete
   end
diff --git a/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb b/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb
index 54cea964ff2c789786bab34bd2468397fab81c5a..634a696377ceb67f9413f368bc7ce8fb79556495 100644
--- a/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb
+++ b/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb
@@ -1,4 +1,4 @@
-class RemoveTodosForDeletedMergeRequests < ActiveRecord::Migration
+class RemoveTodosForDeletedMergeRequests < ActiveRecord::Migration[4.2]
   def up
     execute <<-SQL
       DELETE FROM todos
diff --git a/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb b/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb
index dec80497fb31db153cfcca4406ff23314b32eb69..6e5a748d0966854e0f215832425b3fb5a0c05ca5 100644
--- a/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb
+++ b/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveTwitterSharingEnabledFromApplicationSettings < ActiveRecord::Migration
+class RemoveTwitterSharingEnabledFromApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     remove_column :application_settings, :twitter_sharing_enabled, :boolean
   end
diff --git a/db/migrate/20160407120251_add_images_enabled_for_project.rb b/db/migrate/20160407120251_add_images_enabled_for_project.rb
index 47f0ca8e8debdcff19b68783618e2fb3f5d17295..2c42d89ccdf9ec202bba459a20a7cf7d77391958 100644
--- a/db/migrate/20160407120251_add_images_enabled_for_project.rb
+++ b/db/migrate/20160407120251_add_images_enabled_for_project.rb
@@ -1,4 +1,4 @@
-class AddImagesEnabledForProject < ActiveRecord::Migration
+class AddImagesEnabledForProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :container_registry_enabled, :boolean
   end
diff --git a/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb b/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb
index 920d4d411104151f3ff58355a32897698e707f60..a59563b835ea5c08353fa2238fa9fa67f99618d5 100644
--- a/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb
+++ b/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddRepositoryChecksEnabledSetting < ActiveRecord::Migration
+class AddRepositoryChecksEnabledSetting < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :repository_checks_enabled, :boolean, default: true
   end
diff --git a/db/migrate/20160412173416_add_fields_to_ci_commit.rb b/db/migrate/20160412173416_add_fields_to_ci_commit.rb
index 00162af5cdadd0eea8b1511df8f84c4b61765eb3..4b3d4e8bd30d287f235e2bb3948b8d78f1997804 100644
--- a/db/migrate/20160412173416_add_fields_to_ci_commit.rb
+++ b/db/migrate/20160412173416_add_fields_to_ci_commit.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddFieldsToCiCommit < ActiveRecord::Migration
+class AddFieldsToCiCommit < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_commits, :status, :string
     add_column :ci_commits, :started_at, :timestamp
diff --git a/db/migrate/20160412173417_update_ci_commit.rb b/db/migrate/20160412173417_update_ci_commit.rb
index 858faeb060e68f6114f885afedbdf83cfcc88f6a..91dd4582f7ac36f44c704b038a0b75ba42b2e0ed 100644
--- a/db/migrate/20160412173417_update_ci_commit.rb
+++ b/db/migrate/20160412173417_update_ci_commit.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class UpdateCiCommit < ActiveRecord::Migration
+class UpdateCiCommit < ActiveRecord::Migration[4.2]
   # This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers
   # Otherwise Offline migration should be used.
   def change
diff --git a/db/migrate/20160412173418_add_ci_commit_indexes.rb b/db/migrate/20160412173418_add_ci_commit_indexes.rb
index 414f1f8279fe74aeb2bf97474141fb78b87937c8..709e6b84d5765b7840bb949ec6e2a5df107b55bd 100644
--- a/db/migrate/20160412173418_add_ci_commit_indexes.rb
+++ b/db/migrate/20160412173418_add_ci_commit_indexes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddCiCommitIndexes < ActiveRecord::Migration
+class AddCiCommitIndexes < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def change
diff --git a/db/migrate/20160413115152_add_token_to_web_hooks.rb b/db/migrate/20160413115152_add_token_to_web_hooks.rb
index f04225068cd2cf08c851b0d062d66b1f6450d19a..43fe46dfe5d8cf2f13ae50bf4aaffaecb99264d7 100644
--- a/db/migrate/20160413115152_add_token_to_web_hooks.rb
+++ b/db/migrate/20160413115152_add_token_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddTokenToWebHooks < ActiveRecord::Migration
+class AddTokenToWebHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :web_hooks, :token, :string
   end
diff --git a/db/migrate/20160415062917_create_personal_access_tokens.rb b/db/migrate/20160415062917_create_personal_access_tokens.rb
index 946500269942e61df98729f2c9a134b05e44cff4..43599db799ed247a7e530925bdeea6bce70f1907 100644
--- a/db/migrate/20160415062917_create_personal_access_tokens.rb
+++ b/db/migrate/20160415062917_create_personal_access_tokens.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreatePersonalAccessTokens < ActiveRecord::Migration
+class CreatePersonalAccessTokens < ActiveRecord::Migration[4.2]
   def change
     create_table :personal_access_tokens do |t|
       t.references :user, index: true, foreign_key: true, null: false
diff --git a/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb
index d493044c67b83148e561688cd8c9716c257decb3..e96c0591a071801010553ce8a52fdac35f60c4e7 100644
--- a/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb
+++ b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration
+class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :shared_runners_text, :text
   end
diff --git a/db/migrate/20160416180807_add_award_emoji.rb b/db/migrate/20160416180807_add_award_emoji.rb
index 0d252e5044e8a523778f91b1f6947b384ca6cec3..99c984fd1167df0e87131ca6a80ea84d315578c6 100644
--- a/db/migrate/20160416180807_add_award_emoji.rb
+++ b/db/migrate/20160416180807_add_award_emoji.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddAwardEmoji < ActiveRecord::Migration
+class AddAwardEmoji < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
index 50f159a80b18ba06d0f5370cfe9850d2f1b6f111..af2820986f0f9d60fb0483defb2206301aa38055 100644
--- a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
+++ b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb
@@ -1,4 +1,4 @@
-class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration
+class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def up
diff --git a/db/migrate/20160419120017_add_metrics_packet_size.rb b/db/migrate/20160419120017_add_metrics_packet_size.rb
index 78c163d62acf8782c3d7294b6858e174d5921392..16c3ebfe22b43b8e488c34b5bbbf12ce81aeec59 100644
--- a/db/migrate/20160419120017_add_metrics_packet_size.rb
+++ b/db/migrate/20160419120017_add_metrics_packet_size.rb
@@ -1,4 +1,4 @@
-class AddMetricsPacketSize < ActiveRecord::Migration
+class AddMetricsPacketSize < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :metrics_packet_size, :integer, default: 1
   end
diff --git a/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb b/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb
index 1716b6e815358efd4fec4c604397388de329cd05..cf842a684a6433f7bf9afe3d29fa50d872db12b0 100644
--- a/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb
+++ b/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddOnlyAllowMergeIfBuildSucceedsToProjects < ActiveRecord::Migration
+class AddOnlyAllowMergeIfBuildSucceedsToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160421130527_disable_repository_checks.rb b/db/migrate/20160421130527_disable_repository_checks.rb
index 7e65ddc45e73186c605ba91c4cf17ba40a8072fc..8b3ce73c5e81961285e4e520df99a8375dfedcf4 100644
--- a/db/migrate/20160421130527_disable_repository_checks.rb
+++ b/db/migrate/20160421130527_disable_repository_checks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class DisableRepositoryChecks < ActiveRecord::Migration
+class DisableRepositoryChecks < ActiveRecord::Migration[4.2]
   def up
     change_column_default :application_settings, :repository_checks_enabled, false 
     execute 'UPDATE application_settings SET repository_checks_enabled = false'
diff --git a/db/migrate/20160425045124_create_u2f_registrations.rb b/db/migrate/20160425045124_create_u2f_registrations.rb
index 72cbe98ebba3615766cd9b4f45b30e6a6fdfe6cc..9b48fc822b61429116dfa8b7f6d27ee22375baeb 100644
--- a/db/migrate/20160425045124_create_u2f_registrations.rb
+++ b/db/migrate/20160425045124_create_u2f_registrations.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateU2fRegistrations < ActiveRecord::Migration
+class CreateU2fRegistrations < ActiveRecord::Migration[4.2]
   def change
     create_table :u2f_registrations do |t|
       t.text :certificate
diff --git a/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb b/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb
index facd33875ba1efcf2d6571935d09a0bfdf2548a2..9a0d1a2d31655cf3dc5d904e7e8a23316fdde93c 100644
--- a/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb
+++ b/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddDisabledOauthSignInSourcesToApplicationSettings < ActiveRecord::Migration
+class AddDisabledOauthSignInSourcesToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :disabled_oauth_sign_in_sources, :text
   end
diff --git a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb
index 84e5e4eabe27657474fa30cd834139be89e519e0..03ec29b9951d3179563f7e91e883c8d4d0655f77 100644
--- a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb
+++ b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb
@@ -1,4 +1,4 @@
-class AddRunUntaggedToCiRunner < ActiveRecord::Migration
+class AddRunUntaggedToCiRunner < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb
index 6792ffc957abd394906742223e7bd612590b1690..4edbeb09f74321efbbc4adc420d236ee196ee369 100644
--- a/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb
+++ b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class RemoveWallEnabledFromProjects < ActiveRecord::Migration
+class RemoveWallEnabledFromProjects < ActiveRecord::Migration[4.2]
   def change
     remove_column :projects, :wall_enabled, :boolean, default: true, null: false
   end
diff --git a/db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb b/db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb
index 1c4d60e7234fa3c49c9b4cc07d3b1dbdfbd69c5a..ee7c9326bfeacff8e549eec5f78a9769b2874ddc 100644
--- a/db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb
+++ b/db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb
@@ -1,4 +1,4 @@
-class AddHeadCommitIdToMergeRequestDiffs < ActiveRecord::Migration
+class AddHeadCommitIdToMergeRequestDiffs < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_request_diffs, :head_commit_sha, :string
   end
diff --git a/db/migrate/20160508215820_add_type_to_notes.rb b/db/migrate/20160508215820_add_type_to_notes.rb
index 58944d4e651c4e44328deb6dfc317cac5f8724b2..343743a589c9591fa36a3df7fba0d6e63a937f6c 100644
--- a/db/migrate/20160508215820_add_type_to_notes.rb
+++ b/db/migrate/20160508215820_add_type_to_notes.rb
@@ -1,4 +1,4 @@
-class AddTypeToNotes < ActiveRecord::Migration
+class AddTypeToNotes < ActiveRecord::Migration[4.2]
   def change
     add_column :notes, :type, :string
   end
diff --git a/db/migrate/20160508215920_add_positions_to_diff_notes.rb b/db/migrate/20160508215920_add_positions_to_diff_notes.rb
index 2952c25004ea6295ebbdc6f786c39e08b098e5ee..e0ee03d0fb5122b0865f24d3dba835e05e4ffd57 100644
--- a/db/migrate/20160508215920_add_positions_to_diff_notes.rb
+++ b/db/migrate/20160508215920_add_positions_to_diff_notes.rb
@@ -1,4 +1,4 @@
-class AddPositionsToDiffNotes < ActiveRecord::Migration
+class AddPositionsToDiffNotes < ActiveRecord::Migration[4.2]
   def change
     add_column :notes, :position, :text
     add_column :notes, :original_position, :text
diff --git a/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb b/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb
index 6dd958ff4a07415edefd84d823b5341143d19809..567754d4f4ed0dbf3f00af52fb4dab5a7dc654e3 100644
--- a/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb
+++ b/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class SetTypeOnLegacyDiffNotes < ActiveRecord::Migration
+class SetTypeOnLegacyDiffNotes < ActiveRecord::Migration[4.2]
   def change
     execute "UPDATE notes SET type = 'LegacyDiffNote' WHERE line_code IS NOT NULL"
   end
diff --git a/db/migrate/20160509091049_add_locked_to_ci_runner.rb b/db/migrate/20160509091049_add_locked_to_ci_runner.rb
index 3fbaef3b7f0ae87d39d78a1e02516da7c77a97ab..e19db5a4504d228e349d2a7bd1fe12020034903d 100644
--- a/db/migrate/20160509091049_add_locked_to_ci_runner.rb
+++ b/db/migrate/20160509091049_add_locked_to_ci_runner.rb
@@ -1,4 +1,4 @@
-class AddLockedToCiRunner < ActiveRecord::Migration
+class AddLockedToCiRunner < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb b/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb
index 9d729fec189874fac8611917fa2a080501397571..54d615f7e21c944ecdd14ffde394bb2aef31e06a 100644
--- a/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb
+++ b/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddHealthCheckAccessTokenToApplicationSettings < ActiveRecord::Migration
+class AddHealthCheckAccessTokenToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :health_check_access_token, :string
   end
diff --git a/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb b/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb
index 8c96353b850e05c7819466004420511c2a2b2344..9e203b97a4311b67158d329f16a7741439126349 100644
--- a/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb
+++ b/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddSendUserConfirmationEmailToApplicationSettings < ActiveRecord::Migration
+class AddSendUserConfirmationEmailToApplicationSettings < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :send_user_confirmation_email, :boolean, default: false
 
diff --git a/db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb b/db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb
index b7fd76ee84ba9b76adaacf2002afa3270140e954..a84bfd64bdaf71e79b88e3096c31d6f1584cd308 100644
--- a/db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb
+++ b/db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb
@@ -1,4 +1,4 @@
-class AddStartCommitIdToMergeRequestDiffs < ActiveRecord::Migration
+class AddStartCommitIdToMergeRequestDiffs < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_request_diffs, :start_commit_sha, :string
   end
diff --git a/db/migrate/20160518200441_add_artifacts_expire_date_to_ci_builds.rb b/db/migrate/20160518200441_add_artifacts_expire_date_to_ci_builds.rb
index 8e9ab3f8acceedd990726b091f695d64024deff1..143b84a1662a80c7d50ab4645a3244bd2b786a27 100644
--- a/db/migrate/20160518200441_add_artifacts_expire_date_to_ci_builds.rb
+++ b/db/migrate/20160518200441_add_artifacts_expire_date_to_ci_builds.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddArtifactsExpireDateToCiBuilds < ActiveRecord::Migration
+class AddArtifactsExpireDateToCiBuilds < ActiveRecord::Migration[4.2]
   def change
     add_column :ci_builds, :artifacts_expire_at, :timestamp
   end
diff --git a/db/migrate/20160519203051_add_developers_can_merge_to_protected_branches.rb b/db/migrate/20160519203051_add_developers_can_merge_to_protected_branches.rb
index ac50035eba41e5f43d6f7991c04774d041d46120..ba0e1654379688ac974cb7c144a87a3a008b1f79 100644
--- a/db/migrate/20160519203051_add_developers_can_merge_to_protected_branches.rb
+++ b/db/migrate/20160519203051_add_developers_can_merge_to_protected_branches.rb
@@ -1,4 +1,4 @@
-class AddDevelopersCanMergeToProtectedBranches < ActiveRecord::Migration
+class AddDevelopersCanMergeToProtectedBranches < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160522215720_add_note_type_and_position_to_sent_notification.rb b/db/migrate/20160522215720_add_note_type_and_position_to_sent_notification.rb
index 4eef16c940823a4db44b31555c16df16e361dec6..f569fc7c73f9f20be170a65779f8bb10330d3e4e 100644
--- a/db/migrate/20160522215720_add_note_type_and_position_to_sent_notification.rb
+++ b/db/migrate/20160522215720_add_note_type_and_position_to_sent_notification.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddNoteTypeAndPositionToSentNotification < ActiveRecord::Migration
+class AddNoteTypeAndPositionToSentNotification < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160525205328_remove_main_language_from_projects.rb b/db/migrate/20160525205328_remove_main_language_from_projects.rb
index dc4ceacddb1b3cefd11dc2d46d29d7ffc66b0e92..81d0fb5b08063e270758a3fa7df300d36d3e9fab 100644
--- a/db/migrate/20160525205328_remove_main_language_from_projects.rb
+++ b/db/migrate/20160525205328_remove_main_language_from_projects.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveMainLanguageFromProjects < ActiveRecord::Migration
+class RemoveMainLanguageFromProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb b/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb
index 7910120b4e06ca8f90da2c3db5471588a84a477c..c530c09859d406ea6827efeb8744601782e4c3e8 100644
--- a/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb
+++ b/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb
@@ -1,4 +1,4 @@
-class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration
+class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration[4.2]
   def up
     execute <<-SQL
       DELETE FROM notification_settings
diff --git a/db/migrate/20160528043124_add_users_state_index.rb b/db/migrate/20160528043124_add_users_state_index.rb
index 6419d2ae71d820eb98f9a412b66759cd56f685da..3437b35a0c066e21b3c0ced9bef8444ebf272a7a 100644
--- a/db/migrate/20160528043124_add_users_state_index.rb
+++ b/db/migrate/20160528043124_add_users_state_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddUsersStateIndex < ActiveRecord::Migration
+class AddUsersStateIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb b/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb
index e21376bd571936ed4196a4393b372da09b249a14..7b20146e21caa4e768727ad3d1981a2802a62167 100644
--- a/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb
+++ b/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb
@@ -1,6 +1,6 @@
 # This is ONLINE migration
 
-class AddContainerRegistryTokenExpireDelayToApplicationSettings < ActiveRecord::Migration
+class AddContainerRegistryTokenExpireDelayToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb b/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb
index be295f0181d34be79267748d10d62a6833e088ed..a7d2d7f99528c9c282b2f436dfe0325217332759 100644
--- a/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb
+++ b/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddHasExternalIssueTrackerToProjects < ActiveRecord::Migration
+class AddHasExternalIssueTrackerToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb
index fe1c863b5b9540c93f33d776d29c46fbff46b7bb..0d8c4bf011cd281c3e8a4c0c152115366a5a6540 100644
--- a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb
+++ b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb
@@ -1,4 +1,4 @@
-class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration
+class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration[4.2]
   def up
     duplicates = exec_query(%Q{
       SELECT user_id, source_type, source_id
diff --git a/db/migrate/20160603182247_add_index_to_notification_settings.rb b/db/migrate/20160603182247_add_index_to_notification_settings.rb
index f6ae26d555f446d6d8ad56dd43097f08f9654a6b..cea178d555c917857822ebee2e2f0f37acc9ab05 100644
--- a/db/migrate/20160603182247_add_index_to_notification_settings.rb
+++ b/db/migrate/20160603182247_add_index_to_notification_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIndexToNotificationSettings < ActiveRecord::Migration
+class AddIndexToNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb b/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb
index 89826fb96cb147af6f9592062dcd41b74c3d4fb8..3b3f68529a5cefe773a679d2cbc8a8d55cb5fe42 100644
--- a/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb
+++ b/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddAfterSignUpTextToApplicationSettings < ActiveRecord::Migration
+class AddAfterSignUpTextToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :after_sign_up_text, :text
   end
diff --git a/db/migrate/20160608195742_add_repository_storage_to_projects.rb b/db/migrate/20160608195742_add_repository_storage_to_projects.rb
index e4febd1614d713985df0ec6edb4ae6afbe411f31..2b20c9fbd5fc5389d8b3a4425ed01145b87bad45 100644
--- a/db/migrate/20160608195742_add_repository_storage_to_projects.rb
+++ b/db/migrate/20160608195742_add_repository_storage_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddRepositoryStorageToProjects < ActiveRecord::Migration
+class AddRepositoryStorageToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160608211215_add_user_default_external_to_application_settings.rb b/db/migrate/20160608211215_add_user_default_external_to_application_settings.rb
index 34c702e3fa62cc16378808583285a3ae4070b8a1..9b5cfc67d5aefc46feaed9ae2eb0daad6bfca9fa 100644
--- a/db/migrate/20160608211215_add_user_default_external_to_application_settings.rb
+++ b/db/migrate/20160608211215_add_user_default_external_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddUserDefaultExternalToApplicationSettings < ActiveRecord::Migration
+class AddUserDefaultExternalToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb b/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb
index 259abb08e4742096d5891923692dda1fef5fbc3c..d5301672dc58ff11e8c03ce83278c4418930dd8f 100644
--- a/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb
+++ b/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb
@@ -1,4 +1,4 @@
-class RemoveNotificationSettingNotNullConstraints < ActiveRecord::Migration
+class RemoveNotificationSettingNotNullConstraints < ActiveRecord::Migration[4.2]
   def up
     change_column :notification_settings, :source_type, :string, null: true
     change_column :notification_settings, :source_id, :integer, null: true
diff --git a/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb b/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb
index 21b367711c3ab0b90169483893c8243976dcf4b3..1ac659974038efcee21f6fa910d5eec842158034 100644
--- a/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb
+++ b/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveDeprecatedIssuesTrackerColumnsFromProjects < ActiveRecord::Migration
+class RemoveDeprecatedIssuesTrackerColumnsFromProjects < ActiveRecord::Migration[4.2]
   def change
     remove_column :projects, :issues_tracker, :string, default: 'gitlab', null: false
     remove_column :projects, :issues_tracker_id, :string
diff --git a/db/migrate/20160610201627_migrate_users_notification_level.rb b/db/migrate/20160610201627_migrate_users_notification_level.rb
index cd8b505de9f94e9c25ac9996e32e961b19b13379..553b7f074f2772187dad6a87e1c666d2c31032f2 100644
--- a/db/migrate/20160610201627_migrate_users_notification_level.rb
+++ b/db/migrate/20160610201627_migrate_users_notification_level.rb
@@ -1,4 +1,4 @@
-class MigrateUsersNotificationLevel < ActiveRecord::Migration
+class MigrateUsersNotificationLevel < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   # Migrates only users who changed their default notification level :participating
diff --git a/db/migrate/20160610204157_add_deployments.rb b/db/migrate/20160610204157_add_deployments.rb
index 0ee0b1f5a86c4aa32af2712681696c6243f2dde3..91b619e7d3dd37cfcd0fd93583737a50b45f8063 100644
--- a/db/migrate/20160610204157_add_deployments.rb
+++ b/db/migrate/20160610204157_add_deployments.rb
@@ -1,6 +1,6 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
-class AddDeployments < ActiveRecord::Migration
+class AddDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160610204158_add_environments.rb b/db/migrate/20160610204158_add_environments.rb
index 534a73a5fb6b62222805c78821f4d763f1add8ec..55fb8b1227b0205c51c9aab68e8d88591232495e 100644
--- a/db/migrate/20160610204158_add_environments.rb
+++ b/db/migrate/20160610204158_add_environments.rb
@@ -1,6 +1,6 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
-class AddEnvironments < ActiveRecord::Migration
+class AddEnvironments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160610211845_add_environment_to_builds.rb b/db/migrate/20160610211845_add_environment_to_builds.rb
index 990e445ac55b07b5f60a0382fe32e6f3050b3514..16d5465cafa54e7a9bb751b4dedcef12ffdcae46 100644
--- a/db/migrate/20160610211845_add_environment_to_builds.rb
+++ b/db/migrate/20160610211845_add_environment_to_builds.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEnvironmentToBuilds < ActiveRecord::Migration
+class AddEnvironmentToBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160610301627_remove_notification_level_from_users.rb b/db/migrate/20160610301627_remove_notification_level_from_users.rb
index 356e53b4b23bdf9c99832de40f116d93cad708c3..93f70c476d2d2e2e34eaa4ea12c23b6bb7d56156 100644
--- a/db/migrate/20160610301627_remove_notification_level_from_users.rb
+++ b/db/migrate/20160610301627_remove_notification_level_from_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveNotificationLevelFromUsers < ActiveRecord::Migration
+class RemoveNotificationLevelFromUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160614182521_add_repository_storage_to_application_settings.rb b/db/migrate/20160614182521_add_repository_storage_to_application_settings.rb
index 6dae91b700b866f54f7d7c8904ec9e2023c26bb9..a1bc0e5cd86b90387bbdce9bd8b58b31aa764bbd 100644
--- a/db/migrate/20160614182521_add_repository_storage_to_application_settings.rb
+++ b/db/migrate/20160614182521_add_repository_storage_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRepositoryStorageToApplicationSettings < ActiveRecord::Migration
+class AddRepositoryStorageToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :repository_storage, :string, default: 'default'
   end
diff --git a/db/migrate/20160615142710_add_index_on_requested_at_to_members.rb b/db/migrate/20160615142710_add_index_on_requested_at_to_members.rb
index 178e4bf5ed376ec59929508e4ed2fb430276bd33..1b1dab141f81de9048f2c2194838fdae14673ac6 100644
--- a/db/migrate/20160615142710_add_index_on_requested_at_to_members.rb
+++ b/db/migrate/20160615142710_add_index_on_requested_at_to_members.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexOnRequestedAtToMembers < ActiveRecord::Migration
+class AddIndexOnRequestedAtToMembers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160615173316_add_enabled_git_access_protocols_to_application_settings.rb b/db/migrate/20160615173316_add_enabled_git_access_protocols_to_application_settings.rb
index d0e6d8d1ea15b62b7c405cae703c7cc225c60b78..deb4b86a2fdf2604e3a75a75034b930899964ed9 100644
--- a/db/migrate/20160615173316_add_enabled_git_access_protocols_to_application_settings.rb
+++ b/db/migrate/20160615173316_add_enabled_git_access_protocols_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEnabledGitAccessProtocolsToApplicationSettings < ActiveRecord::Migration
+class AddEnabledGitAccessProtocolsToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
index c58cb957df4058f1079ee36be4a6a81735228cfe..11d15e7c15fe4e0afc0bb22f13cecdc40e96f6f4 100644
--- a/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
+++ b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class SetMissingStageOnCiBuilds < ActiveRecord::Migration
+class SetMissingStageOnCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20160616084004_change_project_of_environment.rb b/db/migrate/20160616084004_change_project_of_environment.rb
index cc1daf9b621c1c75350a4bd038aaf14f24c1bfe6..23914a0325ae11046a2f564bc586b9e9d806a7c0 100644
--- a/db/migrate/20160616084004_change_project_of_environment.rb
+++ b/db/migrate/20160616084004_change_project_of_environment.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ChangeProjectOfEnvironment < ActiveRecord::Migration
+class ChangeProjectOfEnvironment < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160616102642_remove_duplicated_keys.rb b/db/migrate/20160616102642_remove_duplicated_keys.rb
index 5e41cc53e3243d9d9a9be058edc2835e617f86af..0b896108292ee2ac38ad940236f0aee2341446b0 100644
--- a/db/migrate/20160616102642_remove_duplicated_keys.rb
+++ b/db/migrate/20160616102642_remove_duplicated_keys.rb
@@ -1,4 +1,4 @@
-class RemoveDuplicatedKeys < ActiveRecord::Migration
+class RemoveDuplicatedKeys < ActiveRecord::Migration[4.2]
   def up
     select_all("SELECT fingerprint FROM #{quote_table_name(:keys)} GROUP BY fingerprint HAVING COUNT(*) > 1").each do |row|
       fingerprint = connection.quote(row['fingerprint'])
diff --git a/db/migrate/20160616103005_remove_keys_fingerprint_index_if_exists.rb b/db/migrate/20160616103005_remove_keys_fingerprint_index_if_exists.rb
index 081df23f394dd400d8aa8c5ecf69f0f1c1d09909..afccc40cc673dc4abb1a3dbd7f5511be1304b6ed 100644
--- a/db/migrate/20160616103005_remove_keys_fingerprint_index_if_exists.rb
+++ b/db/migrate/20160616103005_remove_keys_fingerprint_index_if_exists.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class RemoveKeysFingerprintIndexIfExists < ActiveRecord::Migration
+class RemoveKeysFingerprintIndexIfExists < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20160616103948_add_unique_index_to_keys_fingerprint.rb b/db/migrate/20160616103948_add_unique_index_to_keys_fingerprint.rb
index 76bb6a096391f1fbc0ab9ffdb4c409ba634d8084..d619acad3d096186f7514b7d57167e82ef07e664 100644
--- a/db/migrate/20160616103948_add_unique_index_to_keys_fingerprint.rb
+++ b/db/migrate/20160616103948_add_unique_index_to_keys_fingerprint.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddUniqueIndexToKeysFingerprint < ActiveRecord::Migration
+class AddUniqueIndexToKeysFingerprint < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20160617301627_add_events_to_notification_settings.rb b/db/migrate/20160617301627_add_events_to_notification_settings.rb
index 609596f45e455b57bfb245c7c8007bf89bdb3943..109817e3d8abbc7558f79cfc71c3a0530f5f282c 100644
--- a/db/migrate/20160617301627_add_events_to_notification_settings.rb
+++ b/db/migrate/20160617301627_add_events_to_notification_settings.rb
@@ -1,4 +1,4 @@
-class AddEventsToNotificationSettings < ActiveRecord::Migration
+class AddEventsToNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160620115026_add_index_on_runners_locked.rb b/db/migrate/20160620115026_add_index_on_runners_locked.rb
index 48f4495b0a47ec1ef686d9b86c7591adab8f4162..c619dc07a916d74aef8f3beac7232043a480e786 100644
--- a/db/migrate/20160620115026_add_index_on_runners_locked.rb
+++ b/db/migrate/20160620115026_add_index_on_runners_locked.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexOnRunnersLocked < ActiveRecord::Migration
+class AddIndexOnRunnersLocked < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb b/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb
index 1222dc640a8a1ba859175c1a7e79b9b2f0604dda..2d3ab4e258340b4514000ff3cc54a2421e05b835 100644
--- a/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb
+++ b/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb
@@ -5,7 +5,7 @@
 # into EE.
 #
 # See discussion at https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3932
-class AddRebaseCommitShaToMergeRequests < ActiveRecord::Migration
+class AddRebaseCommitShaToMergeRequests < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20160628085157_add_artifacts_size_to_ci_builds.rb b/db/migrate/20160628085157_add_artifacts_size_to_ci_builds.rb
index 61dd726fac7bc2288d235c8302346936cc10a488..60bd4c36eb6b1e688aad78280bc84abd1c9f7875 100644
--- a/db/migrate/20160628085157_add_artifacts_size_to_ci_builds.rb
+++ b/db/migrate/20160628085157_add_artifacts_size_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddArtifactsSizeToCiBuilds < ActiveRecord::Migration
+class AddArtifactsSizeToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb b/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb
index 7c5f76572ef80e92b6b44f360f10430972396b9d..13e1280b71af682deae5822fdfc4988a5189b953 100644
--- a/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb
+++ b/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddColumnInProgressMergeCommitShaToMergeRequests < ActiveRecord::Migration
+class AddColumnInProgressMergeCommitShaToMergeRequests < ActiveRecord::Migration[4.2]
   def change
     add_column :merge_requests, :in_progress_merge_commit_sha, :string
   end
diff --git a/db/migrate/20160703180340_add_index_on_award_emoji_user_and_name.rb b/db/migrate/20160703180340_add_index_on_award_emoji_user_and_name.rb
index 0c25f87dfb4b088d83d7711464fa2fbe576bb026..8a576b99de0fd51e1d28c27eb64540e49bf86532 100644
--- a/db/migrate/20160703180340_add_index_on_award_emoji_user_and_name.rb
+++ b/db/migrate/20160703180340_add_index_on_award_emoji_user_and_name.rb
@@ -1,7 +1,7 @@
 # rubocop:disable all
 # Migration type: online without errors
 
-class AddIndexOnAwardEmojiUserAndName < ActiveRecord::Migration
+class AddIndexOnAwardEmojiUserAndName < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160705054938_add_protected_branches_push_access.rb b/db/migrate/20160705054938_add_protected_branches_push_access.rb
index de3aefcb1fb391170f54e5b354ce604a71c7cbfa..314d90efa908db533d2fecb00858c4d9f8928e05 100644
--- a/db/migrate/20160705054938_add_protected_branches_push_access.rb
+++ b/db/migrate/20160705054938_add_protected_branches_push_access.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Timestamps
-class AddProtectedBranchesPushAccess < ActiveRecord::Migration
+class AddProtectedBranchesPushAccess < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160705054952_add_protected_branches_merge_access.rb b/db/migrate/20160705054952_add_protected_branches_merge_access.rb
index 9b18a2061b3297f0c55e4d802ad3281934d3336d..672e0e291dbb5f3b586a139dd5f415949e974956 100644
--- a/db/migrate/20160705054952_add_protected_branches_merge_access.rb
+++ b/db/migrate/20160705054952_add_protected_branches_merge_access.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Timestamps
-class AddProtectedBranchesMergeAccess < ActiveRecord::Migration
+class AddProtectedBranchesMergeAccess < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb b/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb
index 1db0df92becc3e6a384772e7fea917ca684167a6..1bd462cab064f9769e4ecae50d948ea2e290e831 100644
--- a/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb
+++ b/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess < ActiveRecord::Migration
+class MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess < ActiveRecord::Migration[4.2]
   DOWNTIME = true
   DOWNTIME_REASON = <<-HEREDOC
     We're creating a `merge_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
diff --git a/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb b/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb
index 5c3e189bb5ba038857cc18237df2189bbb70a069..d480dac777a00332b05f4f293f13b113c1eba004 100644
--- a/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb
+++ b/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MoveFromDevelopersCanPushToProtectedBranchesPushAccess < ActiveRecord::Migration
+class MoveFromDevelopersCanPushToProtectedBranchesPushAccess < ActiveRecord::Migration[4.2]
   DOWNTIME = true
   DOWNTIME_REASON = <<-HEREDOC
     We're creating a `push_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
diff --git a/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb b/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb
index 058bd539e65c8d9e580d5763939a81dddf5bffec..e5c9da072cf3123940bdea6fb7bab8e5b1fae019 100644
--- a/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb
+++ b/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDevelopersCanPushFromProtectedBranches < ActiveRecord::Migration
+class RemoveDevelopersCanPushFromProtectedBranches < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # This is only required for `#down`
diff --git a/db/migrate/20160705055813_remove_developers_can_merge_from_protected_branches.rb b/db/migrate/20160705055813_remove_developers_can_merge_from_protected_branches.rb
index d0e5da4d28b77e3f934020a8036c5cdbfc90ad23..2a623b558390f0459af583b8b2d53a4157506dc4 100644
--- a/db/migrate/20160705055813_remove_developers_can_merge_from_protected_branches.rb
+++ b/db/migrate/20160705055813_remove_developers_can_merge_from_protected_branches.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDevelopersCanMergeFromProtectedBranches < ActiveRecord::Migration
+class RemoveDevelopersCanMergeFromProtectedBranches < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # This is only required for `#down`
diff --git a/db/migrate/20160705163108_remove_requesters_that_are_owners.rb b/db/migrate/20160705163108_remove_requesters_that_are_owners.rb
index 1fca230c019498d820f37f6f01f2c828395ae935..449c67e1b6abc3fdf03b224d1f983e6a3fa54216 100644
--- a/db/migrate/20160705163108_remove_requesters_that_are_owners.rb
+++ b/db/migrate/20160705163108_remove_requesters_that_are_owners.rb
@@ -1,4 +1,4 @@
-class RemoveRequestersThatAreOwners < ActiveRecord::Migration
+class RemoveRequestersThatAreOwners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/db/migrate/20160707104333_add_lock_to_issuables.rb b/db/migrate/20160707104333_add_lock_to_issuables.rb
index 54866d02cbc46a109e728ebe4c02f1852b440655..fdc3abf46ccbe513567f15be193476bf0c8b2abe 100644
--- a/db/migrate/20160707104333_add_lock_to_issuables.rb
+++ b/db/migrate/20160707104333_add_lock_to_issuables.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLockToIssuables < ActiveRecord::Migration
+class AddLockToIssuables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160712171823_remove_award_emojis_with_no_user.rb b/db/migrate/20160712171823_remove_award_emojis_with_no_user.rb
index 8ebf1a5234dc0591160cd139c765fc61ad4f3b40..0b553182a81b512e09270f3f4d56219722e221ac 100644
--- a/db/migrate/20160712171823_remove_award_emojis_with_no_user.rb
+++ b/db/migrate/20160712171823_remove_award_emojis_with_no_user.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveAwardEmojisWithNoUser < ActiveRecord::Migration
+class RemoveAwardEmojisWithNoUser < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160713200638_add_repository_read_only_to_projects.rb b/db/migrate/20160713200638_add_repository_read_only_to_projects.rb
index 8ee8b55f210d667d9298935329352423020d56d6..ba61bc8cbb041bf2405f59d8d5c6a6aff9f81600 100644
--- a/db/migrate/20160713200638_add_repository_read_only_to_projects.rb
+++ b/db/migrate/20160713200638_add_repository_read_only_to_projects.rb
@@ -1,4 +1,4 @@
-class AddRepositoryReadOnlyToProjects < ActiveRecord::Migration
+class AddRepositoryReadOnlyToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160713205315_add_domain_blacklist_to_application_settings.rb b/db/migrate/20160713205315_add_domain_blacklist_to_application_settings.rb
index f64dfa7675fbf561479694fdf4009cc0e5af3d65..4b9ac12253ea2b5c91d2a5e02708f06b66ad332f 100644
--- a/db/migrate/20160713205315_add_domain_blacklist_to_application_settings.rb
+++ b/db/migrate/20160713205315_add_domain_blacklist_to_application_settings.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/SaferBooleanColumn
-class AddDomainBlacklistToApplicationSettings < ActiveRecord::Migration
+class AddDomainBlacklistToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160713222618_add_usage_ping_to_application_settings.rb b/db/migrate/20160713222618_add_usage_ping_to_application_settings.rb
index a7f76cc626eaf1e70a1e0137e6c83c69097ec907..7ef0231633812ba2ccc64ad79d5e802fff3b238a 100644
--- a/db/migrate/20160713222618_add_usage_ping_to_application_settings.rb
+++ b/db/migrate/20160713222618_add_usage_ping_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddUsagePingToApplicationSettings < ActiveRecord::Migration
+class AddUsagePingToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160715132507_add_user_id_to_pipeline.rb b/db/migrate/20160715132507_add_user_id_to_pipeline.rb
index af0461c4daf9e64749a35e92a1d05943c1c6b5ec..b1e22b1c2bb3982d1ea0a55339a5f22e2a4da4d2 100644
--- a/db/migrate/20160715132507_add_user_id_to_pipeline.rb
+++ b/db/migrate/20160715132507_add_user_id_to_pipeline.rb
@@ -1,4 +1,4 @@
-class AddUserIdToPipeline < ActiveRecord::Migration
+class AddUserIdToPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160715134306_add_index_for_pipeline_user_id.rb b/db/migrate/20160715134306_add_index_for_pipeline_user_id.rb
index fec17ffb7f6c27523d52a907e6476f2cb43ea4a7..8e7ac86a8b75f6a8db92ad0bf647d00acdecd16c 100644
--- a/db/migrate/20160715134306_add_index_for_pipeline_user_id.rb
+++ b/db/migrate/20160715134306_add_index_for_pipeline_user_id.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexForPipelineUserId < ActiveRecord::Migration
+class AddIndexForPipelineUserId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160715154212_add_request_access_enabled_to_projects.rb b/db/migrate/20160715154212_add_request_access_enabled_to_projects.rb
index 22c925799a397a1bafa7a63c0d270112fa757a58..96260f5fd554f6753d7b7051bf934cbc162f7f17 100644
--- a/db/migrate/20160715154212_add_request_access_enabled_to_projects.rb
+++ b/db/migrate/20160715154212_add_request_access_enabled_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddRequestAccessEnabledToProjects < ActiveRecord::Migration
+class AddRequestAccessEnabledToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160715204316_add_request_access_enabled_to_groups.rb b/db/migrate/20160715204316_add_request_access_enabled_to_groups.rb
index 4fcb29e1325e6cd9ed6976498dd410083113da95..14065434523e199c9e012c2556f5600343b744a1 100644
--- a/db/migrate/20160715204316_add_request_access_enabled_to_groups.rb
+++ b/db/migrate/20160715204316_add_request_access_enabled_to_groups.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddRequestAccessEnabledToGroups < ActiveRecord::Migration
+class AddRequestAccessEnabledToGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160715230841_rename_application_settings_restricted_signup_domains.rb b/db/migrate/20160715230841_rename_application_settings_restricted_signup_domains.rb
index dd15704800a58f7467a4a04eb92b522ed3afd251..6a2674fb604660f018608ca1b3f9bc14a57743ef 100644
--- a/db/migrate/20160715230841_rename_application_settings_restricted_signup_domains.rb
+++ b/db/migrate/20160715230841_rename_application_settings_restricted_signup_domains.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameApplicationSettingsRestrictedSignupDomains < ActiveRecord::Migration
+class RenameApplicationSettingsRestrictedSignupDomains < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/db/migrate/20160716115710_add_when_and_yaml_variables_to_ci_builds.rb b/db/migrate/20160716115710_add_when_and_yaml_variables_to_ci_builds.rb
index 3e084023a650392fd4e0e7ebb23484483d604163..d403b0a3cc9a17a5dac6c55382a00629d0b967ce 100644
--- a/db/migrate/20160716115710_add_when_and_yaml_variables_to_ci_builds.rb
+++ b/db/migrate/20160716115710_add_when_and_yaml_variables_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddWhenAndYamlVariablesToCiBuilds < ActiveRecord::Migration
+class AddWhenAndYamlVariablesToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb b/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb
index fd7a48d881e51fc04e0f99a62e3435522b2ce354..2bb9a30e3a3d2dff9b724c77d4bc884b4143d580 100644
--- a/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb
+++ b/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddQueuedAtToCiBuilds < ActiveRecord::Migration
+class AddQueuedAtToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160718153603_add_has_external_wiki_to_projects.rb b/db/migrate/20160718153603_add_has_external_wiki_to_projects.rb
index 55a3e954292d89f734f0a4b2900f248bb176f754..e3e4afaf512bc8ba34a5133fee4309e58637e2b1 100644
--- a/db/migrate/20160718153603_add_has_external_wiki_to_projects.rb
+++ b/db/migrate/20160718153603_add_has_external_wiki_to_projects.rb
@@ -1,4 +1,4 @@
-class AddHasExternalWikiToProjects < ActiveRecord::Migration
+class AddHasExternalWikiToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb b/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
index 58f7f2a284171534eef1512e318e8ac6f9e52190..d31bbb223923da4b3329680246b19d8ddac82de6 100644
--- a/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
+++ b/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration
+class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160722221922_nullify_blank_type_on_notes.rb b/db/migrate/20160722221922_nullify_blank_type_on_notes.rb
index c4b78e8e15cf57161b77cb1486c1720f516ffbe9..83ca5c1e6ec8a524ed3a9fb1032d2af67d6937c0 100644
--- a/db/migrate/20160722221922_nullify_blank_type_on_notes.rb
+++ b/db/migrate/20160722221922_nullify_blank_type_on_notes.rb
@@ -1,4 +1,4 @@
-class NullifyBlankTypeOnNotes < ActiveRecord::Migration
+class NullifyBlankTypeOnNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160724205507_add_resolved_to_notes.rb b/db/migrate/20160724205507_add_resolved_to_notes.rb
index 3aca272a3f7bca8c6f2b029c030aa59f05d40ffd..fc56d3b1452471e1f29fa001a33a155693351814 100644
--- a/db/migrate/20160724205507_add_resolved_to_notes.rb
+++ b/db/migrate/20160724205507_add_resolved_to_notes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddResolvedToNotes < ActiveRecord::Migration
+class AddResolvedToNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160725083350_add_external_url_to_enviroments.rb b/db/migrate/20160725083350_add_external_url_to_enviroments.rb
index 21a8abd310b21fe66cf2367a867e2739ce16f89b..e060c6a849954e1c228042d416246c37d5973cdd 100644
--- a/db/migrate/20160725083350_add_external_url_to_enviroments.rb
+++ b/db/migrate/20160725083350_add_external_url_to_enviroments.rb
@@ -1,4 +1,4 @@
-class AddExternalUrlToEnviroments < ActiveRecord::Migration
+class AddExternalUrlToEnviroments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb b/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb
index 12e11bc3fbe45a30fa36d70884a74fdf800cdc69..d8b4696a246ea08e4b5f5395b9a02c37acfd1512 100644
--- a/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb
+++ b/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class MergeRequestDiffRemoveUniq < ActiveRecord::Migration
+class MergeRequestDiffRemoveUniq < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160725104452_merge_request_diff_add_index.rb b/db/migrate/20160725104452_merge_request_diff_add_index.rb
index 60d81e0bdc079716e9316e0973b6cca9504221db..d3369b3f9610e7383e866b88a25881684a800964 100644
--- a/db/migrate/20160725104452_merge_request_diff_add_index.rb
+++ b/db/migrate/20160725104452_merge_request_diff_add_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class MergeRequestDiffAddIndex < ActiveRecord::Migration
+class MergeRequestDiffAddIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160727163552_create_user_agent_details.rb b/db/migrate/20160727163552_create_user_agent_details.rb
index 3eb36f8464f828441ef51051188ba92b194a6e6a..6ef54deca90057c990e061964948272102daea3b 100644
--- a/db/migrate/20160727163552_create_user_agent_details.rb
+++ b/db/migrate/20160727163552_create_user_agent_details.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateUserAgentDetails < ActiveRecord::Migration
+class CreateUserAgentDetails < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160727191041_create_boards.rb b/db/migrate/20160727191041_create_boards.rb
index 9ec8df1b8e8cac54930f73cc2fa4b254857c3f9b..60ed5508b106d0219bb6353999e899bf51fea2f6 100644
--- a/db/migrate/20160727191041_create_boards.rb
+++ b/db/migrate/20160727191041_create_boards.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateBoards < ActiveRecord::Migration
+class CreateBoards < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160727193336_create_lists.rb b/db/migrate/20160727193336_create_lists.rb
index 3fd95dc8cfc41ed0dae9edbe843c0f8a19b80961..4591c9a120f9a411c50f38e452c359c806777812 100644
--- a/db/migrate/20160727193336_create_lists.rb
+++ b/db/migrate/20160727193336_create_lists.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateLists < ActiveRecord::Migration
+class CreateLists < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb b/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb
index b800e6d7283c548e676092463d7ee1a2e2d451ab..fc3e9f03c744f11f8d7423ed9a8b92946f3699e4 100644
--- a/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb
+++ b/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddPipelineEventsToWebHooks < ActiveRecord::Migration
+class AddPipelineEventsToWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160728103734_add_pipeline_events_to_services.rb b/db/migrate/20160728103734_add_pipeline_events_to_services.rb
index bcd24fe1566b3e6d5befa78886583ce579d56277..421859ff5fd2a83dda5f86340815d7d993bf2d8a 100644
--- a/db/migrate/20160728103734_add_pipeline_events_to_services.rb
+++ b/db/migrate/20160728103734_add_pipeline_events_to_services.rb
@@ -1,4 +1,4 @@
-class AddPipelineEventsToServices < ActiveRecord::Migration
+class AddPipelineEventsToServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb
index baf254c3bcc4a4ff09781b135004f2cad3dc7c11..02e417e376fdebf02dd1f280e2d46b9f1a7c0938 100644
--- a/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb
+++ b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration
+class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160801163421_add_expires_at_to_member.rb b/db/migrate/20160801163421_add_expires_at_to_member.rb
index 8db0fc60c4b687f0730cb4fa154c4691b9c14358..13ca1d04658c32344900895d7eb1b2dcdc11a81f 100644
--- a/db/migrate/20160801163421_add_expires_at_to_member.rb
+++ b/db/migrate/20160801163421_add_expires_at_to_member.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddExpiresAtToMember < ActiveRecord::Migration
+class AddExpiresAtToMember < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb b/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb
index 20a77000ba84d721bd836bc22f0fa1933633f965..fde9dee980e486e147c4d3ea34ef0d928296ce28 100644
--- a/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb
+++ b/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddSubmittedAsHamToSpamLogs < ActiveRecord::Migration
+class AddSubmittedAsHamToSpamLogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160802010328_remove_builds_enable_index_on_projects.rb b/db/migrate/20160802010328_remove_builds_enable_index_on_projects.rb
index 6d7733762c81126b0708549c7789d993b525b1be..4ad740e0812819a2434b4c2d1795a108acadcf36 100644
--- a/db/migrate/20160802010328_remove_builds_enable_index_on_projects.rb
+++ b/db/migrate/20160802010328_remove_builds_enable_index_on_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class RemoveBuildsEnableIndexOnProjects < ActiveRecord::Migration
+class RemoveBuildsEnableIndexOnProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb b/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb
index 9c1511963f78c613ea77300c1ca73fd7ce5d1cd1..f866fe15ec1d87af501a2355f8f2de2921fc8402 100644
--- a/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb
+++ b/db/migrate/20160803161903_add_unique_index_to_lists_label_id.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddUniqueIndexToListsLabelId < ActiveRecord::Migration
+class AddUniqueIndexToListsLabelId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160804142904_add_ci_config_file_to_project.rb b/db/migrate/20160804142904_add_ci_config_file_to_project.rb
index 341ae555c1b95964fd7841f0b597b29165293590..abd94e63db32bc1fc42875c657974efaeaf97c32 100644
--- a/db/migrate/20160804142904_add_ci_config_file_to_project.rb
+++ b/db/migrate/20160804142904_add_ci_config_file_to_project.rb
@@ -1,4 +1,4 @@
-class AddCiConfigFileToProject < ActiveRecord::Migration
+class AddCiConfigFileToProject < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160804150737_add_timestamps_to_members_again.rb b/db/migrate/20160804150737_add_timestamps_to_members_again.rb
index 6691ba57fbb323a7176b33683efb7f1402e55333..4e71197b8e724ad75fd387c9d0c71691562c7827 100644
--- a/db/migrate/20160804150737_add_timestamps_to_members_again.rb
+++ b/db/migrate/20160804150737_add_timestamps_to_members_again.rb
@@ -6,7 +6,7 @@
 #
 # Why this happened is lost in the mists of time, so repeat the SQL query
 # without speculation, just in case more than one person was affected.
-class AddTimestampsToMembersAgain < ActiveRecord::Migration
+class AddTimestampsToMembersAgain < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
index 404c253e18bfa53dbad2f2cba716cfa4c1f27094..a0dfa3259ec71b2194ac74348c459e242a3e146f 100644
--- a/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
+++ b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/Datetime
 # rubocop:disable RemoveIndex
-class AddDeletedAtToNamespaces < ActiveRecord::Migration
+class AddDeletedAtToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160808085531_add_token_to_build.rb b/db/migrate/20160808085531_add_token_to_build.rb
index 3ed2a103ae3ca31d8ee9df38e215198e1bc5a28f..a1d8945a53817b1bbdc5fa34ed0300a33390c63c 100644
--- a/db/migrate/20160808085531_add_token_to_build.rb
+++ b/db/migrate/20160808085531_add_token_to_build.rb
@@ -1,4 +1,4 @@
-class AddTokenToBuild < ActiveRecord::Migration
+class AddTokenToBuild < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160808085602_add_index_for_build_token.rb b/db/migrate/20160808085602_add_index_for_build_token.rb
index 0446b2f2e15ab8bbb0501f87f1b1e627a3755e3f..22d50e4165a5a2c20fcac593e60cb7635cfb6eaa 100644
--- a/db/migrate/20160808085602_add_index_for_build_token.rb
+++ b/db/migrate/20160808085602_add_index_for_build_token.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexForBuildToken < ActiveRecord::Migration
+class AddIndexForBuildToken < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb b/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb
index 0cfb637804bb56e301245ada56042d5dfd0bad17..738b93912b690022fedff33a28684a191b83f53d 100644
--- a/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb
+++ b/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveCiRunnerTrigramIndexes < ActiveRecord::Migration
+class RemoveCiRunnerTrigramIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160810142633_remove_redundant_indexes.rb b/db/migrate/20160810142633_remove_redundant_indexes.rb
index ea7d1f9a4369c17f9b7aa76739afa856db29080e..91f82cf9afabee6c410a17d0cdaf13595461e52a 100644
--- a/db/migrate/20160810142633_remove_redundant_indexes.rb
+++ b/db/migrate/20160810142633_remove_redundant_indexes.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class RemoveRedundantIndexes < ActiveRecord::Migration
+class RemoveRedundantIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160811172945_add_can_push_to_keys.rb b/db/migrate/20160811172945_add_can_push_to_keys.rb
index 5fd303fe8fbdfd2fd5d499721fb78ff49f9acbcc..2e78ab0249ee844dbdfb8712779e501eb6527466 100644
--- a/db/migrate/20160811172945_add_can_push_to_keys.rb
+++ b/db/migrate/20160811172945_add_can_push_to_keys.rb
@@ -1,4 +1,4 @@
-class AddCanPushToKeys < ActiveRecord::Migration
+class AddCanPushToKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160816161312_add_column_name_to_u2f_registrations.rb b/db/migrate/20160816161312_add_column_name_to_u2f_registrations.rb
index 7152bd04331a9ee29716a2dd85cfd993d23c5c67..76b60787323c561b99c3ddf880a82ca1af57eb12 100644
--- a/db/migrate/20160816161312_add_column_name_to_u2f_registrations.rb
+++ b/db/migrate/20160816161312_add_column_name_to_u2f_registrations.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddColumnNameToU2fRegistrations < ActiveRecord::Migration
+class AddColumnNameToU2fRegistrations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160817133006_add_koding_to_application_settings.rb b/db/migrate/20160817133006_add_koding_to_application_settings.rb
index 46120652d8e2b0b18c87d25c3ddf89b735c445dc..04f9d7be29b0d9f9898d1adcdc7bae994f71547c 100644
--- a/db/migrate/20160817133006_add_koding_to_application_settings.rb
+++ b/db/migrate/20160817133006_add_koding_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/SaferBooleanColumn
-class AddKodingToApplicationSettings < ActiveRecord::Migration
+class AddKodingToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160817154936_add_discussion_ids_to_notes.rb b/db/migrate/20160817154936_add_discussion_ids_to_notes.rb
index 61facce665a4e3f9fe114fa8bb721cf547d2a3e4..e735eeadac55c9d2fe333b4046b7a6ba9eaf5a65 100644
--- a/db/migrate/20160817154936_add_discussion_ids_to_notes.rb
+++ b/db/migrate/20160817154936_add_discussion_ids_to_notes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDiscussionIdsToNotes < ActiveRecord::Migration
+class AddDiscussionIdsToNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160818205718_add_expires_at_to_project_group_links.rb b/db/migrate/20160818205718_add_expires_at_to_project_group_links.rb
index 0ed538b0df8303cf67e760b24b92f0f6ce537330..06f621c6c2ee7d2d06184f3e2e27fef7b4bffda2 100644
--- a/db/migrate/20160818205718_add_expires_at_to_project_group_links.rb
+++ b/db/migrate/20160818205718_add_expires_at_to_project_group_links.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddExpiresAtToProjectGroupLinks < ActiveRecord::Migration
+class AddExpiresAtToProjectGroupLinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160819221631_add_index_to_note_discussion_id.rb b/db/migrate/20160819221631_add_index_to_note_discussion_id.rb
index 843643c4e9533793521e28eb95a76cbfe5508135..1dbc0474fd2d30368803d620d93fafb45217de18 100644
--- a/db/migrate/20160819221631_add_index_to_note_discussion_id.rb
+++ b/db/migrate/20160819221631_add_index_to_note_discussion_id.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexToNoteDiscussionId < ActiveRecord::Migration
+class AddIndexToNoteDiscussionId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160819221833_reset_diff_note_discussion_id_because_it_was_calculated_wrongly.rb b/db/migrate/20160819221833_reset_diff_note_discussion_id_because_it_was_calculated_wrongly.rb
index 0c68cf01900f6a76b625fc0e1a324efe8d398d57..61f593a52c5768660755c5dd7c9b333b86b149f3 100644
--- a/db/migrate/20160819221833_reset_diff_note_discussion_id_because_it_was_calculated_wrongly.rb
+++ b/db/migrate/20160819221833_reset_diff_note_discussion_id_because_it_was_calculated_wrongly.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ResetDiffNoteDiscussionIdBecauseItWasCalculatedWrongly < ActiveRecord::Migration
+class ResetDiffNoteDiscussionIdBecauseItWasCalculatedWrongly < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160819232256_add_incoming_email_token_to_users.rb b/db/migrate/20160819232256_add_incoming_email_token_to_users.rb
index a004a3802a25033f0917703795b520cd96c72069..0a7190f632d9eb4573f9fa06e522b744d51c4d68 100644
--- a/db/migrate/20160819232256_add_incoming_email_token_to_users.rb
+++ b/db/migrate/20160819232256_add_incoming_email_token_to_users.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIncomingEmailTokenToUsers < ActiveRecord::Migration
+class AddIncomingEmailTokenToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160823081327_change_merge_error_to_text.rb b/db/migrate/20160823081327_change_merge_error_to_text.rb
index 7920389cd83a1eab517fa21a8f0c3d633ba84913..23b4f35a776bea1b8a34c88531186fae216c6b6b 100644
--- a/db/migrate/20160823081327_change_merge_error_to_text.rb
+++ b/db/migrate/20160823081327_change_merge_error_to_text.rb
@@ -1,4 +1,4 @@
-class ChangeMergeErrorToText < ActiveRecord::Migration
+class ChangeMergeErrorToText < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20160823083941_add_column_scopes_to_personal_access_tokens.rb b/db/migrate/20160823083941_add_column_scopes_to_personal_access_tokens.rb
index 91479de840b779f24c73cbaa9c67334c8458daba..4c320123088d083f1d7a944a7919c601ddccda0e 100644
--- a/db/migrate/20160823083941_add_column_scopes_to_personal_access_tokens.rb
+++ b/db/migrate/20160823083941_add_column_scopes_to_personal_access_tokens.rb
@@ -2,7 +2,7 @@
 # It's easier to achieve this by adding the column with the `['api']` default, and then changing the default to
 # `[]`.
 
-class AddColumnScopesToPersonalAccessTokens < ActiveRecord::Migration
+class AddColumnScopesToPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb b/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb
index c169084e976977171b21bf994dc0330558ea1c87..87e6e8b69451d191102c7cb8c648b8dd162deb95 100644
--- a/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb
+++ b/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLfsEnabledToProjects < ActiveRecord::Migration
+class AddLfsEnabledToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160824103857_drop_unused_ci_tables.rb b/db/migrate/20160824103857_drop_unused_ci_tables.rb
index 65cf46308d95b73ffd7cedd709de650b22791e38..8a2076838483ec7ca69b5338ab7771570753a01e 100644
--- a/db/migrate/20160824103857_drop_unused_ci_tables.rb
+++ b/db/migrate/20160824103857_drop_unused_ci_tables.rb
@@ -1,4 +1,4 @@
-class DropUnusedCiTables < ActiveRecord::Migration
+class DropUnusedCiTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160824124900_add_table_issue_metrics.rb b/db/migrate/20160824124900_add_table_issue_metrics.rb
index 49be8bc949b5b2279c499585578a28563d008613..4f34f377e22dda5a896e9e56d757cd6ee03195b5 100644
--- a/db/migrate/20160824124900_add_table_issue_metrics.rb
+++ b/db/migrate/20160824124900_add_table_issue_metrics.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 # rubocop:disable Migration/Timestamps
-class AddTableIssueMetrics < ActiveRecord::Migration
+class AddTableIssueMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160825052008_add_table_merge_request_metrics.rb b/db/migrate/20160825052008_add_table_merge_request_metrics.rb
index 3c9dcc08190408c9e32f505a32f7684577e5dd01..150f698869d5dcced58f52769c4ef16d6e1beae8 100644
--- a/db/migrate/20160825052008_add_table_merge_request_metrics.rb
+++ b/db/migrate/20160825052008_add_table_merge_request_metrics.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 # rubocop:disable Migration/Timestamps
-class AddTableMergeRequestMetrics < ActiveRecord::Migration
+class AddTableMergeRequestMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb b/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb
index 7c55bc23cf2fecf8f419d26594d95b127bfbc183..18c0f0be3eb9bbc7cda1ffd8484e7658b003073b 100644
--- a/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb
+++ b/db/migrate/20160827011312_ensure_lock_version_has_no_default.rb
@@ -1,4 +1,4 @@
-class EnsureLockVersionHasNoDefault < ActiveRecord::Migration
+class EnsureLockVersionHasNoDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160829114652_add_markdown_cache_columns.rb b/db/migrate/20160829114652_add_markdown_cache_columns.rb
index 6ad7237f4cd7ae56511b0b1df05fc070eb5de34b..b1c5e38c3c493578d3443beea03bcbf2afec32e5 100644
--- a/db/migrate/20160829114652_add_markdown_cache_columns.rb
+++ b/db/migrate/20160829114652_add_markdown_cache_columns.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddMarkdownCacheColumns < ActiveRecord::Migration
+class AddMarkdownCacheColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160830203109_add_confidential_issues_events_to_web_hooks.rb b/db/migrate/20160830203109_add_confidential_issues_events_to_web_hooks.rb
index a27947212f6031b07086c59fe6f9d408bf6bcb27..771a6b84648d42b3d8e45644729b3b7d5fe31b0b 100644
--- a/db/migrate/20160830203109_add_confidential_issues_events_to_web_hooks.rb
+++ b/db/migrate/20160830203109_add_confidential_issues_events_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddConfidentialIssuesEventsToWebHooks < ActiveRecord::Migration
+class AddConfidentialIssuesEventsToWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160830211132_add_confidential_issues_events_to_services.rb b/db/migrate/20160830211132_add_confidential_issues_events_to_services.rb
index 030e7c39350e3fdc05f508d008afa3b5b50d375e..a18072643416d9111d92117cf301ad8b98c5ee74 100644
--- a/db/migrate/20160830211132_add_confidential_issues_events_to_services.rb
+++ b/db/migrate/20160830211132_add_confidential_issues_events_to_services.rb
@@ -1,4 +1,4 @@
-class AddConfidentialIssuesEventsToServices < ActiveRecord::Migration
+class AddConfidentialIssuesEventsToServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160830232601_change_lock_version_not_null.rb b/db/migrate/20160830232601_change_lock_version_not_null.rb
index 01c58ed5bdca892342b4b8eaefb2c4133c7ae1c0..1e34b57e53fde8e8b23977242de6d78fd301e335 100644
--- a/db/migrate/20160830232601_change_lock_version_not_null.rb
+++ b/db/migrate/20160830232601_change_lock_version_not_null.rb
@@ -1,4 +1,4 @@
-class ChangeLockVersionNotNull < ActiveRecord::Migration
+class ChangeLockVersionNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160831214002_create_project_features.rb b/db/migrate/20160831214002_create_project_features.rb
index 7ac6c8ec654295c08576649601aca08ceed36071..e1e61c3a4a22d4de1d357801ebe7b4e6bbd9cac8 100644
--- a/db/migrate/20160831214002_create_project_features.rb
+++ b/db/migrate/20160831214002_create_project_features.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateProjectFeatures < ActiveRecord::Migration
+class CreateProjectFeatures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20160831214543_migrate_project_features.rb b/db/migrate/20160831214543_migrate_project_features.rb
index 79a5fb29d6405c0611d68d4f3fcd0b3183f96dc9..ba7ffd7c9f2134c48b1cb6f426ebc9ad8090881f 100644
--- a/db/migrate/20160831214543_migrate_project_features.rb
+++ b/db/migrate/20160831214543_migrate_project_features.rb
@@ -1,4 +1,4 @@
-class MigrateProjectFeatures < ActiveRecord::Migration
+class MigrateProjectFeatures < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20160831223750_remove_features_enabled_from_projects.rb b/db/migrate/20160831223750_remove_features_enabled_from_projects.rb
index 9eafd8b947766418f95394e6c29dbe38c5406e78..6d39d42882b2ab52364651cd199a0f6696c69cf6 100644
--- a/db/migrate/20160831223750_remove_features_enabled_from_projects.rb
+++ b/db/migrate/20160831223750_remove_features_enabled_from_projects.rb
@@ -3,7 +3,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/UpdateLargeTable
-class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration
+class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20160901141443_set_confidential_issues_events_on_webhooks.rb b/db/migrate/20160901141443_set_confidential_issues_events_on_webhooks.rb
index f8486e3e1a6140929a8abc74ed2a3da29acd3112..2921bb566c9ac637038bc766ee7c08af793746a1 100644
--- a/db/migrate/20160901141443_set_confidential_issues_events_on_webhooks.rb
+++ b/db/migrate/20160901141443_set_confidential_issues_events_on_webhooks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateColumnInBatches
-class SetConfidentialIssuesEventsOnWebhooks < ActiveRecord::Migration
+class SetConfidentialIssuesEventsOnWebhooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb b/db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
index fd413d1ca8cf20147d319f4ca1a45814b4d97bd5..1be5f3f6ab05ff073f628f33eb2fc77e0c33e370 100644
--- a/db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
+++ b/db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLfsEnabledToNamespaces < ActiveRecord::Migration
+class AddLfsEnabledToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
index a80a57254dd6f4a0c87ef9b17bee79590409f05d..6c2dc58876e410f25fa3db3f6e58ee7eb104aba4 100644
--- a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
+++ b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
@@ -1,4 +1,4 @@
-class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
+class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # After the deploy the caches will be cold anyway
diff --git a/db/migrate/20160907131111_add_environment_type_to_environments.rb b/db/migrate/20160907131111_add_environment_type_to_environments.rb
index fac73753d5b44fba877c479b121b8ed1889adaf0..34463178fcabd67dac813701c4ea691a920d0f21 100644
--- a/db/migrate/20160907131111_add_environment_type_to_environments.rb
+++ b/db/migrate/20160907131111_add_environment_type_to_environments.rb
@@ -1,4 +1,4 @@
-class AddEnvironmentTypeToEnvironments < ActiveRecord::Migration
+class AddEnvironmentTypeToEnvironments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
index f32167037e0863a3c8c8f84e5f5ecc0b26e38f80..51650c6817052593bce332a757396f05dfd0e07e 100644
--- a/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
+++ b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb
@@ -3,7 +3,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/UpdateLargeTable
-class RemoveProjectsPushesSinceGc < ActiveRecord::Migration
+class RemoveProjectsPushesSinceGc < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20160913212128_change_artifacts_size_column.rb b/db/migrate/20160913212128_change_artifacts_size_column.rb
index 063bbca537c04d70573e87f36d9a7cdfcb9146a6..f2c2aaff9a882112e89f8d9bb1ce7a04a5f4d802 100644
--- a/db/migrate/20160913212128_change_artifacts_size_column.rb
+++ b/db/migrate/20160913212128_change_artifacts_size_column.rb
@@ -1,4 +1,4 @@
-class ChangeArtifactsSizeColumn < ActiveRecord::Migration
+class ChangeArtifactsSizeColumn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20160914131004_only_allow_merge_if_all_discussions_are_resolved.rb b/db/migrate/20160914131004_only_allow_merge_if_all_discussions_are_resolved.rb
index 4da5ec9bd289262fdf60a1b913fab41bf44f8364..81511f9861b7cd8c66cb4748f21cdbfba32154d6 100644
--- a/db/migrate/20160914131004_only_allow_merge_if_all_discussions_are_resolved.rb
+++ b/db/migrate/20160914131004_only_allow_merge_if_all_discussions_are_resolved.rb
@@ -1,4 +1,4 @@
-class OnlyAllowMergeIfAllDiscussionsAreResolved < ActiveRecord::Migration
+class OnlyAllowMergeIfAllDiscussionsAreResolved < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb
index 10c5604bb5c4caccf20a9acbf71e47c9b1f0c935..3efe8c8901b04e5f65599f5bb0ad5ad917e643c8 100644
--- a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb
+++ b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Timestamps
-class CreateMergeRequestsClosingIssues < ActiveRecord::Migration
+class CreateMergeRequestsClosingIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20160919144305_add_type_to_labels.rb b/db/migrate/20160919144305_add_type_to_labels.rb
index d08b339cd279153b46af35cd291e134991b8fa48..f897646d264b5cedcc529e9cd8fd2ad8cc23af57 100644
--- a/db/migrate/20160919144305_add_type_to_labels.rb
+++ b/db/migrate/20160919144305_add_type_to_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateColumnInBatches
-class AddTypeToLabels < ActiveRecord::Migration
+class AddTypeToLabels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20160919145149_add_group_id_to_labels.rb b/db/migrate/20160919145149_add_group_id_to_labels.rb
index 917c2b0c521f33c58c37f5a3308c4f420f94703b..df11a2fc4c8a873c2dcce5e4f46d6cee06b2f64d 100644
--- a/db/migrate/20160919145149_add_group_id_to_labels.rb
+++ b/db/migrate/20160919145149_add_group_id_to_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddGroupIdToLabels < ActiveRecord::Migration
+class AddGroupIdToLabels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160920160832_add_index_to_labels_title.rb b/db/migrate/20160920160832_add_index_to_labels_title.rb
index e38c655baeee1cd89aa2049220833cc31bb7dab8..e6c87836d4e12c8c90a3f444d7d0527656cb9708 100644
--- a/db/migrate/20160920160832_add_index_to_labels_title.rb
+++ b/db/migrate/20160920160832_add_index_to_labels_title.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToLabelsTitle < ActiveRecord::Migration
+class AddIndexToLabelsTitle < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20160926145521_add_organization_to_user.rb b/db/migrate/20160926145521_add_organization_to_user.rb
index e0bef6e7548b42d6bfb61f0cbb7c15b1edb0cd54..2d8d907591d6b83f1b341c832f5151ff06881911 100644
--- a/db/migrate/20160926145521_add_organization_to_user.rb
+++ b/db/migrate/20160926145521_add_organization_to_user.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddOrganizationToUser < ActiveRecord::Migration
+class AddOrganizationToUser < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161006104309_add_state_to_environment.rb b/db/migrate/20161006104309_add_state_to_environment.rb
index ccb546654f988220a834278e8c56784fa3dec924..c51dada9bca5ccea3b380814c7338c680933e102 100644
--- a/db/migrate/20161006104309_add_state_to_environment.rb
+++ b/db/migrate/20161006104309_add_state_to_environment.rb
@@ -1,4 +1,4 @@
-class AddStateToEnvironment < ActiveRecord::Migration
+class AddStateToEnvironment < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161007073613_create_user_activities.rb b/db/migrate/20161007073613_create_user_activities.rb
index a2f4a38f19a3ccfe26ee769f5b9b7408b1c40406..dc972bf466456045e7b36a9c844854a33101a5d9 100644
--- a/db/migrate/20161007073613_create_user_activities.rb
+++ b/db/migrate/20161007073613_create_user_activities.rb
@@ -1,5 +1,5 @@
 
-class CreateUserActivities < ActiveRecord::Migration
+class CreateUserActivities < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = true
 
diff --git a/db/migrate/20161007133303_precalculate_trending_projects.rb b/db/migrate/20161007133303_precalculate_trending_projects.rb
index b324cd942689a77d4b93de461bfbff51696a9dab..c7a678c9d8f624c22e84f672af49459a882809c2 100644
--- a/db/migrate/20161007133303_precalculate_trending_projects.rb
+++ b/db/migrate/20161007133303_precalculate_trending_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PrecalculateTrendingProjects < ActiveRecord::Migration
+class PrecalculateTrendingProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161010142410_create_project_authorizations.rb b/db/migrate/20161010142410_create_project_authorizations.rb
index e095ab969f833d11bb184bdd955a23c7701f05ea..b340a4ece192258b533d4f8dff24f69df9f2656e 100644
--- a/db/migrate/20161010142410_create_project_authorizations.rb
+++ b/db/migrate/20161010142410_create_project_authorizations.rb
@@ -1,4 +1,4 @@
-class CreateProjectAuthorizations < ActiveRecord::Migration
+class CreateProjectAuthorizations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161012180455_add_repository_access_level_to_project_feature.rb b/db/migrate/20161012180455_add_repository_access_level_to_project_feature.rb
index 7b33da3ea111e7938fd23f0a692ff23e91570e36..3024ea81ed8bfb0575f31547d0ef071222e778b6 100644
--- a/db/migrate/20161012180455_add_repository_access_level_to_project_feature.rb
+++ b/db/migrate/20161012180455_add_repository_access_level_to_project_feature.rb
@@ -1,4 +1,4 @@
-class AddRepositoryAccessLevelToProjectFeature < ActiveRecord::Migration
+class AddRepositoryAccessLevelToProjectFeature < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20161014173530_create_label_priorities.rb b/db/migrate/20161014173530_create_label_priorities.rb
index 28937c81e026455bec689e2d2123dccf0f196d4b..c7d60caa7d19c76ec30280e163283430ad88b442 100644
--- a/db/migrate/20161014173530_create_label_priorities.rb
+++ b/db/migrate/20161014173530_create_label_priorities.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateLabelPriorities < ActiveRecord::Migration
+class CreateLabelPriorities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb b/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb
index 8f6be9dd6775547113ee12009e134968717c0288..11f4fa1a1f7b15af86b2f4b0d1f1529d52239952 100644
--- a/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb
+++ b/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb
@@ -1,4 +1,4 @@
-class AddAuthorizedProjectsPopulatedToUsers < ActiveRecord::Migration
+class AddAuthorizedProjectsPopulatedToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161017095000_add_properties_to_deployment.rb b/db/migrate/20161017095000_add_properties_to_deployment.rb
index f620ee0de1cd76c639d6289605b70c33772988ae..31bd4cd24ad03ec8994a77e185c47c5a85bbe7b5 100644
--- a/db/migrate/20161017095000_add_properties_to_deployment.rb
+++ b/db/migrate/20161017095000_add_properties_to_deployment.rb
@@ -1,4 +1,4 @@
-class AddPropertiesToDeployment < ActiveRecord::Migration
+class AddPropertiesToDeployment < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161017125927_add_unique_index_to_labels.rb b/db/migrate/20161017125927_add_unique_index_to_labels.rb
index fcdd79d3b029e7ee41e408cce9efffc6c0032a92..b5326789f5262d6d9811ba82bb86ab49ae19c8ab 100644
--- a/db/migrate/20161017125927_add_unique_index_to_labels.rb
+++ b/db/migrate/20161017125927_add_unique_index_to_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddUniqueIndexToLabels < ActiveRecord::Migration
+class AddUniqueIndexToLabels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161018024215_migrate_labels_priority.rb b/db/migrate/20161018024215_migrate_labels_priority.rb
index 22bec2382f46025f90f53fff50c634f8ccf33a05..3e2540c134cdd0b2a27ca517fabc72b586978177 100644
--- a/db/migrate/20161018024215_migrate_labels_priority.rb
+++ b/db/migrate/20161018024215_migrate_labels_priority.rb
@@ -1,4 +1,4 @@
-class MigrateLabelsPriority < ActiveRecord::Migration
+class MigrateLabelsPriority < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161018024550_remove_priority_from_labels.rb b/db/migrate/20161018024550_remove_priority_from_labels.rb
index bc25a43526cc267cdef169678f3ddea7a8779add..e164d959bdfc72c6affa68a1509c8471d8dfff63 100644
--- a/db/migrate/20161018024550_remove_priority_from_labels.rb
+++ b/db/migrate/20161018024550_remove_priority_from_labels.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemovePriorityFromLabels < ActiveRecord::Migration
+class RemovePriorityFromLabels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161018124658_make_project_owners_masters.rb b/db/migrate/20161018124658_make_project_owners_masters.rb
index cb93b449067ae4b7587697fcbd0ff1f34f3e9cbd..132c17388dc5ee447afa51295aa67ac29ef0085c 100644
--- a/db/migrate/20161018124658_make_project_owners_masters.rb
+++ b/db/migrate/20161018124658_make_project_owners_masters.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateColumnInBatches
-class MakeProjectOwnersMasters < ActiveRecord::Migration
+class MakeProjectOwnersMasters < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb b/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb
index 9f502a8df734f5a07b90dbe8e0c1fe187b84869a..fc6d97846382e45c684628a4877bc30d818cf2ea 100644
--- a/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb
+++ b/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration
+class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161019213545_generate_project_feature_for_projects.rb b/db/migrate/20161019213545_generate_project_feature_for_projects.rb
index 4554e14b0df612cc0b9e09efc642a66913fbb9be..587bdf60f705c850a829cbf338da353ae293ea65 100644
--- a/db/migrate/20161019213545_generate_project_feature_for_projects.rb
+++ b/db/migrate/20161019213545_generate_project_feature_for_projects.rb
@@ -1,4 +1,4 @@
-class GenerateProjectFeatureForProjects < ActiveRecord::Migration
+class GenerateProjectFeatureForProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = true
 
   DOWNTIME_REASON = <<-HEREDOC
diff --git a/db/migrate/20161020075734_default_request_access_groups.rb b/db/migrate/20161020075734_default_request_access_groups.rb
index 9721cc88724a097a868b708f3bd45e9453295410..72aec86167e321d9c88981de47708b61d26cef9e 100644
--- a/db/migrate/20161020075734_default_request_access_groups.rb
+++ b/db/migrate/20161020075734_default_request_access_groups.rb
@@ -1,4 +1,4 @@
-class DefaultRequestAccessGroups < ActiveRecord::Migration
+class DefaultRequestAccessGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/migrate/20161020075830_default_request_access_projects.rb b/db/migrate/20161020075830_default_request_access_projects.rb
index a3a53350e8dcc84a95206968049ee07e9eaf834a..b457e39f83883b62799327f65542d96ad595a06d 100644
--- a/db/migrate/20161020075830_default_request_access_projects.rb
+++ b/db/migrate/20161020075830_default_request_access_projects.rb
@@ -1,4 +1,4 @@
-class DefaultRequestAccessProjects < ActiveRecord::Migration
+class DefaultRequestAccessProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb b/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb
index b77daf12f6822555836601d494fa670f044d76e6..60352363e42fffd593df2573013f348a335908b6 100644
--- a/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb
+++ b/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration
+class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161020180657_add_minimum_key_length_to_application_settings.rb b/db/migrate/20161020180657_add_minimum_key_length_to_application_settings.rb
index 5b6079002c09894a1c9c1a7dcde1755be50af5e6..7839bee6a5b3e420fbcf0d483976b2f9bf36ac25 100644
--- a/db/migrate/20161020180657_add_minimum_key_length_to_application_settings.rb
+++ b/db/migrate/20161020180657_add_minimum_key_length_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddMinimumKeyLengthToApplicationSettings < ActiveRecord::Migration
+class AddMinimumKeyLengthToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161021114307_add_lock_version_to_build_and_pipelines.rb b/db/migrate/20161021114307_add_lock_version_to_build_and_pipelines.rb
index b47f3aa281018e8407f1328b15d30366f18cec9e..e172dc3adf241f1a4e295f2bce81edfbb2a2d809 100644
--- a/db/migrate/20161021114307_add_lock_version_to_build_and_pipelines.rb
+++ b/db/migrate/20161021114307_add_lock_version_to_build_and_pipelines.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLockVersionToBuildAndPipelines < ActiveRecord::Migration
+class AddLockVersionToBuildAndPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb b/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb
index fc2e4c12b300a049aa6b1f9357414a7f9dd9329e..d27f8fc38c8a56617a80651d9650979a14f24c47 100644
--- a/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb
+++ b/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateMailroomQueueFromDefault < ActiveRecord::Migration
+class MigrateMailroomQueueFromDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161025231710_migrate_jira_to_gem.rb b/db/migrate/20161025231710_migrate_jira_to_gem.rb
index 870b00411d2bf0fa11fa0cda43a3972e2ca879ea..aa1c59ec9e676c1208540b81728631a71cb91fcb 100644
--- a/db/migrate/20161025231710_migrate_jira_to_gem.rb
+++ b/db/migrate/20161025231710_migrate_jira_to_gem.rb
@@ -1,4 +1,4 @@
-class MigrateJiraToGem < ActiveRecord::Migration
+class MigrateJiraToGem < ActiveRecord::Migration[4.2]
   DOWNTIME = true
 
   DOWNTIME_REASON = <<-HEREDOC
diff --git a/db/migrate/20161031155516_add_housekeeping_to_application_settings.rb b/db/migrate/20161031155516_add_housekeeping_to_application_settings.rb
index 5a451fb575b8c83441544b08786fbb2c263be6b7..963358fe3e58d93281b1a5227c6e5b62a44ebea4 100644
--- a/db/migrate/20161031155516_add_housekeeping_to_application_settings.rb
+++ b/db/migrate/20161031155516_add_housekeeping_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddHousekeepingToApplicationSettings < ActiveRecord::Migration
+class AddHousekeepingToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161031171301_add_project_id_to_subscriptions.rb b/db/migrate/20161031171301_add_project_id_to_subscriptions.rb
index 8b1c10a124fd63ef1463fee88749e4f89f93935c..5fd10d9b3595edacbcec0227ceecfd533d4bc639 100644
--- a/db/migrate/20161031171301_add_project_id_to_subscriptions.rb
+++ b/db/migrate/20161031171301_add_project_id_to_subscriptions.rb
@@ -1,4 +1,4 @@
-class AddProjectIdToSubscriptions < ActiveRecord::Migration
+class AddProjectIdToSubscriptions < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161031174110_migrate_subscriptions_project_id.rb b/db/migrate/20161031174110_migrate_subscriptions_project_id.rb
index 549145a0a65232248dbe8cddaf77f97b0ae36bc0..7f4087fdcd3f54aa4e57b726289ed8468a7b5630 100644
--- a/db/migrate/20161031174110_migrate_subscriptions_project_id.rb
+++ b/db/migrate/20161031174110_migrate_subscriptions_project_id.rb
@@ -1,4 +1,4 @@
-class MigrateSubscriptionsProjectId < ActiveRecord::Migration
+class MigrateSubscriptionsProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb b/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb
index f263377fbc68a99417acb7108e0e027adee62386..23a775d62821b708ce8e22b107d0db973ad4f745 100644
--- a/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb
+++ b/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddUniqueIndexToSubscriptions < ActiveRecord::Migration
+class AddUniqueIndexToSubscriptions < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161103171205_rename_repository_storage_column.rb b/db/migrate/20161103171205_rename_repository_storage_column.rb
index 932805739394b592086b826be37ba0e68e424e8e..d6050500e47cb147f21ce1ace59b8caae04c14e6 100644
--- a/db/migrate/20161103171205_rename_repository_storage_column.rb
+++ b/db/migrate/20161103171205_rename_repository_storage_column.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameRepositoryStorageColumn < ActiveRecord::Migration
+class RenameRepositoryStorageColumn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161103191444_add_sidekiq_throttling_to_application_settings.rb b/db/migrate/20161103191444_add_sidekiq_throttling_to_application_settings.rb
index 522437b92b4bedb06fafc0d1a327197fc2ed83a7..83c51c83509f64080da730a99793f681ef088c6d 100644
--- a/db/migrate/20161103191444_add_sidekiq_throttling_to_application_settings.rb
+++ b/db/migrate/20161103191444_add_sidekiq_throttling_to_application_settings.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/SaferBooleanColumn
-class AddSidekiqThrottlingToApplicationSettings < ActiveRecord::Migration
+class AddSidekiqThrottlingToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161106185620_add_project_import_data_project_index.rb b/db/migrate/20161106185620_add_project_import_data_project_index.rb
index b3746dc4f6c57d627d6b4f62ed0dc177d030f8d3..46809ca170790fe3c65deec1f6ff572607c80672 100644
--- a/db/migrate/20161106185620_add_project_import_data_project_index.rb
+++ b/db/migrate/20161106185620_add_project_import_data_project_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddProjectImportDataProjectIndex < ActiveRecord::Migration
+class AddProjectImportDataProjectIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161113184239_create_user_chat_names_table.rb b/db/migrate/20161113184239_create_user_chat_names_table.rb
index 7bead07fd76d6b4f3a1d75dac0954787b3874031..0031ca66afed3efa1c36ecb5571a790795e8a718 100644
--- a/db/migrate/20161113184239_create_user_chat_names_table.rb
+++ b/db/migrate/20161113184239_create_user_chat_names_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateUserChatNamesTable < ActiveRecord::Migration
+class CreateUserChatNamesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161114024742_add_coverage_regex_to_builds.rb b/db/migrate/20161114024742_add_coverage_regex_to_builds.rb
index 88aa5d52b396ae2290a9f92f93ff00e6f2b06ab8..631968b4aee188e16b10add27a16cb91a3551840 100644
--- a/db/migrate/20161114024742_add_coverage_regex_to_builds.rb
+++ b/db/migrate/20161114024742_add_coverage_regex_to_builds.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCoverageRegexToBuilds < ActiveRecord::Migration
+class AddCoverageRegexToBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161115173905_add_start_date_to_milestones.rb b/db/migrate/20161115173905_add_start_date_to_milestones.rb
index 413733b8db77f184cb4d7d538fdb754593c038c7..847c4f0bebb9f49c991c4fa31dc24dc12b3aaac6 100644
--- a/db/migrate/20161115173905_add_start_date_to_milestones.rb
+++ b/db/migrate/20161115173905_add_start_date_to_milestones.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddStartDateToMilestones < ActiveRecord::Migration
+class AddStartDateToMilestones < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161117114805_remove_undeleted_groups.rb b/db/migrate/20161117114805_remove_undeleted_groups.rb
index 29040583aa25367eb1788ee270777570ad62d252..0a4fe1c05b7f21191208ea9501e95c4ee8833746 100644
--- a/db/migrate/20161117114805_remove_undeleted_groups.rb
+++ b/db/migrate/20161117114805_remove_undeleted_groups.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveUndeletedGroups < ActiveRecord::Migration
+class RemoveUndeletedGroups < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20161118183841_add_commit_events_to_services.rb b/db/migrate/20161118183841_add_commit_events_to_services.rb
index 4f9b5dd2281ebb5967dce4657d9bc221ac37be82..0eb089151183724e72445d5df7a92a7be7e455ac 100644
--- a/db/migrate/20161118183841_add_commit_events_to_services.rb
+++ b/db/migrate/20161118183841_add_commit_events_to_services.rb
@@ -1,4 +1,4 @@
-class AddCommitEventsToServices < ActiveRecord::Migration
+class AddCommitEventsToServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161124111390_add_parent_id_to_namespace.rb b/db/migrate/20161124111390_add_parent_id_to_namespace.rb
index a6fa1b70a9da04bb43f66188a4073bb14682ca63..67f6aee2b9cb912a30ca7f62248749b8df6608d6 100644
--- a/db/migrate/20161124111390_add_parent_id_to_namespace.rb
+++ b/db/migrate/20161124111390_add_parent_id_to_namespace.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddParentIdToNamespace < ActiveRecord::Migration
+class AddParentIdToNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161124111395_add_index_to_parent_id.rb b/db/migrate/20161124111395_add_index_to_parent_id.rb
index 065643e058d0ea039b460b3805afb9db1b07e7ca..d7a51ec905a0d97f9aa8dfebc5c9a88c7d7ecf4e 100644
--- a/db/migrate/20161124111395_add_index_to_parent_id.rb
+++ b/db/migrate/20161124111395_add_index_to_parent_id.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexToParentId < ActiveRecord::Migration
+class AddIndexToParentId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161124111402_add_routes_table.rb b/db/migrate/20161124111402_add_routes_table.rb
index f5241d906d18ae98a3b08150f57fc34509ef1ed1..36f49ef8c97f5d65d8776b60fc237e7bf4e70bc0 100644
--- a/db/migrate/20161124111402_add_routes_table.rb
+++ b/db/migrate/20161124111402_add_routes_table.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Timestamps
-class AddRoutesTable < ActiveRecord::Migration
+class AddRoutesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb b/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
index 1eb6a8fa5df54224a24d58c671313d6025913a00..0772821210c94e7cda44eb16f8955105c61537cc 100644
--- a/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
+++ b/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb
@@ -1,4 +1,4 @@
-class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
+class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class Repository
diff --git a/db/migrate/20161128095517_add_in_reply_to_discussion_id_to_sent_notifications.rb b/db/migrate/20161128095517_add_in_reply_to_discussion_id_to_sent_notifications.rb
index d56d83ca1d3362d5ac2d3cffc07a854e4e1ef6e7..a2971486014fa0e31c32f5031b5a04472c4aad98 100644
--- a/db/migrate/20161128095517_add_in_reply_to_discussion_id_to_sent_notifications.rb
+++ b/db/migrate/20161128095517_add_in_reply_to_discussion_id_to_sent_notifications.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddInReplyToDiscussionIdToSentNotifications < ActiveRecord::Migration
+class AddInReplyToDiscussionIdToSentNotifications < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161128142110_remove_unnecessary_indexes.rb b/db/migrate/20161128142110_remove_unnecessary_indexes.rb
index 699a9368eb31326e21f85809fac66dfe27a6c855..b6c6e303ec7ab8e8efe4c8049805f366236feada 100644
--- a/db/migrate/20161128142110_remove_unnecessary_indexes.rb
+++ b/db/migrate/20161128142110_remove_unnecessary_indexes.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class RemoveUnnecessaryIndexes < ActiveRecord::Migration
+class RemoveUnnecessaryIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20161128161412_add_html_emails_enabled_to_application_settings.rb b/db/migrate/20161128161412_add_html_emails_enabled_to_application_settings.rb
index 38f5781745b92aab417088a9e22a4f952d38ba21..63139eb97bd994dceb38d3b5509c4a7fdcb7761a 100644
--- a/db/migrate/20161128161412_add_html_emails_enabled_to_application_settings.rb
+++ b/db/migrate/20161128161412_add_html_emails_enabled_to_application_settings.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/SaferBooleanColumn
-class AddHtmlEmailsEnabledToApplicationSettings < ActiveRecord::Migration
+class AddHtmlEmailsEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161130095245_fill_routes_table.rb b/db/migrate/20161130095245_fill_routes_table.rb
index c3536d6d911a006d88e2a8df0377593b2a02f1bf..712be187c7ce145a0ed5e464164826fe6e647732 100644
--- a/db/migrate/20161130095245_fill_routes_table.rb
+++ b/db/migrate/20161130095245_fill_routes_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class FillRoutesTable < ActiveRecord::Migration
+class FillRoutesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161130101252_fill_projects_routes_table.rb b/db/migrate/20161130101252_fill_projects_routes_table.rb
index 56ba6fcdbe35cf1c2a58e5be5e7ead3f7d908a26..1900d6c8013323eaabc32bdd0e94a28d1c6dfdf1 100644
--- a/db/migrate/20161130101252_fill_projects_routes_table.rb
+++ b/db/migrate/20161130101252_fill_projects_routes_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class FillProjectsRoutesTable < ActiveRecord::Migration
+class FillProjectsRoutesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161201001911_add_plant_uml_url_to_application_settings.rb b/db/migrate/20161201001911_add_plant_uml_url_to_application_settings.rb
index b8d8742ae402bd50539475de46beb1871db69bdd..79558a6b3b9454355a2e5923ed0937ef048343c5 100644
--- a/db/migrate/20161201001911_add_plant_uml_url_to_application_settings.rb
+++ b/db/migrate/20161201001911_add_plant_uml_url_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPlantUmlUrlToApplicationSettings < ActiveRecord::Migration
+class AddPlantUmlUrlToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161201155511_create_project_statistics.rb b/db/migrate/20161201155511_create_project_statistics.rb
index 26e6d3623eb1317526fc2a5ae504010e411ba81a..6dcb5adb82b829e4b11081400c87236e51d94a74 100644
--- a/db/migrate/20161201155511_create_project_statistics.rb
+++ b/db/migrate/20161201155511_create_project_statistics.rb
@@ -1,4 +1,4 @@
-class CreateProjectStatistics < ActiveRecord::Migration
+class CreateProjectStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161201160452_migrate_project_statistics.rb b/db/migrate/20161201160452_migrate_project_statistics.rb
index a547409aaa5418ed1fa41783e5258db28b5820e0..42c5be07e83cff15af3bd3f3c568a6df4ca5415d 100644
--- a/db/migrate/20161201160452_migrate_project_statistics.rb
+++ b/db/migrate/20161201160452_migrate_project_statistics.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class MigrateProjectStatistics < ActiveRecord::Migration
+class MigrateProjectStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161202152031_remove_duplicates_from_routes.rb b/db/migrate/20161202152031_remove_duplicates_from_routes.rb
index d73b08475064dc444ea0da78d5ab2ecd4e508805..0615f683859eb216ffa8642e8b333f63808fdbf8 100644
--- a/db/migrate/20161202152031_remove_duplicates_from_routes.rb
+++ b/db/migrate/20161202152031_remove_duplicates_from_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDuplicatesFromRoutes < ActiveRecord::Migration
+class RemoveDuplicatesFromRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161202152035_add_index_to_routes.rb b/db/migrate/20161202152035_add_index_to_routes.rb
index 552b5fab68c2ff0b3eb80ecae8fccb5849b5927d..ad2e0cd13c93e6ebb6f21c99341e83c3e98bda85 100644
--- a/db/migrate/20161202152035_add_index_to_routes.rb
+++ b/db/migrate/20161202152035_add_index_to_routes.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexToRoutes < ActiveRecord::Migration
+class AddIndexToRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161206003819_add_plant_uml_enabled_to_application_settings.rb b/db/migrate/20161206003819_add_plant_uml_enabled_to_application_settings.rb
index 7f56ecf4c9e494a7ac08dd7cf8b0f8a3f165eca4..bb44d56ee563c61804935915522655915cb2b2c3 100644
--- a/db/migrate/20161206003819_add_plant_uml_enabled_to_application_settings.rb
+++ b/db/migrate/20161206003819_add_plant_uml_enabled_to_application_settings.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/SaferBooleanColumn
-class AddPlantUmlEnabledToApplicationSettings < ActiveRecord::Migration
+class AddPlantUmlEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161206153749_remove_uniq_path_index_from_namespace.rb b/db/migrate/20161206153749_remove_uniq_path_index_from_namespace.rb
index 7d39c2ae6268e8391d17d9284d480467c1205751..c301d76646e0040928783887528b491b61a30543 100644
--- a/db/migrate/20161206153749_remove_uniq_path_index_from_namespace.rb
+++ b/db/migrate/20161206153749_remove_uniq_path_index_from_namespace.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class RemoveUniqPathIndexFromNamespace < ActiveRecord::Migration
+class RemoveUniqPathIndexFromNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161206153751_add_path_index_to_namespace.rb b/db/migrate/20161206153751_add_path_index_to_namespace.rb
index 623037e35cdad9291e7b6432ce48350864240230..f0848cc59a52bf5dd0870c99ec68086a2ba723c3 100644
--- a/db/migrate/20161206153751_add_path_index_to_namespace.rb
+++ b/db/migrate/20161206153751_add_path_index_to_namespace.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddPathIndexToNamespace < ActiveRecord::Migration
+class AddPathIndexToNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161206153753_remove_uniq_name_index_from_namespace.rb b/db/migrate/20161206153753_remove_uniq_name_index_from_namespace.rb
index 9296ae36aa56294e5004e404d5aeef2bad8c160d..13660cec7aa037bb0ca45b217032888e4b970e3e 100644
--- a/db/migrate/20161206153753_remove_uniq_name_index_from_namespace.rb
+++ b/db/migrate/20161206153753_remove_uniq_name_index_from_namespace.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class RemoveUniqNameIndexFromNamespace < ActiveRecord::Migration
+class RemoveUniqNameIndexFromNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161206153754_add_name_index_to_namespace.rb b/db/migrate/20161206153754_add_name_index_to_namespace.rb
index 2bbd039ff2756a2c3f8bac4eb21495963f37ec42..14152a6dc07298e502bdb6f9aacc5742e5b2021d 100644
--- a/db/migrate/20161206153754_add_name_index_to_namespace.rb
+++ b/db/migrate/20161206153754_add_name_index_to_namespace.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddNameIndexToNamespace < ActiveRecord::Migration
+class AddNameIndexToNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
index 1db8c68626a5e190bc916a69d8d6cb8b37da6c38..7cae09021cdd11a545f116cefe4f5d3a39c3b64c 100644
--- a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
+++ b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
@@ -1,4 +1,4 @@
-class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
+class FixupEnvironmentNameUniqueness < ActiveRecord::Migration[4.2]
   include Gitlab::Database::ArelMethods
   include Gitlab::Database::MigrationHelpers
 
diff --git a/db/migrate/20161207231621_create_environment_name_unique_index.rb b/db/migrate/20161207231621_create_environment_name_unique_index.rb
index 15093350f120461b3bafef171e89ad8adb980dce..28d226644056e4fe2d59cf9d3c66d8927f1ce04b 100644
--- a/db/migrate/20161207231621_create_environment_name_unique_index.rb
+++ b/db/migrate/20161207231621_create_environment_name_unique_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration
+class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20161207231626_add_environment_slug.rb b/db/migrate/20161207231626_add_environment_slug.rb
index 162f82a01cb9c1d86722eb4a633541188408086e..4657b023dfa426995aaa0d6cb7fc43bdf83633ac 100644
--- a/db/migrate/20161207231626_add_environment_slug.rb
+++ b/db/migrate/20161207231626_add_environment_slug.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEnvironmentSlug < ActiveRecord::Migration
+class AddEnvironmentSlug < ActiveRecord::Migration[4.2]
   include Gitlab::Database::ArelMethods
   include Gitlab::Database::MigrationHelpers
 
diff --git a/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb b/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb
index 42a90091b876f2831968c115c63adad482b094e0..57606a33cb9276badc158363f69fd72fca37163e 100644
--- a/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb
+++ b/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration
+class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb b/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb
index e63d5927f86b0d927860d0b019169e16e885e111..e8ea9cf8fda2f0614d7fd623ce6869dbb5fbadad 100644
--- a/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb
+++ b/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb
@@ -1,4 +1,4 @@
-class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration
+class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161212142807_add_lower_path_index_to_routes.rb b/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
index 76db5179795278d6b38e0b34a02b33ce4e07751d..92a12dbc699f0d482fc141ec204c33bf30d80f52 100644
--- a/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
+++ b/db/migrate/20161212142807_add_lower_path_index_to_routes.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddLowerPathIndexToRoutes < ActiveRecord::Migration
+class AddLowerPathIndexToRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
index dc38d0ac90674cffe50429ebb16612006683305d..babac6bfc4fedeeb5c0b6672631a92cf3296808b 100644
--- a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
+++ b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
@@ -1,4 +1,4 @@
-class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration
+class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161220141214_remove_dot_git_from_group_names.rb b/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
index 17357b67ab77942e7d437425c37e0de0846af3aa..5c0b083325efe5c408403acf6388c23d0976e498 100644
--- a/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
+++ b/db/migrate/20161220141214_remove_dot_git_from_group_names.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDotGitFromGroupNames < ActiveRecord::Migration
+class RemoveDotGitFromGroupNames < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   include Gitlab::ShellAdapter
 
diff --git a/db/migrate/20161221152132_add_last_used_at_to_key.rb b/db/migrate/20161221152132_add_last_used_at_to_key.rb
index 86dc78702478956c83450104c6c6cc0afefc798b..a5b3f2b6f4bc73abc271d92f9e1b32d62ca80fe3 100644
--- a/db/migrate/20161221152132_add_last_used_at_to_key.rb
+++ b/db/migrate/20161221152132_add_last_used_at_to_key.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddLastUsedAtToKey < ActiveRecord::Migration
+class AddLastUsedAtToKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161223034433_add_estimate_to_issuables_ce.rb b/db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
index d5116dfab49a59c80b0e5c669b5c8ed9191f7a0a..75bea41387cffec695787298ce191f88ff60476e 100644
--- a/db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
+++ b/db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
@@ -1,4 +1,4 @@
-class AddEstimateToIssuablesCe < ActiveRecord::Migration
+class AddEstimateToIssuablesCe < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161223034646_create_timelogs_ce.rb b/db/migrate/20161223034646_create_timelogs_ce.rb
index 1e894cc916113afd9895a5062df3b37e5f2034c4..489a2b35dfdac39079b4982addaf8f5c0acfab90 100644
--- a/db/migrate/20161223034646_create_timelogs_ce.rb
+++ b/db/migrate/20161223034646_create_timelogs_ce.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateTimelogsCe < ActiveRecord::Migration
+class CreateTimelogsCe < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161226122833_remove_dot_git_from_usernames.rb b/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
index db10426b483aab65af451aee795c3742f46c1f04..e3318780151015de9d23e66ae89359de05cce479 100644
--- a/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
+++ b/db/migrate/20161226122833_remove_dot_git_from_usernames.rb
@@ -1,4 +1,4 @@
-class RemoveDotGitFromUsernames < ActiveRecord::Migration
+class RemoveDotGitFromUsernames < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   include Gitlab::ShellAdapter
 
diff --git a/db/migrate/20161227192806_rename_slack_and_mattermost_notification_services.rb b/db/migrate/20161227192806_rename_slack_and_mattermost_notification_services.rb
index 6b15e5caccf404c5c068c3ce44493630b286db90..df5714278f2a7435cdee74dbbf93cc8399f73421 100644
--- a/db/migrate/20161227192806_rename_slack_and_mattermost_notification_services.rb
+++ b/db/migrate/20161227192806_rename_slack_and_mattermost_notification_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateColumnInBatches
-class RenameSlackAndMattermostNotificationServices < ActiveRecord::Migration
+class RenameSlackAndMattermostNotificationServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20161228124936_change_expires_at_to_date_in_personal_access_tokens.rb b/db/migrate/20161228124936_change_expires_at_to_date_in_personal_access_tokens.rb
index 16f7cc487cef12afcee5d31fcbecb20e5e2e7428..f9f8f11316d0029cf49caa92077ea6cc2270e8a1 100644
--- a/db/migrate/20161228124936_change_expires_at_to_date_in_personal_access_tokens.rb
+++ b/db/migrate/20161228124936_change_expires_at_to_date_in_personal_access_tokens.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Datetime
-class ChangeExpiresAtToDateInPersonalAccessTokens < ActiveRecord::Migration
+class ChangeExpiresAtToDateInPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20161228135550_add_impersonation_to_personal_access_tokens.rb b/db/migrate/20161228135550_add_impersonation_to_personal_access_tokens.rb
index ea9caceaa2c3a99c0d5758cf680948d281aa6c8e..489d7fb8b752d841615c3377125922e6cdf923f0 100644
--- a/db/migrate/20161228135550_add_impersonation_to_personal_access_tokens.rb
+++ b/db/migrate/20161228135550_add_impersonation_to_personal_access_tokens.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddImpersonationToPersonalAccessTokens < ActiveRecord::Migration
+class AddImpersonationToPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170120131253_create_chat_teams.rb b/db/migrate/20170120131253_create_chat_teams.rb
index 522088219112bfaa5bc5dc344b8498e28ba3473d..e9b9bd7bd2f2d6069aa5f090d17af06335d2ba24 100644
--- a/db/migrate/20170120131253_create_chat_teams.rb
+++ b/db/migrate/20170120131253_create_chat_teams.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateChatTeams < ActiveRecord::Migration
+class CreateChatTeams < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20170121123724_add_index_to_ci_builds_for_status_runner_id_and_type.rb b/db/migrate/20170121123724_add_index_to_ci_builds_for_status_runner_id_and_type.rb
index c006098fafd07a691767b493a3e55e931a7b0473..cc1a4d2db59255cd4a37c26f8c445a0aba4a8a47 100644
--- a/db/migrate/20170121123724_add_index_to_ci_builds_for_status_runner_id_and_type.rb
+++ b/db/migrate/20170121123724_add_index_to_ci_builds_for_status_runner_id_and_type.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToCiBuildsForStatusRunnerIdAndType < ActiveRecord::Migration
+class AddIndexToCiBuildsForStatusRunnerIdAndType < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170121130655_add_index_to_ci_runners_for_is_shared.rb b/db/migrate/20170121130655_add_index_to_ci_runners_for_is_shared.rb
index 00aa0b311b1394f95d1286b6a40e81cd614b61ec..1b83ce4cfe3f70c397fe0248d0179ba4627f1772 100644
--- a/db/migrate/20170121130655_add_index_to_ci_runners_for_is_shared.rb
+++ b/db/migrate/20170121130655_add_index_to_ci_runners_for_is_shared.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToCiRunnersForIsShared < ActiveRecord::Migration
+class AddIndexToCiRunnersForIsShared < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb b/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
index a7d4e141a1aae27e12e3726131dc3b48028c9a18..ffd966be086c0daf4acdb8e6dafa83285e20bdba 100644
--- a/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
+++ b/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddForeignKeysToTimelogs < ActiveRecord::Migration
+class AddForeignKeysToTimelogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170124193147_add_two_factor_columns_to_namespaces.rb b/db/migrate/20170124193147_add_two_factor_columns_to_namespaces.rb
index 27ebe0af33be27342299e4faf52e8a5d04d0f25e..324e051666b631cdefb9be7b9fcbf7c6e4899183 100644
--- a/db/migrate/20170124193147_add_two_factor_columns_to_namespaces.rb
+++ b/db/migrate/20170124193147_add_two_factor_columns_to_namespaces.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddTwoFactorColumnsToNamespaces < ActiveRecord::Migration
+class AddTwoFactorColumnsToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170124193205_add_two_factor_columns_to_users.rb b/db/migrate/20170124193205_add_two_factor_columns_to_users.rb
index 558a1837c7968229ea6b027ff098eeaa3ba06cb1..6c80dbfc965cef7c3793485bc0777f67c6fbbab5 100644
--- a/db/migrate/20170124193205_add_two_factor_columns_to_users.rb
+++ b/db/migrate/20170124193205_add_two_factor_columns_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddTwoFactorColumnsToUsers < ActiveRecord::Migration
+class AddTwoFactorColumnsToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170126174819_add_terminal_max_session_time_to_application_settings.rb b/db/migrate/20170126174819_add_terminal_max_session_time_to_application_settings.rb
index 334f53f9145f3b3147463098431dd30586cafb9c..70f1669108a37f16210f93405c71a2c7198f7160 100644
--- a/db/migrate/20170126174819_add_terminal_max_session_time_to_application_settings.rb
+++ b/db/migrate/20170126174819_add_terminal_max_session_time_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddTerminalMaxSessionTimeToApplicationSettings < ActiveRecord::Migration
+class AddTerminalMaxSessionTimeToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb b/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb
index 0ee4229d1f833f07960ee6b65fbbf09024991250..2e2fecfa2a79af18479d4cdea4237585bc72c554 100644
--- a/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb
+++ b/db/migrate/20170127032550_remove_backlog_lists_from_boards.rb
@@ -1,4 +1,4 @@
-class RemoveBacklogListsFromBoards < ActiveRecord::Migration
+class RemoveBacklogListsFromBoards < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170130204620_add_index_to_project_authorizations.rb b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
index f256251516a668775cf1bad3822e583073daaadc..28c4480e9c65a48efd94dc84cdf8f873fee2ba5c 100644
--- a/db/migrate/20170130204620_add_index_to_project_authorizations.rb
+++ b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToProjectAuthorizations < ActiveRecord::Migration
+class AddIndexToProjectAuthorizations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170130221926_create_uploads.rb b/db/migrate/20170130221926_create_uploads.rb
index 6f06c5dd84082bfe37a11118c0c61d72036956e1..7bf15ca4978f53511e6bbf53357224d09dec17da 100644
--- a/db/migrate/20170130221926_create_uploads.rb
+++ b/db/migrate/20170130221926_create_uploads.rb
@@ -1,4 +1,4 @@
-class CreateUploads < ActiveRecord::Migration
+class CreateUploads < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170131221752_add_relative_position_to_issues.rb b/db/migrate/20170131221752_add_relative_position_to_issues.rb
index fd18d8b6a60f1b78f09ae05f2b5e2efa614f6644..126cb9e54151dd501dfefcaa653a259a10ebd514 100644
--- a/db/migrate/20170131221752_add_relative_position_to_issues.rb
+++ b/db/migrate/20170131221752_add_relative_position_to_issues.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddRelativePositionToIssues < ActiveRecord::Migration
+class AddRelativePositionToIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170204172458_add_name_to_route.rb b/db/migrate/20170204172458_add_name_to_route.rb
index 38ed1ad9039c5e9678c12d3b6c194a2015f7c23b..e7c94aceb260a4233d536a756bfebf966e77dd82 100644
--- a/db/migrate/20170204172458_add_name_to_route.rb
+++ b/db/migrate/20170204172458_add_name_to_route.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddNameToRoute < ActiveRecord::Migration
+class AddNameToRoute < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb b/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb
index b1b0a601007716d09d2ce6d4daf572c1e6d3f6dc..746322885b1e3417680aba505b36e944b6759f66 100644
--- a/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb
+++ b/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToLabelsForTypeAndProject < ActiveRecord::Migration
+class AddIndexToLabelsForTypeAndProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170206071414_add_recaptcha_verified_to_spam_logs.rb b/db/migrate/20170206071414_add_recaptcha_verified_to_spam_logs.rb
index 44372334d21dc13b39969c7ed982e66d59efe1d8..06338ac943ecea4c44e69e86dfe0cd8588688244 100644
--- a/db/migrate/20170206071414_add_recaptcha_verified_to_spam_logs.rb
+++ b/db/migrate/20170206071414_add_recaptcha_verified_to_spam_logs.rb
@@ -1,4 +1,4 @@
-class AddRecaptchaVerifiedToSpamLogs < ActiveRecord::Migration
+class AddRecaptchaVerifiedToSpamLogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20170206115204_add_column_ghost_to_users.rb b/db/migrate/20170206115204_add_column_ghost_to_users.rb
index cc1eeda1160f11fab73cf3e53adda376a7a1bbd6..4b86814e05d022b843180a315c01f3e18538907f 100644
--- a/db/migrate/20170206115204_add_column_ghost_to_users.rb
+++ b/db/migrate/20170206115204_add_column_ghost_to_users.rb
@@ -1,4 +1,4 @@
-class AddColumnGhostToUsers < ActiveRecord::Migration
+class AddColumnGhostToUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb b/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb
index 2c20f6a48ab041e3d7d73b3c4b54a4205f207066..d0b440b8ccb1a3257c4df8a5cf179feed74b867c 100644
--- a/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb
+++ b/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToLabelsForTitleAndProject < ActiveRecord::Migration
+class AddIndexToLabelsForTitleAndProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb b/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb
index c31057f2617c47ab2268041c19d7c1dc52a17155..753d6c77e357dfcf3e40a6ef4dea858a0a94b418 100644
--- a/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb
+++ b/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToCiTriggerRequestsForCommitId < ActiveRecord::Migration
+class AddIndexToCiTriggerRequestsForCommitId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170210103609_add_index_to_user_agent_detail.rb b/db/migrate/20170210103609_add_index_to_user_agent_detail.rb
index ba4976a5ce8e2fe0940f3acc4aab475be0c3889a..a2d6528ea82d704a58cc928a413326b570e14b93 100644
--- a/db/migrate/20170210103609_add_index_to_user_agent_detail.rb
+++ b/db/migrate/20170210103609_add_index_to_user_agent_detail.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexToUserAgentDetail < ActiveRecord::Migration
+class AddIndexToUserAgentDetail < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb b/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb
index 9ab970134be83578c95a033679b86e24c43e8d13..c286354f476b6048e2c5e6cf83e128b58068c77d 100644
--- a/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb
+++ b/db/migrate/20170210131347_add_unique_ips_limit_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddUniqueIpsLimitToApplicationSettings < ActiveRecord::Migration
+class AddUniqueIpsLimitToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
   disable_ddl_transaction!
diff --git a/db/migrate/20170214084746_add_default_artifacts_expiration_to_application_settings.rb b/db/migrate/20170214084746_add_default_artifacts_expiration_to_application_settings.rb
index e0e3ff8957a05f8c4f1b3c6fdbc436294b0bd844..84814c2f8f24781e0a10f3a88a71829ffff64e22 100644
--- a/db/migrate/20170214084746_add_default_artifacts_expiration_to_application_settings.rb
+++ b/db/migrate/20170214084746_add_default_artifacts_expiration_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddDefaultArtifactsExpirationToApplicationSettings < ActiveRecord::Migration
+class AddDefaultArtifactsExpirationToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb b/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
index 884c4e569d685ed6bf8cbabbe686eb34975f7a3b..be393bd496d6635ce507b4e124ffa5796467c229 100644
--- a/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
+++ b/db/migrate/20170216135621_add_index_for_latest_successful_pipeline.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexForLatestSuccessfulPipeline < ActiveRecord::Migration
+class AddIndexForLatestSuccessfulPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/migrate/20170216141440_drop_index_for_builds_project_status.rb b/db/migrate/20170216141440_drop_index_for_builds_project_status.rb
index 56ad566ca67605fe27974ab7404bf398f8409068..7edf7dd7e105e770e9b91e59d60788d024db1dd7 100644
--- a/db/migrate/20170216141440_drop_index_for_builds_project_status.rb
+++ b/db/migrate/20170216141440_drop_index_for_builds_project_status.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class DropIndexForBuildsProjectStatus < ActiveRecord::Migration
+class DropIndexForBuildsProjectStatus < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/migrate/20170217132157_rename_merge_when_build_succeeds.rb b/db/migrate/20170217132157_rename_merge_when_build_succeeds.rb
index 9011526565dcf51bd2790549b661a9764e916344..ee8838eff5636358e1eae42f92c0b0c236c47570 100644
--- a/db/migrate/20170217132157_rename_merge_when_build_succeeds.rb
+++ b/db/migrate/20170217132157_rename_merge_when_build_succeeds.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameMergeWhenBuildSucceeds < ActiveRecord::Migration
+class RenameMergeWhenBuildSucceeds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170217151947_rename_only_allow_merge_if_build_succeeds.rb b/db/migrate/20170217151947_rename_only_allow_merge_if_build_succeeds.rb
index b2b68ff72d134b25cf835df89ac56a7076965d52..5d35216f3af3a5d21dbbcdf8dfa8ff4aa4443749 100644
--- a/db/migrate/20170217151947_rename_only_allow_merge_if_build_succeeds.rb
+++ b/db/migrate/20170217151947_rename_only_allow_merge_if_build_succeeds.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameOnlyAllowMergeIfBuildSucceeds < ActiveRecord::Migration
+class RenameOnlyAllowMergeIfBuildSucceeds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170217151948_add_owner_id_to_triggers.rb b/db/migrate/20170217151948_add_owner_id_to_triggers.rb
index 16d7cc5bed69189e381083db38085556a5ff55c0..a28711ae59ad977b4baeaad40cd936d5b3882e2c 100644
--- a/db/migrate/20170217151948_add_owner_id_to_triggers.rb
+++ b/db/migrate/20170217151948_add_owner_id_to_triggers.rb
@@ -1,4 +1,4 @@
-class AddOwnerIdToTriggers < ActiveRecord::Migration
+class AddOwnerIdToTriggers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170217151949_add_description_to_triggers.rb b/db/migrate/20170217151949_add_description_to_triggers.rb
index 1dca0e374124a005e4dfc81d40016f706b7bd18c..27cb4b3ab3127e6097047312c10f91beba4470ee 100644
--- a/db/migrate/20170217151949_add_description_to_triggers.rb
+++ b/db/migrate/20170217151949_add_description_to_triggers.rb
@@ -1,4 +1,4 @@
-class AddDescriptionToTriggers < ActiveRecord::Migration
+class AddDescriptionToTriggers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170222111732_create_gpg_keys.rb b/db/migrate/20170222111732_create_gpg_keys.rb
index 0d6d454bbf3aa831c0040b66be51b5f2d1740333..012e8ef5854883ce0140f48a3ba3dc8c88933669 100644
--- a/db/migrate/20170222111732_create_gpg_keys.rb
+++ b/db/migrate/20170222111732_create_gpg_keys.rb
@@ -1,4 +1,4 @@
-class CreateGpgKeys < ActiveRecord::Migration
+class CreateGpgKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170222143317_drop_ci_projects.rb b/db/migrate/20170222143317_drop_ci_projects.rb
index 4db8658f36fbe1c3edcc128ebc492174eb14ab22..9f3aa2da382d05d189dc8062f7fbe1f9a0996834 100644
--- a/db/migrate/20170222143317_drop_ci_projects.rb
+++ b/db/migrate/20170222143317_drop_ci_projects.rb
@@ -1,4 +1,4 @@
-class DropCiProjects < ActiveRecord::Migration
+class DropCiProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170222143500_remove_old_project_id_columns.rb b/db/migrate/20170222143500_remove_old_project_id_columns.rb
index 9bed38a34443f67ebf6285e9cf3fd533fe075494..356dee4a06087c7d3bd5d416a66b8d7f5f02b568 100644
--- a/db/migrate/20170222143500_remove_old_project_id_columns.rb
+++ b/db/migrate/20170222143500_remove_old_project_id_columns.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/RemoveColumn
 # rubocop:disable RemoveIndex
-class RemoveOldProjectIdColumns < ActiveRecord::Migration
+class RemoveOldProjectIdColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170222143603_rename_gl_project_id_to_project_id.rb b/db/migrate/20170222143603_rename_gl_project_id_to_project_id.rb
index 7c19d471557811cccd05bcb9c388710cad7a518f..390b2c33d9105d220cee6fbc240ac8962ffacf0b 100644
--- a/db/migrate/20170222143603_rename_gl_project_id_to_project_id.rb
+++ b/db/migrate/20170222143603_rename_gl_project_id_to_project_id.rb
@@ -1,4 +1,4 @@
-class RenameGlProjectIdToProjectId < ActiveRecord::Migration
+class RenameGlProjectIdToProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20170301101006_add_ci_runner_namespaces.rb b/db/migrate/20170301101006_add_ci_runner_namespaces.rb
index deaf03e928ba8880f27eddef4c27afd357055202..aa2d8a14242c1ed9c2bc3bc80e11e5358599af0d 100644
--- a/db/migrate/20170301101006_add_ci_runner_namespaces.rb
+++ b/db/migrate/20170301101006_add_ci_runner_namespaces.rb
@@ -1,4 +1,4 @@
-class AddCiRunnerNamespaces < ActiveRecord::Migration
+class AddCiRunnerNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170301125302_add_printing_merge_request_link_enabled_to_project.rb b/db/migrate/20170301125302_add_printing_merge_request_link_enabled_to_project.rb
index 6d43f346d4f7ca03dbb5cd05691dc3a60f37eff8..a7efeb8ae6f479a9b75fea8279a872a103eeb079 100644
--- a/db/migrate/20170301125302_add_printing_merge_request_link_enabled_to_project.rb
+++ b/db/migrate/20170301125302_add_printing_merge_request_link_enabled_to_project.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/UpdateLargeTable
-class AddPrintingMergeRequestLinkEnabledToProject < ActiveRecord::Migration
+class AddPrintingMergeRequestLinkEnabledToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb b/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb
index 4f061d9639214562447a7190311302110ab286f4..791e9c845a6ff267534b442a22c88a8a19c53237 100644
--- a/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb
+++ b/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb
@@ -1,4 +1,4 @@
-class RenameCiCommitsToCiPipelines < ActiveRecord::Migration
+class RenameCiCommitsToCiPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb b/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
index ee802ab34ca9fbd8188dbfc7347d334cd450c9c7..08a11aee9921364236b611cf560c8ddd2143868d 100644
--- a/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
+++ b/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveUnusedCiTablesAndColumns < ActiveRecord::Migration
+class RemoveUnusedCiTablesAndColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb b/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb
index 3c5cd95726a1e16472e3500cb2f99f03b43545d4..3e317bb5248503e718ee8c635b997dfff35ca057 100644
--- a/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb
+++ b/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddAutoCancelPendingPipelinesToProject < ActiveRecord::Migration
+class AddAutoCancelPendingPipelinesToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170305203726_add_owner_id_foreign_key.rb b/db/migrate/20170305203726_add_owner_id_foreign_key.rb
index 5fbdc45f1a748e0ba19942413fc951ee0bbf626f..b3bd441ff9cf205dab0041a6411dbf417cc85f4d 100644
--- a/db/migrate/20170305203726_add_owner_id_foreign_key.rb
+++ b/db/migrate/20170305203726_add_owner_id_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddOwnerIdForeignKey < ActiveRecord::Migration
+class AddOwnerIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170307125949_add_last_activity_on_to_users.rb b/db/migrate/20170307125949_add_last_activity_on_to_users.rb
index 0100836b4733cd42d1a64f99faa708c60781affc..42331eab7537de781dd5b176e37a79920eb287d0 100644
--- a/db/migrate/20170307125949_add_last_activity_on_to_users.rb
+++ b/db/migrate/20170307125949_add_last_activity_on_to_users.rb
@@ -1,4 +1,4 @@
-class AddLastActivityOnToUsers < ActiveRecord::Migration
+class AddLastActivityOnToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170309173138_create_protected_tags.rb b/db/migrate/20170309173138_create_protected_tags.rb
index 4684c9964c496eaf74532e6478c1f57e61e189d9..f518b500bd41d97876bcfb5413482ec48cad001e 100644
--- a/db/migrate/20170309173138_create_protected_tags.rb
+++ b/db/migrate/20170309173138_create_protected_tags.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateProtectedTags < ActiveRecord::Migration
+class CreateProtectedTags < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb b/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb
index 1690ce9056431f9c923047ac1d8a2182a8e3d668..26187a9e8b3fef01b7e0c79f61b06e63eeeec3a3 100644
--- a/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb
+++ b/db/migrate/20170312114329_add_auto_canceled_by_id_to_pipeline.rb
@@ -1,4 +1,4 @@
-class AddAutoCanceledByIdToPipeline < ActiveRecord::Migration
+class AddAutoCanceledByIdToPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170312114529_add_auto_canceled_by_id_foreign_key_to_pipeline.rb b/db/migrate/20170312114529_add_auto_canceled_by_id_foreign_key_to_pipeline.rb
index 1e7b02ecf0e3fd6f1c81fff1c05cbd9fd5764177..a2b5c1c4533ba3962f1cb8e3ae8a0f5f89c95e39 100644
--- a/db/migrate/20170312114529_add_auto_canceled_by_id_foreign_key_to_pipeline.rb
+++ b/db/migrate/20170312114529_add_auto_canceled_by_id_foreign_key_to_pipeline.rb
@@ -1,4 +1,4 @@
-class AddAutoCanceledByIdForeignKeyToPipeline < ActiveRecord::Migration
+class AddAutoCanceledByIdForeignKeyToPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170313213916_add_index_to_user_ghost.rb b/db/migrate/20170313213916_add_index_to_user_ghost.rb
index fe5847ed225f4737c6fbf06eac9bd4418b4e4a45..66e57b444a02024e708e94b1c2053c3b3637bec9 100644
--- a/db/migrate/20170313213916_add_index_to_user_ghost.rb
+++ b/db/migrate/20170313213916_add_index_to_user_ghost.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class AddIndexToUserGhost < ActiveRecord::Migration
+class AddIndexToUserGhost < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170314082049_create_system_note_metadata.rb b/db/migrate/20170314082049_create_system_note_metadata.rb
index fee47e9605327a79a50d9347668f40fa35381788..d0cc6e3be36d5b3c9a346a0055939a9162b0a1ca 100644
--- a/db/migrate/20170314082049_create_system_note_metadata.rb
+++ b/db/migrate/20170314082049_create_system_note_metadata.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateSystemNoteMetadata < ActiveRecord::Migration
+class CreateSystemNoteMetadata < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170315174634_revert_add_notified_of_own_activity_to_users.rb b/db/migrate/20170315174634_revert_add_notified_of_own_activity_to_users.rb
index 9b9098d115df33c493e092c8ec1bb60521cdd258..8773c7ea657f49e1f07aa42600f4188b28dc92d2 100644
--- a/db/migrate/20170315174634_revert_add_notified_of_own_activity_to_users.rb
+++ b/db/migrate/20170315174634_revert_add_notified_of_own_activity_to_users.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/RemoveColumn
 # rubocop:disable Migration/UpdateLargeTable
-class RevertAddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration
+class RevertAddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170315194013_add_closed_at_to_issues.rb b/db/migrate/20170315194013_add_closed_at_to_issues.rb
index 34a1bd7ca8c86a333ff9a49d3a832f7789bd2a81..0b06ee6e74ccd83e4cf0603d0aacbe9113a88ed3 100644
--- a/db/migrate/20170315194013_add_closed_at_to_issues.rb
+++ b/db/migrate/20170315194013_add_closed_at_to_issues.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddClosedAtToIssues < ActiveRecord::Migration
+class AddClosedAtToIssues < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb b/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb
index 524eb2557ce1b58354a5dffbebc453ad694f0c41..82029dfd3fc171c9d7133b1693545078a98cc6dc 100644
--- a/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb
+++ b/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb
@@ -1,4 +1,4 @@
-class ReaddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration
+class ReaddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170316163845_move_uploads_to_system_dir.rb b/db/migrate/20170316163845_move_uploads_to_system_dir.rb
index cfcb909ddaff3e9131b709763cdf6fe5952c6448..d24527b55cdf396bedf7ed46ad28f40b108a5f02 100644
--- a/db/migrate/20170316163845_move_uploads_to_system_dir.rb
+++ b/db/migrate/20170316163845_move_uploads_to_system_dir.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MoveUploadsToSystemDir < ActiveRecord::Migration
+class MoveUploadsToSystemDir < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170317203554_index_routes_path_for_like.rb b/db/migrate/20170317203554_index_routes_path_for_like.rb
index 8d3609135d0f475282faad7f43d5e42ef7e42c00..a1bee3c8783d51df3a9e9c958ba65742a2e99a9e 100644
--- a/db/migrate/20170317203554_index_routes_path_for_like.rb
+++ b/db/migrate/20170317203554_index_routes_path_for_like.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IndexRoutesPathForLike < ActiveRecord::Migration
+class IndexRoutesPathForLike < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170320173259_migrate_assignees.rb b/db/migrate/20170320173259_migrate_assignees.rb
index 255b5e9c4db151b3029becd5f80b5b9feca516b3..43a90758bd9073774a2245a741bd42633a44df2d 100644
--- a/db/migrate/20170320173259_migrate_assignees.rb
+++ b/db/migrate/20170320173259_migrate_assignees.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class MigrateAssignees < ActiveRecord::Migration
+class MigrateAssignees < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170322013926_create_container_repository.rb b/db/migrate/20170322013926_create_container_repository.rb
index 242f7b8d17df0a99f01c6113b80480a114353a1b..b1e778671b2c0abad1bfcbeb04d22856161517f1 100644
--- a/db/migrate/20170322013926_create_container_repository.rb
+++ b/db/migrate/20170322013926_create_container_repository.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateContainerRepository < ActiveRecord::Migration
+class CreateContainerRepository < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170327091750_add_created_at_index_to_deployments.rb b/db/migrate/20170327091750_add_created_at_index_to_deployments.rb
index fd6ed499b80a186db9f1f1de715020072aee5ad4..f29fff7d5b91c9e0a277e970c889c4b42b43d28f 100644
--- a/db/migrate/20170327091750_add_created_at_index_to_deployments.rb
+++ b/db/migrate/20170327091750_add_created_at_index_to_deployments.rb
@@ -1,4 +1,4 @@
-class AddCreatedAtIndexToDeployments < ActiveRecord::Migration
+class AddCreatedAtIndexToDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170328010804_add_uuid_to_application_settings.rb b/db/migrate/20170328010804_add_uuid_to_application_settings.rb
index 5dfcc751c7b5bf37c7d400b92f5d2cbc10e7925a..95a01c2dc8f5ea6cfb746286265165023c55a91c 100644
--- a/db/migrate/20170328010804_add_uuid_to_application_settings.rb
+++ b/db/migrate/20170328010804_add_uuid_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddUuidToApplicationSettings < ActiveRecord::Migration
+class AddUuidToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170329095325_add_ref_to_triggers.rb b/db/migrate/20170329095325_add_ref_to_triggers.rb
index 4aa52dd8f8f8f7d8263cf6bd64979238b47db458..db09b36db1713a135f1d27a2dd83facf3ce8955f 100644
--- a/db/migrate/20170329095325_add_ref_to_triggers.rb
+++ b/db/migrate/20170329095325_add_ref_to_triggers.rb
@@ -1,4 +1,4 @@
-class AddRefToTriggers < ActiveRecord::Migration
+class AddRefToTriggers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170329095907_create_ci_trigger_schedules.rb b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
index cfcfa27ebb53881861dfd4d1428e937a41082f3d..7f759f908cd079d6095c69714e337f16d47c4363 100644
--- a/db/migrate/20170329095907_create_ci_trigger_schedules.rb
+++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
@@ -1,4 +1,4 @@
-class CreateCiTriggerSchedules < ActiveRecord::Migration
+class CreateCiTriggerSchedules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170329124448_add_polling_interval_multiplier_to_application_settings.rb b/db/migrate/20170329124448_add_polling_interval_multiplier_to_application_settings.rb
index a8affd19a0b48c6c8d925de6149b7c51414f56db..17307879a2a6ed6629d3c3a4aaaddb6c470daae5 100644
--- a/db/migrate/20170329124448_add_polling_interval_multiplier_to_application_settings.rb
+++ b/db/migrate/20170329124448_add_polling_interval_multiplier_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPollingIntervalMultiplierToApplicationSettings < ActiveRecord::Migration
+class AddPollingIntervalMultiplierToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170330141723_disable_invalid_service_templates2.rb b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
index 8424e56d8a1802c36698bd484663cfafb39f7660..91ec19dfa8764e2241fd9e39c234d5ae970afacd 100644
--- a/db/migrate/20170330141723_disable_invalid_service_templates2.rb
+++ b/db/migrate/20170330141723_disable_invalid_service_templates2.rb
@@ -1,7 +1,7 @@
 # This is the same as DisableInvalidServiceTemplates. Later migrations may have
 # inadventently enabled some invalid templates again.
 #
-class DisableInvalidServiceTemplates2 < ActiveRecord::Migration
+class DisableInvalidServiceTemplates2 < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   unless defined?(Service)
diff --git a/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
index 42c90103262ee0d5998367b92eea380f3f6e02d4..4c417ce2f7124e06f937b9b046535e4e773f5e08 100644
--- a/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
+++ b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
@@ -1,6 +1,6 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
-class RemoveIndexForUsersCurrentSignInAt < ActiveRecord::Migration
+class RemoveIndexForUsersCurrentSignInAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170404163427_add_trigger_id_foreign_key.rb b/db/migrate/20170404163427_add_trigger_id_foreign_key.rb
index 6679a95ca116c735975c0e31e78a070d0d92dcd2..f35730c8e45078f7283eb717a3fb2defbeb38553 100644
--- a/db/migrate/20170404163427_add_trigger_id_foreign_key.rb
+++ b/db/migrate/20170404163427_add_trigger_id_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddTriggerIdForeignKey < ActiveRecord::Migration
+class AddTriggerIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170405080720_add_import_jid_to_projects.rb b/db/migrate/20170405080720_add_import_jid_to_projects.rb
index 55b87b9d56d0da8bdbc11b60f8cfcd1f1ccd0ac7..ddbea9d7ab6f1581041001071e59a5c4d27b79e0 100644
--- a/db/migrate/20170405080720_add_import_jid_to_projects.rb
+++ b/db/migrate/20170405080720_add_import_jid_to_projects.rb
@@ -1,4 +1,4 @@
-class AddImportJidToProjects < ActiveRecord::Migration
+class AddImportJidToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb b/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb
index c1d803b43084cef0289bfcc921bf08084045ff96..ba43a070587e2c1cebc006b7e3e1146e14fbf288 100644
--- a/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb
+++ b/db/migrate/20170406114958_add_auto_canceled_by_id_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddAutoCanceledByIdToCiBuilds < ActiveRecord::Migration
+class AddAutoCanceledByIdToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb b/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb
index 3004683933b151d35364d197252ba807aec1a465..2ec281e20c1b7dbe9c3e92a6d3d036281b87624c 100644
--- a/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb
+++ b/db/migrate/20170406115029_add_auto_canceled_by_id_foreign_key_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddAutoCanceledByIdForeignKeyToCiBuilds < ActiveRecord::Migration
+class AddAutoCanceledByIdForeignKeyToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170407114956_add_ref_to_ci_trigger_schedule.rb b/db/migrate/20170407114956_add_ref_to_ci_trigger_schedule.rb
index 523a306f12706c91ed13272d41aa97d7e742a048..5d156b7ef2eee4271db658afb00b569cb5ce5eab 100644
--- a/db/migrate/20170407114956_add_ref_to_ci_trigger_schedule.rb
+++ b/db/migrate/20170407114956_add_ref_to_ci_trigger_schedule.rb
@@ -1,4 +1,4 @@
-class AddRefToCiTriggerSchedule < ActiveRecord::Migration
+class AddRefToCiTriggerSchedule < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170407122426_add_active_to_ci_trigger_schedule.rb b/db/migrate/20170407122426_add_active_to_ci_trigger_schedule.rb
index 36892118ac071a3d9775750ac8f1412a606fa598..33295bd3f2ef133c010614c6ed9647e6b6b7b5f3 100644
--- a/db/migrate/20170407122426_add_active_to_ci_trigger_schedule.rb
+++ b/db/migrate/20170407122426_add_active_to_ci_trigger_schedule.rb
@@ -1,4 +1,4 @@
-class AddActiveToCiTriggerSchedule < ActiveRecord::Migration
+class AddActiveToCiTriggerSchedule < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170407135259_add_foreigh_key_trigger_requests_trigger.rb b/db/migrate/20170407135259_add_foreigh_key_trigger_requests_trigger.rb
index 81761c65a9fa00c464825197b8ece8263e75fd7e..9aaa4d0eddf3199235765f8f462b1a525ac8a50f 100644
--- a/db/migrate/20170407135259_add_foreigh_key_trigger_requests_trigger.rb
+++ b/db/migrate/20170407135259_add_foreigh_key_trigger_requests_trigger.rb
@@ -1,4 +1,4 @@
-class AddForeighKeyTriggerRequestsTrigger < ActiveRecord::Migration
+class AddForeighKeyTriggerRequestsTrigger < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170407140450_add_index_to_next_run_at_and_active.rb b/db/migrate/20170407140450_add_index_to_next_run_at_and_active.rb
index 626c2a67fdcc0b3bf57f4d6c524236e89c49347b..0bde4f69b3bd9dba4af27cb11ca930f0601f39ac 100644
--- a/db/migrate/20170407140450_add_index_to_next_run_at_and_active.rb
+++ b/db/migrate/20170407140450_add_index_to_next_run_at_and_active.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexToNextRunAtAndActive < ActiveRecord::Migration
+class AddIndexToNextRunAtAndActive < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170410133135_add_version_field_to_markdown_cache.rb b/db/migrate/20170410133135_add_version_field_to_markdown_cache.rb
index d9209fe57703352ae56f5eb99452c452ac63311e..c019e0627d3ac538fc4e87dd3e979a5490791505 100644
--- a/db/migrate/20170410133135_add_version_field_to_markdown_cache.rb
+++ b/db/migrate/20170410133135_add_version_field_to_markdown_cache.rb
@@ -1,4 +1,4 @@
-class AddVersionFieldToMarkdownCache < ActiveRecord::Migration
+class AddVersionFieldToMarkdownCache < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170413035209_add_preferred_language_to_users.rb b/db/migrate/20170413035209_add_preferred_language_to_users.rb
index 92f1d6f243633109d19ca76f3152230ed4bd4fd4..5b5f00ea60feedc4329bb39e0719314a7ea34b5d 100644
--- a/db/migrate/20170413035209_add_preferred_language_to_users.rb
+++ b/db/migrate/20170413035209_add_preferred_language_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPreferredLanguageToUsers < ActiveRecord::Migration
+class AddPreferredLanguageToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170418103908_delete_orphan_notification_settings.rb b/db/migrate/20170418103908_delete_orphan_notification_settings.rb
index e4b9cf659364699b35da5528c03e1f17c907f92f..c99729b9127504871fcecf97074471120ad8cc9e 100644
--- a/db/migrate/20170418103908_delete_orphan_notification_settings.rb
+++ b/db/migrate/20170418103908_delete_orphan_notification_settings.rb
@@ -1,4 +1,4 @@
-class DeleteOrphanNotificationSettings < ActiveRecord::Migration
+class DeleteOrphanNotificationSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170419001229_add_index_to_system_note_metadata.rb b/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
index c68fd920fff45c17b30546e517b0b19e51ad5b4a..59cd55395fc66a5adb3865135dfcd711317d281d 100644
--- a/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
+++ b/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
@@ -1,4 +1,4 @@
-class AddIndexToSystemNoteMetadata < ActiveRecord::Migration
+class AddIndexToSystemNoteMetadata < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170421102337_remove_nil_type_services.rb b/db/migrate/20170421102337_remove_nil_type_services.rb
index b835b9c6ed99242fbc15dcb01baf1c5ca1ee06df..561eddf69e0589cb4aeaa3f74382be903edb444b 100644
--- a/db/migrate/20170421102337_remove_nil_type_services.rb
+++ b/db/migrate/20170421102337_remove_nil_type_services.rb
@@ -1,4 +1,4 @@
-class RemoveNilTypeServices < ActiveRecord::Migration
+class RemoveNilTypeServices < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb b/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb
index 0bbb74ee05ef78037b5a2bdb10dd43abe641242d..76252378c2e70bec6f35fcd487604c9f1f1f1214 100644
--- a/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb
+++ b/db/migrate/20170423064036_add_index_on_ci_builds_updated_at.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexOnCiBuildsUpdatedAt < ActiveRecord::Migration
+class AddIndexOnCiBuildsUpdatedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb b/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
index 348d5dbc270520ee9652bb64aa68b6aae59ec66c..ab2501da9417299107a05ac3c94b83caf0e84c87 100644
--- a/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
+++ b/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexOnCiBuildsUserId < ActiveRecord::Migration
+class AddIndexOnCiBuildsUserId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170424142900_add_index_to_web_hooks_type.rb b/db/migrate/20170424142900_add_index_to_web_hooks_type.rb
index 9af158e3844da3a06b9978257bea3b56c3b35b86..1c56c1ed65a6398dc1862c79bdf73698a2667340 100644
--- a/db/migrate/20170424142900_add_index_to_web_hooks_type.rb
+++ b/db/migrate/20170424142900_add_index_to_web_hooks_type.rb
@@ -1,4 +1,4 @@
-class AddIndexToWebHooksType < ActiveRecord::Migration
+class AddIndexToWebHooksType < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170425112128_create_pipeline_schedules_table.rb b/db/migrate/20170425112128_create_pipeline_schedules_table.rb
index bd15b9eef19d5e1f9ce7bb85590e320caade95bf..e66e81b34bec34963b611906d6763204b254c113 100644
--- a/db/migrate/20170425112128_create_pipeline_schedules_table.rb
+++ b/db/migrate/20170425112128_create_pipeline_schedules_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreatePipelineSchedulesTable < ActiveRecord::Migration
+class CreatePipelineSchedulesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb b/db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
index 1587eee06ae2f8f38bc7c89dc0bdcb02cb8fa068..d89c4c61cbe5ba0219419861910df0328de2d16c 100644
--- a/db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
+++ b/db/migrate/20170425112628_remove_foreigh_key_ci_trigger_schedules.rb
@@ -1,4 +1,4 @@
-class RemoveForeighKeyCiTriggerSchedules < ActiveRecord::Migration
+class RemoveForeighKeyCiTriggerSchedules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170425114731_add_pipeline_schedule_id_to_pipelines.rb b/db/migrate/20170425114731_add_pipeline_schedule_id_to_pipelines.rb
index ddb27d4dc816367dbfc90c60cdfb102c907d971b..da16d89febc54e20071dc9e20cf729ae8bb57b4e 100644
--- a/db/migrate/20170425114731_add_pipeline_schedule_id_to_pipelines.rb
+++ b/db/migrate/20170425114731_add_pipeline_schedule_id_to_pipelines.rb
@@ -1,4 +1,4 @@
-class AddPipelineScheduleIdToPipelines < ActiveRecord::Migration
+class AddPipelineScheduleIdToPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170426175636_fill_missing_uuid_on_application_settings.rb b/db/migrate/20170426175636_fill_missing_uuid_on_application_settings.rb
index 58ad2c64075e2cbeec757f064756dd970e5981e4..eeeb216f32cd13bc7dc8f3d862f36c4178eb8a4f 100644
--- a/db/migrate/20170426175636_fill_missing_uuid_on_application_settings.rb
+++ b/db/migrate/20170426175636_fill_missing_uuid_on_application_settings.rb
@@ -1,4 +1,4 @@
-class FillMissingUuidOnApplicationSettings < ActiveRecord::Migration
+class FillMissingUuidOnApplicationSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb b/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb
index 879825a1934a227eaf2af36350407396aeefbbec..e14b2eb4c8a5fe6f5578b5b38fe30a60538136ea 100644
--- a/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb
+++ b/db/migrate/20170426181740_add_index_on_ci_runners_contacted_at.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexOnCiRunnersContactedAt < ActiveRecord::Migration
+class AddIndexOnCiRunnersContactedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170427103502_create_web_hook_logs.rb b/db/migrate/20170427103502_create_web_hook_logs.rb
index 3643c52180c90c766dae4166d4b925ba80ea72db..a7a061e7bae978d002589f15e024a7558ef5ee34 100644
--- a/db/migrate/20170427103502_create_web_hook_logs.rb
+++ b/db/migrate/20170427103502_create_web_hook_logs.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class CreateWebHookLogs < ActiveRecord::Migration
+class CreateWebHookLogs < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170427215854_create_redirect_routes.rb b/db/migrate/20170427215854_create_redirect_routes.rb
index 6db508e5db452b3ecdc8fbee7b0a54c491dd3ef3..069c9b39d37050f342d56a5223b86e663ff6577e 100644
--- a/db/migrate/20170427215854_create_redirect_routes.rb
+++ b/db/migrate/20170427215854_create_redirect_routes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateRedirectRoutes < ActiveRecord::Migration
+class CreateRedirectRoutes < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = false
 
diff --git a/db/migrate/20170428064307_add_column_delete_error_to_projects.rb b/db/migrate/20170428064307_add_column_delete_error_to_projects.rb
index 09f9d9b5b7a9e6ba8f6c552f03e4cc397646645d..bef0373309cfc58e1ef7edbc4c62f78543f26668 100644
--- a/db/migrate/20170428064307_add_column_delete_error_to_projects.rb
+++ b/db/migrate/20170428064307_add_column_delete_error_to_projects.rb
@@ -1,4 +1,4 @@
-class AddColumnDeleteErrorToProjects < ActiveRecord::Migration
+class AddColumnDeleteErrorToProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170502065653_make_auto_cancel_pending_pipelines_on_by_default.rb b/db/migrate/20170502065653_make_auto_cancel_pending_pipelines_on_by_default.rb
index 03bf626a08a4b3c07e22470e9fcec76b4ceb33d5..e51a790de4dfcca50242c223fc7a6e11325ede00 100644
--- a/db/migrate/20170502065653_make_auto_cancel_pending_pipelines_on_by_default.rb
+++ b/db/migrate/20170502065653_make_auto_cancel_pending_pipelines_on_by_default.rb
@@ -1,4 +1,4 @@
-class MakeAutoCancelPendingPipelinesOnByDefault < ActiveRecord::Migration
+class MakeAutoCancelPendingPipelinesOnByDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb b/db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb
index b64d7e0e3f6effe73578d0cd124ff77c202501d0..7acae645c7b541ff5dd37accb0ffca516dcf8fcd 100644
--- a/db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb
+++ b/db/migrate/20170502135553_create_index_ci_pipelines_auto_canceled_by_id.rb
@@ -1,4 +1,4 @@
-class CreateIndexCiPipelinesAutoCanceledById < ActiveRecord::Migration
+class CreateIndexCiPipelinesAutoCanceledById < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb b/db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb
index 0a8d2c8ff61ea4f564df06f334c923febc4d1aa9..f5148f6fdb802f6247433b37c75a6edecb45e2af 100644
--- a/db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb
+++ b/db/migrate/20170502140503_create_index_ci_builds_auto_canceled_by_id.rb
@@ -1,4 +1,4 @@
-class CreateIndexCiBuildsAutoCanceledById < ActiveRecord::Migration
+class CreateIndexCiBuildsAutoCanceledById < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503004125_add_last_repository_updated_at_to_projects.rb b/db/migrate/20170503004125_add_last_repository_updated_at_to_projects.rb
index 2ea49f627428f111c8bdbe06824e5a6d3bd6fe87..303250ff3b02d2fbf17d4a4c8eba8824f0292bb3 100644
--- a/db/migrate/20170503004125_add_last_repository_updated_at_to_projects.rb
+++ b/db/migrate/20170503004125_add_last_repository_updated_at_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddLastRepositoryUpdatedAtToProjects < ActiveRecord::Migration
+class AddLastRepositoryUpdatedAtToProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170503004425_add_index_to_last_repository_updated_at_on_projects.rb b/db/migrate/20170503004425_add_index_to_last_repository_updated_at_on_projects.rb
index 6144d74745c8bfed7a4086759bb9dc2200040fc2..ae54cfb39f5bf1d05471eeaac51f5e1c9af20b88 100644
--- a/db/migrate/20170503004425_add_index_to_last_repository_updated_at_on_projects.rb
+++ b/db/migrate/20170503004425_add_index_to_last_repository_updated_at_on_projects.rb
@@ -1,4 +1,4 @@
-class AddIndexToLastRepositoryUpdatedAtOnProjects < ActiveRecord::Migration
+class AddIndexToLastRepositoryUpdatedAtOnProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503004426_add_retried_to_ci_build.rb b/db/migrate/20170503004426_add_retried_to_ci_build.rb
index 2851e3de47303e9d9ba7d4da09765408278a3482..ff2e0ba64c50e7399354405b354492a7fc35bce4 100644
--- a/db/migrate/20170503004426_add_retried_to_ci_build.rb
+++ b/db/migrate/20170503004426_add_retried_to_ci_build.rb
@@ -1,4 +1,4 @@
-class AddRetriedToCiBuild < ActiveRecord::Migration
+class AddRetriedToCiBuild < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503021915_add_last_edited_at_and_last_edited_by_id_to_issues.rb b/db/migrate/20170503021915_add_last_edited_at_and_last_edited_by_id_to_issues.rb
index a5d1eca82bbd8375b03bb853cdcd8f0963efc37c..ef527bb8007b664cb4decb3761c80642c963a8ab 100644
--- a/db/migrate/20170503021915_add_last_edited_at_and_last_edited_by_id_to_issues.rb
+++ b/db/migrate/20170503021915_add_last_edited_at_and_last_edited_by_id_to_issues.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLastEditedAtAndLastEditedByIdToIssues < ActiveRecord::Migration
+class AddLastEditedAtAndLastEditedByIdToIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170503022548_add_last_edited_at_and_last_edited_by_id_to_merge_requests.rb b/db/migrate/20170503022548_add_last_edited_at_and_last_edited_by_id_to_merge_requests.rb
index 47ba6bde8561364ad061273ba3dadf48504c9dee..19b8a9d66e70a6e33dcc515ae78628edd894e0fc 100644
--- a/db/migrate/20170503022548_add_last_edited_at_and_last_edited_by_id_to_merge_requests.rb
+++ b/db/migrate/20170503022548_add_last_edited_at_and_last_edited_by_id_to_merge_requests.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLastEditedAtAndLastEditedByIdToMergeRequests < ActiveRecord::Migration
+class AddLastEditedAtAndLastEditedByIdToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170503023315_add_repository_update_events_to_web_hooks.rb b/db/migrate/20170503023315_add_repository_update_events_to_web_hooks.rb
index 0faea87a962e3483a8a2a3fdfabd54b056774996..4824c404ec78160018c8b18a20ee82893f9d2f4a 100644
--- a/db/migrate/20170503023315_add_repository_update_events_to_web_hooks.rb
+++ b/db/migrate/20170503023315_add_repository_update_events_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddRepositoryUpdateEventsToWebHooks < ActiveRecord::Migration
+class AddRepositoryUpdateEventsToWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503114228_add_description_to_snippets.rb b/db/migrate/20170503114228_add_description_to_snippets.rb
index 3fc960b2da5b8e324e905ee2253f66b35ebb05b8..78151ed9ff6454f4e1287c25d8db923a69ece49a 100644
--- a/db/migrate/20170503114228_add_description_to_snippets.rb
+++ b/db/migrate/20170503114228_add_description_to_snippets.rb
@@ -1,4 +1,4 @@
-class AddDescriptionToSnippets < ActiveRecord::Migration
+class AddDescriptionToSnippets < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503140201_reschedule_project_authorizations.rb b/db/migrate/20170503140201_reschedule_project_authorizations.rb
index fa45adadbae80f3f21760e75e123b39952833448..aa940bed2d32aa10edb5ecb992cc4bbb2c293239 100644
--- a/db/migrate/20170503140201_reschedule_project_authorizations.rb
+++ b/db/migrate/20170503140201_reschedule_project_authorizations.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RescheduleProjectAuthorizations < ActiveRecord::Migration
+class RescheduleProjectAuthorizations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb b/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb
index 33908ae115630efbeec47461c00969898edced29..cfa63b65df457ba0795b22e7f796da976461f1da 100644
--- a/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb
+++ b/db/migrate/20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb
@@ -5,7 +5,7 @@
 # updating a namespace to also rename directories (uploads, GitLab pages, etc).
 # The alternative is to copy hundreds of lines of code into this migration,
 # adjust them where needed, etc; something which doesn't work well at all.
-class TurnNestedGroupsIntoRegularGroupsForMysql < ActiveRecord::Migration
+class TurnNestedGroupsIntoRegularGroupsForMysql < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170503184421_add_index_to_redirect_routes.rb b/db/migrate/20170503184421_add_index_to_redirect_routes.rb
index 9062cf19a73989313e9a6f19464f65fe52d79abf..6320d4bbc99a84f82ee34d8d0f9bb5f44fdb0590 100644
--- a/db/migrate/20170503184421_add_index_to_redirect_routes.rb
+++ b/db/migrate/20170503184421_add_index_to_redirect_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexToRedirectRoutes < ActiveRecord::Migration
+class AddIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170503185032_index_redirect_routes_path_for_like.rb b/db/migrate/20170503185032_index_redirect_routes_path_for_like.rb
index 8eb20faa03af5c6017ca4d3a06c77353f47036ce..5d06fd0511cea291fadf6f8b3646f1eb7bd3c75c 100644
--- a/db/migrate/20170503185032_index_redirect_routes_path_for_like.rb
+++ b/db/migrate/20170503185032_index_redirect_routes_path_for_like.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IndexRedirectRoutesPathForLike < ActiveRecord::Migration
+class IndexRedirectRoutesPathForLike < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170504102911_add_clientside_sentry_to_application_settings.rb b/db/migrate/20170504102911_add_clientside_sentry_to_application_settings.rb
index 141112f8b5084e0b0056861d9d3ac14af85d7c37..4659f6940209c38354e04e699ea77caa6684533b 100644
--- a/db/migrate/20170504102911_add_clientside_sentry_to_application_settings.rb
+++ b/db/migrate/20170504102911_add_clientside_sentry_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddClientsideSentryToApplicationSettings < ActiveRecord::Migration
+class AddClientsideSentryToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170504182103_add_index_project_group_links_group_id.rb b/db/migrate/20170504182103_add_index_project_group_links_group_id.rb
index 62bf641daa6ab4719fe7ea08850f7e03076c0527..5b1c14e66ddd2908ac654c7d1f8bbc8c0af524cd 100644
--- a/db/migrate/20170504182103_add_index_project_group_links_group_id.rb
+++ b/db/migrate/20170504182103_add_index_project_group_links_group_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexProjectGroupLinksGroupId < ActiveRecord::Migration
+class AddIndexProjectGroupLinksGroupId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170506085040_add_index_to_pipeline_pipeline_schedule_id.rb b/db/migrate/20170506085040_add_index_to_pipeline_pipeline_schedule_id.rb
index 08a7f3fc9abb7c3aa34bad17bd1cd85536899de3..9d8cc8a83a29f11142b06beb81d7dc9d7c3fc202 100644
--- a/db/migrate/20170506085040_add_index_to_pipeline_pipeline_schedule_id.rb
+++ b/db/migrate/20170506085040_add_index_to_pipeline_pipeline_schedule_id.rb
@@ -1,4 +1,4 @@
-class AddIndexToPipelinePipelineScheduleId < ActiveRecord::Migration
+class AddIndexToPipelinePipelineScheduleId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170506091344_add_foreign_key_to_pipeline_schedules.rb b/db/migrate/20170506091344_add_foreign_key_to_pipeline_schedules.rb
index 7f2dba702af58ed03d38393037ff370f29dfb31d..244e41e2f0766c03594f80acb872ba98bb4e157d 100644
--- a/db/migrate/20170506091344_add_foreign_key_to_pipeline_schedules.rb
+++ b/db/migrate/20170506091344_add_foreign_key_to_pipeline_schedules.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToPipelineSchedules < ActiveRecord::Migration
+class AddForeignKeyToPipelineSchedules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170506185517_add_foreign_key_pipeline_schedules_and_pipelines.rb b/db/migrate/20170506185517_add_foreign_key_pipeline_schedules_and_pipelines.rb
index cc5cb355579a190d973240e089c44d854690c58e..50364cac2590e24788e6b15ee55a4d5a1965f254 100644
--- a/db/migrate/20170506185517_add_foreign_key_pipeline_schedules_and_pipelines.rb
+++ b/db/migrate/20170506185517_add_foreign_key_pipeline_schedules_and_pipelines.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyPipelineSchedulesAndPipelines < ActiveRecord::Migration
+class AddForeignKeyPipelineSchedulesAndPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170507205316_add_head_pipeline_id_to_merge_requests.rb b/db/migrate/20170507205316_add_head_pipeline_id_to_merge_requests.rb
index 8fc6e380a77b45e8aedab34325e6febba0f93db9..adfe6559084d8c7bc4147c4c308f59c376cd0602 100644
--- a/db/migrate/20170507205316_add_head_pipeline_id_to_merge_requests.rb
+++ b/db/migrate/20170507205316_add_head_pipeline_id_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddHeadPipelineIdToMergeRequests < ActiveRecord::Migration
+class AddHeadPipelineIdToMergeRequests < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb b/db/migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb
index 41c687a4f6e74670a67ff3c35a2f806802d549b1..2a0c7132bfd6a223e81b0c9c18f12927a29486a8 100644
--- a/db/migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb
+++ b/db/migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb
@@ -1,4 +1,4 @@
-class AddNotNullContraintsToCiVariables < ActiveRecord::Migration
+class AddNotNullContraintsToCiVariables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170508190732_add_foreign_key_to_ci_variables.rb b/db/migrate/20170508190732_add_foreign_key_to_ci_variables.rb
index 20ecaa2c36c2a02ef4241314574e7c987d1e8f5a..305366b2171f6513ba7eab91cc727498c67c2b33 100644
--- a/db/migrate/20170508190732_add_foreign_key_to_ci_variables.rb
+++ b/db/migrate/20170508190732_add_foreign_key_to_ci_variables.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToCiVariables < ActiveRecord::Migration
+class AddForeignKeyToCiVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb b/db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb
index a2320a911b74c3851464580650aec07c646dbf8a..3a44057d9488869237d4fff1762e395c38b18870 100644
--- a/db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb
+++ b/db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameWebHooksBuildEventsToJobEvents < ActiveRecord::Migration
+class RenameWebHooksBuildEventsToJobEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170511083824_rename_services_build_events_to_job_events.rb b/db/migrate/20170511083824_rename_services_build_events_to_job_events.rb
index 303d47078e7145312da14cf3d710b6fe2fcdf862..713adde76ef7d6fabe2dc00469cfc2bdff3a126c 100644
--- a/db/migrate/20170511083824_rename_services_build_events_to_job_events.rb
+++ b/db/migrate/20170511083824_rename_services_build_events_to_job_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameServicesBuildEventsToJobEvents < ActiveRecord::Migration
+class RenameServicesBuildEventsToJobEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
index eed9f00d8b283933bc072b0b5500eefdeb33f0aa..0ed4577542143d6b78eb17a2ca0c84bc5ff061a1 100644
--- a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
+++ b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateAssigneeToSeparateTable < ActiveRecord::Migration
+class MigrateAssigneeToSeparateTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170516183131_add_indices_to_issue_assignees.rb b/db/migrate/20170516183131_add_indices_to_issue_assignees.rb
index a1f064c68483612258388379d4dcfbcabae6aec3..6877fe9ff98b026242895a6876fcbbff761acc33 100644
--- a/db/migrate/20170516183131_add_indices_to_issue_assignees.rb
+++ b/db/migrate/20170516183131_add_indices_to_issue_assignees.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndicesToIssueAssignees < ActiveRecord::Migration
+class AddIndicesToIssueAssignees < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
index 6ec2ed712b969f7dbe6819ab76e57efa78c77a36..9c8f58104bdcaff522253e2856bfce2d28bd442c 100644
--- a/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
+++ b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb
@@ -1,4 +1,4 @@
-class AddPrometheusSettingsToMetricsSettings < ActiveRecord::Migration
+class AddPrometheusSettingsToMetricsSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20170521184006_add_change_position_to_notes.rb b/db/migrate/20170521184006_add_change_position_to_notes.rb
index 219ed1ade4c1bc182e24dfdcf9392675917b4f15..f0ca3a2a9eac8ce7bfdf447efe2a9fb580c1fc36 100644
--- a/db/migrate/20170521184006_add_change_position_to_notes.rb
+++ b/db/migrate/20170521184006_add_change_position_to_notes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddChangePositionToNotes < ActiveRecord::Migration
+class AddChangePositionToNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170523091700_add_rss_token_to_users.rb b/db/migrate/20170523091700_add_rss_token_to_users.rb
index 06a85f6ac3d4f5ece5bc23082c30825f82ee3e8c..e1bcd9b3fee3ba1197cfc01a9c6e39a75b473c00 100644
--- a/db/migrate/20170523091700_add_rss_token_to_users.rb
+++ b/db/migrate/20170523091700_add_rss_token_to_users.rb
@@ -1,4 +1,4 @@
-class AddRssTokenToUsers < ActiveRecord::Migration
+class AddRssTokenToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170523121229_create_conversational_development_index_metrics.rb b/db/migrate/20170523121229_create_conversational_development_index_metrics.rb
index 7026a867ae16493d3c96d55f7f6ef1c7142d88f1..5f8c0d07e3c33ad1bf05e16ffa1d2cf3c5e8b840 100644
--- a/db/migrate/20170523121229_create_conversational_development_index_metrics.rb
+++ b/db/migrate/20170523121229_create_conversational_development_index_metrics.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateConversationalDevelopmentIndexMetrics < ActiveRecord::Migration
+class CreateConversationalDevelopmentIndexMetrics < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170524125940_add_source_to_ci_pipeline.rb b/db/migrate/20170524125940_add_source_to_ci_pipeline.rb
index 1fa3d48037be879b2aa8c0dd0614d372e3d235f1..81358e7ce3d96445c4f8176e8c4e3749bc8928f7 100644
--- a/db/migrate/20170524125940_add_source_to_ci_pipeline.rb
+++ b/db/migrate/20170524125940_add_source_to_ci_pipeline.rb
@@ -1,4 +1,4 @@
-class AddSourceToCiPipeline < ActiveRecord::Migration
+class AddSourceToCiPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170524161101_add_protected_to_ci_variables.rb b/db/migrate/20170524161101_add_protected_to_ci_variables.rb
index 99d4861e8899256adc8a756decee1b7545f7ce64..6125ea5d5a82c48788c22b99bf257fac294d8c12 100644
--- a/db/migrate/20170524161101_add_protected_to_ci_variables.rb
+++ b/db/migrate/20170524161101_add_protected_to_ci_variables.rb
@@ -1,4 +1,4 @@
-class AddProtectedToCiVariables < ActiveRecord::Migration
+class AddProtectedToCiVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170525130346_create_group_variables_table.rb b/db/migrate/20170525130346_create_group_variables_table.rb
index eaa38dbc40d466a3a136e9cd8f116d9238bb54b5..6eae7eff7bde0f4e1affd305ce06cbd34df50a82 100644
--- a/db/migrate/20170525130346_create_group_variables_table.rb
+++ b/db/migrate/20170525130346_create_group_variables_table.rb
@@ -1,4 +1,4 @@
-class CreateGroupVariablesTable < ActiveRecord::Migration
+class CreateGroupVariablesTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170525130758_add_foreign_key_to_group_variables.rb b/db/migrate/20170525130758_add_foreign_key_to_group_variables.rb
index 0146235c5baa920bac304b2163f89e4b587042a3..f1f51a1dda3e5d7563b92043e77ebba8a99b667b 100644
--- a/db/migrate/20170525130758_add_foreign_key_to_group_variables.rb
+++ b/db/migrate/20170525130758_add_foreign_key_to_group_variables.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToGroupVariables < ActiveRecord::Migration
+class AddForeignKeyToGroupVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170525132202_create_pipeline_stages.rb b/db/migrate/20170525132202_create_pipeline_stages.rb
index 825993aa41e435d365204bca90ba5393fbb4ccd1..0a6400fde903be019cda73d315530055dd85fc7b 100644
--- a/db/migrate/20170525132202_create_pipeline_stages.rb
+++ b/db/migrate/20170525132202_create_pipeline_stages.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreatePipelineStages < ActiveRecord::Migration
+class CreatePipelineStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170525174156_create_feature_tables.rb b/db/migrate/20170525174156_create_feature_tables.rb
index a083c89c85f76d1477a39b3fa90e9691f27be1c1..e1eaaff8d3539dae83d181c6f993883bb3b070bc 100644
--- a/db/migrate/20170525174156_create_feature_tables.rb
+++ b/db/migrate/20170525174156_create_feature_tables.rb
@@ -1,4 +1,4 @@
-class CreateFeatureTables < ActiveRecord::Migration
+class CreateFeatureTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb b/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb
index d27cba76d8199e81ed03e52668dceb91912816b5..6958557d11844fa6c57eec27b6d3d01589971871 100644
--- a/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb
+++ b/db/migrate/20170526185602_add_stage_id_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddStageIdToCiBuilds < ActiveRecord::Migration
+class AddStageIdToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170530130129_project_foreign_keys_with_cascading_deletes.rb b/db/migrate/20170530130129_project_foreign_keys_with_cascading_deletes.rb
index 12352d98a6278dd74971af4bbeb5bf27157a9463..d40c61f24b114ce012155262c0596ad0d203bcd4 100644
--- a/db/migrate/20170530130129_project_foreign_keys_with_cascading_deletes.rb
+++ b/db/migrate/20170530130129_project_foreign_keys_with_cascading_deletes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ProjectForeignKeysWithCascadingDeletes < ActiveRecord::Migration
+class ProjectForeignKeysWithCascadingDeletes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170531180233_add_authorized_keys_enabled_to_application_settings.rb b/db/migrate/20170531180233_add_authorized_keys_enabled_to_application_settings.rb
index 1d86a531eb3dca43b52b905ea965e54aacec5e23..f440609ff8a3f625717fd89ef56566fccc6619ea 100644
--- a/db/migrate/20170531180233_add_authorized_keys_enabled_to_application_settings.rb
+++ b/db/migrate/20170531180233_add_authorized_keys_enabled_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddAuthorizedKeysEnabledToApplicationSettings < ActiveRecord::Migration
+class AddAuthorizedKeysEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170531202042_rename_users_ldap_email_to_external_email.rb b/db/migrate/20170531202042_rename_users_ldap_email_to_external_email.rb
index f858611d24b6673763c2d33f12f4fc26dffd60e8..7b1a76445553515f289be98bec5912cfe54beeeb 100644
--- a/db/migrate/20170531202042_rename_users_ldap_email_to_external_email.rb
+++ b/db/migrate/20170531202042_rename_users_ldap_email_to_external_email.rb
@@ -1,4 +1,4 @@
-class RenameUsersLdapEmailToExternalEmail < ActiveRecord::Migration
+class RenameUsersLdapEmailToExternalEmail < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb
index e82109190a72be58775aa15075635ff107679841..4c9ac821b20957ae5be8886d4bb0954d019bee89 100644
--- a/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb
+++ b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb
@@ -1,4 +1,4 @@
-class AddArtifactsStoreToCiBuild < ActiveRecord::Migration
+class AddArtifactsStoreToCiBuild < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb b/db/migrate/20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb
index d358020d182f4069e73b973e01738feee3da4b60..ff9e188d7a8498a3b900a63b6afaad02ba4865a4 100644
--- a/db/migrate/20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb
+++ b/db/migrate/20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/SaferBooleanColumn
-class AddHelpPageHideCommercialContentToApplicationSettings < ActiveRecord::Migration
+class AddHelpPageHideCommercialContentToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170602154813_add_help_page_support_url_to_application_settings.rb b/db/migrate/20170602154813_add_help_page_support_url_to_application_settings.rb
index 138fe9b2a37b4db374b8dd06491d394fa3b6ed3e..388e130ab88d82404a6535c567b18609fcfd9f41 100644
--- a/db/migrate/20170602154813_add_help_page_support_url_to_application_settings.rb
+++ b/db/migrate/20170602154813_add_help_page_support_url_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddHelpPageSupportUrlToApplicationSettings < ActiveRecord::Migration
+class AddHelpPageSupportUrlToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170603200744_add_email_provider_to_users.rb b/db/migrate/20170603200744_add_email_provider_to_users.rb
index ed90af9aadc63bf322a8b08cc8443f76f40423a8..ad6e813d31b6adaf8a872035f0b4f12e5d94001b 100644
--- a/db/migrate/20170603200744_add_email_provider_to_users.rb
+++ b/db/migrate/20170603200744_add_email_provider_to_users.rb
@@ -1,4 +1,4 @@
-class AddEmailProviderToUsers < ActiveRecord::Migration
+class AddEmailProviderToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170606154216_add_notification_setting_columns.rb b/db/migrate/20170606154216_add_notification_setting_columns.rb
index 0a9b5da6583834f72ed70db5717da484f5002bf9..3b9493e6b497de82cfe629863041264afc6874df 100644
--- a/db/migrate/20170606154216_add_notification_setting_columns.rb
+++ b/db/migrate/20170606154216_add_notification_setting_columns.rb
@@ -1,4 +1,4 @@
-class AddNotificationSettingColumns < ActiveRecord::Migration
+class AddNotificationSettingColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170608152747_prepare_events_table_for_push_events_migration.rb b/db/migrate/20170608152747_prepare_events_table_for_push_events_migration.rb
index f4f03bbabaf79a025764996f6047653246521235..851af7f7bf6aafd04fe2fadf36f4abc99ae4490f 100644
--- a/db/migrate/20170608152747_prepare_events_table_for_push_events_migration.rb
+++ b/db/migrate/20170608152747_prepare_events_table_for_push_events_migration.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PrepareEventsTableForPushEventsMigration < ActiveRecord::Migration
+class PrepareEventsTableForPushEventsMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170608152748_create_push_event_payloads_tables.rb b/db/migrate/20170608152748_create_push_event_payloads_tables.rb
index 6c55ad1f2f7a9f1ad1b38cf5a1d6fec9ba6fa20a..292d9e3ca06e208f7d62c8d78721d28a2a36c33d 100644
--- a/db/migrate/20170608152748_create_push_event_payloads_tables.rb
+++ b/db/migrate/20170608152748_create_push_event_payloads_tables.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreatePushEventPayloadsTables < ActiveRecord::Migration
+class CreatePushEventPayloadsTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170608171156_create_merge_request_diff_files.rb b/db/migrate/20170608171156_create_merge_request_diff_files.rb
index bf0c0d29adcb4add28b4201b71a322aac281d478..94b518455ee33d8e1ea7b534c203b796989b7164 100644
--- a/db/migrate/20170608171156_create_merge_request_diff_files.rb
+++ b/db/migrate/20170608171156_create_merge_request_diff_files.rb
@@ -1,4 +1,4 @@
-class CreateMergeRequestDiffFiles < ActiveRecord::Migration
+class CreateMergeRequestDiffFiles < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/db/migrate/20170613154149_create_gpg_signatures.rb b/db/migrate/20170613154149_create_gpg_signatures.rb
index abef13a7a0b646d10728c2ee3dda57e3c6f96961..181d35fe7af3eeba7b613ff10d9f5201e943ed59 100644
--- a/db/migrate/20170613154149_create_gpg_signatures.rb
+++ b/db/migrate/20170613154149_create_gpg_signatures.rb
@@ -1,4 +1,4 @@
-class CreateGpgSignatures < ActiveRecord::Migration
+class CreateGpgSignatures < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170616133147_create_merge_request_diff_commits.rb b/db/migrate/20170616133147_create_merge_request_diff_commits.rb
index 616464cb470e871bac71e9527752197eb2c2fab8..5e148affba2ae7a5058e2f941c2aa21846f30f3a 100644
--- a/db/migrate/20170616133147_create_merge_request_diff_commits.rb
+++ b/db/migrate/20170616133147_create_merge_request_diff_commits.rb
@@ -1,4 +1,4 @@
-class CreateMergeRequestDiffCommits < ActiveRecord::Migration
+class CreateMergeRequestDiffCommits < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb b/db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb
index 02863bee0825533cda5d68e654d29dae5a7978b7..f97c8a14b8d3ab0418b86b2f4eb0c74b4e3df930 100644
--- a/db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb
+++ b/db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb
@@ -1,4 +1,4 @@
-class AddIndexForHeadPipelineMergeRequest < ActiveRecord::Migration
+class AddIndexForHeadPipelineMergeRequest < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb b/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb
index 92833765a827457bf36f9648f5a385bc96e6f243..74f3603505b17ec5b22bc6abe5bf39ae6aa2bbd6 100644
--- a/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb
+++ b/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb
@@ -1,4 +1,4 @@
-class CreateCiPipelineScheduleVariables < ActiveRecord::Migration
+class CreateCiPipelineScheduleVariables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb b/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb
index 7bbf66e0ac392a4708ec0c29af89923d89491690..f6de19aeaf29b6c452b79792ba7dc33f872a7163 100644
--- a/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb
+++ b/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToCiPipelineScheduleVariables < ActiveRecord::Migration
+class AddForeignKeyToCiPipelineScheduleVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170622130029_correct_protected_branches_foreign_keys.rb b/db/migrate/20170622130029_correct_protected_branches_foreign_keys.rb
index 46497775527279169a99037cf53b2e281c44721b..c4ba3ec2cc06841314bfca89815297216582d4d3 100644
--- a/db/migrate/20170622130029_correct_protected_branches_foreign_keys.rb
+++ b/db/migrate/20170622130029_correct_protected_branches_foreign_keys.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CorrectProtectedBranchesForeignKeys < ActiveRecord::Migration
+class CorrectProtectedBranchesForeignKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170622132212_add_foreign_key_for_merge_request_diffs.rb b/db/migrate/20170622132212_add_foreign_key_for_merge_request_diffs.rb
index 9f524fac8a7b0c424141471afcf9ae2aa63e3007..b826f67ff39e83c224076e1f3d132465b62aa79e 100644
--- a/db/migrate/20170622132212_add_foreign_key_for_merge_request_diffs.rb
+++ b/db/migrate/20170622132212_add_foreign_key_for_merge_request_diffs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddForeignKeyForMergeRequestDiffs < ActiveRecord::Migration
+class AddForeignKeyForMergeRequestDiffs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170622135451_rename_duplicated_variable_key.rb b/db/migrate/20170622135451_rename_duplicated_variable_key.rb
index 368718ab0ce787d95f66894ea053e04006745156..06a9529ae7973986f46328f14ef9ef9b572b03e2 100644
--- a/db/migrate/20170622135451_rename_duplicated_variable_key.rb
+++ b/db/migrate/20170622135451_rename_duplicated_variable_key.rb
@@ -1,4 +1,4 @@
-class RenameDuplicatedVariableKey < ActiveRecord::Migration
+class RenameDuplicatedVariableKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170622135628_add_environment_scope_to_ci_variables.rb b/db/migrate/20170622135628_add_environment_scope_to_ci_variables.rb
index 17fe062d8d59272a3ebeb6857541183d65bb1029..8fbb2ab57d5c09704f26f10072be4841d7f3c84b 100644
--- a/db/migrate/20170622135628_add_environment_scope_to_ci_variables.rb
+++ b/db/migrate/20170622135628_add_environment_scope_to_ci_variables.rb
@@ -1,4 +1,4 @@
-class AddEnvironmentScopeToCiVariables < ActiveRecord::Migration
+class AddEnvironmentScopeToCiVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170622135728_add_unique_constraint_to_ci_variables.rb b/db/migrate/20170622135728_add_unique_constraint_to_ci_variables.rb
index 787022b7bfe363d56427b19e2590a3fd86ecc975..240f55766d367553907e90139325facba7ad7d1f 100644
--- a/db/migrate/20170622135728_add_unique_constraint_to_ci_variables.rb
+++ b/db/migrate/20170622135728_add_unique_constraint_to_ci_variables.rb
@@ -1,4 +1,4 @@
-class AddUniqueConstraintToCiVariables < ActiveRecord::Migration
+class AddUniqueConstraintToCiVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170622162730_add_ref_fetched_to_merge_request.rb b/db/migrate/20170622162730_add_ref_fetched_to_merge_request.rb
index 62aa1a4b4f05fb16698fc8081fa7bb9ec6145d58..4715ff7a7156b3bf33403796835c223dd25abe6a 100644
--- a/db/migrate/20170622162730_add_ref_fetched_to_merge_request.rb
+++ b/db/migrate/20170622162730_add_ref_fetched_to_merge_request.rb
@@ -1,4 +1,4 @@
-class AddRefFetchedToMergeRequest < ActiveRecord::Migration
+class AddRefFetchedToMergeRequest < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170623080805_remove_ci_variables_project_id_index.rb b/db/migrate/20170623080805_remove_ci_variables_project_id_index.rb
index ddcc0292b9d66dad359a5ef1efe53d7e2fc7cf46..861dbd2ee142a8619560b041d0482d2312a33f68 100644
--- a/db/migrate/20170623080805_remove_ci_variables_project_id_index.rb
+++ b/db/migrate/20170623080805_remove_ci_variables_project_id_index.rb
@@ -1,4 +1,4 @@
-class RemoveCiVariablesProjectIdIndex < ActiveRecord::Migration
+class RemoveCiVariablesProjectIdIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170629171610_rename_application_settings_signin_enabled_to_password_authentication_enabled.rb b/db/migrate/20170629171610_rename_application_settings_signin_enabled_to_password_authentication_enabled.rb
index 858b3bebace585af867067b78db083868594e946..1651a47ebec4a941c9f5713a655bfb706585e76a 100644
--- a/db/migrate/20170629171610_rename_application_settings_signin_enabled_to_password_authentication_enabled.rb
+++ b/db/migrate/20170629171610_rename_application_settings_signin_enabled_to_password_authentication_enabled.rb
@@ -1,4 +1,4 @@
-class RenameApplicationSettingsSigninEnabledToPasswordAuthenticationEnabled < ActiveRecord::Migration
+class RenameApplicationSettingsSigninEnabledToPasswordAuthenticationEnabled < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb b/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb
index a89d348b127fe30927235a7642e0b8e395b94d6c..36ac360fb0b9a7aed4312b37e54a469a7dbae60c 100644
--- a/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb
+++ b/db/migrate/20170703102400_add_stage_id_foreign_key_to_builds.rb
@@ -1,4 +1,4 @@
-class AddStageIdForeignKeyToBuilds < ActiveRecord::Migration
+class AddStageIdForeignKeyToBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170706151212_add_performance_bar_allowed_group_id_to_application_settings.rb b/db/migrate/20170706151212_add_performance_bar_allowed_group_id_to_application_settings.rb
index fe9970ddc71e7101a59ade324972a44e9a9aaafa..61416f74b63728cb4e43a2d822b1668861ab8f7d 100644
--- a/db/migrate/20170706151212_add_performance_bar_allowed_group_id_to_application_settings.rb
+++ b/db/migrate/20170706151212_add_performance_bar_allowed_group_id_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddPerformanceBarAllowedGroupIdToApplicationSettings < ActiveRecord::Migration
+class AddPerformanceBarAllowedGroupIdToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170707183807_add_group_id_to_milestones.rb b/db/migrate/20170707183807_add_group_id_to_milestones.rb
index 675ffd4a1c92f1fbece23dc3c1053179044bfc43..e778a30192f712a1903df5608516e05dbbe648e3 100644
--- a/db/migrate/20170707183807_add_group_id_to_milestones.rb
+++ b/db/migrate/20170707183807_add_group_id_to_milestones.rb
@@ -1,4 +1,4 @@
-class AddGroupIdToMilestones < ActiveRecord::Migration
+class AddGroupIdToMilestones < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170707184243_add_group_milestone_id_indexes.rb b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb
index aa48fe90cadb6d899e9b4efb21b82312cc4d6eac..545ee070194c30eefd4dffab721d26f9b75c6ca5 100644
--- a/db/migrate/20170707184243_add_group_milestone_id_indexes.rb
+++ b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb
@@ -1,4 +1,4 @@
-class AddGroupMilestoneIdIndexes < ActiveRecord::Migration
+class AddGroupMilestoneIdIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb b/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb
index 38536a8b06a23224d1f18f5f2357db193a1d895d..f99206c7f7831f6bef79851fd4cbd9af62f6b832 100644
--- a/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb
+++ b/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb
@@ -1,4 +1,4 @@
-class RemoveWrongVersionsFromSchemaVersions < ActiveRecord::Migration
+class RemoveWrongVersionsFromSchemaVersions < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170710083355_clean_stage_id_reference_migration.rb b/db/migrate/20170710083355_clean_stage_id_reference_migration.rb
index 681203eaf400c68381ed24db00a5424272a3590b..d33c6f53b158ce694edbda6284d6f5d236835930 100644
--- a/db/migrate/20170710083355_clean_stage_id_reference_migration.rb
+++ b/db/migrate/20170710083355_clean_stage_id_reference_migration.rb
@@ -1,4 +1,4 @@
-class CleanStageIdReferenceMigration < ActiveRecord::Migration
+class CleanStageIdReferenceMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170711145320_add_status_to_ci_stages.rb b/db/migrate/20170711145320_add_status_to_ci_stages.rb
index d497a61a9591a6dd5b775f6de4dba314f06e571b..3ea7b7508822140d2163ea82663f1466d187c37b 100644
--- a/db/migrate/20170711145320_add_status_to_ci_stages.rb
+++ b/db/migrate/20170711145320_add_status_to_ci_stages.rb
@@ -1,4 +1,4 @@
-class AddStatusToCiStages < ActiveRecord::Migration
+class AddStatusToCiStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb b/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb
index c409915ceedb2b68999a10d5b54322d44781b024..908b122c659ef3545d095d2b1aa5fe355d4e46bb 100644
--- a/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb
+++ b/db/migrate/20170713104829_add_foreign_key_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToMergeRequests < ActiveRecord::Migration
+class AddForeignKeyToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170717074009_move_system_upload_folder.rb b/db/migrate/20170717074009_move_system_upload_folder.rb
index d3caa53a7a41487e6c39424808894712f763ec6e..6c57a751c8d5160a53077c8e0733d39fd1e830d7 100644
--- a/db/migrate/20170717074009_move_system_upload_folder.rb
+++ b/db/migrate/20170717074009_move_system_upload_folder.rb
@@ -1,4 +1,4 @@
-class MoveSystemUploadFolder < ActiveRecord::Migration
+class MoveSystemUploadFolder < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170717200542_add_trusted_column_to_oauth_applications.rb b/db/migrate/20170717200542_add_trusted_column_to_oauth_applications.rb
index 1a013e6aefb39b92849ec3f8d493de24d1174282..d9ae86f6c52d66c59920bfc643cba8f5e7fe5b85 100644
--- a/db/migrate/20170717200542_add_trusted_column_to_oauth_applications.rb
+++ b/db/migrate/20170717200542_add_trusted_column_to_oauth_applications.rb
@@ -1,4 +1,4 @@
-class AddTrustedColumnToOauthApplications < ActiveRecord::Migration
+class AddTrustedColumnToOauthApplications < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170720111708_add_lock_version_to_ci_stages.rb b/db/migrate/20170720111708_add_lock_version_to_ci_stages.rb
index e1c4f0332864d3bf8211b0a2e3c21620bd87f173..a5caca7e80cb712322f59165d7fd3452be3580c9 100644
--- a/db/migrate/20170720111708_add_lock_version_to_ci_stages.rb
+++ b/db/migrate/20170720111708_add_lock_version_to_ci_stages.rb
@@ -1,4 +1,4 @@
-class AddLockVersionToCiStages < ActiveRecord::Migration
+class AddLockVersionToCiStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170720122741_create_user_custom_attributes.rb b/db/migrate/20170720122741_create_user_custom_attributes.rb
index b1c0bebc633c11fbc8d5e67c18f1d420a6d2e9a8..0e6f37d73174c997d478044e1bfb12099cec3bff 100644
--- a/db/migrate/20170720122741_create_user_custom_attributes.rb
+++ b/db/migrate/20170720122741_create_user_custom_attributes.rb
@@ -1,4 +1,4 @@
-class CreateUserCustomAttributes < ActiveRecord::Migration
+class CreateUserCustomAttributes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170720130522_create_ci_pipeline_variables.rb b/db/migrate/20170720130522_create_ci_pipeline_variables.rb
index a784f5dd1423924073e7ab379154d07aafb23f93..4f162d46cf549e6038ceb2371fe767d5f5d82a2e 100644
--- a/db/migrate/20170720130522_create_ci_pipeline_variables.rb
+++ b/db/migrate/20170720130522_create_ci_pipeline_variables.rb
@@ -1,4 +1,4 @@
-class CreateCiPipelineVariables < ActiveRecord::Migration
+class CreateCiPipelineVariables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
index 550b8a88f020f8c812e6316f5b2c01ab429c9032..df9350d9ad5a2da4c45bfc6a58bd743993811f37 100644
--- a/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
+++ b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToCiPipelineVariables < ActiveRecord::Migration
+class AddForeignKeyToCiPipelineVariables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170724214302_add_lower_path_index_to_redirect_routes.rb b/db/migrate/20170724214302_add_lower_path_index_to_redirect_routes.rb
index a770ff63b4e1ee5fbe9c8a900254d9387c7469ac..1a6516f87774a389b3cc0fd2799e73a083489458 100644
--- a/db/migrate/20170724214302_add_lower_path_index_to_redirect_routes.rb
+++ b/db/migrate/20170724214302_add_lower_path_index_to_redirect_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLowerPathIndexToRedirectRoutes < ActiveRecord::Migration
+class AddLowerPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb b/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb
index 1f5fa7e3d49a10810d7c2cfc2045c8921b844f51..c7d377547e49b7726c2c1282462cd464756543b8 100644
--- a/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb
+++ b/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb
@@ -1,4 +1,4 @@
-class AddBinaryToMergeRequestDiffFiles < ActiveRecord::Migration
+class AddBinaryToMergeRequestDiffFiles < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170727123534_add_index_on_events_project_id_id.rb b/db/migrate/20170727123534_add_index_on_events_project_id_id.rb
index 1c4aaaf9dd62b9e567aa67ac7c9a0945f27ecca9..076b8ee87b2d0bfa1f6f459ecf48c8768cd1b98e 100644
--- a/db/migrate/20170727123534_add_index_on_events_project_id_id.rb
+++ b/db/migrate/20170727123534_add_index_on_events_project_id_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexOnEventsProjectIdId < ActiveRecord::Migration
+class AddIndexOnEventsProjectIdId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170731175128_add_percentages_to_conv_dev.rb b/db/migrate/20170731175128_add_percentages_to_conv_dev.rb
index 1819bfc96bbbfea86fbd5bfbc841eb0cc0ac152e..522e99c0751460ebd40464c00ef4f10af54a2b57 100644
--- a/db/migrate/20170731175128_add_percentages_to_conv_dev.rb
+++ b/db/migrate/20170731175128_add_percentages_to_conv_dev.rb
@@ -1,4 +1,4 @@
-class AddPercentagesToConvDev < ActiveRecord::Migration
+class AddPercentagesToConvDev < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170731183033_add_merge_jid_to_merge_requests.rb b/db/migrate/20170731183033_add_merge_jid_to_merge_requests.rb
index a7d8f2f3604e1f70b11a6b5001c13aafc01fa254..3c677f3bc2debba57fa7a470378c6546ada639a7 100644
--- a/db/migrate/20170731183033_add_merge_jid_to_merge_requests.rb
+++ b/db/migrate/20170731183033_add_merge_jid_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddMergeJidToMergeRequests < ActiveRecord::Migration
+class AddMergeJidToMergeRequests < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170802013652_add_storage_fields_to_project.rb b/db/migrate/20170802013652_add_storage_fields_to_project.rb
index c2381a9d0b278e1da9bd9e5bf24b91ec9057eff0..d6672b9b3af4cf2704f662bdc1bdd1d8740fb99d 100644
--- a/db/migrate/20170802013652_add_storage_fields_to_project.rb
+++ b/db/migrate/20170802013652_add_storage_fields_to_project.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddStorageFieldsToProject < ActiveRecord::Migration
+class AddStorageFieldsToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170803130232_reorganise_issues_indexes_for_faster_sorting.rb b/db/migrate/20170803130232_reorganise_issues_indexes_for_faster_sorting.rb
index eb7d1be17320f46266d3d31202d6239b4694bbc2..e92b5f286851af741a465d69f6fcf917e87322f1 100644
--- a/db/migrate/20170803130232_reorganise_issues_indexes_for_faster_sorting.rb
+++ b/db/migrate/20170803130232_reorganise_issues_indexes_for_faster_sorting.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ReorganiseIssuesIndexesForFasterSorting < ActiveRecord::Migration
+class ReorganiseIssuesIndexesForFasterSorting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170807071105_add_hashed_storage_to_settings.rb b/db/migrate/20170807071105_add_hashed_storage_to_settings.rb
index 0846557add8422749c078973d29f852d18ad70b3..cfb89743127bd35c95167577bda12a865a575113 100644
--- a/db/migrate/20170807071105_add_hashed_storage_to_settings.rb
+++ b/db/migrate/20170807071105_add_hashed_storage_to_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddHashedStorageToSettings < ActiveRecord::Migration
+class AddHashedStorageToSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170809133343_add_broadcast_messages_index.rb b/db/migrate/20170809133343_add_broadcast_messages_index.rb
index 4ab2ddb059dc3d77c187dc9bac5916265eaca923..bcbc6c9f7d2761f211e9b150797e6d8f968133a4 100644
--- a/db/migrate/20170809133343_add_broadcast_messages_index.rb
+++ b/db/migrate/20170809133343_add_broadcast_messages_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddBroadcastMessagesIndex < ActiveRecord::Migration
+class AddBroadcastMessagesIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170809134534_add_broadcast_message_not_null_constraints.rb b/db/migrate/20170809134534_add_broadcast_message_not_null_constraints.rb
index 5551fb51a6e0a205289cb42ec323d8d3481ae74b..fd8cdbb95aa2ebdd706c764aa26089beead5ed07 100644
--- a/db/migrate/20170809134534_add_broadcast_message_not_null_constraints.rb
+++ b/db/migrate/20170809134534_add_broadcast_message_not_null_constraints.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddBroadcastMessageNotNullConstraints < ActiveRecord::Migration
+class AddBroadcastMessageNotNullConstraints < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170809142252_cleanup_appearances_schema.rb b/db/migrate/20170809142252_cleanup_appearances_schema.rb
index acf45060114740bf7c496ffa54c474511b1b233c..4c5d6a6d75d8be8fa09dc2c56100c1e98de34137 100644
--- a/db/migrate/20170809142252_cleanup_appearances_schema.rb
+++ b/db/migrate/20170809142252_cleanup_appearances_schema.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupAppearancesSchema < ActiveRecord::Migration
+class CleanupAppearancesSchema < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170809161910_add_project_export_enabled_to_application_settings.rb b/db/migrate/20170809161910_add_project_export_enabled_to_application_settings.rb
index 4baba1ade6dec4d7aa46d36a31517712f3f3b5b9..9dd520de264900e694fa60c5e2df1ebf81e752ba 100644
--- a/db/migrate/20170809161910_add_project_export_enabled_to_application_settings.rb
+++ b/db/migrate/20170809161910_add_project_export_enabled_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddProjectExportEnabledToApplicationSettings < ActiveRecord::Migration
+class AddProjectExportEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20170815221154_add_discussion_locked_to_issuable.rb b/db/migrate/20170815221154_add_discussion_locked_to_issuable.rb
index 5bd777c53a0abf6e1bc8cb3435c86a79c209ae53..1444ca480b3f3df2ea6a8f6f6b693c4c3cd91e8c 100644
--- a/db/migrate/20170815221154_add_discussion_locked_to_issuable.rb
+++ b/db/migrate/20170815221154_add_discussion_locked_to_issuable.rb
@@ -1,4 +1,4 @@
-class AddDiscussionLockedToIssuable < ActiveRecord::Migration
+class AddDiscussionLockedToIssuable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170816133938_add_access_level_to_ci_runners.rb b/db/migrate/20170816133938_add_access_level_to_ci_runners.rb
index fc484730f428a9ad93d9188ee5cd583c9901d5bc..5a1ea9514d151ceb37b87c9597f0b16cfca2d059 100644
--- a/db/migrate/20170816133938_add_access_level_to_ci_runners.rb
+++ b/db/migrate/20170816133938_add_access_level_to_ci_runners.rb
@@ -1,4 +1,4 @@
-class AddAccessLevelToCiRunners < ActiveRecord::Migration
+class AddAccessLevelToCiRunners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170816133940_add_protected_to_ci_builds.rb b/db/migrate/20170816133940_add_protected_to_ci_builds.rb
index c73a4387d29882b80d303e25d8e16a602c9b4ed1..13e1be0d89cd3c7cf3a3e7e41b0ca00b11957ea1 100644
--- a/db/migrate/20170816133940_add_protected_to_ci_builds.rb
+++ b/db/migrate/20170816133940_add_protected_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddProtectedToCiBuilds < ActiveRecord::Migration
+class AddProtectedToCiBuilds < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170816143940_add_protected_to_ci_pipelines.rb b/db/migrate/20170816143940_add_protected_to_ci_pipelines.rb
index ce8f1e036862a4ae7ce2c2cd43124d2262d28efc..aefaf4a487bb4f077985afd25780a26ecffc3064 100644
--- a/db/migrate/20170816143940_add_protected_to_ci_pipelines.rb
+++ b/db/migrate/20170816143940_add_protected_to_ci_pipelines.rb
@@ -1,4 +1,4 @@
-class AddProtectedToCiPipelines < ActiveRecord::Migration
+class AddProtectedToCiPipelines < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170816153940_add_index_on_ci_builds_protected.rb b/db/migrate/20170816153940_add_index_on_ci_builds_protected.rb
index caf7c705a6ee353b54dc1689eba8fca7a74a677b..fbe5fe31ae8957f0680e24e1758e9295bc927a7c 100644
--- a/db/migrate/20170816153940_add_index_on_ci_builds_protected.rb
+++ b/db/migrate/20170816153940_add_index_on_ci_builds_protected.rb
@@ -1,4 +1,4 @@
-class AddIndexOnCiBuildsProtected < ActiveRecord::Migration
+class AddIndexOnCiBuildsProtected < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170816234252_add_theme_id_to_users.rb b/db/migrate/20170816234252_add_theme_id_to_users.rb
index 5043f9ec5917433ce5a76d189434834c3b7f5188..bd04445cac6d5888d345dce19596339d13497d10 100644
--- a/db/migrate/20170816234252_add_theme_id_to_users.rb
+++ b/db/migrate/20170816234252_add_theme_id_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddThemeIdToUsers < ActiveRecord::Migration
+class AddThemeIdToUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb
index 128cd109f8d69179a1269a11fd8b746eee843c70..c7d81dc005a20b4d89ce97ae0eeff17d33f5277c 100644
--- a/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb
+++ b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb
@@ -1,4 +1,4 @@
-class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration
+class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   include Gitlab::Database::MigrationHelpers
diff --git a/db/migrate/20170820100558_correct_protected_tags_foreign_keys.rb b/db/migrate/20170820100558_correct_protected_tags_foreign_keys.rb
index 229298e194636a94cccde10ffd6d683dac5d4343..82e05885b0ebc8f432372cd45648dac4dcfd7398 100644
--- a/db/migrate/20170820100558_correct_protected_tags_foreign_keys.rb
+++ b/db/migrate/20170820100558_correct_protected_tags_foreign_keys.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CorrectProtectedTagsForeignKeys < ActiveRecord::Migration
+class CorrectProtectedTagsForeignKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170820120108_create_user_synced_attributes_metadata.rb b/db/migrate/20170820120108_create_user_synced_attributes_metadata.rb
index 79028e3498777b5556dbcfd4510e1b19d7fa2deb..131dcf7ac25f8ec11395532285e52ef07960471d 100644
--- a/db/migrate/20170820120108_create_user_synced_attributes_metadata.rb
+++ b/db/migrate/20170820120108_create_user_synced_attributes_metadata.rb
@@ -1,4 +1,4 @@
-class CreateUserSyncedAttributesMetadata < ActiveRecord::Migration
+class CreateUserSyncedAttributesMetadata < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb b/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb
index da518d8215cb112fee2f9adeafefabfd593636f1..f7c0aeab8f96593440b7dc40b365df4ddbd9afb4 100644
--- a/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb
+++ b/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddAutoDevopsEnabledToApplicationSettings < ActiveRecord::Migration
+class AddAutoDevopsEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170824162758_allow_appearances_description_html_null.rb b/db/migrate/20170824162758_allow_appearances_description_html_null.rb
index d7f481ee8942632741eb524ac9d1096c4ab92a4b..6efa3452796aa6722055904eb33e0c23629f7f8a 100644
--- a/db/migrate/20170824162758_allow_appearances_description_html_null.rb
+++ b/db/migrate/20170824162758_allow_appearances_description_html_null.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AllowAppearancesDescriptionHtmlNull < ActiveRecord::Migration
+class AllowAppearancesDescriptionHtmlNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
index 41bb031014f6b3945705f5cc60119add395c5cb4..be543ffc983e0f4c25848a32a4318a9190fa0ee1 100644
--- a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
+++ b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddFileStoreToLfsObjects < ActiveRecord::Migration
+class AddFileStoreToLfsObjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb b/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
index c5fb5762d616e6a0e72950b7117495ebbba45b38..b1adccc9c5c469f2a3e5db262b7bbd44e158cacf 100644
--- a/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
+++ b/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
@@ -1,4 +1,4 @@
-class MigrateIssuesToGhostUser < ActiveRecord::Migration
+class MigrateIssuesToGhostUser < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/migrate/20170825154015_resolve_outdated_diff_discussions.rb b/db/migrate/20170825154015_resolve_outdated_diff_discussions.rb
index 235530bb1e64e70684d6e3fa1f2779978804c5a8..1aed21f10a0af6217e45d86d1c8f6f23a6422e8d 100644
--- a/db/migrate/20170825154015_resolve_outdated_diff_discussions.rb
+++ b/db/migrate/20170825154015_resolve_outdated_diff_discussions.rb
@@ -1,4 +1,4 @@
-class ResolveOutdatedDiffDiscussions < ActiveRecord::Migration
+class ResolveOutdatedDiffDiscussions < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb b/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb
index 2140ff7b05ef585ec0ad17bd2f0346acb3cf7830..e2061b5600acf88cb5d741a652ec35e886252237 100644
--- a/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb
+++ b/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb
@@ -1,6 +1,6 @@
 # rubocop:disable RemoveIndex
 
-class AddIndexOnMergeRequestDiffCommitSha < ActiveRecord::Migration
+class AddIndexOnMergeRequestDiffCommitSha < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170828093725_create_project_auto_dev_ops.rb b/db/migrate/20170828093725_create_project_auto_dev_ops.rb
index c1bb4f20c1dee4863f20b6e6b5c5f7188990e2dc..ea895dc14c197ce28935bca8dc2964459c57ae35 100644
--- a/db/migrate/20170828093725_create_project_auto_dev_ops.rb
+++ b/db/migrate/20170828093725_create_project_auto_dev_ops.rb
@@ -1,4 +1,4 @@
-class CreateProjectAutoDevOps < ActiveRecord::Migration
+class CreateProjectAutoDevOps < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170828135939_migrate_user_external_mail_data.rb b/db/migrate/20170828135939_migrate_user_external_mail_data.rb
index f7ac87374b62265be2978db13739ada4493558ef..9ee4a4598bfc5d5689b115ae620335eed6d510d4 100644
--- a/db/migrate/20170828135939_migrate_user_external_mail_data.rb
+++ b/db/migrate/20170828135939_migrate_user_external_mail_data.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateUserExternalMailData < ActiveRecord::Migration
+class MigrateUserExternalMailData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb b/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb
index 5a7487b9227cd6564b3a94073b278c47654d7b9c..44f709868cac2d7791e8f451534f6ba16069c301 100644
--- a/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb
+++ b/db/migrate/20170830125940_add_failure_reason_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddFailureReasonToCiBuilds < ActiveRecord::Migration
+class AddFailureReasonToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170830130119_steal_remaining_event_migration_jobs.rb b/db/migrate/20170830130119_steal_remaining_event_migration_jobs.rb
index 0dfdc4ed261bccb7cf4990e54dde0ca88068698c..bcc34d56d2dc06adb49b21a1a44b49baf2d71aae 100644
--- a/db/migrate/20170830130119_steal_remaining_event_migration_jobs.rb
+++ b/db/migrate/20170830130119_steal_remaining_event_migration_jobs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class StealRemainingEventMigrationJobs < ActiveRecord::Migration
+class StealRemainingEventMigrationJobs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170830131015_swap_event_migration_tables.rb b/db/migrate/20170830131015_swap_event_migration_tables.rb
index a256de4a8af9e4568882355a7412462b5aaf8c56..fb3b2472ffe2a948a339e3b9baa29abcde779f7a 100644
--- a/db/migrate/20170830131015_swap_event_migration_tables.rb
+++ b/db/migrate/20170830131015_swap_event_migration_tables.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class SwapEventMigrationTables < ActiveRecord::Migration
+class SwapEventMigrationTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170831092813_add_config_source_to_pipelines.rb b/db/migrate/20170831092813_add_config_source_to_pipelines.rb
index ff51e968abd86787a63a0137dc086ff4e2b85213..ba1f73f0e689b491121b8af2cecd7017fd43c7aa 100644
--- a/db/migrate/20170831092813_add_config_source_to_pipelines.rb
+++ b/db/migrate/20170831092813_add_config_source_to_pipelines.rb
@@ -1,4 +1,4 @@
-class AddConfigSourceToPipelines < ActiveRecord::Migration
+class AddConfigSourceToPipelines < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170901071411_add_foreign_key_to_issue_author.rb b/db/migrate/20170901071411_add_foreign_key_to_issue_author.rb
index ab6e9fb565af9049e5c1a21c6e98feaf69bd41d8..00d0b0f2c7f862f6540e4d743a252867627e1e22 100644
--- a/db/migrate/20170901071411_add_foreign_key_to_issue_author.rb
+++ b/db/migrate/20170901071411_add_foreign_key_to_issue_author.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyToIssueAuthor < ActiveRecord::Migration
+class AddForeignKeyToIssueAuthor < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170904092148_add_email_confirmation.rb b/db/migrate/20170904092148_add_email_confirmation.rb
index 17ff424b3197c481fe8053d3d52a636c02fa6b13..8bfb20059363c9813cc75dac1dad44aebd448d30 100644
--- a/db/migrate/20170904092148_add_email_confirmation.rb
+++ b/db/migrate/20170904092148_add_email_confirmation.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEmailConfirmation < ActiveRecord::Migration
+class AddEmailConfirmation < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170905112933_add_resolved_by_push_to_notes.rb b/db/migrate/20170905112933_add_resolved_by_push_to_notes.rb
index ceb31ffb08abe982fff2f8b9b4591fab0b5919ea..1f27ea3c4673eea2bc59a7864dc055a6b3ecddf4 100644
--- a/db/migrate/20170905112933_add_resolved_by_push_to_notes.rb
+++ b/db/migrate/20170905112933_add_resolved_by_push_to_notes.rb
@@ -1,4 +1,4 @@
-class AddResolvedByPushToNotes < ActiveRecord::Migration
+class AddResolvedByPushToNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170906133745_add_runners_token_to_groups.rb b/db/migrate/20170906133745_add_runners_token_to_groups.rb
index 852f4cba670562d0d365ce7beed5a406d20f2a77..a02160feb838857eab34f27bd088573e7ea7d842 100644
--- a/db/migrate/20170906133745_add_runners_token_to_groups.rb
+++ b/db/migrate/20170906133745_add_runners_token_to_groups.rb
@@ -1,4 +1,4 @@
-class AddRunnersTokenToGroups < ActiveRecord::Migration
+class AddRunnersTokenToGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170909090114_add_email_confirmation_index.rb b/db/migrate/20170909090114_add_email_confirmation_index.rb
index a8c1023c48211020c1af8e43b436c07a6076728a..31c48db2bd2d5a26b4f67ded851f40311a4bb49b 100644
--- a/db/migrate/20170909090114_add_email_confirmation_index.rb
+++ b/db/migrate/20170909090114_add_email_confirmation_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEmailConfirmationIndex < ActiveRecord::Migration
+class AddEmailConfirmationIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170909150936_add_spent_at_to_timelogs.rb b/db/migrate/20170909150936_add_spent_at_to_timelogs.rb
index ffff719c2894602424ccb16a29bdc1b4b89247cb..3a2c900b445b216937574d6d115face51526505b 100644
--- a/db/migrate/20170909150936_add_spent_at_to_timelogs.rb
+++ b/db/migrate/20170909150936_add_spent_at_to_timelogs.rb
@@ -1,4 +1,4 @@
-class AddSpentAtToTimelogs < ActiveRecord::Migration
+class AddSpentAtToTimelogs < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20170912113435_clean_stages_statuses_migration.rb b/db/migrate/20170912113435_clean_stages_statuses_migration.rb
index fc091d7894ecbe9beb29d975e31e93609fb38d41..f2040f819cd0b7b35a9eab741d153d8731ba311e 100644
--- a/db/migrate/20170912113435_clean_stages_statuses_migration.rb
+++ b/db/migrate/20170912113435_clean_stages_statuses_migration.rb
@@ -1,4 +1,4 @@
-class CleanStagesStatusesMigration < ActiveRecord::Migration
+class CleanStagesStatusesMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170913131410_environments_project_id_not_null.rb b/db/migrate/20170913131410_environments_project_id_not_null.rb
index d5404f8ede9989b5947537489e713b1cf517fabb..ba66113945bef847a5e4818c2bd0961be72b59d1 100644
--- a/db/migrate/20170913131410_environments_project_id_not_null.rb
+++ b/db/migrate/20170913131410_environments_project_id_not_null.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class EnvironmentsProjectIdNotNull < ActiveRecord::Migration
+class EnvironmentsProjectIdNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170914135630_add_index_for_recent_push_events.rb b/db/migrate/20170914135630_add_index_for_recent_push_events.rb
index 99f593b046586d36e2073c7a7b613e98e8b6f684..ac86185ba502687ada984081c0355625b62b450c 100644
--- a/db/migrate/20170914135630_add_index_for_recent_push_events.rb
+++ b/db/migrate/20170914135630_add_index_for_recent_push_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexForRecentPushEvents < ActiveRecord::Migration
+class AddIndexForRecentPushEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170918072948_create_job_artifacts.rb b/db/migrate/20170918072948_create_job_artifacts.rb
index 95f2c6c8ce8d26188a1f4318b06b507ca665f2b4..4dd24aaff9966aee6ed059cf43ee5b8a26565705 100644
--- a/db/migrate/20170918072948_create_job_artifacts.rb
+++ b/db/migrate/20170918072948_create_job_artifacts.rb
@@ -1,4 +1,4 @@
-class CreateJobArtifacts < ActiveRecord::Migration
+class CreateJobArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170918072949_add_file_store_job_artifacts.rb b/db/migrate/20170918072949_add_file_store_job_artifacts.rb
index b1f1bea6debd64561d701d5bb5312f2bc0f22306..3eb355c930518520898de928028456ddb890b3e2 100644
--- a/db/migrate/20170918072949_add_file_store_job_artifacts.rb
+++ b/db/migrate/20170918072949_add_file_store_job_artifacts.rb
@@ -1,4 +1,4 @@
-class AddFileStoreJobArtifacts < ActiveRecord::Migration
+class AddFileStoreJobArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20170918111708_create_project_custom_attributes.rb b/db/migrate/20170918111708_create_project_custom_attributes.rb
index b5bc90ec02ecf6458ed767309c9eb816bb5e7246..bd6064689ff4960dd9ce7fb54e39e32fa9691b38 100644
--- a/db/migrate/20170918111708_create_project_custom_attributes.rb
+++ b/db/migrate/20170918111708_create_project_custom_attributes.rb
@@ -1,4 +1,4 @@
-class CreateProjectCustomAttributes < ActiveRecord::Migration
+class CreateProjectCustomAttributes < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170918140927_create_group_custom_attributes.rb b/db/migrate/20170918140927_create_group_custom_attributes.rb
index 3879ea15eb6b9f913a3c5acb05e9f22df20c76a6..215a0f16b6fe8d8cceda27c2758dab8cdd47493e 100644
--- a/db/migrate/20170918140927_create_group_custom_attributes.rb
+++ b/db/migrate/20170918140927_create_group_custom_attributes.rb
@@ -1,4 +1,4 @@
-class CreateGroupCustomAttributes < ActiveRecord::Migration
+class CreateGroupCustomAttributes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170918222253_reorganize_deployments_indexes.rb b/db/migrate/20170918222253_reorganize_deployments_indexes.rb
index 139427ed2b9befda78b2dc83cf983fa4f6a14e42..480847ac3930f46f47ba56d4e606d842d825ed37 100644
--- a/db/migrate/20170918222253_reorganize_deployments_indexes.rb
+++ b/db/migrate/20170918222253_reorganize_deployments_indexes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ReorganizeDeploymentsIndexes < ActiveRecord::Migration
+class ReorganizeDeploymentsIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170918223303_add_deployments_index_for_last_deployment.rb b/db/migrate/20170918223303_add_deployments_index_for_last_deployment.rb
index b91efb86d98202cfe97e2db3923c32d41291c8b7..8e165ac647d1dd54b17bbe84346f16ba288b992f 100644
--- a/db/migrate/20170918223303_add_deployments_index_for_last_deployment.rb
+++ b/db/migrate/20170918223303_add_deployments_index_for_last_deployment.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDeploymentsIndexForLastDeployment < ActiveRecord::Migration
+class AddDeploymentsIndexForLastDeployment < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170919211300_remove_temporary_ci_builds_index.rb b/db/migrate/20170919211300_remove_temporary_ci_builds_index.rb
index 8423bf13fd970806a2c59436dc959d69a382e214..23c94a809d4d3c95698d824186d76a15371c76d4 100644
--- a/db/migrate/20170919211300_remove_temporary_ci_builds_index.rb
+++ b/db/migrate/20170919211300_remove_temporary_ci_builds_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveTemporaryCiBuildsIndex < ActiveRecord::Migration
+class RemoveTemporaryCiBuildsIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170921115009_add_project_repository_storage_index.rb b/db/migrate/20170921115009_add_project_repository_storage_index.rb
index 1c5a8fd65e18e64619e8498be14821e91a8ba617..9e1f5052f2877256b5ba9ea3eafb57fa873437bd 100644
--- a/db/migrate/20170921115009_add_project_repository_storage_index.rb
+++ b/db/migrate/20170921115009_add_project_repository_storage_index.rb
@@ -1,4 +1,4 @@
-class AddProjectRepositoryStorageIndex < ActiveRecord::Migration
+class AddProjectRepositoryStorageIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170924094327_create_gcp_clusters.rb b/db/migrate/20170924094327_create_gcp_clusters.rb
index 657dddcbbc489c3c2bd944318ce188638b640706..43201f75ad77e74ce8037bd3e1934053d8a72b67 100644
--- a/db/migrate/20170924094327_create_gcp_clusters.rb
+++ b/db/migrate/20170924094327_create_gcp_clusters.rb
@@ -1,4 +1,4 @@
-class CreateGcpClusters < ActiveRecord::Migration
+class CreateGcpClusters < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170925184228_add_favicon_to_appearances.rb b/db/migrate/20170925184228_add_favicon_to_appearances.rb
index 65083733afbf0de984da7c4289857dd5dcdb74a2..1ce750f7e830044279d585a49a70ab1a88424a57 100644
--- a/db/migrate/20170925184228_add_favicon_to_appearances.rb
+++ b/db/migrate/20170925184228_add_favicon_to_appearances.rb
@@ -1,4 +1,4 @@
-class AddFaviconToAppearances < ActiveRecord::Migration
+class AddFaviconToAppearances < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20170927095921_add_ci_builds_index_for_jobscontroller.rb b/db/migrate/20170927095921_add_ci_builds_index_for_jobscontroller.rb
index c2cb1df2586c51b9097cd13b129670f79064b36b..85aa78006dbd085224dface488d7fd8bb5ae5b26 100644
--- a/db/migrate/20170927095921_add_ci_builds_index_for_jobscontroller.rb
+++ b/db/migrate/20170927095921_add_ci_builds_index_for_jobscontroller.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCiBuildsIndexForJobscontroller < ActiveRecord::Migration
+class AddCiBuildsIndexForJobscontroller < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170927122209_add_partial_index_for_labels_template.rb b/db/migrate/20170927122209_add_partial_index_for_labels_template.rb
index c3e5077ba20338e84c46563c7e3562753cdfdb76..dd79e024df41229c1b22f19f6fbcc0d334102e18 100644
--- a/db/migrate/20170927122209_add_partial_index_for_labels_template.rb
+++ b/db/migrate/20170927122209_add_partial_index_for_labels_template.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPartialIndexForLabelsTemplate < ActiveRecord::Migration
+class AddPartialIndexForLabelsTemplate < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170927161718_create_gpg_key_subkeys.rb b/db/migrate/20170927161718_create_gpg_key_subkeys.rb
index d9dc2404cac48fcb1c83a1cfc81dff6a6d7a046b..3b5d452ee12f16a727273b7a9aeb62fddc8df6f1 100644
--- a/db/migrate/20170927161718_create_gpg_key_subkeys.rb
+++ b/db/migrate/20170927161718_create_gpg_key_subkeys.rb
@@ -1,4 +1,4 @@
-class CreateGpgKeySubkeys < ActiveRecord::Migration
+class CreateGpgKeySubkeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170928100231_add_composite_index_on_merge_requests_merge_commit_sha.rb b/db/migrate/20170928100231_add_composite_index_on_merge_requests_merge_commit_sha.rb
index 9f02daf04c1b41ee24c0ce3423b3ce158c96698d..cb16589e8dbcef05fd76931064a133c10a7ccc5b 100644
--- a/db/migrate/20170928100231_add_composite_index_on_merge_requests_merge_commit_sha.rb
+++ b/db/migrate/20170928100231_add_composite_index_on_merge_requests_merge_commit_sha.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCompositeIndexOnMergeRequestsMergeCommitSha < ActiveRecord::Migration
+class AddCompositeIndexOnMergeRequestsMergeCommitSha < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20170928124105_create_fork_networks.rb b/db/migrate/20170928124105_create_fork_networks.rb
index 89e5b871967c9710df4b3c57cff3f25e35e0c388..01f623117f57dc768952b9acbeb01efdbdd012b9 100644
--- a/db/migrate/20170928124105_create_fork_networks.rb
+++ b/db/migrate/20170928124105_create_fork_networks.rb
@@ -1,4 +1,4 @@
-class CreateForkNetworks < ActiveRecord::Migration
+class CreateForkNetworks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170928133643_create_fork_network_members.rb b/db/migrate/20170928133643_create_fork_network_members.rb
index 8c7d9ba859a24c833d683e0adf3cb18077b8a4c8..e2a6d7b0e8aaf5bfdcc7c6d6c3c2a18e4e5b6110 100644
--- a/db/migrate/20170928133643_create_fork_network_members.rb
+++ b/db/migrate/20170928133643_create_fork_network_members.rb
@@ -1,4 +1,4 @@
-class CreateForkNetworkMembers < ActiveRecord::Migration
+class CreateForkNetworkMembers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb
index 82adddbc1ec11afbf651d71523af8416b18baeda..e000ee27eefde8aaf834f183bf9c87cbc83e91d8 100644
--- a/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb
+++ b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb
@@ -1,4 +1,4 @@
-class AddFailureReasonToPipelines < ActiveRecord::Migration
+class AddFailureReasonToPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20170929131201_populate_fork_networks.rb b/db/migrate/20170929131201_populate_fork_networks.rb
index ddbf27e18525ed86cb8517891ad001bde083e748..ba4f8ef253181d96e244911304c1cbfce9b12c1c 100644
--- a/db/migrate/20170929131201_populate_fork_networks.rb
+++ b/db/migrate/20170929131201_populate_fork_networks.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PopulateForkNetworks < ActiveRecord::Migration
+class PopulateForkNetworks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb b/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb
index ac266c3e22eadf83b365effd468fff34e95a4734..9b417de1793a214855756a0ee506899b874c57dd 100644
--- a/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb
+++ b/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MakeSureFastForwardOptionExists < ActiveRecord::Migration
+class MakeSureFastForwardOptionExists < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171006090001_create_ci_build_trace_sections.rb b/db/migrate/20171006090001_create_ci_build_trace_sections.rb
index ab5ef3196182e995f791a66463441a8c6e99cd41..a2eca0832f27a9ed8300870b5c922f3ecede082f 100644
--- a/db/migrate/20171006090001_create_ci_build_trace_sections.rb
+++ b/db/migrate/20171006090001_create_ci_build_trace_sections.rb
@@ -1,4 +1,4 @@
-class CreateCiBuildTraceSections < ActiveRecord::Migration
+class CreateCiBuildTraceSections < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb
index d279463eb4bc78284884d21f7c6bcacede6f4421..7b17763ac84d0562f8cf8cd851e13b98a32e4344 100644
--- a/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb
+++ b/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb
@@ -1,4 +1,4 @@
-class AddBuildForeignKeyToCiBuildTraceSections < ActiveRecord::Migration
+class AddBuildForeignKeyToCiBuildTraceSections < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171006090100_create_ci_build_trace_section_names.rb b/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
index 88f3e60699ae7557523c7ca0d14bfb830a662fd5..00a38fa59c2b247128b55cc12591a8a9632fdf55 100644
--- a/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
+++ b/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
@@ -1,4 +1,4 @@
-class CreateCiBuildTraceSectionNames < ActiveRecord::Migration
+class CreateCiBuildTraceSectionNames < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb
index 08422885a985540560f52638b50f06319e717148..1342ff013b7e0cfb738a3b308b3cac47ab4181a5 100644
--- a/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb
+++ b/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb
@@ -1,4 +1,4 @@
-class AddNameForeignKeyToCiBuildTraceSections < ActiveRecord::Migration
+class AddNameForeignKeyToCiBuildTraceSections < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171006220837_add_global_rate_limits_to_application_settings.rb b/db/migrate/20171006220837_add_global_rate_limits_to_application_settings.rb
index 55e822752af7f01c8bb0797122d06df58bf1ffb8..96d76069b355db9a74642d37336e087b5056df37 100644
--- a/db/migrate/20171006220837_add_global_rate_limits_to_application_settings.rb
+++ b/db/migrate/20171006220837_add_global_rate_limits_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddGlobalRateLimitsToApplicationSettings < ActiveRecord::Migration
+class AddGlobalRateLimitsToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171012101043_add_circuit_breaker_properties_to_application_settings.rb b/db/migrate/20171012101043_add_circuit_breaker_properties_to_application_settings.rb
index bcf7dbd8e6415ff9d70d36bbdcb8aa26391fe3dd..91bba07b4d79dea920f0e43912b4ba9f04c18241 100644
--- a/db/migrate/20171012101043_add_circuit_breaker_properties_to_application_settings.rb
+++ b/db/migrate/20171012101043_add_circuit_breaker_properties_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCircuitBreakerPropertiesToApplicationSettings < ActiveRecord::Migration
+class AddCircuitBreakerPropertiesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171012125712_migrate_user_authentication_token_to_personal_access_token.rb b/db/migrate/20171012125712_migrate_user_authentication_token_to_personal_access_token.rb
index 9a909644a44a6c11ad0b4b6b72fb13dd9cebe4c6..305c12e31f8c3fbe10872142b352ce9bf1e4127a 100644
--- a/db/migrate/20171012125712_migrate_user_authentication_token_to_personal_access_token.rb
+++ b/db/migrate/20171012125712_migrate_user_authentication_token_to_personal_access_token.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateUserAuthenticationTokenToPersonalAccessToken < ActiveRecord::Migration
+class MigrateUserAuthenticationTokenToPersonalAccessToken < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171013094327_create_new_clusters_architectures.rb b/db/migrate/20171013094327_create_new_clusters_architectures.rb
index dabb3e25e4802c287faafd34105a903ac55364f8..98f91e6130faa609018c0166dbb66485985f354d 100644
--- a/db/migrate/20171013094327_create_new_clusters_architectures.rb
+++ b/db/migrate/20171013094327_create_new_clusters_architectures.rb
@@ -1,4 +1,4 @@
-class CreateNewClustersArchitectures < ActiveRecord::Migration
+class CreateNewClustersArchitectures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20171017145932_add_new_circuitbreaker_settings_to_application_settings.rb b/db/migrate/20171017145932_add_new_circuitbreaker_settings_to_application_settings.rb
index 07eb25c0b0fa708e73fc9e70693c27e838c40364..4a0cadea364ba8df7b1d2c2feb020014edd9f7d3 100644
--- a/db/migrate/20171017145932_add_new_circuitbreaker_settings_to_application_settings.rb
+++ b/db/migrate/20171017145932_add_new_circuitbreaker_settings_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddNewCircuitbreakerSettingsToApplicationSettings < ActiveRecord::Migration
+class AddNewCircuitbreakerSettingsToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171019141859_fix_dev_timezone_schema.rb b/db/migrate/20171019141859_fix_dev_timezone_schema.rb
index fb7c17dd7472f9439a9b6a719c15baf5fa3ae953..68c8b528e17d1a34fd58a2f2f8eec4d516b4f351 100644
--- a/db/migrate/20171019141859_fix_dev_timezone_schema.rb
+++ b/db/migrate/20171019141859_fix_dev_timezone_schema.rb
@@ -1,4 +1,4 @@
-class FixDevTimezoneSchema < ActiveRecord::Migration
+class FixDevTimezoneSchema < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # The this migrations tries to help solve unwanted changes to `schema.rb`
diff --git a/db/migrate/20171025110159_add_latest_merge_request_diff_id_to_merge_requests.rb b/db/migrate/20171025110159_add_latest_merge_request_diff_id_to_merge_requests.rb
index 74a2badc130811f2fe30a899da30ce35de242e90..1af0cf7095888e33fb1a017dc0f525ca488cb85f 100644
--- a/db/migrate/20171025110159_add_latest_merge_request_diff_id_to_merge_requests.rb
+++ b/db/migrate/20171025110159_add_latest_merge_request_diff_id_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddLatestMergeRequestDiffIdToMergeRequests < ActiveRecord::Migration
+class AddLatestMergeRequestDiffIdToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb b/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb
index a2ce37127eae92c14cf6177119c27f793db52847..0af05f5c94ad01ac253ec7167805c8d3a43213f8 100644
--- a/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb
+++ b/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb
@@ -1,4 +1,4 @@
-class CreateClustersKubernetesHelmApps < ActiveRecord::Migration
+class CreateClustersKubernetesHelmApps < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171101130535_add_gitaly_timeout_properties_to_application_settings.rb b/db/migrate/20171101130535_add_gitaly_timeout_properties_to_application_settings.rb
index de621e7111c80bc108677a534d56ab050e0eb168..6d60fdc6132eeecef2905d21450bc758443ab5c2 100644
--- a/db/migrate/20171101130535_add_gitaly_timeout_properties_to_application_settings.rb
+++ b/db/migrate/20171101130535_add_gitaly_timeout_properties_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddGitalyTimeoutPropertiesToApplicationSettings < ActiveRecord::Migration
+class AddGitalyTimeoutPropertiesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb b/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb
index 1fbe505f804b8259ecbe0a3b0f87435f92f42830..93cec87f999846883cd775604aaff3e418b70f2e 100644
--- a/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb
+++ b/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class SetUploadsPathSizeForMysql < ActiveRecord::Migration
+class SetUploadsPathSizeForMysql < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb b/db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
index 21f48b1d1b4b5b93a761f61ef4cd9678f85f0cac..770cb94ee18aac271ad5fdc34fdf7ed7cf1983eb 100644
--- a/db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
+++ b/db/migrate/20171106101200_create_clusters_kubernetes_ingress_apps.rb
@@ -1,4 +1,4 @@
-class CreateClustersKubernetesIngressApps < ActiveRecord::Migration
+class CreateClustersKubernetesIngressApps < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171106132212_issues_confidential_not_null.rb b/db/migrate/20171106132212_issues_confidential_not_null.rb
index c959d2dd938bba5eb940e0e9b48aec11383fa4ad..444a38c2dc53f7e60141e806fe8e4c8cbcb7dd79 100644
--- a/db/migrate/20171106132212_issues_confidential_not_null.rb
+++ b/db/migrate/20171106132212_issues_confidential_not_null.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IssuesConfidentialNotNull < ActiveRecord::Migration
+class IssuesConfidentialNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106133143_rename_application_settings_password_authentication_enabled_to_password_authentication_enabled_for_web.rb b/db/migrate/20171106133143_rename_application_settings_password_authentication_enabled_to_password_authentication_enabled_for_web.rb
index 6d369e9336127eda40b11f6bb17c84dee1cf3187..58762a4f852961e44c6d2f009db2a29caca1097f 100644
--- a/db/migrate/20171106133143_rename_application_settings_password_authentication_enabled_to_password_authentication_enabled_for_web.rb
+++ b/db/migrate/20171106133143_rename_application_settings_password_authentication_enabled_to_password_authentication_enabled_for_web.rb
@@ -1,4 +1,4 @@
-class RenameApplicationSettingsPasswordAuthenticationEnabledToPasswordAuthenticationEnabledForWeb < ActiveRecord::Migration
+class RenameApplicationSettingsPasswordAuthenticationEnabledToPasswordAuthenticationEnabledForWeb < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171106133911_add_password_authentication_enabled_for_git_to_application_settings.rb b/db/migrate/20171106133911_add_password_authentication_enabled_for_git_to_application_settings.rb
index b8aa600864e620f23b927382e1228717cbedb36b..1f96a0426a17f3619720f689989cbc07d03e6df8 100644
--- a/db/migrate/20171106133911_add_password_authentication_enabled_for_git_to_application_settings.rb
+++ b/db/migrate/20171106133911_add_password_authentication_enabled_for_git_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddPasswordAuthenticationEnabledForGitToApplicationSettings < ActiveRecord::Migration
+class AddPasswordAuthenticationEnabledForGitToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb b/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
index bfb3dcae511f44f328fa73b68fc8a80151bb802a..1de7d5e768eea4a73816d61b2254dfc74449ef1a 100644
--- a/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
+++ b/db/migrate/20171106135924_issues_milestone_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IssuesMilestoneIdForeignKey < ActiveRecord::Migration
+class IssuesMilestoneIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106150657_issues_updated_by_id_foreign_key.rb b/db/migrate/20171106150657_issues_updated_by_id_foreign_key.rb
index 3b8844d7d9f5729a2b66f0b39663973455855ad2..b2992b1ff5dc647f5189e2c45068b36ed562f8ad 100644
--- a/db/migrate/20171106150657_issues_updated_by_id_foreign_key.rb
+++ b/db/migrate/20171106150657_issues_updated_by_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IssuesUpdatedByIdForeignKey < ActiveRecord::Migration
+class IssuesUpdatedByIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106151218_issues_moved_to_id_foreign_key.rb b/db/migrate/20171106151218_issues_moved_to_id_foreign_key.rb
index 6395462384bbfdc84a68e58f03241f562d22bade..66bfb5718dce2f36a9a2342358aac61c05e0cdd6 100644
--- a/db/migrate/20171106151218_issues_moved_to_id_foreign_key.rb
+++ b/db/migrate/20171106151218_issues_moved_to_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class IssuesMovedToIdForeignKey < ActiveRecord::Migration
+class IssuesMovedToIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106155656_turn_issues_due_date_index_to_partial_index.rb b/db/migrate/20171106155656_turn_issues_due_date_index_to_partial_index.rb
index 08784de404365f9d56a55bc72c48a0646357ca33..58392de5e6b4f8c85e7c950d753132be4c7716e4 100644
--- a/db/migrate/20171106155656_turn_issues_due_date_index_to_partial_index.rb
+++ b/db/migrate/20171106155656_turn_issues_due_date_index_to_partial_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class TurnIssuesDueDateIndexToPartialIndex < ActiveRecord::Migration
+class TurnIssuesDueDateIndexToPartialIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171106171453_add_timezone_to_issues_closed_at.rb b/db/migrate/20171106171453_add_timezone_to_issues_closed_at.rb
index 0f1e937545b398a74856e8315140f101b222e46d..c6edc1af6cbea17e307ba153040dadb4fb621083 100644
--- a/db/migrate/20171106171453_add_timezone_to_issues_closed_at.rb
+++ b/db/migrate/20171106171453_add_timezone_to_issues_closed_at.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddTimezoneToIssuesClosedAt < ActiveRecord::Migration
+class AddTimezoneToIssuesClosedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114150259_merge_requests_author_id_foreign_key.rb b/db/migrate/20171114150259_merge_requests_author_id_foreign_key.rb
index 021eaa04a0c6f38418eef02bf40c6ec3b6b3bb29..4ebb6fad0596f8b86c93ff0d7071ccd7b18772f0 100644
--- a/db/migrate/20171114150259_merge_requests_author_id_foreign_key.rb
+++ b/db/migrate/20171114150259_merge_requests_author_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsAuthorIdForeignKey < ActiveRecord::Migration
+class MergeRequestsAuthorIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114160005_merge_requests_assignee_id_foreign_key.rb b/db/migrate/20171114160005_merge_requests_assignee_id_foreign_key.rb
index 1a242f01051da4cd15abe84cde937c54113e4d61..73c177c44f9b645d6008e955ab93218a76150ab2 100644
--- a/db/migrate/20171114160005_merge_requests_assignee_id_foreign_key.rb
+++ b/db/migrate/20171114160005_merge_requests_assignee_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsAssigneeIdForeignKey < ActiveRecord::Migration
+class MergeRequestsAssigneeIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114160904_merge_requests_updated_by_id_foreign_key.rb b/db/migrate/20171114160904_merge_requests_updated_by_id_foreign_key.rb
index eb3872e38da9aeef31a6c7f73bf83d8abb66d5fa..69f9c181c105cfa45c7c31aa72e7746bb535e239 100644
--- a/db/migrate/20171114160904_merge_requests_updated_by_id_foreign_key.rb
+++ b/db/migrate/20171114160904_merge_requests_updated_by_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsUpdatedByIdForeignKey < ActiveRecord::Migration
+class MergeRequestsUpdatedByIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114161720_merge_requests_merge_user_id_foreign_key.rb b/db/migrate/20171114161720_merge_requests_merge_user_id_foreign_key.rb
index 925b3e537d7adc877eb79017674e66317ab48d2a..ccd275d5bb4234d6d5737f14e0e79a833e705c56 100644
--- a/db/migrate/20171114161720_merge_requests_merge_user_id_foreign_key.rb
+++ b/db/migrate/20171114161720_merge_requests_merge_user_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsMergeUserIdForeignKey < ActiveRecord::Migration
+class MergeRequestsMergeUserIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114161914_merge_requests_source_project_id_foreign_key.rb b/db/migrate/20171114161914_merge_requests_source_project_id_foreign_key.rb
index 99740f64fe6d59fa1186c48b8a64f102600e83c6..250928a6551b54f3b19ca98ae91ba167415e4061 100644
--- a/db/migrate/20171114161914_merge_requests_source_project_id_foreign_key.rb
+++ b/db/migrate/20171114161914_merge_requests_source_project_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsSourceProjectIdForeignKey < ActiveRecord::Migration
+class MergeRequestsSourceProjectIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171114162227_merge_requests_milestone_id_foreign_key.rb b/db/migrate/20171114162227_merge_requests_milestone_id_foreign_key.rb
index c005cf7d17369605bc561f5f3605425169aff742..cafe0ce0853056f8f2e506ecf0169ecc2974dc51 100644
--- a/db/migrate/20171114162227_merge_requests_milestone_id_foreign_key.rb
+++ b/db/migrate/20171114162227_merge_requests_milestone_id_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsMilestoneIdForeignKey < ActiveRecord::Migration
+class MergeRequestsMilestoneIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171115164540_populate_merge_requests_latest_merge_request_diff_id_take_two.rb b/db/migrate/20171115164540_populate_merge_requests_latest_merge_request_diff_id_take_two.rb
index 27b6b4ebddc23d1597ab281b9c9a5f9aae62827c..935092ce46a4cb44bc95ff9b1edc6ba8c668befa 100644
--- a/db/migrate/20171115164540_populate_merge_requests_latest_merge_request_diff_id_take_two.rb
+++ b/db/migrate/20171115164540_populate_merge_requests_latest_merge_request_diff_id_take_two.rb
@@ -1,5 +1,5 @@
 # This is identical to the stolen background migration, which already has specs.
-class PopulateMergeRequestsLatestMergeRequestDiffIdTakeTwo < ActiveRecord::Migration
+class PopulateMergeRequestsLatestMergeRequestDiffIdTakeTwo < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171116135628_add_environment_scope_to_clusters.rb b/db/migrate/20171116135628_add_environment_scope_to_clusters.rb
index cce757095dd4c423abf81ff96edf7c49c61e2437..39bb8759cc032d042cd0a34a9d2f22f80b887e62 100644
--- a/db/migrate/20171116135628_add_environment_scope_to_clusters.rb
+++ b/db/migrate/20171116135628_add_environment_scope_to_clusters.rb
@@ -1,4 +1,4 @@
-class AddEnvironmentScopeToClusters < ActiveRecord::Migration
+class AddEnvironmentScopeToClusters < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171121135738_clean_up_from_merge_request_diffs_and_commits.rb b/db/migrate/20171121135738_clean_up_from_merge_request_diffs_and_commits.rb
index 30cf08b29fcb15d6ac52651bd1e64e049ee3af16..6be7b75492d4cfa69df1cada6d1c39ac588b8b31 100644
--- a/db/migrate/20171121135738_clean_up_from_merge_request_diffs_and_commits.rb
+++ b/db/migrate/20171121135738_clean_up_from_merge_request_diffs_and_commits.rb
@@ -1,4 +1,4 @@
-class CleanUpFromMergeRequestDiffsAndCommits < ActiveRecord::Migration
+class CleanUpFromMergeRequestDiffsAndCommits < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171121144800_ci_pipelines_index_on_project_id_ref_status_id.rb b/db/migrate/20171121144800_ci_pipelines_index_on_project_id_ref_status_id.rb
index 5a8ae6e4b571291bff3914aeddf08871422590a0..a1dcfc70650a72a526e6f7db1f8f3c602559830f 100644
--- a/db/migrate/20171121144800_ci_pipelines_index_on_project_id_ref_status_id.rb
+++ b/db/migrate/20171121144800_ci_pipelines_index_on_project_id_ref_status_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CiPipelinesIndexOnProjectIdRefStatusId < ActiveRecord::Migration
+class CiPipelinesIndexOnProjectIdRefStatusId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171122131600_add_new_project_guidelines_to_appearances.rb b/db/migrate/20171122131600_add_new_project_guidelines_to_appearances.rb
index 328cc65a5494cedc528f3e3802e6c94b9a53d66d..cbcbb5d988a0ff054c56f9739a8368276d834267 100644
--- a/db/migrate/20171122131600_add_new_project_guidelines_to_appearances.rb
+++ b/db/migrate/20171122131600_add_new_project_guidelines_to_appearances.rb
@@ -1,4 +1,4 @@
-class AddNewProjectGuidelinesToAppearances < ActiveRecord::Migration
+class AddNewProjectGuidelinesToAppearances < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171123094802_add_circuitbreaker_check_interval_to_application_settings.rb b/db/migrate/20171123094802_add_circuitbreaker_check_interval_to_application_settings.rb
index 213d46018fcfd7cbfb2dc6b029218cd914e59ab9..94360c6492655e08fa4a3b3c6b87a1ebb390d6f0 100644
--- a/db/migrate/20171123094802_add_circuitbreaker_check_interval_to_application_settings.rb
+++ b/db/migrate/20171123094802_add_circuitbreaker_check_interval_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddCircuitbreakerCheckIntervalToApplicationSettings < ActiveRecord::Migration
+class AddCircuitbreakerCheckIntervalToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171124125042_add_default_values_to_merge_request_states.rb b/db/migrate/20171124125042_add_default_values_to_merge_request_states.rb
index d08863c3b78638f9be8537d2677a76c6a40a49ce..d0d06863777f98c1e18e13829c149459a149d42c 100644
--- a/db/migrate/20171124125042_add_default_values_to_merge_request_states.rb
+++ b/db/migrate/20171124125042_add_default_values_to_merge_request_states.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDefaultValuesToMergeRequestStates < ActiveRecord::Migration
+class AddDefaultValuesToMergeRequestStates < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171124125748_populate_missing_merge_request_statuses.rb b/db/migrate/20171124125748_populate_missing_merge_request_statuses.rb
index 72fbab59f4ca3558ec5192ea56b5d19e5c43a7a7..67444f36e24500bf179eaee421b29954f51c25e2 100644
--- a/db/migrate/20171124125748_populate_missing_merge_request_statuses.rb
+++ b/db/migrate/20171124125748_populate_missing_merge_request_statuses.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PopulateMissingMergeRequestStatuses < ActiveRecord::Migration
+class PopulateMissingMergeRequestStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171124132536_make_merge_request_statuses_not_null.rb b/db/migrate/20171124132536_make_merge_request_statuses_not_null.rb
index 4bb091260368bdb6219230ff5b9e8484ef9f9ee6..49b693c5950765984672dd5fd4b081962457265d 100644
--- a/db/migrate/20171124132536_make_merge_request_statuses_not_null.rb
+++ b/db/migrate/20171124132536_make_merge_request_statuses_not_null.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MakeMergeRequestStatusesNotNull < ActiveRecord::Migration
+class MakeMergeRequestStatusesNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171127151038_add_events_related_columns_to_merge_request_metrics.rb b/db/migrate/20171127151038_add_events_related_columns_to_merge_request_metrics.rb
index 18af697cf88206ab754741a0437ea73b82cd9dc9..385de9dd73dfb89cd6fe986ad172d52fefe9f329 100644
--- a/db/migrate/20171127151038_add_events_related_columns_to_merge_request_metrics.rb
+++ b/db/migrate/20171127151038_add_events_related_columns_to_merge_request_metrics.rb
@@ -1,4 +1,4 @@
-class AddEventsRelatedColumnsToMergeRequestMetrics < ActiveRecord::Migration
+class AddEventsRelatedColumnsToMergeRequestMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171204204233_add_permanent_to_redirect_route.rb b/db/migrate/20171204204233_add_permanent_to_redirect_route.rb
index f3ae471201e23f69b8dbf963faa6e4dfb71a432c..bc0658035d635ccc7b9b8504ae7dced850cc1aeb 100644
--- a/db/migrate/20171204204233_add_permanent_to_redirect_route.rb
+++ b/db/migrate/20171204204233_add_permanent_to_redirect_route.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPermanentToRedirectRoute < ActiveRecord::Migration
+class AddPermanentToRedirectRoute < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20171206221519_add_permanent_index_to_redirect_route.rb b/db/migrate/20171206221519_add_permanent_index_to_redirect_route.rb
index 33ce7e1aa68eb44d16712dcff1e65cde4eda5b8c..ba924c4eeccbeac0e01533fa9d4b46104e5518ed 100644
--- a/db/migrate/20171206221519_add_permanent_index_to_redirect_route.rb
+++ b/db/migrate/20171206221519_add_permanent_index_to_redirect_route.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPermanentIndexToRedirectRoute < ActiveRecord::Migration
+class AddPermanentIndexToRedirectRoute < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171207185153_add_merge_request_state_index.rb b/db/migrate/20171207185153_add_merge_request_state_index.rb
index 72f846c5c38d4f04c5809d1306cbbd3669eb0d8f..167470cf7fe6fc57b6417607e295bcc33077f3d4 100644
--- a/db/migrate/20171207185153_add_merge_request_state_index.rb
+++ b/db/migrate/20171207185153_add_merge_request_state_index.rb
@@ -1,4 +1,4 @@
-class AddMergeRequestStateIndex < ActiveRecord::Migration
+class AddMergeRequestStateIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171211145425_add_can_push_to_deploy_keys_projects.rb b/db/migrate/20171211145425_add_can_push_to_deploy_keys_projects.rb
index 5dc723db9f992f4993e61c0340b66cd94c04402f..63e86b23aad1c31edc52295cad39af2be64896e4 100644
--- a/db/migrate/20171211145425_add_can_push_to_deploy_keys_projects.rb
+++ b/db/migrate/20171211145425_add_can_push_to_deploy_keys_projects.rb
@@ -1,4 +1,4 @@
-class AddCanPushToDeployKeysProjects < ActiveRecord::Migration
+class AddCanPushToDeployKeysProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171212203433_create_clusters_applications_prometheus.rb b/db/migrate/20171212203433_create_clusters_applications_prometheus.rb
index dc2531d26912be0ec8d1611bc84315d8ed0d1d81..6eb9fec609ee00858d00867121fa877762f46534 100644
--- a/db/migrate/20171212203433_create_clusters_applications_prometheus.rb
+++ b/db/migrate/20171212203433_create_clusters_applications_prometheus.rb
@@ -1,4 +1,4 @@
-class CreateClustersApplicationsPrometheus < ActiveRecord::Migration
+class CreateClustersApplicationsPrometheus < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171214144320_add_store_column_to_uploads.rb b/db/migrate/20171214144320_add_store_column_to_uploads.rb
index e35798e2c41095a98bb315cb9fe9f6bd6994c96c..11b3951a3fa59b85af2266399ac8f324f861f1a5 100644
--- a/db/migrate/20171214144320_add_store_column_to_uploads.rb
+++ b/db/migrate/20171214144320_add_store_column_to_uploads.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddStoreColumnToUploads < ActiveRecord::Migration
+class AddStoreColumnToUploads < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb b/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb
index 680855af94524f1bfb2cfaf0a317e00ea566a3af..e2d7879b140514f7a4685bac4e602469f134bbb1 100644
--- a/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb
+++ b/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PopulateCanPushFromDeployKeysProjects < ActiveRecord::Migration
+class PopulateCanPushFromDeployKeysProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171216111734_clean_up_for_members.rb b/db/migrate/20171216111734_clean_up_for_members.rb
index 22e0997dce6d1042e0e04d72fcbef86bded65bcc..2fefc6c7fd1c69c28c585dfc6a1542ca2a05d342 100644
--- a/db/migrate/20171216111734_clean_up_for_members.rb
+++ b/db/migrate/20171216111734_clean_up_for_members.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanUpForMembers < ActiveRecord::Migration
+class CleanUpForMembers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171216112339_add_foreign_key_for_members.rb b/db/migrate/20171216112339_add_foreign_key_for_members.rb
index be17769be6a694fba734a238615183f4c25ec2ca..06c2c5068dae5c3a2bad7a0907a0aec6f77f171e 100644
--- a/db/migrate/20171216112339_add_foreign_key_for_members.rb
+++ b/db/migrate/20171216112339_add_foreign_key_for_members.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddForeignKeyForMembers < ActiveRecord::Migration
+class AddForeignKeyForMembers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb b/db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb
index 130b24fe6f0d15ad577750fa23470b2287a9d411..7543e435941643aecb4b9fe70d9bff7effbc1464 100644
--- a/db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb
+++ b/db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb
@@ -1,4 +1,4 @@
-class AddIndexOnNamespacesLowerName < ActiveRecord::Migration
+class AddIndexOnNamespacesLowerName < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
   INDEX_NAME = 'index_on_namespaces_lower_name'
diff --git a/db/migrate/20171222115326_add_confidential_note_events_to_web_hooks.rb b/db/migrate/20171222115326_add_confidential_note_events_to_web_hooks.rb
index 900a6386922cff15437c6f4861c256a0215a1d58..788a842a3ad137b4aa95e108e3191db86a767b97 100644
--- a/db/migrate/20171222115326_add_confidential_note_events_to_web_hooks.rb
+++ b/db/migrate/20171222115326_add_confidential_note_events_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddConfidentialNoteEventsToWebHooks < ActiveRecord::Migration
+class AddConfidentialNoteEventsToWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20171222183504_add_jobs_cache_index_to_project.rb b/db/migrate/20171222183504_add_jobs_cache_index_to_project.rb
index 607e9d027d73b6df1225effcaa3d748afeb3ff85..78a195c351cbc2b007b9663bb51e3edcf10b4e26 100644
--- a/db/migrate/20171222183504_add_jobs_cache_index_to_project.rb
+++ b/db/migrate/20171222183504_add_jobs_cache_index_to_project.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddJobsCacheIndexToProject < ActiveRecord::Migration
+class AddJobsCacheIndexToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171229225929_change_user_project_limit_not_null_and_remove_default.rb b/db/migrate/20171229225929_change_user_project_limit_not_null_and_remove_default.rb
index 54fbbcf1a0d275706786430780b5c409efba494d..b9efdb8bb8f35bb4e4c6b532f6a6d13998454a7b 100644
--- a/db/migrate/20171229225929_change_user_project_limit_not_null_and_remove_default.rb
+++ b/db/migrate/20171229225929_change_user_project_limit_not_null_and_remove_default.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ChangeUserProjectLimitNotNullAndRemoveDefault < ActiveRecord::Migration
+class ChangeUserProjectLimitNotNullAndRemoveDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb b/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
index 94a7c1019d8993dfdd650129d22b6272c3df9ac9..4e1107e1ff5d24d6ce11dd48a5bd0dc7e79400b5 100644
--- a/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
+++ b/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
@@ -1,4 +1,4 @@
-class AddRebaseCommitShaToMergeRequestsCe < ActiveRecord::Migration
+class AddRebaseCommitShaToMergeRequestsCe < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20180101160629_create_prometheus_metrics.rb b/db/migrate/20180101160629_create_prometheus_metrics.rb
index c3be0939b1713ea3c2b5cacea83a87edf97403f3..e3b1ed710d62656288485f815127566b5c47678d 100644
--- a/db/migrate/20180101160629_create_prometheus_metrics.rb
+++ b/db/migrate/20180101160629_create_prometheus_metrics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreatePrometheusMetrics < ActiveRecord::Migration
+class CreatePrometheusMetrics < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb b/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb
index 66820f13f5445465bf87c3a242e1493468eb65da..d225899af182c9761f8f4a24f6a2acf16bde0280 100644
--- a/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb
+++ b/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class ChangeProjectIdForPrometheusMetrics < ActiveRecord::Migration
+class ChangeProjectIdForPrometheusMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180102220145_add_pages_https_only_to_projects.rb b/db/migrate/20180102220145_add_pages_https_only_to_projects.rb
index ef6bc6896c04c0ab6e0786c1ffbef826e222bcd4..75488f57fa9ff5701b1bfbf037952929eea8a3d4 100644
--- a/db/migrate/20180102220145_add_pages_https_only_to_projects.rb
+++ b/db/migrate/20180102220145_add_pages_https_only_to_projects.rb
@@ -1,4 +1,4 @@
-class AddPagesHttpsOnlyToProjects < ActiveRecord::Migration
+class AddPagesHttpsOnlyToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180103123548_add_confidential_note_events_to_services.rb b/db/migrate/20180103123548_add_confidential_note_events_to_services.rb
index b54ad88df437dff73d50113eb27b23904a2676a6..02724575e6cc02e1be71e02c789d7d783fcc6104 100644
--- a/db/migrate/20180103123548_add_confidential_note_events_to_services.rb
+++ b/db/migrate/20180103123548_add_confidential_note_events_to_services.rb
@@ -1,4 +1,4 @@
-class AddConfidentialNoteEventsToServices < ActiveRecord::Migration
+class AddConfidentialNoteEventsToServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb b/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb
index f942b4c062e99398abe97fbd4d652258143a87c6..e27eecde90602b396d7fa93a30433b044f9be014 100644
--- a/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb
+++ b/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb
@@ -1,4 +1,4 @@
-class AddCommitsCountToMergeRequestDiff < ActiveRecord::Migration
+class AddCommitsCountToMergeRequestDiff < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb b/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb
index c242e1b0d24c102defbe479c5eb23d7a5996ba75..558eb60ac3f4fe0ce5e47ec9e954503ca61db5fe 100644
--- a/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb
+++ b/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb
@@ -1,4 +1,4 @@
-class ChangeDefaultValueForPagesHttpsOnly < ActiveRecord::Migration
+class ChangeDefaultValueForPagesHttpsOnly < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
index 53f82a31203ee025cfaa78e8106929bb2cd7166a..4c3bb0a26ce4081bd5a69f4379a6d92392229182 100644
--- a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
+++ b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ReworkRedirectRoutesIndexes < ActiveRecord::Migration
+class ReworkRedirectRoutesIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180115201419_add_index_updated_at_to_issues.rb b/db/migrate/20180115201419_add_index_updated_at_to_issues.rb
index a5a48fc97be0fe504d6874774cb5f3bf0ad6698a..8707307eed06cc7f1b096adebb9568e8ba9448ea 100644
--- a/db/migrate/20180115201419_add_index_updated_at_to_issues.rb
+++ b/db/migrate/20180115201419_add_index_updated_at_to_issues.rb
@@ -1,4 +1,4 @@
-class AddIndexUpdatedAtToIssues < ActiveRecord::Migration
+class AddIndexUpdatedAtToIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180116193854_create_lfs_file_locks.rb b/db/migrate/20180116193854_create_lfs_file_locks.rb
index 23b0c90484b0740b8eea40492d265243ef75d6c3..2dd0e71916b4228e633b16a21e9ae495d962eb79 100644
--- a/db/migrate/20180116193854_create_lfs_file_locks.rb
+++ b/db/migrate/20180116193854_create_lfs_file_locks.rb
@@ -1,4 +1,4 @@
-class CreateLfsFileLocks < ActiveRecord::Migration
+class CreateLfsFileLocks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb
index a678c3d049f6830062a0aee20965842bd8098a42..7dd0a06e3bfe43097df37bd889c641d1beb4ed77 100644
--- a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb
+++ b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUploaderIndexToUploads < ActiveRecord::Migration
+class AddUploaderIndexToUploads < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180119160751_optimize_ci_job_artifacts.rb b/db/migrate/20180119160751_optimize_ci_job_artifacts.rb
index 9b4340ed7b7f9cbe6e5e3e2fb2cc0d970f8cbd24..3598689d78c0a04c2c230b8b9de797740a493d80 100644
--- a/db/migrate/20180119160751_optimize_ci_job_artifacts.rb
+++ b/db/migrate/20180119160751_optimize_ci_job_artifacts.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class OptimizeCiJobArtifacts < ActiveRecord::Migration
+class OptimizeCiJobArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb b/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb
index 7e16cb830872107b220665cc42974b271c8c530d..c76dc5b3a68cd337e741853fc623275abb63ebe6 100644
--- a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb
+++ b/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration
+class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180125214301_create_user_callouts.rb b/db/migrate/20180125214301_create_user_callouts.rb
index 856eff36ae02b0afe97d71f86c73b5255f6cbee8..6eb2f932ccc9b30faaea73ea7692faa8882305df 100644
--- a/db/migrate/20180125214301_create_user_callouts.rb
+++ b/db/migrate/20180125214301_create_user_callouts.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateUserCallouts < ActiveRecord::Migration
+class CreateUserCallouts < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = false
 
diff --git a/db/migrate/20180129193323_add_uploads_builder_context.rb b/db/migrate/20180129193323_add_uploads_builder_context.rb
index b3909a770ca1284c1c6d36ebd14e5bf9776b8bcc..c7227bf0f1ebcdfa2342472126e846f64bf17f39 100644
--- a/db/migrate/20180129193323_add_uploads_builder_context.rb
+++ b/db/migrate/20180129193323_add_uploads_builder_context.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUploadsBuilderContext < ActiveRecord::Migration
+class AddUploadsBuilderContext < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb b/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb
index 02e53b8fa8acdf0f16ca350d8bbe16125d47d9f8..1f2a79d36a5da628f4634d4adbc7e61f9e105b6b 100644
--- a/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb
+++ b/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb
@@ -1,4 +1,4 @@
-class AddUniqueConstraintToTrendingProjectsProjectId < ActiveRecord::Migration
+class AddUniqueConstraintToTrendingProjectsProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180201110056_add_foreign_keys_to_todos.rb b/db/migrate/20180201110056_add_foreign_keys_to_todos.rb
index 020b055032109958d6ca3044f4a84400b0f1d64f..6b217632a520bb1ecab9030cd24a9fd18f19872d 100644
--- a/db/migrate/20180201110056_add_foreign_keys_to_todos.rb
+++ b/db/migrate/20180201110056_add_foreign_keys_to_todos.rb
@@ -1,4 +1,4 @@
-class AddForeignKeysToTodos < ActiveRecord::Migration
+class AddForeignKeysToTodos < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class Todo < ActiveRecord::Base
diff --git a/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb b/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb
index 36a85b619686973c7b923705bca67cb2d649ecb4..d398909f25bd905dea3ef149a0ce0293f3cc5ef7 100644
--- a/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb
+++ b/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateRemainingIssuesClosedAt < ActiveRecord::Migration
+class MigrateRemainingIssuesClosedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180206200543_reset_events_primary_key_sequence.rb b/db/migrate/20180206200543_reset_events_primary_key_sequence.rb
index eb5c4a6a1e72dfe005850e2b519f0dd447a3cbb5..d395c5725e4f8dfd92029a7281d7fc8f4fccf1a7 100644
--- a/db/migrate/20180206200543_reset_events_primary_key_sequence.rb
+++ b/db/migrate/20180206200543_reset_events_primary_key_sequence.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ResetEventsPrimaryKeySequence < ActiveRecord::Migration
+class ResetEventsPrimaryKeySequence < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb b/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb
index e46e793d9d21099e4ecdd8f7ed3bb8c8bd063990..b69ac8f94c19dbd724a9a6f9510f4f603acfb741 100644
--- a/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb
+++ b/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class SchedulePopulateUntrackedUploadsIfNeeded < ActiveRecord::Migration
+class SchedulePopulateUntrackedUploadsIfNeeded < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180209165249_add_closed_by_to_issues.rb b/db/migrate/20180209165249_add_closed_by_to_issues.rb
index e251afd7b49894facb79425e66a06efc1c3ffa5d..91a1e021ab96a9eead5a63fdc6c3a767e1db29b5 100644
--- a/db/migrate/20180209165249_add_closed_by_to_issues.rb
+++ b/db/migrate/20180209165249_add_closed_by_to_issues.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddClosedByToIssues < ActiveRecord::Migration
+class AddClosedByToIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb b/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb
index dbe09a43aa7ec3b42f1db44dbe7035a6ede8b29e..e2a9a68b1adbfc5049b8d103a754492aa1b5613b 100644
--- a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb
+++ b/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb
@@ -1,4 +1,4 @@
-class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration
+class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb b/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb
index cedf2510dda1a33fb9c2ada894c3d3420ff05100..905915d923923898e4adcf2b13904a73844d6465 100644
--- a/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb
+++ b/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectsForIndexOnlyScans < ActiveRecord::Migration
+class AddPartialIndexToProjectsForIndexOnlyScans < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180214093516_create_badges.rb b/db/migrate/20180214093516_create_badges.rb
index a1d77328f778e589d032af36220904bdc9d16149..66e017b115ad2525c7fc6fe33c0ea6e612a05aa0 100644
--- a/db/migrate/20180214093516_create_badges.rb
+++ b/db/migrate/20180214093516_create_badges.rb
@@ -1,4 +1,4 @@
-class CreateBadges < ActiveRecord::Migration
+class CreateBadges < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180214155405_create_clusters_applications_runners.rb b/db/migrate/20180214155405_create_clusters_applications_runners.rb
index fc4c088133896f9ec4e705993b4c8f72ab8544c0..ce594c918902014bfb0544bffd826766b28572b4 100644
--- a/db/migrate/20180214155405_create_clusters_applications_runners.rb
+++ b/db/migrate/20180214155405_create_clusters_applications_runners.rb
@@ -1,4 +1,4 @@
-class CreateClustersApplicationsRunners < ActiveRecord::Migration
+class CreateClustersApplicationsRunners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180215181245_users_name_lower_index.rb b/db/migrate/20180215181245_users_name_lower_index.rb
index d3f68cb7d45f0f2c070d63c34844f7d3690c7ff4..3b80601a7271b6d6586540ddf27e27719cd433dd 100644
--- a/db/migrate/20180215181245_users_name_lower_index.rb
+++ b/db/migrate/20180215181245_users_name_lower_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UsersNameLowerIndex < ActiveRecord::Migration
+class UsersNameLowerIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180216120000_add_pages_domain_verification.rb b/db/migrate/20180216120000_add_pages_domain_verification.rb
index 8b7cae922854d9d7566242a3c5b126e12527eff7..f709f5a5809db10dd56b37edb7b2e97cb39af449 100644
--- a/db/migrate/20180216120000_add_pages_domain_verification.rb
+++ b/db/migrate/20180216120000_add_pages_domain_verification.rb
@@ -1,4 +1,4 @@
-class AddPagesDomainVerification < ActiveRecord::Migration
+class AddPagesDomainVerification < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb b/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb
index 825dfb52dce4de78cd3ce7e2eca5e8b7440cf314..6e7cb89c7657fb4c4cdaac39d20582199ea28cda 100644
--- a/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb
+++ b/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb
@@ -1,4 +1,4 @@
-class AddPagesDomainVerifiedAtIndex < ActiveRecord::Migration
+class AddPagesDomainVerifiedAtIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb b/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb
index 06d458028b351f219cb8b3cfd9f27a7642e00cad..18e4f534105fcfdee8095a06852497e51d0e1f9f 100644
--- a/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb
+++ b/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb
@@ -1,4 +1,4 @@
-class AllowDomainVerificationToBeDisabled < ActiveRecord::Migration
+class AllowDomainVerificationToBeDisabled < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180216120030_add_pages_domain_enabled_until.rb b/db/migrate/20180216120030_add_pages_domain_enabled_until.rb
index b40653044dd5b45ead5e8be028aa4629f36d551a..3347bb6deaab03ff47961c71bafedeacd06c8458 100644
--- a/db/migrate/20180216120030_add_pages_domain_enabled_until.rb
+++ b/db/migrate/20180216120030_add_pages_domain_enabled_until.rb
@@ -1,4 +1,4 @@
-class AddPagesDomainEnabledUntil < ActiveRecord::Migration
+class AddPagesDomainEnabledUntil < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb b/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb
index 00f6e4979da43df1643edce54ec80310b2c5810e..3880a8ea139e11dc63bb3381310166ef9576fca1 100644
--- a/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb
+++ b/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb
@@ -1,4 +1,4 @@
-class AddPagesDomainEnabledUntilIndex < ActiveRecord::Migration
+class AddPagesDomainEnabledUntilIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180216120050_pages_domains_verification_grace_period.rb b/db/migrate/20180216120050_pages_domains_verification_grace_period.rb
index d7f8634b5369d9ac9af75d90ec3e7195db48fe84..e51cff68b50049d75316de8bf536e699bd3c54a2 100644
--- a/db/migrate/20180216120050_pages_domains_verification_grace_period.rb
+++ b/db/migrate/20180216120050_pages_domains_verification_grace_period.rb
@@ -1,4 +1,4 @@
-class PagesDomainsVerificationGracePeriod < ActiveRecord::Migration
+class PagesDomainsVerificationGracePeriod < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class PagesDomain < ActiveRecord::Base
diff --git a/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb b/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
index 072e696a43e5bffd04a0624a0a5112449f2938e5..68578c232077345ecda4b54b55e598a197baf162 100644
--- a/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
+++ b/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
@@ -1,4 +1,4 @@
-class AddMaximumTimeoutToCiRunners < ActiveRecord::Migration
+class AddMaximumTimeoutToCiRunners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb b/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb
index 81acfbc3655789e3a1df91b00a2c89b08b1a5a47..71f6bc46a88086d9a04eb34c602b81744c242957 100644
--- a/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb
+++ b/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddAllowMaintainerToPushToMergeRequests < ActiveRecord::Migration
+class AddAllowMaintainerToPushToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180222043024_add_ip_address_to_runner.rb b/db/migrate/20180222043024_add_ip_address_to_runner.rb
index bf00560b5a86ea32aa69056fab1748400707be2f..b52366c0be10a82a95a6a4d2ba57ff0eb60e7336 100644
--- a/db/migrate/20180222043024_add_ip_address_to_runner.rb
+++ b/db/migrate/20180222043024_add_ip_address_to_runner.rb
@@ -1,4 +1,4 @@
-class AddIpAddressToRunner < ActiveRecord::Migration
+class AddIpAddressToRunner < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180223120443_create_user_interacted_projects_table.rb b/db/migrate/20180223120443_create_user_interacted_projects_table.rb
index 8da8cf6808821e8c0311711f5d64d946ef3d7d6b..185a690ad3d1793167a54c371b8b2b24efe5ad57 100644
--- a/db/migrate/20180223120443_create_user_interacted_projects_table.rb
+++ b/db/migrate/20180223120443_create_user_interacted_projects_table.rb
@@ -1,4 +1,4 @@
-class CreateUserInteractedProjectsTable < ActiveRecord::Migration
+class CreateUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb b/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb
index c994a54698b1522d21b8d012f87f3882e24e33ba..3bd7d6fd827a2a855c1d7ee6a9efd46f706f524c 100644
--- a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb
+++ b/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddAllowLocalRequestsFromHooksAndServicesToApplicationSettings < ActiveRecord::Migration
+class AddAllowLocalRequestsFromHooksAndServicesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb b/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
index 54e6e35449e49a0437df83f32d1c6fbbbaa7039e..bccb7ac26eca2b06f9ad66dcf988187f323f5a5e 100644
--- a/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
+++ b/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
@@ -1,4 +1,4 @@
-class AddChecksumToCiJobArtifacts < ActiveRecord::Migration
+class AddChecksumToCiJobArtifacts < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180227182112_add_group_id_to_boards_ce.rb b/db/migrate/20180227182112_add_group_id_to_boards_ce.rb
index 5b2691b3a00acba459882153027541fcbf5259d9..b887be0cc556eb459c71641bb4a7c9fb52d90058 100644
--- a/db/migrate/20180227182112_add_group_id_to_boards_ce.rb
+++ b/db/migrate/20180227182112_add_group_id_to_boards_ce.rb
@@ -1,4 +1,4 @@
-class AddGroupIdToBoardsCe < ActiveRecord::Migration
+class AddGroupIdToBoardsCe < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/migrate/20180228172924_add_include_private_contributions_to_users.rb b/db/migrate/20180228172924_add_include_private_contributions_to_users.rb
index ea3ebdd83d1b91524f79629e85633e206666e63f..7921d3a14b63ba31c0b37f6bd8530209bbd0d752 100644
--- a/db/migrate/20180228172924_add_include_private_contributions_to_users.rb
+++ b/db/migrate/20180228172924_add_include_private_contributions_to_users.rb
@@ -1,4 +1,4 @@
-class AddIncludePrivateContributionsToUsers < ActiveRecord::Migration
+class AddIncludePrivateContributionsToUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180301010859_create_ci_builds_metadata_table.rb b/db/migrate/20180301010859_create_ci_builds_metadata_table.rb
index ce73744409233ce04672f370f11baa5d6835a8a5..29652c675e1160e7f2e7d783fc8ee8e3c824b85f 100644
--- a/db/migrate/20180301010859_create_ci_builds_metadata_table.rb
+++ b/db/migrate/20180301010859_create_ci_builds_metadata_table.rb
@@ -1,4 +1,4 @@
-class CreateCiBuildsMetadataTable < ActiveRecord::Migration
+class CreateCiBuildsMetadataTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb b/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
index e6cec39e61f9e2338e8eeae23e9ae3e9c341f151..d660c7cfd2d472fe9faa5d7d23cb865c025abc19 100644
--- a/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
+++ b/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class EnsureForeignKeysOnClustersApplications < ActiveRecord::Migration
+class EnsureForeignKeysOnClustersApplications < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180305095250_create_internal_ids_table.rb b/db/migrate/20180305095250_create_internal_ids_table.rb
index 432086fe98b8de9c7446e95205efa3f8ef54dd1f..8565f5d848b339269914a6405c0cff85867d44c1 100644
--- a/db/migrate/20180305095250_create_internal_ids_table.rb
+++ b/db/migrate/20180305095250_create_internal_ids_table.rb
@@ -1,4 +1,4 @@
-class CreateInternalIdsTable < ActiveRecord::Migration
+class CreateInternalIdsTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180305144721_add_privileged_to_runner.rb b/db/migrate/20180305144721_add_privileged_to_runner.rb
index 32e73dba8d54bf564cad1bc564d2ffd095d24a23..359498bf9b0ddf085abb390849e0389bbc6c5a8b 100644
--- a/db/migrate/20180305144721_add_privileged_to_runner.rb
+++ b/db/migrate/20180305144721_add_privileged_to_runner.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPrivilegedToRunner < ActiveRecord::Migration
+class AddPrivilegedToRunner < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb b/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb
index 06e402adcd71c223844a9f894c473e8d1af90a57..b400ff94dbebf00d39f4a00087429ed802f1f27f 100644
--- a/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb
+++ b/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb
@@ -2,7 +2,7 @@
 #
 # It has been modified to handle no-downtime GitLab migrations. Several
 # indexes have been removed since they are not needed for GitLab.
-class AddMissingIndexesActsAsTaggableOnEngine < ActiveRecord::Migration
+class AddMissingIndexesActsAsTaggableOnEngine < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb b/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
index b616cc2fd30aab4cbcfa2fba1546fd0152e23947..4d2ab7d757fe8cc68b5158492c38cc6c65e0151e 100644
--- a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
+++ b/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
@@ -1,4 +1,4 @@
-class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration
+class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb b/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb
index fe50e909563e55ecb2d0bdc9837b83dcaedfe4de..5e4bf96f86f2d53937b782f172139c553f4f681e 100644
--- a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb
+++ b/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb
@@ -1,4 +1,4 @@
-class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration
+class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb b/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
index 990759104b0112ee94ac9d6229a53b9d625cbc85..ecb06dd43121c68545bd914ff82f88a6ccf0f685 100644
--- a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
+++ b/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
@@ -1,4 +1,4 @@
-class RescheduleCommitsCountForMergeRequestDiff < ActiveRecord::Migration
+class RescheduleCommitsCountForMergeRequestDiff < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180309160427_add_partial_indexes_on_todos.rb b/db/migrate/20180309160427_add_partial_indexes_on_todos.rb
index 671fa743cec881444b4e8b5069ae0c164d578626..c22ed0a5177fe2f69eec50b946a4c871443c9be7 100644
--- a/db/migrate/20180309160427_add_partial_indexes_on_todos.rb
+++ b/db/migrate/20180309160427_add_partial_indexes_on_todos.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPartialIndexesOnTodos < ActiveRecord::Migration
+class AddPartialIndexesOnTodos < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb
index d129459ea0ac50c962135e9b114120cdf7f11bab..a4d797679c5050e7b64714af483341be20840af4 100644
--- a/db/migrate/20180319190020_create_deploy_tokens.rb
+++ b/db/migrate/20180319190020_create_deploy_tokens.rb
@@ -1,4 +1,4 @@
-class CreateDeployTokens < ActiveRecord::Migration
+class CreateDeployTokens < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
index 824bbb3ac05a2cb6f722cd2e19e570019b69893f..a15e1d68a958ca8c92240f2b18e0470e7c7d5952 100644
--- a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
+++ b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
@@ -1,4 +1,4 @@
-class AddIndexesForUserActivityQueries < ActiveRecord::Migration
+class AddIndexesForUserActivityQueries < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb b/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb
index 12b8875d8dcd618deff23e57bb3cdbb6f90fb829..3b38d21a8aa82e157797143ae300ae2723355087 100644
--- a/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb
+++ b/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb
@@ -1,4 +1,4 @@
-class AddPushToMergeRequestToNotificationSettings < ActiveRecord::Migration
+class AddPushToMergeRequestToNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180326202229_create_ci_build_trace_chunks.rb b/db/migrate/20180326202229_create_ci_build_trace_chunks.rb
index fb3f5786e856c58ee85d5e78a668f14da4f74329..45a64ec23d1f40d498e15452a00ba865c7fa068c 100644
--- a/db/migrate/20180326202229_create_ci_build_trace_chunks.rb
+++ b/db/migrate/20180326202229_create_ci_build_trace_chunks.rb
@@ -1,4 +1,4 @@
-class CreateCiBuildTraceChunks < ActiveRecord::Migration
+class CreateCiBuildTraceChunks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180327101207_remove_index_from_events_table.rb b/db/migrate/20180327101207_remove_index_from_events_table.rb
index 172441da65b58329aa4f37c8624d36d0bd2d054d..0583a2641ecb812c723b044c8c9acbbe3f9c55a0 100644
--- a/db/migrate/20180327101207_remove_index_from_events_table.rb
+++ b/db/migrate/20180327101207_remove_index_from_events_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveIndexFromEventsTable < ActiveRecord::Migration
+class RemoveIndexFromEventsTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb b/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
index c64a481fcf08e516e7f22df04cb04244a32603e0..2d9ca0028721e04dc018d4998c05aec617edd7f6 100644
--- a/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
+++ b/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
@@ -1,4 +1,4 @@
-class AddIssueDueToNotificationSettings < ActiveRecord::Migration
+class AddIssueDueToNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180403035759_create_project_ci_cd_settings.rb b/db/migrate/20180403035759_create_project_ci_cd_settings.rb
index 173e662cffc783db00b3dcc5b5362c97db24d809..000286897791fa8ebf33b225cfc9193a9aab8ef2 100644
--- a/db/migrate/20180403035759_create_project_ci_cd_settings.rb
+++ b/db/migrate/20180403035759_create_project_ci_cd_settings.rb
@@ -1,4 +1,4 @@
-class CreateProjectCiCdSettings < ActiveRecord::Migration
+class CreateProjectCiCdSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180405142733_create_project_deploy_tokens.rb b/db/migrate/20180405142733_create_project_deploy_tokens.rb
index 9d8f89243a82f31053ee19fec40c5937111ec3a8..ba0004922478cc98f838b0332aef28b34b2c74c0 100644
--- a/db/migrate/20180405142733_create_project_deploy_tokens.rb
+++ b/db/migrate/20180405142733_create_project_deploy_tokens.rb
@@ -1,4 +1,4 @@
-class CreateProjectDeployTokens < ActiveRecord::Migration
+class CreateProjectDeployTokens < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180406204716_add_limits_ci_build_trace_chunks_raw_data_for_mysql.rb b/db/migrate/20180406204716_add_limits_ci_build_trace_chunks_raw_data_for_mysql.rb
index 0f2734853e6b6603b097033f90f4166a78cf20b3..0b541e943538cbe170a6e97ad35920815b26cba1 100644
--- a/db/migrate/20180406204716_add_limits_ci_build_trace_chunks_raw_data_for_mysql.rb
+++ b/db/migrate/20180406204716_add_limits_ci_build_trace_chunks_raw_data_for_mysql.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 require Rails.root.join('db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql')
 
-class AddLimitsCiBuildTraceChunksRawDataForMysql < ActiveRecord::Migration
+class AddLimitsCiBuildTraceChunksRawDataForMysql < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb b/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb
index e852d50b25ed0db25b4c6a169b7c1711f7bd0d8c..4b8844a134de849b2752970a115297b35e90207e 100644
--- a/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb
+++ b/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb
@@ -1,4 +1,4 @@
-class RenameUsersRssTokenToFeedToken < ActiveRecord::Migration
+class RenameUsersRssTokenToFeedToken < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb b/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb
index b7b346cb10ea1229cfdf1caf10c78f82400badb4..90d869a8c10e3af9855bf420d0a06c51cccf8695 100644
--- a/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb
+++ b/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb
@@ -1,4 +1,4 @@
-class CreateMissingNamespaceForInternalUsers < ActiveRecord::Migration
+class CreateMissingNamespaceForInternalUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb b/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb
index 37e2d19e022a6b742a589f79dcb9533f6cc7be39..7c28cbb67957a89d2b8d8bbedb387943e07d3180 100644
--- a/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb
+++ b/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb
@@ -1,4 +1,4 @@
-class AddFurtherScopeColumnsToInternalIdTable < ActiveRecord::Migration
+class AddFurtherScopeColumnsToInternalIdTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb b/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb
index 58de795472ab6362fe8a8887fcd40fbbe91208b6..ac6bb1a8cab0dd1e1971add6bc9a9a89ff43679e 100644
--- a/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb
+++ b/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb
@@ -1,4 +1,4 @@
-class AddIndexConstraintsToInternalIdTable < ActiveRecord::Migration
+class AddIndexConstraintsToInternalIdTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb b/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
index ee82c70ecf879244dcea09eec9f25417910f4c75..ce4708849992a4de7d6a46b7e6d5741b0317a7ed 100644
--- a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
+++ b/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
@@ -1,4 +1,4 @@
-class AddTmpStagePriorityIndexToCiBuilds < ActiveRecord::Migration
+class AddTmpStagePriorityIndexToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180417101940_add_index_to_ci_stage.rb b/db/migrate/20180417101940_add_index_to_ci_stage.rb
index 9dac78db7746daffd92640dcdc9c236bc3ffd8dc..97a8f5efce06ebdf4dd1107a26e5922ef3a5486f 100644
--- a/db/migrate/20180417101940_add_index_to_ci_stage.rb
+++ b/db/migrate/20180417101940_add_index_to_ci_stage.rb
@@ -1,4 +1,4 @@
-class AddIndexToCiStage < ActiveRecord::Migration
+class AddIndexToCiStage < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb b/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb
index ac91624c3d54e484430d3119e63785ae7f853eb9..4b574923483e06936780e448966933bcc275e8bc 100644
--- a/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb
+++ b/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb
@@ -1,4 +1,4 @@
-class AddIndexToCiJobArtifactsFileStore < ActiveRecord::Migration
+class AddIndexToCiJobArtifactsFileStore < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
index 6fabe07bc9c865dc196c7242f52b148934819048..90a908feaee7e4a754f1b23c011b4f6e103d7ed9 100644
--- a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
+++ b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddPipelineBuildForeignKey < ActiveRecord::Migration
+class AddPipelineBuildForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180420010616_cleanup_build_stage_migration.rb b/db/migrate/20180420010616_cleanup_build_stage_migration.rb
index 5e9fe756efda7e67f889350878f8b459fd252625..30c0d97781dca603e17f9740fec1d24ffc8f7808 100644
--- a/db/migrate/20180420010616_cleanup_build_stage_migration.rb
+++ b/db/migrate/20180420010616_cleanup_build_stage_migration.rb
@@ -1,4 +1,4 @@
-class CleanupBuildStageMigration < ActiveRecord::Migration
+class CleanupBuildStageMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb b/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb
index 1d2f8cf9c7681d8b06cc138b542a1a3eb42c747f..0c536f917ce5c72de60ab6eadf54e4d3e1f6bb12 100644
--- a/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb
+++ b/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb
@@ -1,4 +1,4 @@
-class AddPagesAccessLevelToProjectFeature < ActiveRecord::Migration
+class AddPagesAccessLevelToProjectFeature < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb b/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb
index f5afdb0e4e6dd278cf2c4e6ef1a22ef5c5b00f62..b8fd71002a1b4f2c6a9913b0ecbc2849f4183999 100644
--- a/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb
+++ b/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddEnforceTermsToApplicationSettings < ActiveRecord::Migration
+class AddEnforceTermsToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180424134533_create_application_setting_terms.rb b/db/migrate/20180424134533_create_application_setting_terms.rb
index f29335cfc519c5f457375c0ed2823ae0b01a88e9..8741f20daebb04e4d528357c19174afccf6418c3 100644
--- a/db/migrate/20180424134533_create_application_setting_terms.rb
+++ b/db/migrate/20180424134533_create_application_setting_terms.rb
@@ -1,4 +1,4 @@
-class CreateApplicationSettingTerms < ActiveRecord::Migration
+class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb b/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
index e8f0c91d612a885d9e0ae9abb239679da6df0f93..550b5a2c149f3de5c7bd3fc2735e8bd52b89b89c 100644
--- a/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
+++ b/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
@@ -1,4 +1,4 @@
-class AddPipelineIidToCiPipelines < ActiveRecord::Migration
+class AddPipelineIidToCiPipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180425075446_create_term_agreements.rb b/db/migrate/20180425075446_create_term_agreements.rb
index 1fa2c8dd3befb7d1b9615b525c3e6403ac80dd31..25182215841ae1fa9aa13258ae68e70678a2c0f1 100644
--- a/db/migrate/20180425075446_create_term_agreements.rb
+++ b/db/migrate/20180425075446_create_term_agreements.rb
@@ -1,4 +1,4 @@
-class CreateTermAgreements < ActiveRecord::Migration
+class CreateTermAgreements < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb b/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb
index 0e991c23bfa6fe889a3f9d45dd0cdd31fe226478..7d38a15b850d119798d31bf1ede4fb46f4d0c4eb 100644
--- a/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb
+++ b/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb
@@ -1,4 +1,4 @@
-class AssureCommitsCountForMergeRequestDiff < ActiveRecord::Migration
+class AssureCommitsCountForMergeRequestDiff < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb b/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
index 3fa59b44d5d79014ea5e590af37c79b05c7e6403..8a0cb7ae4e405d2d8c6db7b68c7617c8e1fc55a2 100644
--- a/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
+++ b/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
@@ -1,4 +1,4 @@
-class AddIndexConstraintsToPipelineIid < ActiveRecord::Migration
+class AddIndexConstraintsToPipelineIid < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180426102016_add_accepted_term_to_users.rb b/db/migrate/20180426102016_add_accepted_term_to_users.rb
index 3d446f662146f46c33164854ed30ae7495e2ea00..3c6665b42643764c22f257e84ebdbb5aab33c41c 100644
--- a/db/migrate/20180426102016_add_accepted_term_to_users.rb
+++ b/db/migrate/20180426102016_add_accepted_term_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddAcceptedTermToUsers < ActiveRecord::Migration
+class AddAcceptedTermToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb b/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb
index 42409349b755d4b9f20af388fc30bb5a81f45679..a74231e0f44a068a78d77429702f1683c6980d78 100644
--- a/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb
+++ b/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb
@@ -1,4 +1,4 @@
-class AddRunnerTypeToCiRunners < ActiveRecord::Migration
+class AddRunnerTypeToCiRunners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180502122856_create_project_mirror_data.rb b/db/migrate/20180502122856_create_project_mirror_data.rb
index 8554c74190462f60d35b25ae7310217f1b5db742..9781815a97b46f7481eba6da3ee988dc6abe67aa 100644
--- a/db/migrate/20180502122856_create_project_mirror_data.rb
+++ b/db/migrate/20180502122856_create_project_mirror_data.rb
@@ -1,4 +1,4 @@
-class CreateProjectMirrorData < ActiveRecord::Migration
+class CreateProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503131624_create_remote_mirrors.rb b/db/migrate/20180503131624_create_remote_mirrors.rb
index 601c184ed76911ebfc965cf97f1662f9df4ac0a8..288ae365f0fd0781ee3c5bef629f381f3432c863 100644
--- a/db/migrate/20180503131624_create_remote_mirrors.rb
+++ b/db/migrate/20180503131624_create_remote_mirrors.rb
@@ -1,4 +1,4 @@
-class CreateRemoteMirrors < ActiveRecord::Migration
+class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb b/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb
index cc21f3c4fd34534e2aa13195cdbe2bd89a6b36de..1d99d46b7d6ac8bffed3294f52f3bf05018864bc 100644
--- a/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb
+++ b/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb
@@ -1,4 +1,4 @@
-class AddRemoteMirrorAvailableOverriddenToProjects < ActiveRecord::Migration
+class AddRemoteMirrorAvailableOverriddenToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb b/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb
index 9e55690bd33c6a83664a40b757709525e937a52c..899e4a05cbdc5a71e481243f4e31de6bdc91730f 100644
--- a/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb
+++ b/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexToNamespacesRunnersToken < ActiveRecord::Migration
+class AddIndexToNamespacesRunnersToken < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb b/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb
index 970a53d68d07c8de0c754860c0302faa01ba206b..3775b3a08c9d7bb2a08e29f284a80432341a4621 100644
--- a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb
+++ b/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb
@@ -1,4 +1,4 @@
-class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration
+class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb b/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
index b59b941c815d3ed8f3cbcfba9982b481813a3c59..15a188594b0fd2cd4f0f27f51b2b0292e63ed080 100644
--- a/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
+++ b/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
@@ -1,4 +1,4 @@
-class AddIndexesToProjectMirrorData < ActiveRecord::Migration
+class AddIndexesToProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb b/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
index aeec5e855545771fb0121fec4ca62e76f9bd2150..19bed8d0500b77d20c1816f6c5f424ad0a7a5aae 100644
--- a/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
+++ b/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
@@ -1,4 +1,4 @@
-class AddIndexesToRemoteMirror < ActiveRecord::Migration
+class AddIndexesToRemoteMirror < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb b/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb
index b67b1aa648cf303634c56783068c2dc4f4599527..d6a04035d4817131ad9ab141173f30066ddb0b63 100644
--- a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb
+++ b/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddMirrorAvailableToApplicationSettings < ActiveRecord::Migration
+class AddMirrorAvailableToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb b/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
index 2c8f86ff0f48d8db2309b1e3b5deb31a36f238ad..bab3b1787135bcd56482c05bd10b6665c12150b5 100644
--- a/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
+++ b/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
@@ -1,4 +1,4 @@
-class EnablePrometheusMetricsByDefault < ActiveRecord::Migration
+class EnablePrometheusMetricsByDefault < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20180504195842_project_name_lower_index.rb b/db/migrate/20180504195842_project_name_lower_index.rb
index 74f3673bb03b5a2f8a173dd5f0f1b6cf245c6224..3fe90c3fbb1e5f16f4b6b4b2b6973ed56741b799 100644
--- a/db/migrate/20180504195842_project_name_lower_index.rb
+++ b/db/migrate/20180504195842_project_name_lower_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ProjectNameLowerIndex < ActiveRecord::Migration
+class ProjectNameLowerIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb b/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb
index 0d8a8357a1eff7b954c353c243704ac3e269b433..81aa18c8b863ebae47adbe3a721cc727ede94c04 100644
--- a/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb
+++ b/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb
@@ -1,4 +1,4 @@
-class MakeRemoteMirrorsDisabledByDefault < ActiveRecord::Migration
+class MakeRemoteMirrorsDisabledByDefault < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb b/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb
index 82087d15ccbe125fdc4dbbb3ce8d22d83c5d167b..dba5d20f276abb883b24cd7ea9a8b22216be6061 100644
--- a/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb
+++ b/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddNotNullConstraintToProjectMirrorDataForeignKey < ActiveRecord::Migration
+class AddNotNullConstraintToProjectMirrorDataForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb b/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb
index acb976b52fa3b7dbdeb1636758fe2ca40712287e..b225354ca43fb34138d7ec2b2b217fa186fd4638 100644
--- a/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb
+++ b/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb
@@ -1,4 +1,4 @@
-class AddUniqueConstraintToProjectMirrorDataProjectIdIndex < ActiveRecord::Migration
+class AddUniqueConstraintToProjectMirrorDataProjectIdIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180508135515_set_runner_type_not_null.rb b/db/migrate/20180508135515_set_runner_type_not_null.rb
index dd043ec7179d349dd36e589f201b0b21a6ace61f..00c546c8f47b81c0a3adf8e8b501e0a8edd2fc8e 100644
--- a/db/migrate/20180508135515_set_runner_type_not_null.rb
+++ b/db/migrate/20180508135515_set_runner_type_not_null.rb
@@ -1,4 +1,4 @@
-class SetRunnerTypeNotNull < ActiveRecord::Migration
+class SetRunnerTypeNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb b/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb
index f3ed20fd243ddc4fb56bd5fe09d0816ef63f34d7..4913b8602c9f20f482394c359396c86be8482f19 100644
--- a/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb
+++ b/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb
@@ -1,4 +1,4 @@
-class AddIndexOnCiRunnersRunnerType < ActiveRecord::Migration
+class AddIndexOnCiRunnersRunnerType < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb b/db/migrate/20180511131058_create_clusters_applications_jupyter.rb
index f3923884e37d42bf9932687fd20e79fd2ee23a6e..749aeeb4792cc91a33484434d41400d804152f74 100644
--- a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb
+++ b/db/migrate/20180511131058_create_clusters_applications_jupyter.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateClustersApplicationsJupyter < ActiveRecord::Migration
+class CreateClustersApplicationsJupyter < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180515005612_add_squash_to_merge_requests.rb b/db/migrate/20180515005612_add_squash_to_merge_requests.rb
index fd85e968acd49f4b1bb60ccd7eb99958abbb5dba..14636d6fd8ef7ac28aefe9ceee0dd7ab85e1c54c 100644
--- a/db/migrate/20180515005612_add_squash_to_merge_requests.rb
+++ b/db/migrate/20180515005612_add_squash_to_merge_requests.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddSquashToMergeRequests < ActiveRecord::Migration
+class AddSquashToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/migrate/20180515121227_create_notes_diff_files.rb b/db/migrate/20180515121227_create_notes_diff_files.rb
index efcd3bb9c7e70ca0a8ca5c28c97f943880901a23..e50324d8599b8627905b5fcab5e3810329d84e18 100644
--- a/db/migrate/20180515121227_create_notes_diff_files.rb
+++ b/db/migrate/20180515121227_create_notes_diff_files.rb
@@ -1,4 +1,4 @@
-class CreateNotesDiffFiles < ActiveRecord::Migration
+class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
index 3b7b877232bc681efe8dab736d351dff8fd1d707..36f4770ff3297669983f982e6e203a2f79d68f58 100644
--- a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
+++ b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
@@ -1,4 +1,4 @@
-class AddNotNullConstraintsToProjectAuthorizations < ActiveRecord::Migration
+class AddNotNullConstraintsToProjectAuthorizations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb b/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb
index 41bc7b71694d79ddb0aa0510b269dd9a9c231895..131dca1fbc293cb1b9a53c7500b793aff137b29b 100644
--- a/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb
+++ b/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb
@@ -1,4 +1,4 @@
-class RenameMergeRequestsAllowMaintainerToPush < ActiveRecord::Migration
+class RenameMergeRequestsAllowMaintainerToPush < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb b/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb
index cee576b91c85ca3d9f41a7ee9a8beebf8a66ede0..bff4690427ed66d0a8a9ee70bc03b44307d1f603 100644
--- a/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb
+++ b/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeRequestsTargetIdIidStatePartialIndex < ActiveRecord::Migration
+class MergeRequestsTargetIdIidStatePartialIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb
index 22e9482cb1d76c89d3724db65d69f9ed93fe2cf5..207e1f089fbde13ce100f6ebdd0992de5fe71245 100644
--- a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb
+++ b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb
@@ -1,4 +1,4 @@
-class EnsureRemoteMirrorColumns < ActiveRecord::Migration
+class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180530135500_add_index_to_stages_position.rb b/db/migrate/20180530135500_add_index_to_stages_position.rb
index 61150f33a25624e3a98177e1f0271ba8812c279f..eabf94ab8ec83d7a88cabe40522cd1ad097d2b6d 100644
--- a/db/migrate/20180530135500_add_index_to_stages_position.rb
+++ b/db/migrate/20180530135500_add_index_to_stages_position.rb
@@ -1,4 +1,4 @@
-class AddIndexToStagesPosition < ActiveRecord::Migration
+class AddIndexToStagesPosition < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180531185349_add_repository_languages.rb b/db/migrate/20180531185349_add_repository_languages.rb
index bfcfb618c87fc80c59e48cda38cf1b83f913203b..26a01c3bb26ce0e424654c0f49d75b15bfd16208 100644
--- a/db/migrate/20180531185349_add_repository_languages.rb
+++ b/db/migrate/20180531185349_add_repository_languages.rb
@@ -1,4 +1,4 @@
-class AddRepositoryLanguages < ActiveRecord::Migration
+class AddRepositoryLanguages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb b/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
index dbbbcd1f62265ec82ffe231f13bea6ac6e589230..cf621c46f2b4f3e97105cf7c68ced8cd08d65feb 100644
--- a/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
+++ b/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
@@ -1,4 +1,4 @@
-class ChangeDefaultValueForDsaKeyRestriction < ActiveRecord::Migration
+class ChangeDefaultValueForDsaKeyRestriction < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = false
 
diff --git a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb
index 6f50d428965efec9075957da95268e6fb6518aa8..78a3617ec9336f89345e420227c9081632a00cb4 100644
--- a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb
+++ b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDeployStrategyToProjectAutoDevops < ActiveRecord::Migration
+class AddDeployStrategyToProjectAutoDevops < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb
index 6a69460e611ec31557afb61df6c3b963cda36a3b..e6a1daaffc2cc796a136c009f6a282c05c7536de 100644
--- a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb
+++ b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration
+class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180608091413_add_group_to_todos.rb b/db/migrate/20180608091413_add_group_to_todos.rb
index 20ba48490571c40b5d833e0edc0327a89b3c2570..7f8efd78c5917a48b691fa638f83b5940ea86868 100644
--- a/db/migrate/20180608091413_add_group_to_todos.rb
+++ b/db/migrate/20180608091413_add_group_to_todos.rb
@@ -1,4 +1,4 @@
-class AddGroupToTodos < ActiveRecord::Migration
+class AddGroupToTodos < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb b/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb
index 36f2a593fbe851a40af37bd5e20bd67c3a2b14fb..0f2d5ba3a5eb3f2750491f91cd3cea8aaee466ae 100644
--- a/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb
+++ b/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameMergeRequestsAllowCollaboration < ActiveRecord::Migration
+class RenameMergeRequestsAllowCollaboration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb b/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb
index 57cea18abcd7d4c7854b1c4f5b1591856f2f5587..d7273dff48ef6098925c7eba6c7d94c6736a83fb 100644
--- a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb
+++ b/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration
+class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180613081317_create_ci_builds_runner_session.rb b/db/migrate/20180613081317_create_ci_builds_runner_session.rb
index e550c07b9ab10c5151c68baeae3a71ae86ffc688..eb41f76b10567a98b610019e0ae6b6a8883343c0 100644
--- a/db/migrate/20180613081317_create_ci_builds_runner_session.rb
+++ b/db/migrate/20180613081317_create_ci_builds_runner_session.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateCiBuildsRunnerSession < ActiveRecord::Migration
+class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180625113853_create_import_export_uploads.rb b/db/migrate/20180625113853_create_import_export_uploads.rb
index be42304b0ae011f3ecf006163d59445ee05e131b..d76b3e8cc152565d830de64247ab15b2c18400bf 100644
--- a/db/migrate/20180625113853_create_import_export_uploads.rb
+++ b/db/migrate/20180625113853_create_import_export_uploads.rb
@@ -1,4 +1,4 @@
-class CreateImportExportUploads < ActiveRecord::Migration
+class CreateImportExportUploads < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb b/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
index a0e3a228f6c8e668f29d2d2bea4e4546dfb0d1da..0fc14b43fae224e278210469c677012dd32171b7 100644
--- a/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
+++ b/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexOnDeployableForDeployments < ActiveRecord::Migration
+class AddIndexOnDeployableForDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb b/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb
index 289c87b30d26c9d62df0eed64ec57d43b49e3626..64ef165c5e6f9baf3c00d3a0d49eb7535415c842 100644
--- a/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb
+++ b/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AlterWebHookLogsIndexes < ActiveRecord::Migration
+class AlterWebHookLogsIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180629153018_create_site_statistics.rb b/db/migrate/20180629153018_create_site_statistics.rb
index 085ce1ba64b27ae371c62d5158ed4f04dd4a7e24..60a32b3b2a7b01165b6c790db362c4fe3134b915 100644
--- a/db/migrate/20180629153018_create_site_statistics.rb
+++ b/db/migrate/20180629153018_create_site_statistics.rb
@@ -1,4 +1,4 @@
-class CreateSiteStatistics < ActiveRecord::Migration
+class CreateSiteStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180702124358_remove_orphaned_routes.rb b/db/migrate/20180702124358_remove_orphaned_routes.rb
index 4068e479b6c295028573fec0a5283b6e46f58fa4..62c15f9cd00cfb77e8bba07fe916fc3aab0d07ad 100644
--- a/db/migrate/20180702124358_remove_orphaned_routes.rb
+++ b/db/migrate/20180702124358_remove_orphaned_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveOrphanedRoutes < ActiveRecord::Migration
+class RemoveOrphanedRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180702134423_generate_missing_routes.rb b/db/migrate/20180702134423_generate_missing_routes.rb
index 994725f9bd1a41716f25c0c30112d9f9022142dc..a440bc3179c3d47487b060a84e4166158286666e 100644
--- a/db/migrate/20180702134423_generate_missing_routes.rb
+++ b/db/migrate/20180702134423_generate_missing_routes.rb
@@ -7,7 +7,7 @@
 # On GitLab.com this would insert 611 project routes, and 0 namespace routes.
 # The exact number could vary per instance, so we take care of both just in
 # case.
-class GenerateMissingRoutes < ActiveRecord::Migration
+class GenerateMissingRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
index 6631c5d1b6c03e935264caba768053f5a2a4a41b..03afbe217b57fda14c4c4e380212e1ee5b9c6085 100644
--- a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
+++ b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration
+class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb b/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb
index 63c188693f35f492285f999843a0a618b6a48b12..938438841a541ff534385a674c368c7c44aac0d8 100644
--- a/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb
+++ b/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb
@@ -1,4 +1,4 @@
-class AddFileFormatToCiJobArtifacts < ActiveRecord::Migration
+class AddFileFormatToCiJobArtifacts < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb b/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb
index 91656f194e5f258e8a1cdf6a6c14564cb8a94df8..79691f2b24cd17d7b50123ef4a595a56cb800c56 100644
--- a/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb
+++ b/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyFromNotificationSettingsToUsers < ActiveRecord::Migration
+class AddForeignKeyFromNotificationSettingsToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class NotificationSetting < ActiveRecord::Base
diff --git a/db/migrate/20180711103851_drop_duplicate_protected_tags.rb b/db/migrate/20180711103851_drop_duplicate_protected_tags.rb
index 8fa2137551e279bdea01f7e4cf55df2a38096f12..6166aa65f1fb89dd1b2b305fcef761e11f3d14eb 100644
--- a/db/migrate/20180711103851_drop_duplicate_protected_tags.rb
+++ b/db/migrate/20180711103851_drop_duplicate_protected_tags.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class DropDuplicateProtectedTags < ActiveRecord::Migration
+class DropDuplicateProtectedTags < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/db/migrate/20180711103922_add_protected_tags_index.rb b/db/migrate/20180711103922_add_protected_tags_index.rb
index 7ed2258ebaf7e00aa3d0af2f49e04d8fa7ef43ed..ef81ca633c3f9e9de676c48aa0d5386543b7460c 100644
--- a/db/migrate/20180711103922_add_protected_tags_index.rb
+++ b/db/migrate/20180711103922_add_protected_tags_index.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddProtectedTagsIndex < ActiveRecord::Migration
+class AddProtectedTagsIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180713092803_create_user_statuses.rb b/db/migrate/20180713092803_create_user_statuses.rb
index cbe21b89ad9c5a4ae3d7c97e54420326c6f5e263..43b96805c1ef316d8673378b9fdf8ae7e8dbde38 100644
--- a/db/migrate/20180713092803_create_user_statuses.rb
+++ b/db/migrate/20180713092803_create_user_statuses.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateUserStatuses < ActiveRecord::Migration
+class CreateUserStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180717125853_remove_restricted_todos.rb b/db/migrate/20180717125853_remove_restricted_todos.rb
index fdf43921a7371e7e73bb09be1424366b443986fd..1d4bbf6571ece001c6c9243d95a9246d0986bc3d 100644
--- a/db/migrate/20180717125853_remove_restricted_todos.rb
+++ b/db/migrate/20180717125853_remove_restricted_todos.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 # frozen_string_literal: true
 
-class RemoveRestrictedTodos < ActiveRecord::Migration
+class RemoveRestrictedTodos < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   disable_ddl_transaction!
 
diff --git a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb b/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
index 4b6c1f74346fb489f97b49ef2dcf5faf0c03cfa1..ed5fa58b481d709ff654bff3a95ea9983328fb35 100644
--- a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
+++ b/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddInstanceStatisticsVisibilityToApplicationSetting < ActiveRecord::Migration
+class AddInstanceStatisticsVisibilityToApplicationSetting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb b/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb
index 4ed851a07806089d2388d48d8b50b97cfe3adb09..0cf3c78507e9d1aa440b4702f2475c1ebc2ac6e2 100644
--- a/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb
+++ b/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddReceiveMaxInputSizeToApplicationSettings < ActiveRecord::Migration
+class AddReceiveMaxInputSizeToApplicationSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180722103201_add_private_profile_to_users.rb b/db/migrate/20180722103201_add_private_profile_to_users.rb
index 4f7ef1322d8cf7bdd69a3cad7eb6a833320d7dfa..c8d917065bb403f573e1e0dc9fc7d14e7db384ce 100644
--- a/db/migrate/20180722103201_add_private_profile_to_users.rb
+++ b/db/migrate/20180722103201_add_private_profile_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPrivateProfileToUsers < ActiveRecord::Migration
+class AddPrivateProfileToUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb b/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb
index 1ebb91da00c0da21ee21654785c744ef927edd8b..23b8e04674a38ba10d317fd8663a788b260278fa 100644
--- a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb
+++ b/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddWebIdeClientSidePreviewEnabledToApplicationSettings < ActiveRecord::Migration
+class AddWebIdeClientSidePreviewEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180726172057_create_resource_label_events.rb b/db/migrate/20180726172057_create_resource_label_events.rb
index 9f7a3192c68bb980cc01e96cc347fd5b43cf1d23..699215b1b467c5c5734b8ef1a7cad98b606d8f3b 100644
--- a/db/migrate/20180726172057_create_resource_label_events.rb
+++ b/db/migrate/20180726172057_create_resource_label_events.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateResourceLabelEvents < ActiveRecord::Migration
+class CreateResourceLabelEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb b/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb
index f4f7cb6f8ca791a37e93501ae04a9f6bb5ea8d61..c957fc2f6fcf849763dbadb8dc39176624db11e9 100644
--- a/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb
+++ b/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RemoveRedundantStatusIndexOnCiBuilds < ActiveRecord::Migration
+class RemoveRedundantStatusIndexOnCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb b/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb
index e3019af2cc9ba5615f1e599e13c7b7ca0918c874..946d99a4c5f33973366f1e737e386f9c510384c3 100644
--- a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb
+++ b/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUserShowAddSshKeyMessageToApplicationSettings < ActiveRecord::Migration
+class AddUserShowAddSshKeyMessageToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb b/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb
index 05d1124f5c4531511c5a32941d6231daa77be91a..da101bc76e32a61b11ac8f5e774b0feaa67d197e 100644
--- a/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb
+++ b/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class ChangeDefaultOfAutoDevopsInstanceWide < ActiveRecord::Migration
+class ChangeDefaultOfAutoDevopsInstanceWide < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb b/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb
index 21fb62806b37cb14f5e16ef77d1286adf9d01c27..1531fad2c6ce043a53531c7f6f4bfffdea9589db 100644
--- a/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb
+++ b/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class EnableAutoDevopsInstanceWideForEveryone < ActiveRecord::Migration
+class EnableAutoDevopsInstanceWideForEveryone < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180814153625_add_commit_email_to_users.rb b/db/migrate/20180814153625_add_commit_email_to_users.rb
index 5c87d73688e16d8fbf07c13d25fc9c1e802a8ed8..4d9217ea504952e95f5615ddb4bf0e810e56b7ac 100644
--- a/db/migrate/20180814153625_add_commit_email_to_users.rb
+++ b/db/migrate/20180814153625_add_commit_email_to_users.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCommitEmailToUsers < ActiveRecord::Migration
+class AddCommitEmailToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb b/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb
index 6397d6dd99f4125120e268b6d0e90a7c3d06296e..44125b4696a6cf2fccbfbc25c0737f4351fbd034 100644
--- a/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb
+++ b/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddAuthorizationTypeToClusterPlatformsKubernetes < ActiveRecord::Migration
+class AddAuthorizationTypeToClusterPlatformsKubernetes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb b/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb
index 620342005fe3f7f53bf59e05bbb3e83ecc06b3c6..389101902d06e6ffc5d17a982ad79f748571f2ff 100644
--- a/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb
+++ b/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb
@@ -1,4 +1,4 @@
-class AddFileLocationToCiJobArtifacts < ActiveRecord::Migration
+class AddFileLocationToCiJobArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb b/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb
index 5e041ea6559dea6fb0c92f99269cdbee8af4b85d..237e6ba45594ea39a9140ab8174bfcbe9a0bcd3a 100644
--- a/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb
+++ b/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToCiBuildsArtifactsFile < ActiveRecord::Migration
+class AddPartialIndexToCiBuildsArtifactsFile < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180815175440_add_index_on_list_type.rb b/db/migrate/20180815175440_add_index_on_list_type.rb
index aad805e436e183a6549a92f2afdc491a5683ad81..3fe0f6b8de5d6f5d9e54c4053918ab100e9a867b 100644
--- a/db/migrate/20180815175440_add_index_on_list_type.rb
+++ b/db/migrate/20180815175440_add_index_on_list_type.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddIndexOnListType < ActiveRecord::Migration
+class AddIndexOnListType < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164904_fix_prometheus_metric_query_limits.rb b/db/migrate/20180831164904_fix_prometheus_metric_query_limits.rb
index 28c92e7c7acf6920162fd3257bf9c1c8f0ecc973..80c4d11a38ea26d47e5945860a7dceaf1e6de711 100644
--- a/db/migrate/20180831164904_fix_prometheus_metric_query_limits.rb
+++ b/db/migrate/20180831164904_fix_prometheus_metric_query_limits.rb
@@ -4,7 +4,7 @@
 # for more information on how to write migrations for GitLab.
 require Rails.root.join('db/migrate/prometheus_metrics_limits_to_mysql')
 
-class FixPrometheusMetricQueryLimits < ActiveRecord::Migration
+class FixPrometheusMetricQueryLimits < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb b/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb
index e21c156fff6c69620362c2aefb85e8a3c566f256..5eb77d0480d487e274af93b00dd2f97630925d49 100644
--- a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb
+++ b/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddCommonToPrometheusMetrics < ActiveRecord::Migration
+class AddCommonToPrometheusMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb b/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb
index fdbaaf67b87a189aaa5324b9a9c7aa45359cb669..5758321891a67f670a5854e50ce2749b615b7694 100644
--- a/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb
+++ b/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexOnCommonForPrometheusMetrics < ActiveRecord::Migration
+class AddIndexOnCommonForPrometheusMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb
index 67de990757e15d169d4d2ef5fda8f0da89fc5daa..7aa5950249c1f992126f60f071d96dc8b989c63d 100644
--- a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb
+++ b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIdentifierToPrometheusMetric < ActiveRecord::Migration
+class AddIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb b/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb
index b30c24ccafe619bb68438af69bd9162e731a559d..1f6cfc181f4a9d88bed116c0da1899094787581a 100644
--- a/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb
+++ b/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexForIdentifierToPrometheusMetric < ActiveRecord::Migration
+class AddIndexForIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180831164910_import_common_metrics.rb b/db/migrate/20180831164910_import_common_metrics.rb
index 72658c09b8e93305e576c9b7e3cf3ea9df462110..f67d5f40aaddccac4121c93d0aaf78e0500b9eea 100644
--- a/db/migrate/20180831164910_import_common_metrics.rb
+++ b/db/migrate/20180831164910_import_common_metrics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class ImportCommonMetrics < ActiveRecord::Migration
+class ImportCommonMetrics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   require Rails.root.join('db/importers/common_metrics_importer.rb')
diff --git a/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb b/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb
index 99dfcc94b124ded00f842951a8d49f3bf5bf1cdb..f2136657d95613a5917a01d14cc27f8426a21ddb 100644
--- a/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb
+++ b/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddProjectConfigSourceStatusIndexToPipeline < ActiveRecord::Migration
+class AddProjectConfigSourceStatusIndexToPipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb b/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb
index 264970ceed8eb6d59fbb8f51a564908554950cd7..c8875e16914a9eda34b83e93df9c9c799be745a6 100644
--- a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb
+++ b/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddResourceLabelEventReferenceFields < ActiveRecord::Migration
+class AddResourceLabelEventReferenceFields < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb b/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb
index 5d0e67d2648940f48e437eac0c19c05547337281..334efa12e7bdffb4ad4be778d35fd1fde5b5a6df 100644
--- a/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb
+++ b/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddUserPingConsentToApplicationSettings < ActiveRecord::Migration
+class AddUserPingConsentToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb b/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb
index 933047e32de22f332b54816d2c19cb9fa58da14f..c57611a0f7db4d26fbe76297685a16516ebd3f59 100644
--- a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb
+++ b/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddLegacyAbacToClusterProvidersGcp < ActiveRecord::Migration
+class AddLegacyAbacToClusterProvidersGcp < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb b/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb
index 72f5c8d653b2625a363d6ffe5c2c90b022330a66..ca8dbdba2bb16e1e4095a7bc19556dc40ad54ec5 100644
--- a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb
+++ b/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration
+class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb b/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb
index 203fcfe8eae9d0d91d9c5d935f04086de582621c..142e454832ff6c2aaf96f4d675b0a0ae19ae9e28 100644
--- a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb
+++ b/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration
+class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb b/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb
index 4300cd13a45f05c466d602d3793331d3a92f6a89..d501b07614ad6656719eb9b450eb1eae36823340 100644
--- a/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb
+++ b/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToTokenDigestOnPersonalAccessTokens < ActiveRecord::Migration
+class AddIndexToTokenDigestOnPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180912111628_add_knative_application.rb b/db/migrate/20180912111628_add_knative_application.rb
index bfda6a945a7fec6ea21bd9c067abfa98c9c48e63..86d9100d2e7b72669e39f63ed713e1283a652fa9 100644
--- a/db/migrate/20180912111628_add_knative_application.rb
+++ b/db/migrate/20180912111628_add_knative_application.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddKnativeApplication < ActiveRecord::Migration
+class AddKnativeApplication < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb b/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb
index b9bebf30cf0ffc878e36d61553246d5f20775ce8..5b71c79ac86d0ced575c29d15ba2cc3da5ccd598 100644
--- a/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb
+++ b/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexPipelinesProjectIdSource < ActiveRecord::Migration
+class AddIndexPipelinesProjectIdSource < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb b/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb
index 084dfc65ce553f58a90f265d1f948489e19662ff..5dac5f0d100fac851ba9644283e554b118509b5a 100644
--- a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb
+++ b/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDiffMaxPatchBytesToApplicationSettings < ActiveRecord::Migration
+class AddDiffMaxPatchBytesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb b/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb
index c163fbb1fd6043985a9da569d10c3de01d669421..cd2f8b59d41bd87bb14261747ab89ea6eb4c3c9c 100644
--- a/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb
+++ b/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddScheduledAtToCiBuilds < ActiveRecord::Migration
+class AddScheduledAtToCiBuilds < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb b/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb
index 81bf0d94e1129022e2ac2f33af46dd10aa4c06b9..378fc4e5feabc5d8f74f7ca61d80f1c711c19e50 100644
--- a/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb
+++ b/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddPartialIndexToScheduledAt < ActiveRecord::Migration
+class AddPartialIndexToScheduledAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20180925200829_create_user_preferences.rb b/db/migrate/20180925200829_create_user_preferences.rb
index 755cabdabde620a4429004936a6663165a5eea0d..b46df8157a6c7bb9e63d8d0b34fc2b5a49d0ea4b 100644
--- a/db/migrate/20180925200829_create_user_preferences.rb
+++ b/db/migrate/20180925200829_create_user_preferences.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateUserPreferences < ActiveRecord::Migration
+class CreateUserPreferences < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class UserPreference < ActiveRecord::Base
diff --git a/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb b/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb
index 61d32fe16ebec28fb63bc87babf4b27095690306..80577c52a01c37318ac852301899253af7f0c5b2 100644
--- a/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb
+++ b/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToProjectDeployTokensDeployTokenId < ActiveRecord::Migration
+class AddIndexToProjectDeployTokensDeployTokenId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb b/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb
index 0a8f4a122665175d8b7c5a3f997e37fd48de44c6..7826c8d802efb7ebf0523cd7df91e2c53da7aee7 100644
--- a/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb
+++ b/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb
@@ -3,7 +3,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rescheduling of the revised RemoveRestrictedTodos background migration
-class RemoveRestrictedTodosWithCte < ActiveRecord::Migration
+class RemoveRestrictedTodosWithCte < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   disable_ddl_transaction!
 
diff --git a/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb b/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb
index d09543aa4cc198e7a2606ee28bb68fec39ed03d6..ff17a0a567dac43b0adf61ff74cf10b93809f480 100644
--- a/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb
+++ b/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToLfsObjectsFileStore < ActiveRecord::Migration
+class AddIndexToLfsObjectsFileStore < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181005125926_add_index_to_uploads_store.rb b/db/migrate/20181005125926_add_index_to_uploads_store.rb
index d32ca05e980b72c33206be1cf34da2c38b418e96..d9e31225b6f8b427ba9103da7c9dc04f8bdc28d6 100644
--- a/db/migrate/20181005125926_add_index_to_uploads_store.rb
+++ b/db/migrate/20181005125926_add_index_to_uploads_store.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToUploadsStore < ActiveRecord::Migration
+class AddIndexToUploadsStore < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb
index a58c190e1d6dc0b51ef79d721814dec9a5689c29..62ad6c63d0a9e3d0a291cc235c9e8eaa26e2fec4 100644
--- a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb
+++ b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateClustersKubernetesNamespaces < ActiveRecord::Migration
+class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace'
 
diff --git a/db/migrate/20181010235606_create_board_project_recent_visits.rb b/db/migrate/20181010235606_create_board_project_recent_visits.rb
index 426f41e202a3e08683403d5dc21dc93b5728f666..07bfbdda26bea4e8f90582de50f75dafecc663c2 100644
--- a/db/migrate/20181010235606_create_board_project_recent_visits.rb
+++ b/db/migrate/20181010235606_create_board_project_recent_visits.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateBoardProjectRecentVisits < ActiveRecord::Migration
+class CreateBoardProjectRecentVisits < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181014203236_create_cluster_groups.rb b/db/migrate/20181014203236_create_cluster_groups.rb
index 69382d5c8513e269b22bea96b3d9e10fc0a4d43c..33ae9a4a478af883e2047d0786687689f660dcad 100644
--- a/db/migrate/20181014203236_create_cluster_groups.rb
+++ b/db/migrate/20181014203236_create_cluster_groups.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateClusterGroups < ActiveRecord::Migration
+class CreateClusterGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181015155839_add_finished_at_to_deployments.rb b/db/migrate/20181015155839_add_finished_at_to_deployments.rb
index 1a061bb0f5f3b68fc6dbdbce2632383d53b39506..bb8d6cdcf2c56427ba5767ee77a0eee1c02c2844 100644
--- a/db/migrate/20181015155839_add_finished_at_to_deployments.rb
+++ b/db/migrate/20181015155839_add_finished_at_to_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddFinishedAtToDeployments < ActiveRecord::Migration
+class AddFinishedAtToDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181016141739_add_status_to_deployments.rb b/db/migrate/20181016141739_add_status_to_deployments.rb
index 321172696b4d6b1eaa0a4d802978e5c5c2740023..2ff778448b4cd13cfa32fc75cbbf8de6c885d94a 100644
--- a/db/migrate/20181016141739_add_status_to_deployments.rb
+++ b/db/migrate/20181016141739_add_status_to_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddStatusToDeployments < ActiveRecord::Migration
+class AddStatusToDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value
diff --git a/db/migrate/20181016152238_create_board_group_recent_visits.rb b/db/migrate/20181016152238_create_board_group_recent_visits.rb
index 1e55dc8658e882dc070a7de1490785133c3176a8..9e240a5f97fa876e81bcea79883943983aee7e9f 100644
--- a/db/migrate/20181016152238_create_board_group_recent_visits.rb
+++ b/db/migrate/20181016152238_create_board_group_recent_visits.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateBoardGroupRecentVisits < ActiveRecord::Migration
+class CreateBoardGroupRecentVisits < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb b/db/migrate/20181017001059_add_cluster_type_to_clusters.rb
index 191e7eb4fb3d4370d6ce47fd95abefc8f190d55a..d032afe1a43a49e17b773364ff2b29557a265592 100644
--- a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb
+++ b/db/migrate/20181017001059_add_cluster_type_to_clusters.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddClusterTypeToClusters < ActiveRecord::Migration
+class AddClusterTypeToClusters < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181019032400_add_shards_table.rb b/db/migrate/20181019032400_add_shards_table.rb
index 5e0a6960548dd24130805b6489865e1501829579..e31af97cc94aa1ed0c0f0b91394a916fa1e1b84d 100644
--- a/db/migrate/20181019032400_add_shards_table.rb
+++ b/db/migrate/20181019032400_add_shards_table.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddShardsTable < ActiveRecord::Migration
+class AddShardsTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20181019032408_add_repositories_table.rb b/db/migrate/20181019032408_add_repositories_table.rb
index 077f264d3cec7c0d52d6e4820229a8eae7950e46..2153c1c9fc68acc4d2ca178b6f0f2091e7fb24db 100644
--- a/db/migrate/20181019032408_add_repositories_table.rb
+++ b/db/migrate/20181019032408_add_repositories_table.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddRepositoriesTable < ActiveRecord::Migration
+class AddRepositoriesTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb b/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb
index 059988de38a4898b40469898e679204ff65e3aff..dddf44ce488be44ce60223fe1a10e27d33d32a73 100644
--- a/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb
+++ b/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddProjectsPoolRepositoryIdForeignKey < ActiveRecord::Migration
+class AddProjectsPoolRepositoryIdForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181022135539_add_index_on_status_to_deployments.rb b/db/migrate/20181022135539_add_index_on_status_to_deployments.rb
index 2eed20aa855cf37b6868ef6c90401d6151236196..9c7a722c626eee79dc73090de6f59a46d2176528 100644
--- a/db/migrate/20181022135539_add_index_on_status_to_deployments.rb
+++ b/db/migrate/20181022135539_add_index_on_status_to_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexOnStatusToDeployments < ActiveRecord::Migration
+class AddIndexOnStatusToDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb b/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb
index 744748b3fadd16943f054f3ce0698b174c01f40b..5d7a21fc5b59d2bbda1c92fa9ab75285199111e1 100644
--- a/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb
+++ b/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddArchiveBuildsDurationToApplicationSettings < ActiveRecord::Migration
+class AddArchiveBuildsDurationToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb b/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb
index 5896102af1cbfb941ca5bc415184c7c1a79dcde5..e90e59b57a98a4a10483560d5bd4b0fa0780bc97 100644
--- a/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb
+++ b/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddPartialIndexForLegacySuccessfulDeployments < ActiveRecord::Migration
+class AddPartialIndexForLegacySuccessfulDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb b/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb
index 89ddaf2ae2b34774e107ae4d9754472dc29f364a..052a344f1823fc8cd2bc7f5716b902f8b1f1d45e 100644
--- a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb
+++ b/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migration
+class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb b/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb
index ede0ee27b8a3fcf415a5bf39e1353c4ec775a89f..2f4ef33b25310fa74e15a66e24b4dacf3f825975 100644
--- a/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb
+++ b/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateSnippetsAccessLevelDefaultValue < ActiveRecord::Migration
+class MigrateSnippetsAccessLevelDefaultValue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb
index 176d55565d80787e3abcc9685bec0817f5941836..2b5cd45e92c9ecf50bc3030d83ae588f413e7e61 100644
--- a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb
+++ b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddMissingIndexesForForeignKeys < ActiveRecord::Migration
+class AddMissingIndexesForForeignKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb b/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
index a7106111f46dfb14f564c275210f3116ea19c19b..2c1dea05808f9f383301366e94fd8e762e63c80f 100644
--- a/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
+++ b/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class DropFkGcpClustersTable < ActiveRecord::Migration
+class DropFkGcpClustersTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181031190559_drop_gcp_clusters_table.rb b/db/migrate/20181031190559_drop_gcp_clusters_table.rb
index 808d474b4fc446124bf7f45bd7d86a5bdd6d20f3..597fe49f4c8c1fc24b83ca85a23b47e63c094bc3 100644
--- a/db/migrate/20181031190559_drop_gcp_clusters_table.rb
+++ b/db/migrate/20181031190559_drop_gcp_clusters_table.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class DropGcpClustersTable < ActiveRecord::Migration
+class DropGcpClustersTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb b/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
index 5d3ace54e5c5c25bdcb04b20350f595bfe34eafb..569eaa8b22c0458a5020d96cd44c16ddcdcfe653 100644
--- a/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
+++ b/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddIndexForStuckMrQuery < ActiveRecord::Migration
+class AddIndexForStuckMrQuery < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181106135939_add_index_to_deployments.rb b/db/migrate/20181106135939_add_index_to_deployments.rb
index 5f988a4723c94767ef44cb2be8f2acff8d71dc22..e8181e61d22e7a655384097d1a25759a6f4c5aa8 100644
--- a/db/migrate/20181106135939_add_index_to_deployments.rb
+++ b/db/migrate/20181106135939_add_index_to_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToDeployments < ActiveRecord::Migration
+class AddIndexToDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb
index a480c15e66b8778e90ef8cdb4e71fa6cc0349d29..59d6d2f29ff3da9d97d4c221f8e65249e88b2651 100644
--- a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb
+++ b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class DropDefaultValueOnStatusDeployments < ActiveRecord::Migration
+class DropDefaultValueOnStatusDeployments < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value
 
diff --git a/db/migrate/gpg_keys_limits_to_mysql.rb b/db/migrate/gpg_keys_limits_to_mysql.rb
index 38729320d8cb87a7904a794c1ebbb58dfba064f7..2cd347a0463bff460af4af9b8eeb455854d3d898 100644
--- a/db/migrate/gpg_keys_limits_to_mysql.rb
+++ b/db/migrate/gpg_keys_limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class IncreaseMysqlTextLimitForGpgKeys < ActiveRecord::Migration
+class IncreaseMysqlTextLimitForGpgKeys < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = false
 
diff --git a/db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql.rb b/db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql.rb
index 9fd23aae1e592ef084890fa1519766eb0bc6996b..92402cf387bc3f09ab21a162ac793dc435185895 100644
--- a/db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql.rb
+++ b/db/migrate/limits_ci_build_trace_chunks_raw_data_for_mysql.rb
@@ -1,4 +1,4 @@
-class LimitsCiBuildTraceChunksRawDataForMysql < ActiveRecord::Migration
+class LimitsCiBuildTraceChunksRawDataForMysql < ActiveRecord::Migration[4.2]
   def up
     return unless Gitlab::Database.mysql?
 
diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb
index 7507a4bb43165806c64341648d5323e9b928404f..87992b541b1b1539bcea9eac6484ecb37c317cb1 100644
--- a/db/migrate/limits_to_mysql.rb
+++ b/db/migrate/limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class LimitsToMysql < ActiveRecord::Migration
+class LimitsToMysql < ActiveRecord::Migration[4.2]
   def up
     return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
 
diff --git a/db/migrate/markdown_cache_limits_to_mysql.rb b/db/migrate/markdown_cache_limits_to_mysql.rb
index f6686db3dc057e76e607227a1e7db9d91d8e3ac0..f99d500a1376bf82394f770d41a1cb6276282705 100644
--- a/db/migrate/markdown_cache_limits_to_mysql.rb
+++ b/db/migrate/markdown_cache_limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class MarkdownCacheLimitsToMysql < ActiveRecord::Migration
+class MarkdownCacheLimitsToMysql < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/merge_request_diff_file_limits_to_mysql.rb b/db/migrate/merge_request_diff_file_limits_to_mysql.rb
index ca3bc7d6be92a64b762128cce374072b9afb2892..65dd0b5b7f7579b29ce1a5df843ccd6ff84d6c39 100644
--- a/db/migrate/merge_request_diff_file_limits_to_mysql.rb
+++ b/db/migrate/merge_request_diff_file_limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class MergeRequestDiffFileLimitsToMysql < ActiveRecord::Migration
+class MergeRequestDiffFileLimitsToMysql < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/migrate/prometheus_metrics_limits_to_mysql.rb b/db/migrate/prometheus_metrics_limits_to_mysql.rb
index 79f4ab9b64b0dcb274d076e2cd033c6c47e1e43b..f7a2fcba8c2021dac2b622c61f5bc5be71aa9966 100644
--- a/db/migrate/prometheus_metrics_limits_to_mysql.rb
+++ b/db/migrate/prometheus_metrics_limits_to_mysql.rb
@@ -1,4 +1,4 @@
-class PrometheusMetricsLimitsToMysql < ActiveRecord::Migration
+class PrometheusMetricsLimitsToMysql < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/optional_migrations/composite_primary_keys.rb b/db/optional_migrations/composite_primary_keys.rb
index b330da13d4386e31a8aaf5ffdd43ce74b1628374..e0bb0312a350b8be97a4330c51da7e78a9f6044b 100644
--- a/db/optional_migrations/composite_primary_keys.rb
+++ b/db/optional_migrations/composite_primary_keys.rb
@@ -7,7 +7,7 @@
 # which requires all tables to have a primary key constraint.
 #
 # In that sense, the migration is optional and not strictly needed.
-class CompositePrimaryKeysMigration < ActiveRecord::Migration
+class CompositePrimaryKeysMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20160824121037_change_personal_access_tokens_default_back_to_empty_array.rb b/db/post_migrate/20160824121037_change_personal_access_tokens_default_back_to_empty_array.rb
index 7df561d82dd4ce7196f3837ef68e1eff7d1584a8..099814d75563547e78f7a4db8132003c7e1620a1 100644
--- a/db/post_migrate/20160824121037_change_personal_access_tokens_default_back_to_empty_array.rb
+++ b/db/post_migrate/20160824121037_change_personal_access_tokens_default_back_to_empty_array.rb
@@ -4,7 +4,7 @@
 #
 # Details: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5951#note_19721973
 
-class ChangePersonalAccessTokensDefaultBackToEmptyArray < ActiveRecord::Migration
+class ChangePersonalAccessTokensDefaultBackToEmptyArray < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb b/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb
index 319d86ac1591ed10baa3f4a5f70c80380ed31f86..bf3aee9941803dd3257cccc7022c74ccb174c4de 100644
--- a/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb
+++ b/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb
@@ -1,4 +1,4 @@
-class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration
+class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
index f058e85c1ece5b40ff5c28d73212fe3aed975810..d77a22bfb694b9bee29847b1e3fddf5d6144995a 100644
--- a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
+++ b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
@@ -1,4 +1,4 @@
-class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration
+class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration[4.2]
   include Gitlab::Database::ArelMethods
   include Gitlab::Database::MigrationHelpers
 
diff --git a/db/post_migrate/20161128170531_drop_user_activities_table.rb b/db/post_migrate/20161128170531_drop_user_activities_table.rb
index 09cfacba5ca1447ddb029d9db04ea523b94a2ce5..d8b1e0731f3af98e77a5285de25898601cb34450 100644
--- a/db/post_migrate/20161128170531_drop_user_activities_table.rb
+++ b/db/post_migrate/20161128170531_drop_user_activities_table.rb
@@ -1,6 +1,6 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
-class DropUserActivitiesTable < ActiveRecord::Migration
+class DropUserActivitiesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20161221140236_remove_unneeded_services.rb b/db/post_migrate/20161221140236_remove_unneeded_services.rb
index 6b7e94c864124cefc1dfbbba4b2a85d10d0dd93d..31f2426387784f72c4a784276ceaeeeaca37ffbc 100644
--- a/db/post_migrate/20161221140236_remove_unneeded_services.rb
+++ b/db/post_migrate/20161221140236_remove_unneeded_services.rb
@@ -1,4 +1,4 @@
-class RemoveUnneededServices < ActiveRecord::Migration
+class RemoveUnneededServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20161221153951_rename_reserved_project_names.rb b/db/post_migrate/20161221153951_rename_reserved_project_names.rb
index 678876e886cb458c00216f8b1458509482c48034..b7665e9849071667c5db51f9f8b7e62e18188de7 100644
--- a/db/post_migrate/20161221153951_rename_reserved_project_names.rb
+++ b/db/post_migrate/20161221153951_rename_reserved_project_names.rb
@@ -1,4 +1,4 @@
-class RenameReservedProjectNames < ActiveRecord::Migration
+class RenameReservedProjectNames < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   include Gitlab::ShellAdapter
 
diff --git a/db/post_migrate/20170104150317_requeue_pending_delete_projects.rb b/db/post_migrate/20170104150317_requeue_pending_delete_projects.rb
index d7be004d47f9032c8f62c3aea140c79a7f4f2eab..f567accb051bbeed5fac146d6ebb79092cdd9f99 100644
--- a/db/post_migrate/20170104150317_requeue_pending_delete_projects.rb
+++ b/db/post_migrate/20170104150317_requeue_pending_delete_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RequeuePendingDeleteProjects < ActiveRecord::Migration
+class RequeuePendingDeleteProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170106142508_fill_authorized_projects.rb b/db/post_migrate/20170106142508_fill_authorized_projects.rb
index 0ca20587981c10924635d0f0fc759d93298480b9..1f1dd0f47f050557e6f29476dbb90070701ba511 100644
--- a/db/post_migrate/20170106142508_fill_authorized_projects.rb
+++ b/db/post_migrate/20170106142508_fill_authorized_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class FillAuthorizedProjects < ActiveRecord::Migration
+class FillAuthorizedProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class User < ActiveRecord::Base
diff --git a/db/post_migrate/20170106172224_remove_project_authorizations_id_column.rb b/db/post_migrate/20170106172224_remove_project_authorizations_id_column.rb
index 7c788160022907bc647d1bedadcab22454fdecb5..893af23465a057b81a6cc083fb53c2bd265cd370 100644
--- a/db/post_migrate/20170106172224_remove_project_authorizations_id_column.rb
+++ b/db/post_migrate/20170106172224_remove_project_authorizations_id_column.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveProjectAuthorizationsIdColumn < ActiveRecord::Migration
+class RemoveProjectAuthorizationsIdColumn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb b/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb
index f1f81691f816454d9075a0f0940e025aa3dea5b0..055a14ad729abda6c10a6d998612a054e6364a03 100644
--- a/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb
+++ b/db/post_migrate/20170131214021_reset_users_authorized_projects_populated.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class ResetUsersAuthorizedProjectsPopulated < ActiveRecord::Migration
+class ResetUsersAuthorizedProjectsPopulated < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
index a8e63e8bc7dc97ee6a163bb1bb77d9be67481a23..f221dac8e208eee4c0b2ad3dcd3a6689bd911c2c 100644
--- a/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
+++ b/db/post_migrate/20170206040400_remove_inactive_default_email_services.rb
@@ -1,4 +1,4 @@
-class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration
+class RemoveInactiveDefaultEmailServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170206101007_remove_trackable_columns_from_timelogs.rb b/db/post_migrate/20170206101007_remove_trackable_columns_from_timelogs.rb
index aee0c1b6245160cc1ed38f0e883786367f97819c..14f5d0d4adde3095f7638f79b4d01de0d9bcefb9 100644
--- a/db/post_migrate/20170206101007_remove_trackable_columns_from_timelogs.rb
+++ b/db/post_migrate/20170206101007_remove_trackable_columns_from_timelogs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveTrackableColumnsFromTimelogs < ActiveRecord::Migration
+class RemoveTrackableColumnsFromTimelogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170206101030_validate_foreign_keys_on_timelogs.rb b/db/post_migrate/20170206101030_validate_foreign_keys_on_timelogs.rb
index f397ef919ccf4a135228cf89f6bb52fe2338e5ee..b5a5c0f06c73551f080b1f7ce3402c88e6419a38 100644
--- a/db/post_migrate/20170206101030_validate_foreign_keys_on_timelogs.rb
+++ b/db/post_migrate/20170206101030_validate_foreign_keys_on_timelogs.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ValidateForeignKeysOnTimelogs < ActiveRecord::Migration
+class ValidateForeignKeysOnTimelogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb b/db/post_migrate/20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb
index e206f9af63601ca54bb1b70bcd4cced4d97b1c8c..81ac4cf13733280795fb43631f7ef2a1896d9ecb 100644
--- a/db/post_migrate/20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb
+++ b/db/post_migrate/20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb
@@ -1,4 +1,4 @@
-class ValidateForeignKeysOnOauthOpenidRequests < ActiveRecord::Migration
+class ValidateForeignKeysOnOauthOpenidRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170211073944_disable_invalid_service_templates.rb b/db/post_migrate/20170211073944_disable_invalid_service_templates.rb
index 603efc43782f49d243a8e10afe7a882a77a43332..31234e5b086ebc52a6abd54d2f1dc30ded2e8bba 100644
--- a/db/post_migrate/20170211073944_disable_invalid_service_templates.rb
+++ b/db/post_migrate/20170211073944_disable_invalid_service_templates.rb
@@ -1,4 +1,4 @@
-class DisableInvalidServiceTemplates < ActiveRecord::Migration
+class DisableInvalidServiceTemplates < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class Service < ActiveRecord::Base
diff --git a/db/post_migrate/20170214111112_delete_deprecated_gitlab_ci_service.rb b/db/post_migrate/20170214111112_delete_deprecated_gitlab_ci_service.rb
index 09a827d22b06cd70b0ed5bf8a673d86741eee993..c273060f8b0a50e67c7cc235fc693e4d2fc27d05 100644
--- a/db/post_migrate/20170214111112_delete_deprecated_gitlab_ci_service.rb
+++ b/db/post_migrate/20170214111112_delete_deprecated_gitlab_ci_service.rb
@@ -1,4 +1,4 @@
-class DeleteDeprecatedGitlabCiService < ActiveRecord::Migration
+class DeleteDeprecatedGitlabCiService < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170215200045_remove_theme_id_from_users.rb b/db/post_migrate/20170215200045_remove_theme_id_from_users.rb
index c51646fbe52b6e19b7ccc3e8d1f4a7f6cd12ecaa..937fe3f57af2ad486489fe7043517c2701fd4e7b 100644
--- a/db/post_migrate/20170215200045_remove_theme_id_from_users.rb
+++ b/db/post_migrate/20170215200045_remove_theme_id_from_users.rb
@@ -1,4 +1,4 @@
-class RemoveThemeIdFromUsers < ActiveRecord::Migration
+class RemoveThemeIdFromUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170301205640_migrate_build_events_to_pipeline_events.rb b/db/post_migrate/20170301205640_migrate_build_events_to_pipeline_events.rb
index 04bf89c96870069b2d15ce23b69fd088f267aa11..c2d28d794919c9c19dd8bf36132d15d3e0107566 100644
--- a/db/post_migrate/20170301205640_migrate_build_events_to_pipeline_events.rb
+++ b/db/post_migrate/20170301205640_migrate_build_events_to_pipeline_events.rb
@@ -1,4 +1,4 @@
-class MigrateBuildEventsToPipelineEvents < ActiveRecord::Migration
+class MigrateBuildEventsToPipelineEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb
index ec6e8cdfc456a27c83f57f7e3444ba9dd7c153f3..aa12e8ac3da7191477b50decb59f58068ff02f23 100644
--- a/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb
+++ b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb
@@ -1,4 +1,4 @@
-class MigrateLegacyManualActions < ActiveRecord::Migration
+class MigrateLegacyManualActions < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb b/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb
index 49fd46b0262a681eb33f1a42266c0781c41b0a6e..2cf4cf61d8f908b6e3e32a3da05fe068b31b4c35 100644
--- a/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb
+++ b/db/post_migrate/20170309171644_reset_relative_position_for_issue.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class ResetRelativePositionForIssue < ActiveRecord::Migration
+class ResetRelativePositionForIssue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
index 26a67b0f8147bb381ffe4e87517efae6633feef2..cac3fd713eb5849cacd3b1c784d5ce3d731ed080 100644
--- a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
+++ b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
@@ -1,4 +1,4 @@
-class RenameMoreReservedProjectNames < ActiveRecord::Migration
+class RenameMoreReservedProjectNames < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   include Gitlab::ShellAdapter
 
diff --git a/db/post_migrate/20170317162059_update_upload_paths_to_system.rb b/db/post_migrate/20170317162059_update_upload_paths_to_system.rb
index 92e33848bf0b07e47d2508b495338083dfc9ffdb..a5a6f043e1062dd33812b9a20e4df8e1007ff94e 100644
--- a/db/post_migrate/20170317162059_update_upload_paths_to_system.rb
+++ b/db/post_migrate/20170317162059_update_upload_paths_to_system.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UpdateUploadPathsToSystem < ActiveRecord::Migration
+class UpdateUploadPathsToSystem < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb b/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
index 392fa00b1ba410ea027954cd6656681454994aa5..73989339ad947b34be50b858219966eb69a416df 100644
--- a/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
+++ b/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class MigrateUserActivitiesToUsersLastActivityOn < ActiveRecord::Migration
+class MigrateUserActivitiesToUsersLastActivityOn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::ArelMethods
   include Gitlab::Database::MigrationHelpers
 
diff --git a/db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb b/db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb
index 0c3b3bd5eb34dddb30ff45a56b9352a373cdc169..334742f04e4d3a5105d7522f39d25ca3ae46010f 100644
--- a/db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb
+++ b/db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveNotesOriginalDiscussionId < ActiveRecord::Migration
+class RemoveNotesOriginalDiscussionId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170406111121_clean_upload_symlinks.rb b/db/post_migrate/20170406111121_clean_upload_symlinks.rb
index 0ab3d61730db4b93d2b172898d737173881c1e4d..5fec00aa1987fa95d43388dcad5336648255147d 100644
--- a/db/post_migrate/20170406111121_clean_upload_symlinks.rb
+++ b/db/post_migrate/20170406111121_clean_upload_symlinks.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanUploadSymlinks < ActiveRecord::Migration
+class CleanUploadSymlinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/post_migrate/20170406142253_migrate_user_project_view.rb b/db/post_migrate/20170406142253_migrate_user_project_view.rb
index d6061dd416d948f2c642a298c182d12633daac97..3601baba78795540903ba99723cd85319176e690 100644
--- a/db/post_migrate/20170406142253_migrate_user_project_view.rb
+++ b/db/post_migrate/20170406142253_migrate_user_project_view.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateUserProjectView < ActiveRecord::Migration
+class MigrateUserProjectView < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20170408033905_remove_old_cache_directories.rb b/db/post_migrate/20170408033905_remove_old_cache_directories.rb
index b23b52896b90f0b9dbb9fabea5d71afab83dc159..22bc5b9db7b2bd865d2d7cd88417587daa04263b 100644
--- a/db/post_migrate/20170408033905_remove_old_cache_directories.rb
+++ b/db/post_migrate/20170408033905_remove_old_cache_directories.rb
@@ -4,7 +4,7 @@
 # Remove all files from old custom carrierwave's cache directories.
 # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9466
 
-class RemoveOldCacheDirectories < ActiveRecord::Migration
+class RemoveOldCacheDirectories < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170412174900_rename_reserved_dynamic_paths.rb b/db/post_migrate/20170412174900_rename_reserved_dynamic_paths.rb
index 08cf366f0a1977e1496801793924413a945db184..c9ff91b0401e420f93bbc15f90fe0589c7a15371 100644
--- a/db/post_migrate/20170412174900_rename_reserved_dynamic_paths.rb
+++ b/db/post_migrate/20170412174900_rename_reserved_dynamic_paths.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameReservedDynamicPaths < ActiveRecord::Migration
+class RenameReservedDynamicPaths < ActiveRecord::Migration[4.2]
   include Gitlab::Database::RenameReservedPathsMigration::V1
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb
index dae9750558ff8186db260091eafa824c7e833d22..99ded277277a27ef051f46a3a1f267e71282d0ec 100644
--- a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb
+++ b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb
@@ -1,4 +1,4 @@
-class MigrateTriggerSchedulesToPipelineSchedules < ActiveRecord::Migration
+class MigrateTriggerSchedulesToPipelineSchedules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170425130047_drop_ci_trigger_schedules_table.rb b/db/post_migrate/20170425130047_drop_ci_trigger_schedules_table.rb
index 24750c58ef00810b7319e65cae049f683b05b605..9d515aca8b4faa3dfd3b07af42f5163e34590a29 100644
--- a/db/post_migrate/20170425130047_drop_ci_trigger_schedules_table.rb
+++ b/db/post_migrate/20170425130047_drop_ci_trigger_schedules_table.rb
@@ -1,4 +1,4 @@
-class DropCiTriggerSchedulesTable < ActiveRecord::Migration
+class DropCiTriggerSchedulesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170502070007_enable_auto_cancel_pending_pipelines_for_all.rb b/db/post_migrate/20170502070007_enable_auto_cancel_pending_pipelines_for_all.rb
index 845c6f0557f8cf6eab1eac589fc541d1ad2b9452..4d091d7f2757f458ddeae776bbbf41b7d94b967b 100644
--- a/db/post_migrate/20170502070007_enable_auto_cancel_pending_pipelines_for_all.rb
+++ b/db/post_migrate/20170502070007_enable_auto_cancel_pending_pipelines_for_all.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/UpdateColumnInBatches
-class EnableAutoCancelPendingPipelinesForAll < ActiveRecord::Migration
+class EnableAutoCancelPendingPipelinesForAll < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb b/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
index 5238a2ba1b7c5c49dad640a6b0ddbd185ff238e7..c018d30c17531f569dc94d07c443ea9db3c9aaca 100644
--- a/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
+++ b/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
@@ -1,6 +1,6 @@
 # This is the counterpart of RequeuePendingDeleteProjects and cleans all
 # projects with `pending_delete = true` and that do not have a namespace.
-class CleanupNamespacelessPendingDeleteProjects < ActiveRecord::Migration
+class CleanupNamespacelessPendingDeleteProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170503004427_update_retried_for_ci_build.rb b/db/post_migrate/20170503004427_update_retried_for_ci_build.rb
index 079f0e7511f76f476083094506b411308fec96f5..596f859330804aefcb1ce000e76e5aa6bb4371a1 100644
--- a/db/post_migrate/20170503004427_update_retried_for_ci_build.rb
+++ b/db/post_migrate/20170503004427_update_retried_for_ci_build.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class UpdateRetriedForCiBuild < ActiveRecord::Migration
+class UpdateRetriedForCiBuild < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170503120310_remove_users_authorized_projects_populated.rb b/db/post_migrate/20170503120310_remove_users_authorized_projects_populated.rb
index 1b44334395f90248cab48e55184534930a55960b..891ce44f60ae74524e5a3cf548d433dd0c5ff8c0 100644
--- a/db/post_migrate/20170503120310_remove_users_authorized_projects_populated.rb
+++ b/db/post_migrate/20170503120310_remove_users_authorized_projects_populated.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveUsersAuthorizedProjectsPopulated < ActiveRecord::Migration
+class RemoveUsersAuthorizedProjectsPopulated < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20170508170547_add_head_pipeline_for_each_merge_request.rb b/db/post_migrate/20170508170547_add_head_pipeline_for_each_merge_request.rb
index 5df3ab71648d63eac965c6bb5924dab310d028b0..6e7365f4c565f73d46946112707f17ffa5bb34c3 100644
--- a/db/post_migrate/20170508170547_add_head_pipeline_for_each_merge_request.rb
+++ b/db/post_migrate/20170508170547_add_head_pipeline_for_each_merge_request.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddHeadPipelineForEachMergeRequest < ActiveRecord::Migration
+class AddHeadPipelineForEachMergeRequest < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170510101043_add_foreign_key_on_pipeline_schedule_owner.rb b/db/post_migrate/20170510101043_add_foreign_key_on_pipeline_schedule_owner.rb
index 6a870f08e89007a9f2e08af58516b28ccfe6d327..85586aecd54d39925bf19784fac7bd182c591852 100644
--- a/db/post_migrate/20170510101043_add_foreign_key_on_pipeline_schedule_owner.rb
+++ b/db/post_migrate/20170510101043_add_foreign_key_on_pipeline_schedule_owner.rb
@@ -1,4 +1,4 @@
-class AddForeignKeyOnPipelineScheduleOwner < ActiveRecord::Migration
+class AddForeignKeyOnPipelineScheduleOwner < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb b/db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
index 281be90163a5b1bc863450dc29a346d1218f1d10..b4a3db6560716c904b29095986e75bcdf6412854 100644
--- a/db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
+++ b/db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupRenameWebHooksBuildEventsToJobEvents < ActiveRecord::Migration
+class CleanupRenameWebHooksBuildEventsToJobEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb b/db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb
index 5d26df5688f053acb124cdc4c4d4f70bf302cab1..65342747321de9ead3e51f4312d726f0fb68e8cd 100644
--- a/db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb
+++ b/db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupRenameServicesBuildEventsToJobEvents < ActiveRecord::Migration
+class CleanupRenameServicesBuildEventsToJobEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170516165238_cleanup_trigger_for_issues.rb b/db/post_migrate/20170516165238_cleanup_trigger_for_issues.rb
index 378fe5603c3c817d4e5f25ed3c3d3d9ed84f247d..affeba522500cb9265575886a30527c6e41bea0b 100644
--- a/db/post_migrate/20170516165238_cleanup_trigger_for_issues.rb
+++ b/db/post_migrate/20170516165238_cleanup_trigger_for_issues.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupTriggerForIssues < ActiveRecord::Migration
+class CleanupTriggerForIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20170516181025_add_constraints_to_issue_assignees_table.rb b/db/post_migrate/20170516181025_add_constraints_to_issue_assignees_table.rb
index 6fa573c5b49f4ddee6ad861566c779626edbf703..03456a31b0d7dcd4ff6a365311e168b274a582c8 100644
--- a/db/post_migrate/20170516181025_add_constraints_to_issue_assignees_table.rb
+++ b/db/post_migrate/20170516181025_add_constraints_to_issue_assignees_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddConstraintsToIssueAssigneesTable < ActiveRecord::Migration
+class AddConstraintsToIssueAssigneesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20170518200835_rename_users_with_renamed_namespace.rb b/db/post_migrate/20170518200835_rename_users_with_renamed_namespace.rb
index 17ad7de065d1b5de398c9e247b01dd50898bdbea..4ba78727cc3951f951e502741e8d438d21918d71 100644
--- a/db/post_migrate/20170518200835_rename_users_with_renamed_namespace.rb
+++ b/db/post_migrate/20170518200835_rename_users_with_renamed_namespace.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameUsersWithRenamedNamespace < ActiveRecord::Migration
+class RenameUsersWithRenamedNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170518231126_fix_wrongly_renamed_routes.rb b/db/post_migrate/20170518231126_fix_wrongly_renamed_routes.rb
index 3e9529808663cebaaf9a2ae1c5b925ea14462e02..28a2a2e01bfb87a712d0f197b54d6d3799bc2726 100644
--- a/db/post_migrate/20170518231126_fix_wrongly_renamed_routes.rb
+++ b/db/post_migrate/20170518231126_fix_wrongly_renamed_routes.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class FixWronglyRenamedRoutes < ActiveRecord::Migration
+class FixWronglyRenamedRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::RenameReservedPathsMigration::V1
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170523073948_remove_assignee_id_from_issue.rb b/db/post_migrate/20170523073948_remove_assignee_id_from_issue.rb
index 006d17b4d6226d9e42e663a8fa4b50085fd5b197..d75bbb2f612d80f72e9e7e19be168686a7f89d18 100644
--- a/db/post_migrate/20170523073948_remove_assignee_id_from_issue.rb
+++ b/db/post_migrate/20170523073948_remove_assignee_id_from_issue.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveAssigneeIdFromIssue < ActiveRecord::Migration
+class RemoveAssigneeIdFromIssue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20170523083112_migrate_old_artifacts.rb b/db/post_migrate/20170523083112_migrate_old_artifacts.rb
index 3a77b9751d3b72990cad4ee31049054d7de4fb39..55e155c7619747ab2961ffb80bcd7fa8c216dae3 100644
--- a/db/post_migrate/20170523083112_migrate_old_artifacts.rb
+++ b/db/post_migrate/20170523083112_migrate_old_artifacts.rb
@@ -1,4 +1,4 @@
-class MigrateOldArtifacts < ActiveRecord::Migration
+class MigrateOldArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
index c996ddbec84a6b61105ad61c9cecdebfd1ea3d38..59b8daaffdff7059864d767e654ddefd0a27cfc8 100644
--- a/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
+++ b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameAllReservedPathsAgain < ActiveRecord::Migration
+class RenameAllReservedPathsAgain < ActiveRecord::Migration[4.2]
   include Gitlab::Database::RenameReservedPathsMigration::V1
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb
index 736aff77f02de0bf21405db76b667678747b906c..53743fc16e6756030779a3472b16670b3077eddf 100644
--- a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb
+++ b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb
@@ -1,4 +1,4 @@
-class MigratePipelineStages < ActiveRecord::Migration
+class MigratePipelineStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170526185858_create_index_in_pipeline_stages.rb b/db/post_migrate/20170526185858_create_index_in_pipeline_stages.rb
index ec9ff33b6b7ab5fdc2d7e64b52e602c4ba02a179..dc7b1d6d026ecfcec9c84b86d4330646bad01147 100644
--- a/db/post_migrate/20170526185858_create_index_in_pipeline_stages.rb
+++ b/db/post_migrate/20170526185858_create_index_in_pipeline_stages.rb
@@ -1,4 +1,4 @@
-class CreateIndexInPipelineStages < ActiveRecord::Migration
+class CreateIndexInPipelineStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb b/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb
index 3879cf9133beed23f1d0e7c8f2fcf7278063af45..de473e7bb916932aea7f5b7d9baeec9622285ea8 100644
--- a/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb
+++ b/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb
@@ -1,4 +1,4 @@
-class RemoveStageIdIndexFromBuilds < ActiveRecord::Migration
+class RemoveStageIdIndexFromBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
index 98c32d8284c7b3855b7339c131c4308cc20e5f57..a9b392314fab55887a1891da39d48a9f1d7bc323 100644
--- a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
+++ b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
@@ -1,4 +1,4 @@
-class MigrateBuildStageReference < ActiveRecord::Migration
+class MigrateBuildStageReference < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb b/db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb
index a7bfba0ab2b3ccc68c41c0acbff3c42229bf81d2..01b6cf3a15895a4d18f184e622e62ffa60718148 100644
--- a/db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb
+++ b/db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class MigrateBuildStageReferenceAgain < ActiveRecord::Migration
+class MigrateBuildStageReferenceAgain < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170531203055_cleanup_users_ldap_email_rename.rb b/db/post_migrate/20170531203055_cleanup_users_ldap_email_rename.rb
index a70e39850054f518d442b3575c32a82e11ad83aa..3d75c7e3eaf358337c25648632061a73986f1e45 100644
--- a/db/post_migrate/20170531203055_cleanup_users_ldap_email_rename.rb
+++ b/db/post_migrate/20170531203055_cleanup_users_ldap_email_rename.rb
@@ -1,4 +1,4 @@
-class CleanupUsersLdapEmailRename < ActiveRecord::Migration
+class CleanupUsersLdapEmailRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170606202615_move_appearance_to_system_dir.rb b/db/post_migrate/20170606202615_move_appearance_to_system_dir.rb
index 07935ab8a52789293590d383627cd039a4bd0660..fb9ac8d6daf5fa3fb561e4950b133de7b7559b7e 100644
--- a/db/post_migrate/20170606202615_move_appearance_to_system_dir.rb
+++ b/db/post_migrate/20170606202615_move_appearance_to_system_dir.rb
@@ -1,4 +1,4 @@
-class MoveAppearanceToSystemDir < ActiveRecord::Migration
+class MoveAppearanceToSystemDir < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/post_migrate/20170607121233_convert_custom_notification_settings_to_columns.rb b/db/post_migrate/20170607121233_convert_custom_notification_settings_to_columns.rb
index 9abda6a1d73ce537388571914d660680a7e82754..8ff26130cba03d7172f7f93536b5a146c696987d 100644
--- a/db/post_migrate/20170607121233_convert_custom_notification_settings_to_columns.rb
+++ b/db/post_migrate/20170607121233_convert_custom_notification_settings_to_columns.rb
@@ -1,4 +1,4 @@
-class ConvertCustomNotificationSettingsToColumns < ActiveRecord::Migration
+class ConvertCustomNotificationSettingsToColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170609183112_remove_position_from_issuables.rb b/db/post_migrate/20170609183112_remove_position_from_issuables.rb
index 4caaa2e83e8f47b8497ba2b663d205ae40d84b0a..edad0a502b40a169e40ce1dc8710f8b5b0891579 100644
--- a/db/post_migrate/20170609183112_remove_position_from_issuables.rb
+++ b/db/post_migrate/20170609183112_remove_position_from_issuables.rb
@@ -1,4 +1,4 @@
-class RemovePositionFromIssuables < ActiveRecord::Migration
+class RemovePositionFromIssuables < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/db/post_migrate/20170612071012_move_personal_snippets_files.rb b/db/post_migrate/20170612071012_move_personal_snippets_files.rb
index c735dc67f4435b76982361c48b34313b618f1df0..d32d92637fa4c1c8fd9798cb584c55a51f9490a6 100644
--- a/db/post_migrate/20170612071012_move_personal_snippets_files.rb
+++ b/db/post_migrate/20170612071012_move_personal_snippets_files.rb
@@ -1,6 +1,6 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
-class MovePersonalSnippetsFiles < ActiveRecord::Migration
+class MovePersonalSnippetsFiles < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/post_migrate/20170613111224_clean_appearance_symlinks.rb b/db/post_migrate/20170613111224_clean_appearance_symlinks.rb
index 17849b78cebc33e949b048fddc31a7f189396c9e..14511bff3db595f7553864b8d0feb919e11c9933 100644
--- a/db/post_migrate/20170613111224_clean_appearance_symlinks.rb
+++ b/db/post_migrate/20170613111224_clean_appearance_symlinks.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanAppearanceSymlinks < ActiveRecord::Migration
+class CleanAppearanceSymlinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb b/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb
index ac61b5c84a838d06b2e89d5c86e3547a6b71c253..cca9b488547d8d1e8301cea709682586644623f0 100644
--- a/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb
+++ b/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb
@@ -1,4 +1,4 @@
-class AddStageIdIndexToBuilds < ActiveRecord::Migration
+class AddStageIdIndexToBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170627101016_schedule_event_migrations.rb b/db/post_migrate/20170627101016_schedule_event_migrations.rb
index 1e020d05f787522b35a11b29b048cf227e22a358..f026a86bc0f14f75f6eff06729d0890f069cf3b8 100644
--- a/db/post_migrate/20170627101016_schedule_event_migrations.rb
+++ b/db/post_migrate/20170627101016_schedule_event_migrations.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ScheduleEventMigrations < ActiveRecord::Migration
+class ScheduleEventMigrations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
index f31015d77a3070d245dc490ac119271617be9acf..36aac3df071f3d161e03a3a6391bc3a83b3177ba 100644
--- a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
+++ b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
@@ -1,4 +1,4 @@
-class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
+class MigrateStageIdReferenceInBackground < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170629180131_cleanup_application_settings_signin_enabled_rename.rb b/db/post_migrate/20170629180131_cleanup_application_settings_signin_enabled_rename.rb
index 52a773ddfee3f39af8f56ad2e9599bda7fee9bab..87268fb4b31ba711ed7b4d20968699fa1e911010 100644
--- a/db/post_migrate/20170629180131_cleanup_application_settings_signin_enabled_rename.rb
+++ b/db/post_migrate/20170629180131_cleanup_application_settings_signin_enabled_rename.rb
@@ -1,4 +1,4 @@
-class CleanupApplicationSettingsSigninEnabledRename < ActiveRecord::Migration
+class CleanupApplicationSettingsSigninEnabledRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb b/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb
index 17a9dc293f1f111204d0a3339c59135f76a977f2..fd4b2859f7fb7e58590177da1b77891064f71898 100644
--- a/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb
+++ b/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb
@@ -1,4 +1,4 @@
-class ScheduleMergeRequestDiffMigrations < ActiveRecord::Migration
+class ScheduleMergeRequestDiffMigrations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170711145558_migrate_stages_statuses.rb b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
index 265f7317b9b0c7839040f35a80268ce9008e2d10..8ba69ea4dcec07574c700f76da188980986292ac 100644
--- a/db/post_migrate/20170711145558_migrate_stages_statuses.rb
+++ b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
@@ -1,4 +1,4 @@
-class MigrateStagesStatuses < ActiveRecord::Migration
+class MigrateStagesStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb b/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb
index 3ae4406ff961a6a3d2c065d51e129cb29da64520..392c4f71532d3fff5f2acc9fab477808d5de0c31 100644
--- a/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb
+++ b/db/post_migrate/20170717111152_cleanup_move_system_upload_folder_symlink.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupMoveSystemUploadFolderSymlink < ActiveRecord::Migration
+class CleanupMoveSystemUploadFolderSymlink < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb
index 87069dce0062d80fe9f08742c40873f9946e3fc9..fdd990ae2e5d76287cb6471c1847efed881c8945 100644
--- a/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb
+++ b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb
@@ -1,4 +1,4 @@
-class EnqueueMigrateSystemUploadsToNewFolder < ActiveRecord::Migration
+class EnqueueMigrateSystemUploadsToNewFolder < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170719150301_merge_issuable_reopened_into_opened_state.rb b/db/post_migrate/20170719150301_merge_issuable_reopened_into_opened_state.rb
index acc0fc7a0ac991769a67caeb65a97447a57551f9..7af1d04f0cc71fffd54d9797efe8e41bcc639158 100644
--- a/db/post_migrate/20170719150301_merge_issuable_reopened_into_opened_state.rb
+++ b/db/post_migrate/20170719150301_merge_issuable_reopened_into_opened_state.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MergeIssuableReopenedIntoOpenedState < ActiveRecord::Migration
+class MergeIssuableReopenedIntoOpenedState < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170728101014_remove_events_from_notification_settings.rb b/db/post_migrate/20170728101014_remove_events_from_notification_settings.rb
index cd533391d8dd574a262f88bfdae5a608a42674d1..f1b0a1daec5ab79c852c5673e07c65de3b33b0de 100644
--- a/db/post_migrate/20170728101014_remove_events_from_notification_settings.rb
+++ b/db/post_migrate/20170728101014_remove_events_from_notification_settings.rb
@@ -1,4 +1,4 @@
-class RemoveEventsFromNotificationSettings < ActiveRecord::Migration
+class RemoveEventsFromNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170803090603_calculate_conv_dev_index_percentages.rb b/db/post_migrate/20170803090603_calculate_conv_dev_index_percentages.rb
index 9af76c94bf305fa338c2b6a0d6d26cf66a5195d0..a148586ca8921d9cdad7a66aaa010c1fa4b205c2 100644
--- a/db/post_migrate/20170803090603_calculate_conv_dev_index_percentages.rb
+++ b/db/post_migrate/20170803090603_calculate_conv_dev_index_percentages.rb
@@ -1,4 +1,4 @@
-class CalculateConvDevIndexPercentages < ActiveRecord::Migration
+class CalculateConvDevIndexPercentages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/post_migrate/20170807160457_remove_locked_at_column_from_merge_requests.rb b/db/post_migrate/20170807160457_remove_locked_at_column_from_merge_requests.rb
index ea3d1fb3e0290f44e6b49dff5038731ad2333576..6dc49211e5a69bbb00ca72829f6e0930838232d8 100644
--- a/db/post_migrate/20170807160457_remove_locked_at_column_from_merge_requests.rb
+++ b/db/post_migrate/20170807160457_remove_locked_at_column_from_merge_requests.rb
@@ -1,4 +1,4 @@
-class RemoveLockedAtColumnFromMergeRequests < ActiveRecord::Migration
+class RemoveLockedAtColumnFromMergeRequests < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb b/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb
index e3d2446b89787ca7451ea70ae78ee5cbce450dcb..8341ac39c25dba085787a4e67713cd0c1b64a2a6 100644
--- a/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb
+++ b/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MovePersonalSnippetFilesIntoCorrectFolder < ActiveRecord::Migration
+class MovePersonalSnippetFilesIntoCorrectFolder < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/db/post_migrate/20170815060945_remove_duplicate_mr_events.rb b/db/post_migrate/20170815060945_remove_duplicate_mr_events.rb
index 6132b553177c13229d367881be17b1d120fba0ab..fdc126b8fd6e59189e373780703df744036f259e 100644
--- a/db/post_migrate/20170815060945_remove_duplicate_mr_events.rb
+++ b/db/post_migrate/20170815060945_remove_duplicate_mr_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDuplicateMrEvents < ActiveRecord::Migration
+class RemoveDuplicateMrEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   DOWNTIME = false
 
diff --git a/db/post_migrate/20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb b/db/post_migrate/20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb
index 3f085c17133181578e934d88463954e2afd65dcc..27656fd926d0abe228916bad34434132a6abc83f 100644
--- a/db/post_migrate/20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb
+++ b/db/post_migrate/20170816102555_cleanup_nonexisting_namespace_pending_delete_projects.rb
@@ -1,7 +1,7 @@
 # Follow up of CleanupNamespacelessPendingDeleteProjects and it cleans
 # all projects with `pending_delete = true` and for which the
 # namespace no longer exists.
-class CleanupNonexistingNamespacePendingDeleteProjects < ActiveRecord::Migration
+class CleanupNonexistingNamespacePendingDeleteProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170822101017_migrate_pipeline_sidekiq_queues.rb b/db/post_migrate/20170822101017_migrate_pipeline_sidekiq_queues.rb
index 8441cfe796891beb82141dbdcd562e392aea0869..825bc9250bd8caef84fcad05263511a672fbbea4 100644
--- a/db/post_migrate/20170822101017_migrate_pipeline_sidekiq_queues.rb
+++ b/db/post_migrate/20170822101017_migrate_pipeline_sidekiq_queues.rb
@@ -1,4 +1,4 @@
-class MigratePipelineSidekiqQueues < ActiveRecord::Migration
+class MigratePipelineSidekiqQueues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170828170502_post_deploy_migrate_user_external_mail_data.rb b/db/post_migrate/20170828170502_post_deploy_migrate_user_external_mail_data.rb
index fd1437b07f5185677259826199a83a69c1d75576..533155aeb7a9c695a8ea52a3f8aacf74b13e90b6 100644
--- a/db/post_migrate/20170828170502_post_deploy_migrate_user_external_mail_data.rb
+++ b/db/post_migrate/20170828170502_post_deploy_migrate_user_external_mail_data.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PostDeployMigrateUserExternalMailData < ActiveRecord::Migration
+class PostDeployMigrateUserExternalMailData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170828170513_remove_user_email_provider_column.rb b/db/post_migrate/20170828170513_remove_user_email_provider_column.rb
index 570f2b3772a4037ff59ed0f326f502b4cb735782..bfc8aede540b1dacc1888c176f1a27425441f5d0 100644
--- a/db/post_migrate/20170828170513_remove_user_email_provider_column.rb
+++ b/db/post_migrate/20170828170513_remove_user_email_provider_column.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveUserEmailProviderColumn < ActiveRecord::Migration
+class RemoveUserEmailProviderColumn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170828170516_remove_user_external_mail_columns.rb b/db/post_migrate/20170828170516_remove_user_external_mail_columns.rb
index bb81dc682b307d7f9f0dd343218ea20edf6d0b8a..0104955e5c84852a5e1306f836a121beff60de7e 100644
--- a/db/post_migrate/20170828170516_remove_user_external_mail_columns.rb
+++ b/db/post_migrate/20170828170516_remove_user_external_mail_columns.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveUserExternalMailColumns < ActiveRecord::Migration
+class RemoveUserExternalMailColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170830084744_destroy_gpg_signatures.rb b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb
index b04d36f6537156c28e7745f5f632fd60fbff6aea..2945eb9fde64388943c7d1bcc495ae7b0a0d49cf 100644
--- a/db/post_migrate/20170830084744_destroy_gpg_signatures.rb
+++ b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb
@@ -1,4 +1,4 @@
-class DestroyGpgSignatures < ActiveRecord::Migration
+class DestroyGpgSignatures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/post_migrate/20170830150306_drop_events_for_migration_table.rb b/db/post_migrate/20170830150306_drop_events_for_migration_table.rb
index 69a612ead40e5467d7fef235eaa193db29047d43..3538b52b00436cbb1928aeb9d4604ac2483ae836 100644
--- a/db/post_migrate/20170830150306_drop_events_for_migration_table.rb
+++ b/db/post_migrate/20170830150306_drop_events_for_migration_table.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class DropEventsForMigrationTable < ActiveRecord::Migration
+class DropEventsForMigrationTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb b/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb
index 9b6745e33d954d457c8d03596f441a03859aea21..8e264c1ab41b00f24d6e49d111b57a94c2aab8f8 100644
--- a/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb
+++ b/db/post_migrate/20170831195038_remove_valid_signature_from_gpg_signatures.rb
@@ -1,4 +1,4 @@
-class RemoveValidSignatureFromGpgSignatures < ActiveRecord::Migration
+class RemoveValidSignatureFromGpgSignatures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb b/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb
index 033019c398ec1371c30ecd97f8449371a6366a9b..95abf2474ddb25be86b54dcd6624efa0eb6a6275 100644
--- a/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb
+++ b/db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class DeleteConflictingRedirectRoutes < ActiveRecord::Migration
+class DeleteConflictingRedirectRoutes < ActiveRecord::Migration[4.2]
   def up
     # No-op.
     # See https://gitlab.com/gitlab-com/infrastructure/issues/3460#note_53223252
diff --git a/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb b/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
index bfa9ad80c7df93e5ca73c0105345f7f8c956fbcf..bbc624ac7c0e63e18afbf7c355cfb5faa80ad5ee 100644
--- a/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
+++ b/db/post_migrate/20170913180600_fix_projects_without_project_feature.rb
@@ -1,4 +1,4 @@
-class FixProjectsWithoutProjectFeature < ActiveRecord::Migration
+class FixProjectsWithoutProjectFeature < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb b/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb
index 2230bb0e53c37dfa74bea8af8d3c2c0850e2f483..9080acee1d66112482596c684b9167a271a74c3f 100644
--- a/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb
+++ b/db/post_migrate/20170921101004_normalize_ldap_extern_uids.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class NormalizeLdapExternUids < ActiveRecord::Migration
+class NormalizeLdapExternUids < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170926150348_schedule_merge_request_diff_migrations_take_two.rb b/db/post_migrate/20170926150348_schedule_merge_request_diff_migrations_take_two.rb
index 5732cb85ea5cfc0bcd6b3f475ea8bf87e2782467..9b675a51725b427c323341a6c7078fd67ab6e965 100644
--- a/db/post_migrate/20170926150348_schedule_merge_request_diff_migrations_take_two.rb
+++ b/db/post_migrate/20170926150348_schedule_merge_request_diff_migrations_take_two.rb
@@ -1,4 +1,4 @@
-class ScheduleMergeRequestDiffMigrationsTakeTwo < ActiveRecord::Migration
+class ScheduleMergeRequestDiffMigrationsTakeTwo < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170927112318_update_legacy_diff_notes_type_for_import.rb b/db/post_migrate/20170927112318_update_legacy_diff_notes_type_for_import.rb
index b040c81b316477d5d033a39296bbc21703af95f6..83c21c203e0489e690d9e891df7b2ac42e6094c4 100644
--- a/db/post_migrate/20170927112318_update_legacy_diff_notes_type_for_import.rb
+++ b/db/post_migrate/20170927112318_update_legacy_diff_notes_type_for_import.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class UpdateLegacyDiffNotesTypeForImport < ActiveRecord::Migration
+class UpdateLegacyDiffNotesTypeForImport < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20170927112319_update_notes_type_for_import.rb b/db/post_migrate/20170927112319_update_notes_type_for_import.rb
index 5a400c71b021323c39b053a97ae2e80afe4d630a..8c691de3192f0a886cace25b97f7ced8c857c309 100644
--- a/db/post_migrate/20170927112319_update_notes_type_for_import.rb
+++ b/db/post_migrate/20170927112319_update_notes_type_for_import.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class UpdateNotesTypeForImport < ActiveRecord::Migration
+class UpdateNotesTypeForImport < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
index 467c584c2e00d09036aaa45d5a3aebd4aac74768..e49a70f902c4f88b2a4d85f96155d46c7f24a727 100644
--- a/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
+++ b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ScheduleCreateGpgKeySubkeysFromGpgKeys < ActiveRecord::Migration
+class ScheduleCreateGpgKeySubkeysFromGpgKeys < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171012150314_remove_user_authentication_token.rb b/db/post_migrate/20171012150314_remove_user_authentication_token.rb
index d0f3aa06e982773ccc9d24815b53312c77db41a9..9313986ce8505bbf04234567fa8b7e4fc11acaba 100644
--- a/db/post_migrate/20171012150314_remove_user_authentication_token.rb
+++ b/db/post_migrate/20171012150314_remove_user_authentication_token.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveUserAuthenticationToken < ActiveRecord::Migration
+class RemoveUserAuthenticationToken < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb b/db/post_migrate/20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb
index 28cd0f70cc25dfbaabbbd3217c28fb054b4988ed..9c90aa611a478c778f68aa926cdd15ba3818146e 100644
--- a/db/post_migrate/20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb
+++ b/db/post_migrate/20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb
@@ -1,4 +1,4 @@
-class MigrateGcpClustersToNewClustersArchitectures < ActiveRecord::Migration
+class MigrateGcpClustersToNewClustersArchitectures < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class GcpCluster < ActiveRecord::Base
diff --git a/db/post_migrate/20171026082505_schedule_merge_request_latest_merge_request_diff_id_migrations.rb b/db/post_migrate/20171026082505_schedule_merge_request_latest_merge_request_diff_id_migrations.rb
index 7a63382cc6d0667d389aba5ed46ec2f7a9b37d8c..764561de997f6ac9f963dc0792a8db599eb0cf32 100644
--- a/db/post_migrate/20171026082505_schedule_merge_request_latest_merge_request_diff_id_migrations.rb
+++ b/db/post_migrate/20171026082505_schedule_merge_request_latest_merge_request_diff_id_migrations.rb
@@ -1,4 +1,4 @@
-class ScheduleMergeRequestLatestMergeRequestDiffIdMigrations < ActiveRecord::Migration
+class ScheduleMergeRequestLatestMergeRequestDiffIdMigrations < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb
index 4e8f495d65d59b97e96f10da0db9148914c1abc0..e6a5ffc8649aa01721c68f5dc6d263c31554ac12 100644
--- a/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb
+++ b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb
@@ -1,4 +1,4 @@
-class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration
+class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20171103140253_track_untracked_uploads.rb b/db/post_migrate/20171103140253_track_untracked_uploads.rb
index 548a94d2d381d20c557fd2117cc239ae391624d1..6891ef5ba12eb73c56f1c36cfbfb1252df925329 100644
--- a/db/post_migrate/20171103140253_track_untracked_uploads.rb
+++ b/db/post_migrate/20171103140253_track_untracked_uploads.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class TrackUntrackedUploads < ActiveRecord::Migration
+class TrackUntrackedUploads < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/post_migrate/20171106133144_cleanup_application_settings_password_authentication_enabled_rename.rb b/db/post_migrate/20171106133144_cleanup_application_settings_password_authentication_enabled_rename.rb
index d54ff3d5f5e75a75df96ecfb6fe279df5c68098b..4a01bf75f50c0ca6ff62313fe553f348f79a65af 100644
--- a/db/post_migrate/20171106133144_cleanup_application_settings_password_authentication_enabled_rename.rb
+++ b/db/post_migrate/20171106133144_cleanup_application_settings_password_authentication_enabled_rename.rb
@@ -1,4 +1,4 @@
-class CleanupApplicationSettingsPasswordAuthenticationEnabledRename < ActiveRecord::Migration
+class CleanupApplicationSettingsPasswordAuthenticationEnabledRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171106154015_remove_issues_branch_name.rb b/db/post_migrate/20171106154015_remove_issues_branch_name.rb
index 3d08225c96de9f25124e30ef7cc29225b3db3e7d..4e71aa2f1639c230f3a250594c17d54752842f8d 100644
--- a/db/post_migrate/20171106154015_remove_issues_branch_name.rb
+++ b/db/post_migrate/20171106154015_remove_issues_branch_name.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveIssuesBranchName < ActiveRecord::Migration
+class RemoveIssuesBranchName < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20171106180641_cleanup_add_timezone_to_issues_closed_at.rb b/db/post_migrate/20171106180641_cleanup_add_timezone_to_issues_closed_at.rb
index 53f376f216b64503372296825f1d2bb0756af082..8187d3971fcc3500075e801cf42ec1156b25051e 100644
--- a/db/post_migrate/20171106180641_cleanup_add_timezone_to_issues_closed_at.rb
+++ b/db/post_migrate/20171106180641_cleanup_add_timezone_to_issues_closed_at.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupAddTimezoneToIssuesClosedAt < ActiveRecord::Migration
+class CleanupAddTimezoneToIssuesClosedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171114104051_remove_empty_fork_networks.rb b/db/post_migrate/20171114104051_remove_empty_fork_networks.rb
index 2fe99a1b9c17a1886a71ff8ae687d8e570326718..76862cccf60f4dab7d63faaf6e66a455d851fd3a 100644
--- a/db/post_migrate/20171114104051_remove_empty_fork_networks.rb
+++ b/db/post_migrate/20171114104051_remove_empty_fork_networks.rb
@@ -1,4 +1,4 @@
-class RemoveEmptyForkNetworks < ActiveRecord::Migration
+class RemoveEmptyForkNetworks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb b/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb
index 3a7b2a7fac041bf6b37d7bb5cf666a6bd5a41f53..93a97993f1fc49d5f93f0d49222d2b3a451a186f 100644
--- a/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb
+++ b/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb
@@ -1,4 +1,4 @@
-class RemoveMergeRequestDiffStCommitsAndStDiffs < ActiveRecord::Migration
+class RemoveMergeRequestDiffStCommitsAndStDiffs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171123101020_update_circuitbreaker_defaults.rb b/db/post_migrate/20171123101020_update_circuitbreaker_defaults.rb
index 8e1c9e6d6bb636d956a77b87a0e0717f4e19947d..ae9542892919020e8bb26c04a7035ddfebec138f 100644
--- a/db/post_migrate/20171123101020_update_circuitbreaker_defaults.rb
+++ b/db/post_migrate/20171123101020_update_circuitbreaker_defaults.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UpdateCircuitbreakerDefaults < ActiveRecord::Migration
+class UpdateCircuitbreakerDefaults < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171123101046_remove_old_circuitbreaker_config.rb b/db/post_migrate/20171123101046_remove_old_circuitbreaker_config.rb
index e646d4d3224ece91e5d4324f8088665ff861b325..3f2c1b2170af80ee7914ec96c09fa48ab157504e 100644
--- a/db/post_migrate/20171123101046_remove_old_circuitbreaker_config.rb
+++ b/db/post_migrate/20171123101046_remove_old_circuitbreaker_config.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveOldCircuitbreakerConfig < ActiveRecord::Migration
+class RemoveOldCircuitbreakerConfig < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb b/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb
index 698df712c11b3931010d8b6df362f891ccdff22f..2c65a4ae4f5e3f6406c61db3206c86321c2f16f6 100644
--- a/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb
+++ b/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb
@@ -1,4 +1,4 @@
-class AddIndexOnMergeRequestDiffsMergeRequestIdAndId < ActiveRecord::Migration
+class AddIndexOnMergeRequestDiffsMergeRequestIdAndId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb b/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb
index 038e4807000c22139f366a38b4b835f7fcdb3976..efd3714d6686936d86abfe2f39b52bc207a8ffd8 100644
--- a/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb
+++ b/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb
@@ -1,4 +1,4 @@
-class RemoveIndexOnMergeRequestDiffsMergeRequestDiffId < ActiveRecord::Migration
+class RemoveIndexOnMergeRequestDiffsMergeRequestDiffId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
index a957f10740544b8ec22ca6623fe9aaebf0b9eeaa..58ceefe3c9744c2b40e57e5de5b811a8deeab34e 100644
--- a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
+++ b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
@@ -1,4 +1,4 @@
-class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migration
+class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb
index 26f917d5a1e8d50e98ec90d0923dae26f19a8812..8e320ea9e8d91fa41e4b5127f3e487892e26e4ae 100644
--- a/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb
+++ b/db/post_migrate/20171124150326_reschedule_fork_network_creation.rb
@@ -1,4 +1,4 @@
-class RescheduleForkNetworkCreation < ActiveRecord::Migration
+class RescheduleForkNetworkCreation < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb b/db/post_migrate/20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb
index 980f76e7d57d05d63ddb3e77ed7fc8cc8eeb872e..51441a36e4baefd53993386d8304e441e69804bf 100644
--- a/db/post_migrate/20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb
+++ b/db/post_migrate/20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class SchedulePopulateMergeRequestMetricsWithEventsData < ActiveRecord::Migration
+class SchedulePopulateMergeRequestMetricsWithEventsData < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   BATCH_SIZE = 10_000
   MIGRATION = 'PopulateMergeRequestMetricsWithEventsData'
diff --git a/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb b/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb
index 30ff5173192228054e50984f1b850750a5633c5c..058f3a40817e501c80050b986d58119db3ac5ee2 100644
--- a/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb
+++ b/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb
@@ -1,4 +1,4 @@
-class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration
+class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb b/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
index 2f339172eeb36aa8d6cc0551ac888a45f8a352e2..44273cebc9d6313dead72e6d7b7b680e9296ae3d 100644
--- a/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
+++ b/db/post_migrate/20171207150300_remove_project_labels_group_id_copy.rb
@@ -1,7 +1,7 @@
 # Copy of 20180202111106 - this one should run before 20171207150343 to fix issues related to
 # the removal of groups with labels.
 
-class RemoveProjectLabelsGroupIdCopy < ActiveRecord::Migration
+class RemoveProjectLabelsGroupIdCopy < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171207150343_remove_soft_removed_objects.rb b/db/post_migrate/20171207150343_remove_soft_removed_objects.rb
index 3109b6dbf8ea4ce2a5db0b6166eb17270a78d695..53707c67d369959dd13f15ead1e1c00f45f6e416 100644
--- a/db/post_migrate/20171207150343_remove_soft_removed_objects.rb
+++ b/db/post_migrate/20171207150343_remove_soft_removed_objects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveSoftRemovedObjects < ActiveRecord::Migration
+class RemoveSoftRemovedObjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20171207150344_remove_deleted_at_columns.rb b/db/post_migrate/20171207150344_remove_deleted_at_columns.rb
index 154d7a1b9266699cc1db99593a36a624505ae09b..5f1c70a27977f855eab86041f06b66398b860ae0 100644
--- a/db/post_migrate/20171207150344_remove_deleted_at_columns.rb
+++ b/db/post_migrate/20171207150344_remove_deleted_at_columns.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveDeletedAtColumns < ActiveRecord::Migration
+class RemoveDeletedAtColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171213160445_migrate_github_importer_advance_stage_sidekiq_queue.rb b/db/post_migrate/20171213160445_migrate_github_importer_advance_stage_sidekiq_queue.rb
index 149c28f194653d13a272565fed0eba58312f0807..088c4b5d46ba001a34eece568d3896fd64b5b9bc 100644
--- a/db/post_migrate/20171213160445_migrate_github_importer_advance_stage_sidekiq_queue.rb
+++ b/db/post_migrate/20171213160445_migrate_github_importer_advance_stage_sidekiq_queue.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateGithubImporterAdvanceStageSidekiqQueue < ActiveRecord::Migration
+class MigrateGithubImporterAdvanceStageSidekiqQueue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171215121205_post_populate_can_push_from_deploy_keys_projects.rb b/db/post_migrate/20171215121205_post_populate_can_push_from_deploy_keys_projects.rb
index 3a5850df3db8cb7d054a3bcf525434b84b27260d..1c81e56db559d3fe95728ce6be07a70447ac7172 100644
--- a/db/post_migrate/20171215121205_post_populate_can_push_from_deploy_keys_projects.rb
+++ b/db/post_migrate/20171215121205_post_populate_can_push_from_deploy_keys_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PostPopulateCanPushFromDeployKeysProjects < ActiveRecord::Migration
+class PostPopulateCanPushFromDeployKeysProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171215121259_remove_can_push_from_keys.rb b/db/post_migrate/20171215121259_remove_can_push_from_keys.rb
index 0599811d9869daee683cb76c127dfaba61fbee26..fc4045a383d1f41e0e77d683e92124e6b0a2907f 100644
--- a/db/post_migrate/20171215121259_remove_can_push_from_keys.rb
+++ b/db/post_migrate/20171215121259_remove_can_push_from_keys.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveCanPushFromKeys < ActiveRecord::Migration
+class RemoveCanPushFromKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb b/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb
index 286721a0894a7d3a4a44bd0714ed6bf00a7f65ea..45ef75fdb98cedab695bce66dd0f23b65a280b68 100644
--- a/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb
+++ b/db/post_migrate/20171219121201_normalize_extern_uid_from_identities.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class NormalizeExternUidFromIdentities < ActiveRecord::Migration
+class NormalizeExternUidFromIdentities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20171221140220_schedule_issues_closed_at_type_change.rb b/db/post_migrate/20171221140220_schedule_issues_closed_at_type_change.rb
index eeecc7b1de0d7ca37542cc48bdccaf900c6515b0..6b5e62026888489bc3873d6a1ce67a0fa1159cab 100644
--- a/db/post_migrate/20171221140220_schedule_issues_closed_at_type_change.rb
+++ b/db/post_migrate/20171221140220_schedule_issues_closed_at_type_change.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 # rubocop:disable Migration/Datetime
-class ScheduleIssuesClosedAtTypeChange < ActiveRecord::Migration
+class ScheduleIssuesClosedAtTypeChange < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb b/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb
index fa51ac8361907ad5214f4807d9f3c2b459febf4b..0822aebc2c6d10c1f7078b44ffd0c50f477a6c31 100644
--- a/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb
+++ b/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb
@@ -1,4 +1,4 @@
-class ScheduleSetConfidentialNoteEventsOnWebhooks < ActiveRecord::Migration
+class ScheduleSetConfidentialNoteEventsOnWebhooks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb b/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
index 269f1287f912434b65cd311d92adeb0c80e1f401..0a2ea7bfb7b31e762ff26c990c3f931d62cd10f6 100644
--- a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
+++ b/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
@@ -1,4 +1,4 @@
-class RemoveRedundantPipelineStages < ActiveRecord::Migration
+class RemoveRedundantPipelineStages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb b/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb
index a3ff9f1719eeb324d94820aa2770b236ed4316c5..98bbb34dda1b1c74cef250e8c8e37399ba7966a7 100644
--- a/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb
+++ b/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb
@@ -1,4 +1,4 @@
-class ScheduleSetConfidentialNoteEventsOnServices < ActiveRecord::Migration
+class ScheduleSetConfidentialNoteEventsOnServices < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180202111106_remove_project_labels_group_id.rb b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb
index db7fd0d167df0ba4d6aae9c61d6e8f0b776b84f3..31ec84f0d6acdce0aa6240a8ba7defb31af3c0b7 100644
--- a/db/post_migrate/20180202111106_remove_project_labels_group_id.rb
+++ b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveProjectLabelsGroupId < ActiveRecord::Migration
+class RemoveProjectLabelsGroupId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb b/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb
index 92c32feebf77b452fafbea340ae8c6c714b5a9ff..54b8a91fa47238697c86496371bd8b9b33243a09 100644
--- a/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb
+++ b/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb
@@ -1,4 +1,4 @@
-class ChangeAuthorIdToNotNullInTodos < ActiveRecord::Migration
+class ChangeAuthorIdToNotNullInTodos < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class Todo < ActiveRecord::Base
diff --git a/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb b/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
index e55e2e6f888612b8d03b80d8d5c8497bc85bff94..f8badcac990e7b3b2852572cbfb83f0ea4678316 100644
--- a/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
+++ b/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
@@ -1,4 +1,4 @@
-class AddTmpPartialNullIndexToBuilds < ActiveRecord::Migration
+class AddTmpPartialNullIndexToBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
index 0f61fa8183238538fe0d564012187c579089b934..2445ab1a1303ea9e7eb8c94eba569e68d693f1e4 100644
--- a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
+++ b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
@@ -1,4 +1,4 @@
-class ScheduleBuildStageMigration < ActiveRecord::Migration
+class ScheduleBuildStageMigration < ActiveRecord::Migration[4.2]
   ##
   # This migration has been rescheduled to run again, see
   # `20180405101928_reschedule_builds_stages_migration.rb`
diff --git a/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb b/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
index ed7b1fc72f46fac46ec83b1b041f16e53f7b2121..2444df881b8443a51ee4552fffc79776fd8adee5 100644
--- a/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
+++ b/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
@@ -1,4 +1,4 @@
-class RemoveTmpPartialNullIndexFromBuilds < ActiveRecord::Migration
+class RemoveTmpPartialNullIndexFromBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb b/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb
index d423673d2a57bcc8b240bbcef3c28f79af855cc3..dae43ee14df1e4cdfd0925693537c1a2e212231b 100644
--- a/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb
+++ b/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb
@@ -1,4 +1,4 @@
-class FillPagesDomainVerificationCode < ActiveRecord::Migration
+class FillPagesDomainVerificationCode < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class PagesDomain < ActiveRecord::Base
diff --git a/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb b/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb
index bf9bf4e660f7ca13c10e1d3e46ae697910fd194d..d776fb85f00f982ca94aa8807e634889df315b8e 100644
--- a/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb
+++ b/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb
@@ -1,4 +1,4 @@
-class EnqueueVerifyPagesDomainWorkers < ActiveRecord::Migration
+class EnqueueVerifyPagesDomainWorkers < ActiveRecord::Migration[4.2]
   class PagesDomain < ActiveRecord::Base
     include EachBatch
   end
diff --git a/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb b/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
index 2d5a8617169c5d1df52a0dcc9b2b06397fe09e65..86ef333685ede566aefe67693bd2bd25a47a0743 100644
--- a/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
+++ b/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
@@ -1,4 +1,4 @@
-class RemoveEmptyExternUidAuth0Identities < ActiveRecord::Migration
+class RemoveEmptyExternUidAuth0Identities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb b/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
index 8c8dbb1a0434091e2a0dc4de4129e8393f61c05f..fa332fd5c708d08b467a539cb7871a299d23878d 100644
--- a/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
+++ b/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
@@ -1,7 +1,7 @@
 require_relative '../migrate/20180223120443_create_user_interacted_projects_table.rb'
 # rubocop:disable AddIndex
 # rubocop:disable AddConcurrentForeignKey
-class BuildUserInteractedProjectsTable < ActiveRecord::Migration
+class BuildUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
@@ -43,7 +43,7 @@ def down
     end
   end
 
-  class PostgresStrategy < ActiveRecord::Migration
+  class PostgresStrategy < ActiveRecord::Migration[4.2]
     include Gitlab::Database::MigrationHelpers
 
     BATCH_SIZE = 100_000
@@ -141,7 +141,7 @@ def with_index(*args)
     end
   end
 
-  class MysqlStrategy < ActiveRecord::Migration
+  class MysqlStrategy < ActiveRecord::Migration[4.2]
     include Gitlab::Database::MigrationHelpers
 
     def up
diff --git a/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb b/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
index 0342372cbed1590f994797c5b0ca8eee5db97b39..62a239b0e7c7452282ceb8d3049509612e01b0b6 100644
--- a/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
+++ b/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class ChangeProjectNamespaceIdNotNull < ActiveRecord::Migration
+class ChangeProjectNamespaceIdNotNull < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class Project < ActiveRecord::Base
diff --git a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb b/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
index aa19732ca1c7122501d306f29cd2e2c418303d27..15c052da99be175d1984825b527fd05de60aef6f 100644
--- a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
+++ b/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemovePermanentFromRedirectRoutes < ActiveRecord::Migration
+class RemovePermanentFromRedirectRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb b/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb
index 0af1c3bc0a5d40c5aa0d9ebe36ac0ee6614c4f84..fc74f6f17125395cf566bf14c49acca27af34c65 100644
--- a/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb
+++ b/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb
@@ -1,4 +1,4 @@
-class MigrateCreateTraceArtifactSidekiqQueue < ActiveRecord::Migration
+class MigrateCreateTraceArtifactSidekiqQueue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
index ca9212fae27ed5eb539f6105633fdbc5a5aa9ee6..53918250b4cb3bf474440e66d1bba3449af2b65a 100644
--- a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
+++ b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPathIndexToRedirectRoutes < ActiveRecord::Migration
+class AddPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb b/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb
index 9728df6d409f52092d13eb02cdf48c89d3acde84..372c04429c7da0e9c0c8b1afda2bb3b681b00af8 100644
--- a/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb
+++ b/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb
@@ -1,4 +1,4 @@
-class MigrateUpdateHeadPipelineForMergeRequestSidekiqQueue < ActiveRecord::Migration
+class MigrateUpdateHeadPipelineForMergeRequestSidekiqQueue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb b/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
index c32123454f95cf2ed9a55a1518f9b5bce08a5ada..213d97b71f7c78e38946f399adc17c2c47ea5585 100644
--- a/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
+++ b/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
@@ -1,4 +1,4 @@
-class RescheduleBuildsStagesMigration < ActiveRecord::Migration
+class RescheduleBuildsStagesMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   ##
diff --git a/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb b/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb
index 3d77ff921c7d3ca17fd3dab2b21b1d65d851982d..813603cb3addcd6ef022ad8051af6cbba21b83c8 100644
--- a/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb
+++ b/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb
@@ -1,4 +1,4 @@
-class CleanupUsersRssTokenRename < ActiveRecord::Migration
+class CleanupUsersRssTokenRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb b/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb
index 3b0fdb3aeea75ca0ab28f8d339516001c37605ba..0cda3d76a3d39452ddd012f41cf484a40e5c7767 100644
--- a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb
+++ b/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PopulateMissingProjectCiCdSettings < ActiveRecord::Migration
+class PopulateMissingProjectCiCdSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180420080616_schedule_stages_index_migration.rb b/db/post_migrate/20180420080616_schedule_stages_index_migration.rb
index eb82f098639fc0add4d4839e5bd5e32d1826f709..2d72e75393f4e05752604f358c1af9e8d3d3cdf3 100644
--- a/db/post_migrate/20180420080616_schedule_stages_index_migration.rb
+++ b/db/post_migrate/20180420080616_schedule_stages_index_migration.rb
@@ -1,4 +1,4 @@
-class ScheduleStagesIndexMigration < ActiveRecord::Migration
+class ScheduleStagesIndexMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180424151928_fill_file_store.rb b/db/post_migrate/20180424151928_fill_file_store.rb
index 03d54dab250bdd849467dbb949cdfbd0da3aea4a..45fa10c955007f68395e7cff709c41d45cd724c8 100644
--- a/db/post_migrate/20180424151928_fill_file_store.rb
+++ b/db/post_migrate/20180424151928_fill_file_store.rb
@@ -1,4 +1,4 @@
-class FillFileStore < ActiveRecord::Migration
+class FillFileStore < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb b/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb
index 0e6ec46e5f07a5549b4977d3bd861c7461298dc8..ba1023866c56bc7219bb25d77193f0560f1e5987 100644
--- a/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb
+++ b/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb
@@ -1,4 +1,4 @@
-class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration
+class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180502134117_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb b/db/post_migrate/20180502134117_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb
index 08d7d64a2c551adb665e396c6fe1318a8e34f89b..b82ee3569c9b5e3e3a700b76b2b7b5f74fded03a 100644
--- a/db/post_migrate/20180502134117_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb
+++ b/db/post_migrate/20180502134117_migrate_import_attributes_data_from_projects_to_project_mirror_data.rb
@@ -1,4 +1,4 @@
-class MigrateImportAttributesDataFromProjectsToProjectMirrorData < ActiveRecord::Migration
+class MigrateImportAttributesDataFromProjectsToProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb b/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb
index fb9616f0c078bb350fa5b8baba1c69e32707a1bb..34edbb08bcf12545930d193f4de33a221a1e621c 100644
--- a/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb
+++ b/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb
@@ -1,4 +1,4 @@
-class SetMinimalProjectBuildTimeout < ActiveRecord::Migration
+class SetMinimalProjectBuildTimeout < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb b/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb
index 88a9f5f825662698114ba08d7d7b4e13398e7d36..a526001a91e60a61d752d6e00bf6a24e4ecd736c 100644
--- a/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb
+++ b/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb
@@ -1,4 +1,4 @@
-class AddUniqueConstraintToProjectFeaturesProjectId < ActiveRecord::Migration
+class AddUniqueConstraintToProjectFeaturesProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb b/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb
index 5a6d6ff4a1091e5743c376030c837329a86dbbe4..e3abbc039e8a713d03ab9e4fc373dc49d8f54229 100644
--- a/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb
+++ b/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb
@@ -1,4 +1,4 @@
-class AddNotNullConstraintToProjectFeaturesProjectId < ActiveRecord::Migration
+class AddNotNullConstraintToProjectFeaturesProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180514161336_remove_gemnasium_service.rb b/db/post_migrate/20180514161336_remove_gemnasium_service.rb
index 6d7806e8daa4db9f4ac6ba5457a00b32bfffbdd6..5842bde474c3bfaf4b019fd872efb5c6e50e0bbe 100644
--- a/db/post_migrate/20180514161336_remove_gemnasium_service.rb
+++ b/db/post_migrate/20180514161336_remove_gemnasium_service.rb
@@ -1,4 +1,4 @@
-class RemoveGemnasiumService < ActiveRecord::Migration
+class RemoveGemnasiumService < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180521162137_migrate_remaining_mr_metrics_populating_background_migration.rb b/db/post_migrate/20180521162137_migrate_remaining_mr_metrics_populating_background_migration.rb
index 0282688fa40d242e8e14495451375135b310e9fd..39666a0cd2ae59c43c4653a318899c34b3dea6ca 100644
--- a/db/post_migrate/20180521162137_migrate_remaining_mr_metrics_populating_background_migration.rb
+++ b/db/post_migrate/20180521162137_migrate_remaining_mr_metrics_populating_background_migration.rb
@@ -1,4 +1,4 @@
-class MigrateRemainingMrMetricsPopulatingBackgroundMigration < ActiveRecord::Migration
+class MigrateRemainingMrMetricsPopulatingBackgroundMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb b/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb
index 7eca7394f5f83f391dea63743e68addbb865c096..b3b539fd15601e1228219e577ddc93a1c85d625d 100644
--- a/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb
+++ b/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb
@@ -1,4 +1,4 @@
-class CleanupMergeRequestsAllowMaintainerToPushRename < ActiveRecord::Migration
+class CleanupMergeRequestsAllowMaintainerToPushRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb b/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb
index 965cd3a8714b13e947d00436551a95a29089e92a..6246f6afab0901b8854b9caeeb76479234b7e54e 100644
--- a/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb
+++ b/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb
@@ -1,4 +1,4 @@
-class ScheduleToArchiveLegacyTraces < ActiveRecord::Migration
+class ScheduleToArchiveLegacyTraces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb b/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb
index 57bee6269b9d63a5e0f8cc59922614761e0504ef..bc7c3eb53853272e9c424a8af52f2af0b7c194f6 100644
--- a/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb
+++ b/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb
@@ -1,4 +1,4 @@
-class MigrateObjectStorageUploadSidekiqQueue < ActiveRecord::Migration
+class MigrateObjectStorageUploadSidekiqQueue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb b/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb
index 5418f442e790c105dbb0f860f2d9f7e9e9b78087..326cdfa27c3f1d5c0a9004f3eb83056ef93bb058 100644
--- a/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb
+++ b/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb
@@ -1,4 +1,4 @@
-class CleanupStagesPositionMigration < ActiveRecord::Migration
+class CleanupStagesPositionMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb b/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb
index 3f3edb8ea3d3d392e75422d25148b63ec60fedac..5e892f8bacef677377f2f84ea7ea3d6484565d5d 100644
--- a/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb
+++ b/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CleanupMergeRequestsAllowCollaborationRename < ActiveRecord::Migration
+class CleanupMergeRequestsAllowCollaborationRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180619121030_enqueue_delete_diff_files_workers.rb b/db/post_migrate/20180619121030_enqueue_delete_diff_files_workers.rb
index c4d2f5f61a0ac0986aaa71e96bd1543f6fa1529e..73f6a3a2a43868954c7d2a2895b4122ed7d4ff29 100644
--- a/db/post_migrate/20180619121030_enqueue_delete_diff_files_workers.rb
+++ b/db/post_migrate/20180619121030_enqueue_delete_diff_files_workers.rb
@@ -1,4 +1,4 @@
-class EnqueueDeleteDiffFilesWorkers < ActiveRecord::Migration
+class EnqueueDeleteDiffFilesWorkers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb b/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb
index a701d3678db596ea9b7e611464d2408a5ad4886f..15c02cd77b82668f40f37517ee91439bf0347497 100644
--- a/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb
+++ b/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectsForLastRepositoryCheckAt < ActiveRecord::Migration
+class AddPartialIndexToProjectsForLastRepositoryCheckAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb b/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb
index 59aa41adedee01a9aa404416461800ba19ab8fd5..3d3d49e75644973d422548247b4e4a980582d9bd 100644
--- a/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb
+++ b/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb
@@ -1,4 +1,4 @@
-class EnqueueFixCrossProjectLabelLinks < ActiveRecord::Migration
+class EnqueueFixCrossProjectLabelLinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180704145007_update_project_indexes.rb b/db/post_migrate/20180704145007_update_project_indexes.rb
index 0e2601ad4fa5a2e3a7933896f82bc0978e52cebc..0a82f4535a0e057aa44cc03348495c8babada853 100644
--- a/db/post_migrate/20180704145007_update_project_indexes.rb
+++ b/db/post_migrate/20180704145007_update_project_indexes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UpdateProjectIndexes < ActiveRecord::Migration
+class UpdateProjectIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180706223200_populate_site_statistics.rb b/db/post_migrate/20180706223200_populate_site_statistics.rb
index e78e9eb900a1824b41078952e8155ef51b2e3c0b..896965b708fa4dcb4ccd99d58e33dba2ef866b5c 100644
--- a/db/post_migrate/20180706223200_populate_site_statistics.rb
+++ b/db/post_migrate/20180706223200_populate_site_statistics.rb
@@ -1,4 +1,4 @@
-class PopulateSiteStatistics < ActiveRecord::Migration
+class PopulateSiteStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180723130817_delete_inconsistent_internal_id_records.rb b/db/post_migrate/20180723130817_delete_inconsistent_internal_id_records.rb
index f61fbe2fb9feea5c812ad146bae09aea98fe8a59..b044224a1c06bc6f0423f942fc73fd0fc94d99f8 100644
--- a/db/post_migrate/20180723130817_delete_inconsistent_internal_id_records.rb
+++ b/db/post_migrate/20180723130817_delete_inconsistent_internal_id_records.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class DeleteInconsistentInternalIdRecords < ActiveRecord::Migration
+class DeleteInconsistentInternalIdRecords < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
index 0a0a33299e442bf58283a00d433a7c94d10abb00..363219da539a1b3c370cf1750ef51bccddbf5cc6 100644
--- a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
+++ b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class MigrateNullWikiAccessLevels < ActiveRecord::Migration
+class MigrateNullWikiAccessLevels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb b/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb
index 2dd711e9c102c3f4e2d808c17ec9de08651e3615..6b0d1ef0d0c5711a2bca6196a8151688bef7d8d4 100644
--- a/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb
+++ b/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb
@@ -1,4 +1,4 @@
-class MigrateLegacyArtifactsToJobArtifacts < ActiveRecord::Migration
+class MigrateLegacyArtifactsToJobArtifacts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb b/db/post_migrate/20180816193530_rename_login_root_namespaces.rb
index 4ab1250473f52bb0f4f6111a7f9f6c129387da07..70db8f46d050b8c7ecb36829754cb8d4395c0cbc 100644
--- a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb
+++ b/db/post_migrate/20180816193530_rename_login_root_namespaces.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class RenameLoginRootNamespaces < ActiveRecord::Migration
+class RenameLoginRootNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   include Gitlab::Database::RenameReservedPathsMigration::V1
 
diff --git a/db/post_migrate/20180826111825_recalculate_site_statistics.rb b/db/post_migrate/20180826111825_recalculate_site_statistics.rb
index 741035a444f99cb046392c6039ad5666d2cf1a70..6d27eca38e33177cabf550e8e3f420c57b533381 100644
--- a/db/post_migrate/20180826111825_recalculate_site_statistics.rb
+++ b/db/post_migrate/20180826111825_recalculate_site_statistics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RecalculateSiteStatistics < ActiveRecord::Migration
+class RecalculateSiteStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180906051323_remove_orphaned_label_links.rb b/db/post_migrate/20180906051323_remove_orphaned_label_links.rb
index b56b74f483ebf6db50cd8e4bbb1061c5a9733850..a474aaf534cf2184a4ee2889b5bf5d23ff5da520 100644
--- a/db/post_migrate/20180906051323_remove_orphaned_label_links.rb
+++ b/db/post_migrate/20180906051323_remove_orphaned_label_links.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RemoveOrphanedLabelLinks < ActiveRecord::Migration
+class RemoveOrphanedLabelLinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb
index ed9422a3894770552e80708a0f555263ee50e703..2c266a4695bfc868d67e3134f94b5240dd543fd5 100644
--- a/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb
+++ b/db/post_migrate/20180913051323_consume_remaining_diff_files_deletion_jobs.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class ConsumeRemainingDiffFilesDeletionJobs < ActiveRecord::Migration
+class ConsumeRemainingDiffFilesDeletionJobs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb b/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb
index 36be819b2456d655ac4d30b75a0bed79bd2b719f..951cb3b088c9012ab92f7174f7cd16a351d765b9 100644
--- a/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb
+++ b/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb
@@ -1,4 +1,4 @@
-class ScheduleDigestPersonalAccessTokens < ActiveRecord::Migration
+class ScheduleDigestPersonalAccessTokens < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb b/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb
index 05ec4864a9e38ffe8384a073c34d5d1948e40884..ef864f490bb9528d323e8934f591e0db0d740aad 100644
--- a/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb
+++ b/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class EncryptWebHooksColumns < ActiveRecord::Migration
+class EncryptWebHooksColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb b/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb
index b3ed0d3f1e981ad32385ff511bc04c67af2491c4..2c007ec395df44ab160bd273f151bea9e9a6451c 100644
--- a/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb
+++ b/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveSidekiqThrottlingFromApplicationSettings < ActiveRecord::Migration
+class RemoveSidekiqThrottlingFromApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20180916014356_populate_external_pipeline_source.rb b/db/post_migrate/20180916014356_populate_external_pipeline_source.rb
index 5577d05cf408eec1f4ff2b8749cf3f6a1dfde0b8..a3d2df1f2bdae15bd583cf40f054b2dc0e3979b5 100644
--- a/db/post_migrate/20180916014356_populate_external_pipeline_source.rb
+++ b/db/post_migrate/20180916014356_populate_external_pipeline_source.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class PopulateExternalPipelineSource < ActiveRecord::Migration
+class PopulateExternalPipelineSource < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb b/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb
index 0a39abe3bdf644532d290be63be1575897c44c88..3b8300dabeba9d065b264a58d1fcf23e33706531 100644
--- a/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb
+++ b/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class RemoveWikisCountFromSiteStatistics < ActiveRecord::Migration
+class RemoveWikisCountFromSiteStatistics < ActiveRecord::Migration[4.2]
   def change
     remove_column :site_statistics, :wikis_count, :integer
   end
diff --git a/db/post_migrate/20181008145341_steal_encrypt_columns.rb b/db/post_migrate/20181008145341_steal_encrypt_columns.rb
index c107ac7291372ee62a58806bab465d9bda542b86..4102643ba138f9da9c53bea6812028bc125b377e 100644
--- a/db/post_migrate/20181008145341_steal_encrypt_columns.rb
+++ b/db/post_migrate/20181008145341_steal_encrypt_columns.rb
@@ -1,4 +1,4 @@
-class StealEncryptColumns < ActiveRecord::Migration
+class StealEncryptColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb b/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
index 0c44bca5f1a9ffa2cf943e2cd38bf2d35db34ab4..93e4458b795b0b21f4c804d432d564effff0b88c 100644
--- a/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
+++ b/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
@@ -1,4 +1,4 @@
-class RemoveWebHooksTokenAndUrl < ActiveRecord::Migration
+class RemoveWebHooksTokenAndUrl < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181008200441_remove_circuit_breaker.rb b/db/post_migrate/20181008200441_remove_circuit_breaker.rb
index 838addb7286c9b33559cacec3b7e042c5c8a3049..378692e8886af28b67c983e3e7c380e31b062104 100644
--- a/db/post_migrate/20181008200441_remove_circuit_breaker.rb
+++ b/db/post_migrate/20181008200441_remove_circuit_breaker.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RemoveCircuitBreaker < ActiveRecord::Migration
+class RemoveCircuitBreaker < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb b/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb
index 938a32e4e983b87d111bdd3d8eb96e0792c9b6fb..550ad94f4abae021ac5119fd3efc30148ae918ad 100644
--- a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb
+++ b/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RemoveKodingFromApplicationSettings < ActiveRecord::Migration
+class RemoveKodingFromApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181014121030_enqueue_redact_links.rb b/db/post_migrate/20181014121030_enqueue_redact_links.rb
index 1ee4703c88a30ec317cfa9bfd51525c8a1c515d3..8d1a840d5948121ae5da99e4d8f302277d3ddc1b 100644
--- a/db/post_migrate/20181014121030_enqueue_redact_links.rb
+++ b/db/post_migrate/20181014121030_enqueue_redact_links.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class EnqueueRedactLinks < ActiveRecord::Migration
+class EnqueueRedactLinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb b/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb
index f80a2aa6eaced3c55262ab2af68a043e212ea248..94a4574abff59e4fef0b4d62c07479d65d2e0073 100644
--- a/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb
+++ b/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class EnqueuePopulateClusterKubernetesNamespace < ActiveRecord::Migration
+class EnqueuePopulateClusterKubernetesNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb b/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb
index 32b271c472a731b7777da996def4fd8bfe13a9b7..228841a14a048b95348c18d9c8bba4c40c5182ba 100644
--- a/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb
+++ b/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class FillEmptyFinishedAtInDeployments < ActiveRecord::Migration
+class FillEmptyFinishedAtInDeployments < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181105201455_steal_fill_store_upload.rb b/db/post_migrate/20181105201455_steal_fill_store_upload.rb
index 982001fedbe3c143b5e003fb4e584b940cf1f8e6..a31a4eab472eec77a3ede9d59a817e283510f4c8 100644
--- a/db/post_migrate/20181105201455_steal_fill_store_upload.rb
+++ b/db/post_migrate/20181105201455_steal_fill_store_upload.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class StealFillStoreUpload < ActiveRecord::Migration
+class StealFillStoreUpload < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/db/post_migrate/20181107054254_remove_restricted_todos_again.rb b/db/post_migrate/20181107054254_remove_restricted_todos_again.rb
index 644e0074c46e2e9c8f8e91826a636ae4be2ab1c0..bbeb4e8a1dea9c44eab9957a796d6a8f1579294c 100644
--- a/db/post_migrate/20181107054254_remove_restricted_todos_again.rb
+++ b/db/post_migrate/20181107054254_remove_restricted_todos_again.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 # rescheduling of the revised RemoveRestrictedTodosWithCte background migration
-class RemoveRestrictedTodosAgain < ActiveRecord::Migration
+class RemoveRestrictedTodosAgain < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20170206203234_create_project_registry.rb b/ee/db/geo/migrate/20170206203234_create_project_registry.rb
index 0efddece2ff01a7f87f1819ecdc653d2e126120b..9471aa213a07c89501f6a6eb9cc8de0ca2c65a7a 100644
--- a/ee/db/geo/migrate/20170206203234_create_project_registry.rb
+++ b/ee/db/geo/migrate/20170206203234_create_project_registry.rb
@@ -1,4 +1,4 @@
-class CreateProjectRegistry < ActiveRecord::Migration
+class CreateProjectRegistry < ActiveRecord::Migration[4.2]
   def change
     create_table :project_registry do |t|
       t.integer  :project_id, null: false
diff --git a/ee/db/geo/migrate/20170223033541_create_file_registry.rb b/ee/db/geo/migrate/20170223033541_create_file_registry.rb
index daa41bafef5d7fe6a36454a97d005a3fb2d6a2b8..5a2607d8de56ead8a769cd923a17e4aecf2dfafd 100644
--- a/ee/db/geo/migrate/20170223033541_create_file_registry.rb
+++ b/ee/db/geo/migrate/20170223033541_create_file_registry.rb
@@ -1,4 +1,4 @@
-class CreateFileRegistry < ActiveRecord::Migration
+class CreateFileRegistry < ActiveRecord::Migration[4.2]
   def change
     create_table :file_registry do |t|
       t.string  :file_type, null: false
diff --git a/ee/db/geo/migrate/20170302005747_add_index_to_project_id_on_project_registry.rb b/ee/db/geo/migrate/20170302005747_add_index_to_project_id_on_project_registry.rb
index 1a514b987c83bb0aabfd2ece6da6f58204cab164..02e702ff65d908432dd5ca3164da5ac64a1f01f6 100644
--- a/ee/db/geo/migrate/20170302005747_add_index_to_project_id_on_project_registry.rb
+++ b/ee/db/geo/migrate/20170302005747_add_index_to_project_id_on_project_registry.rb
@@ -1,4 +1,4 @@
-class AddIndexToProjectIdOnProjectRegistry < ActiveRecord::Migration
+class AddIndexToProjectIdOnProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20170526214010_convert_file_bytes_to_int64.rb b/ee/db/geo/migrate/20170526214010_convert_file_bytes_to_int64.rb
index 3370e0296f146e51d2fbed77d76f345f8da4c907..8f4dc6f2575f3f5a956ca2cccf7085f9ec633d3b 100644
--- a/ee/db/geo/migrate/20170526214010_convert_file_bytes_to_int64.rb
+++ b/ee/db/geo/migrate/20170526214010_convert_file_bytes_to_int64.rb
@@ -1,4 +1,4 @@
-class ConvertFileBytesToInt64 < ActiveRecord::Migration
+class ConvertFileBytesToInt64 < ActiveRecord::Migration[4.2]
   def change
     change_column :file_registry, :bytes, :integer, limit: 8
   end
diff --git a/ee/db/geo/migrate/20170605154253_create_event_log_state.rb b/ee/db/geo/migrate/20170605154253_create_event_log_state.rb
index 00b7369ffc73fe96bfdcb7447d73783bd840c1bc..79039e7b70e84cd374893a0778f92de906886cf8 100644
--- a/ee/db/geo/migrate/20170605154253_create_event_log_state.rb
+++ b/ee/db/geo/migrate/20170605154253_create_event_log_state.rb
@@ -1,4 +1,4 @@
-class CreateEventLogState < ActiveRecord::Migration
+class CreateEventLogState < ActiveRecord::Migration[4.2]
   def change
     create_table :event_log_states, id: false do |t|
       t.integer :event_id, limit: 8, primary_key: true
diff --git a/ee/db/geo/migrate/20170606155045_add_needs_resync_to_project_registry.rb b/ee/db/geo/migrate/20170606155045_add_needs_resync_to_project_registry.rb
index d2d1723b6a641d93555e7ab961d53a1d05470b33..b362c59b18c141f0053de1b39669b4c958178068 100644
--- a/ee/db/geo/migrate/20170606155045_add_needs_resync_to_project_registry.rb
+++ b/ee/db/geo/migrate/20170606155045_add_needs_resync_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddNeedsResyncToProjectRegistry < ActiveRecord::Migration
+class AddNeedsResyncToProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20170614201943_add_last_wiki_synced_at_to_project_registry.rb b/ee/db/geo/migrate/20170614201943_add_last_wiki_synced_at_to_project_registry.rb
index 1c8714dbaae03345fa6ee43d12eb72c32b239042..842d46f44d31e70bb92d383138f5ff7211cba22b 100644
--- a/ee/db/geo/migrate/20170614201943_add_last_wiki_synced_at_to_project_registry.rb
+++ b/ee/db/geo/migrate/20170614201943_add_last_wiki_synced_at_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddLastWikiSyncedAtToProjectRegistry < ActiveRecord::Migration
+class AddLastWikiSyncedAtToProjectRegistry < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/geo/migrate/20170627195211_add_index_to_project_registry.rb b/ee/db/geo/migrate/20170627195211_add_index_to_project_registry.rb
index 2f85c91becb2342abb68fdfcc9e8a263630381eb..08e8422dd92f3722e5e0fe34a1212cdbee6956df 100644
--- a/ee/db/geo/migrate/20170627195211_add_index_to_project_registry.rb
+++ b/ee/db/geo/migrate/20170627195211_add_index_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddIndexToProjectRegistry < ActiveRecord::Migration
+class AddIndexToProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb b/ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb
index b351afd9a653e85e397b4426626ba5e6aa0e09a8..0dea2a43b58812d41f2f4186d692ea1a75e5744b 100644
--- a/ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb
+++ b/ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb
@@ -1,4 +1,4 @@
-class RemoveDuplicatesFromProjectRegistry < ActiveRecord::Migration
+class RemoveDuplicatesFromProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20170906182752_add_unique_index_to_project_id_on_project_registry.rb b/ee/db/geo/migrate/20170906182752_add_unique_index_to_project_id_on_project_registry.rb
index 7d954b6a26644df327f5798df42af94e9bab94c0..4801ec2993fffe37f9d6546216e25aabb61c10fd 100644
--- a/ee/db/geo/migrate/20170906182752_add_unique_index_to_project_id_on_project_registry.rb
+++ b/ee/db/geo/migrate/20170906182752_add_unique_index_to_project_id_on_project_registry.rb
@@ -1,4 +1,4 @@
-class AddUniqueIndexToProjectIdOnProjectRegistry < ActiveRecord::Migration
+class AddUniqueIndexToProjectIdOnProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20171005045404_remove_file_uploads_from_registry.rb b/ee/db/geo/migrate/20171005045404_remove_file_uploads_from_registry.rb
index bea1c8adfcb61c989bf58c621a807241ab63e98f..75808a856c25b04835068f451cbf08d76c42a593 100644
--- a/ee/db/geo/migrate/20171005045404_remove_file_uploads_from_registry.rb
+++ b/ee/db/geo/migrate/20171005045404_remove_file_uploads_from_registry.rb
@@ -1,4 +1,4 @@
-class RemoveFileUploadsFromRegistry < ActiveRecord::Migration
+class RemoveFileUploadsFromRegistry < ActiveRecord::Migration[4.2]
   # Previous to GitLab 10.1, GitLab would save attachments/avatars to the
   # wrong directory (/var/opt/gitlab/gitlab-rails/working). Destroy these
   # entries so they will be downloaded again.
diff --git a/ee/db/geo/migrate/20171009162208_add_file_registry_success.rb b/ee/db/geo/migrate/20171009162208_add_file_registry_success.rb
index 5d75f0545e7ac054f044c8c5181cc4a4d79c017c..f98742bfab7c8b0af75b1ccff6d9a856705d90bd 100644
--- a/ee/db/geo/migrate/20171009162208_add_file_registry_success.rb
+++ b/ee/db/geo/migrate/20171009162208_add_file_registry_success.rb
@@ -1,4 +1,4 @@
-class AddFileRegistrySuccess < ActiveRecord::Migration
+class AddFileRegistrySuccess < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20171009162209_add_file_registry_success_index.rb b/ee/db/geo/migrate/20171009162209_add_file_registry_success_index.rb
index f7ab941029971cf017c0e0646e5c62ca0cfe06b2..690ef58dda0547cf3a3654e57c5d01a3f6b0103f 100644
--- a/ee/db/geo/migrate/20171009162209_add_file_registry_success_index.rb
+++ b/ee/db/geo/migrate/20171009162209_add_file_registry_success_index.rb
@@ -1,4 +1,4 @@
-class AddFileRegistrySuccessIndex < ActiveRecord::Migration
+class AddFileRegistrySuccessIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb b/ee/db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb
index f4319c2b92ffd05c6c2298937f55f7213149358a..9d9bfad4ffafecd2c2ab66766b1722735ec4ae52 100644
--- a/ee/db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb
+++ b/ee/db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb
@@ -1,4 +1,4 @@
-class AddRetryCountFieldsToRegistries < ActiveRecord::Migration
+class AddRetryCountFieldsToRegistries < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20171115143841_add_last_sync_failure_to_project_registry.rb b/ee/db/geo/migrate/20171115143841_add_last_sync_failure_to_project_registry.rb
index 31461b1260ddc75e7a29192dfdde7fe09b7f98bf..099224a21d984046fcf494f7005be8c92a29af6e 100644
--- a/ee/db/geo/migrate/20171115143841_add_last_sync_failure_to_project_registry.rb
+++ b/ee/db/geo/migrate/20171115143841_add_last_sync_failure_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddLastSyncFailureToProjectRegistry < ActiveRecord::Migration
+class AddLastSyncFailureToProjectRegistry < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/geo/migrate/20180201154345_add_repository_verification_to_project_registry.rb b/ee/db/geo/migrate/20180201154345_add_repository_verification_to_project_registry.rb
index 74ada827ef0a1d99ec34eb973bcad84dab20fc26..62908baeb9b65f59a949cbbc79a5e4fb78dfc24e 100644
--- a/ee/db/geo/migrate/20180201154345_add_repository_verification_to_project_registry.rb
+++ b/ee/db/geo/migrate/20180201154345_add_repository_verification_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddRepositoryVerificationToProjectRegistry < ActiveRecord::Migration
+class AddRepositoryVerificationToProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/geo/migrate/20180314175612_add_partial_index_to_project_registy_verification_failure_columns.rb b/ee/db/geo/migrate/20180314175612_add_partial_index_to_project_registy_verification_failure_columns.rb
index 12dfcfcbe3ebcf48dd92e96204c1449f6fb66a32..53b9558df05dd40fa7b7ce38e40a692acd7f336e 100644
--- a/ee/db/geo/migrate/20180314175612_add_partial_index_to_project_registy_verification_failure_columns.rb
+++ b/ee/db/geo/migrate/20180314175612_add_partial_index_to_project_registy_verification_failure_columns.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectRegistyVerificationFailureColumns < ActiveRecord::Migration
+class AddPartialIndexToProjectRegistyVerificationFailureColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180315222132_add_partial_index_to_project_registy_checksum_columns.rb b/ee/db/geo/migrate/20180315222132_add_partial_index_to_project_registy_checksum_columns.rb
index 1cc303dd6c6adde9c4a801f7fd47764826d0f08a..d9a8adda99c231b6ea1db7c445559580dce661ae 100644
--- a/ee/db/geo/migrate/20180315222132_add_partial_index_to_project_registy_checksum_columns.rb
+++ b/ee/db/geo/migrate/20180315222132_add_partial_index_to_project_registy_checksum_columns.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectRegistyChecksumColumns < ActiveRecord::Migration
+class AddPartialIndexToProjectRegistyChecksumColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180321144947_change_repository_verification_checksum_to_sha.rb b/ee/db/geo/migrate/20180321144947_change_repository_verification_checksum_to_sha.rb
index 02c333a837f588e7c08830d2ba7196405a72e90a..c509a9c6099c30063f30838bd8fa7b942f9483fb 100644
--- a/ee/db/geo/migrate/20180321144947_change_repository_verification_checksum_to_sha.rb
+++ b/ee/db/geo/migrate/20180321144947_change_repository_verification_checksum_to_sha.rb
@@ -1,4 +1,4 @@
-class ChangeRepositoryVerificationChecksumToSha < ActiveRecord::Migration
+class ChangeRepositoryVerificationChecksumToSha < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb b/ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb
index 55498ffe3219ff1b023de6c59bd9e0c81f06ebd8..39d0c450782010be1ca286b6817ad0268172d99f 100644
--- a/ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb
+++ b/ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb
@@ -1,4 +1,4 @@
-class MigrateCiJobArtifactsToSeparateRegistry < ActiveRecord::Migration
+class MigrateCiJobArtifactsToSeparateRegistry < ActiveRecord::Migration[4.2]
   def up
     tracking_db.create_table :job_artifact_registry, force: :cascade do |t|
       t.datetime_with_timezone "created_at"
diff --git a/ee/db/geo/migrate/20180323182105_add_missing_on_primary_to_file_registry.rb b/ee/db/geo/migrate/20180323182105_add_missing_on_primary_to_file_registry.rb
index e1ffa7c22364e0a237369a0257de45a614224dd1..e341c473897b4c68043ad3b76c0fad869e928b13 100644
--- a/ee/db/geo/migrate/20180323182105_add_missing_on_primary_to_file_registry.rb
+++ b/ee/db/geo/migrate/20180323182105_add_missing_on_primary_to_file_registry.rb
@@ -1,4 +1,4 @@
-class AddMissingOnPrimaryToFileRegistry < ActiveRecord::Migration
+class AddMissingOnPrimaryToFileRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180327071612_add_partial_index_to_project_registy_checksum_sha_columns.rb b/ee/db/geo/migrate/20180327071612_add_partial_index_to_project_registy_checksum_sha_columns.rb
index d32d86964c3ed778ae64eac88cf307cdc882e039..e5eede6dffc742f5de6d743e28d22e85c0468acb 100644
--- a/ee/db/geo/migrate/20180327071612_add_partial_index_to_project_registy_checksum_sha_columns.rb
+++ b/ee/db/geo/migrate/20180327071612_add_partial_index_to_project_registy_checksum_sha_columns.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectRegistyChecksumShaColumns < ActiveRecord::Migration
+class AddPartialIndexToProjectRegistyChecksumShaColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb b/ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb
index a390851172597ac3e059fbb13744b53a8d5dd49b..057437d0dbf43e940a3c17e7532ffbc681b3b56e 100644
--- a/ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb
+++ b/ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb
@@ -1,4 +1,4 @@
-class AddMissingOnPrimaryToJobArtifactRegistry < ActiveRecord::Migration
+class AddMissingOnPrimaryToJobArtifactRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb b/ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb
index 0ea49707a9ca7ed51e6df2ce7d0d223655bb423b..5f625adf7df6edd49827f5b4ef38dd9970a775b4 100644
--- a/ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb
+++ b/ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexProjectRepositoryVerification < ActiveRecord::Migration
+class AddPartialIndexProjectRepositoryVerification < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180412213305_add_index_to_artifact_id_on_job_artifact_registry.rb b/ee/db/geo/migrate/20180412213305_add_index_to_artifact_id_on_job_artifact_registry.rb
index e6335990b926568c1b1a36c468c7915ef47e6af5..e42a57a6db9eee592bbebf571774ba8e824fe1d9 100644
--- a/ee/db/geo/migrate/20180412213305_add_index_to_artifact_id_on_job_artifact_registry.rb
+++ b/ee/db/geo/migrate/20180412213305_add_index_to_artifact_id_on_job_artifact_registry.rb
@@ -1,4 +1,4 @@
-class AddIndexToArtifactIdOnJobArtifactRegistry < ActiveRecord::Migration
+class AddIndexToArtifactIdOnJobArtifactRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180419174834_add_checksum_mismatch_fields_to_project_registry.rb b/ee/db/geo/migrate/20180419174834_add_checksum_mismatch_fields_to_project_registry.rb
index 8bc4e0b6a80b3d596fbe96701caca7c655e583db..1dfb43589aade747f187aa699efaaad06d275502 100644
--- a/ee/db/geo/migrate/20180419174834_add_checksum_mismatch_fields_to_project_registry.rb
+++ b/ee/db/geo/migrate/20180419174834_add_checksum_mismatch_fields_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddChecksumMismatchFieldsToProjectRegistry < ActiveRecord::Migration
+class AddChecksumMismatchFieldsToProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180419192603_add_indexes_to_checksum_mismatch_fields_on_project_registry.rb b/ee/db/geo/migrate/20180419192603_add_indexes_to_checksum_mismatch_fields_on_project_registry.rb
index 9a5bc91b33de605a57db015c0013e7146c2daf4b..8e068bc164eed4836f1386016c7d0444764fb51f 100644
--- a/ee/db/geo/migrate/20180419192603_add_indexes_to_checksum_mismatch_fields_on_project_registry.rb
+++ b/ee/db/geo/migrate/20180419192603_add_indexes_to_checksum_mismatch_fields_on_project_registry.rb
@@ -1,4 +1,4 @@
-class AddIndexesToChecksumMismatchFieldsOnProjectRegistry < ActiveRecord::Migration
+class AddIndexesToChecksumMismatchFieldsOnProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180427114641_add_repository_check_to_geo_project_registry.rb b/ee/db/geo/migrate/20180427114641_add_repository_check_to_geo_project_registry.rb
index b243f873ce927f1dc0d1a39a9668ee119063da89..d510d930b271b39c8ae50395cb82161bbbc16f86 100644
--- a/ee/db/geo/migrate/20180427114641_add_repository_check_to_geo_project_registry.rb
+++ b/ee/db/geo/migrate/20180427114641_add_repository_check_to_geo_project_registry.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddRepositoryCheckToGeoProjectRegistry < ActiveRecord::Migration
+class AddRepositoryCheckToGeoProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb b/ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb
index a9b64ec76065667499708c04de7bf44439808a92..2e588bdae3af736bba89c2d939949989e5956555 100644
--- a/ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb
+++ b/ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb
@@ -1,4 +1,4 @@
-class SetResyncFlagForRetriedProjects < ActiveRecord::Migration
+class SetResyncFlagForRetriedProjects < ActiveRecord::Migration[4.2]
   def up
     execute <<-SQL
       UPDATE project_registry SET resync_repository = 't' WHERE repository_retry_count > 0 AND resync_repository = 'f';
diff --git a/ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb b/ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb
index 2584460e413d8a44672bdd26c31c163e63156b37..6d072593548a1febd9744847484ffa6d424bbb12 100644
--- a/ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb
+++ b/ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb
@@ -1,4 +1,4 @@
-class AddResyncWasScheduledAtToProjectRegistry < ActiveRecord::Migration
+class AddResyncWasScheduledAtToProjectRegistry < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180727221937_add_missing_on_primary_to_project_registry.rb b/ee/db/geo/migrate/20180727221937_add_missing_on_primary_to_project_registry.rb
index b89c9dd82ce996fe5f924e2bf52139d9c5765feb..2fc7c0bd35b3680dfb68975b37f43c434c4fdad9 100644
--- a/ee/db/geo/migrate/20180727221937_add_missing_on_primary_to_project_registry.rb
+++ b/ee/db/geo/migrate/20180727221937_add_missing_on_primary_to_project_registry.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddMissingOnPrimaryToProjectRegistry < ActiveRecord::Migration
+class AddMissingOnPrimaryToProjectRegistry < ActiveRecord::Migration[4.2]
   def change
     add_column :project_registry, :repository_missing_on_primary, :boolean
     add_column :project_registry, :wiki_missing_on_primary, :boolean
diff --git a/ee/db/geo/migrate/20180802215313_add_retry_verification_fields_to_project_registry.rb b/ee/db/geo/migrate/20180802215313_add_retry_verification_fields_to_project_registry.rb
index b69ac326cc37c36f3eef4d97364cb52e9d9f68ee..f0b11aa40a3e32aac0afe862b881b08dbb0731d0 100644
--- a/ee/db/geo/migrate/20180802215313_add_retry_verification_fields_to_project_registry.rb
+++ b/ee/db/geo/migrate/20180802215313_add_retry_verification_fields_to_project_registry.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddRetryVerificationFieldsToProjectRegistry < ActiveRecord::Migration
+class AddRetryVerificationFieldsToProjectRegistry < ActiveRecord::Migration[4.2]
   def change
     add_column :project_registry, :repository_verification_retry_count, :integer
     add_column :project_registry, :wiki_verification_retry_count, :integer
diff --git a/ee/db/geo/migrate/20180803160048_add_synced_repositories_partial_index.rb b/ee/db/geo/migrate/20180803160048_add_synced_repositories_partial_index.rb
index 6dfe15de79cb1b0fb3aea0df54cf49981b66926e..34d26734550ffd583d80f208e250926a2173d824 100644
--- a/ee/db/geo/migrate/20180803160048_add_synced_repositories_partial_index.rb
+++ b/ee/db/geo/migrate/20180803160048_add_synced_repositories_partial_index.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddSyncedRepositoriesPartialIndex < ActiveRecord::Migration
+class AddSyncedRepositoriesPartialIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180806011909_add_failed_synchronizations_partial_index.rb b/ee/db/geo/migrate/20180806011909_add_failed_synchronizations_partial_index.rb
index 03e252d1d3d1b1867c0a513597437ffa84543e8a..82bde8bd0d0c7d955a70ebe9ca57aebeb0b919c5 100644
--- a/ee/db/geo/migrate/20180806011909_add_failed_synchronizations_partial_index.rb
+++ b/ee/db/geo/migrate/20180806011909_add_failed_synchronizations_partial_index.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddFailedSynchronizationsPartialIndex < ActiveRecord::Migration
+class AddFailedSynchronizationsPartialIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/migrate/20180806020615_add_pending_synchronizations_partial_index.rb b/ee/db/geo/migrate/20180806020615_add_pending_synchronizations_partial_index.rb
index d013a3d95b6cb8b4a2592dd19aa14f0d60758a3f..08c331a9460d02d60cc9701afdf8b2fbdd46e85a 100644
--- a/ee/db/geo/migrate/20180806020615_add_pending_synchronizations_partial_index.rb
+++ b/ee/db/geo/migrate/20180806020615_add_pending_synchronizations_partial_index.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddPendingSynchronizationsPartialIndex < ActiveRecord::Migration
+class AddPendingSynchronizationsPartialIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/geo/post_migrate/20180320011914_remove_last_verification_failed_columns_from_geo_project_registry.rb b/ee/db/geo/post_migrate/20180320011914_remove_last_verification_failed_columns_from_geo_project_registry.rb
index b4fbf00c3114b0a4a502ea0b24c3a0b8c9094b7d..a05925076e89295e3bc56198e5d1bf267f933a5b 100644
--- a/ee/db/geo/post_migrate/20180320011914_remove_last_verification_failed_columns_from_geo_project_registry.rb
+++ b/ee/db/geo/post_migrate/20180320011914_remove_last_verification_failed_columns_from_geo_project_registry.rb
@@ -1,4 +1,4 @@
-class RemoveLastVerificationFailedColumnsFromGeoProjectRegistry < ActiveRecord::Migration
+class RemoveLastVerificationFailedColumnsFromGeoProjectRegistry < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/geo/post_migrate/20180320013929_remove_last_verification_at_columns_from_geo_project_registry.rb b/ee/db/geo/post_migrate/20180320013929_remove_last_verification_at_columns_from_geo_project_registry.rb
index d28864a7db5437684409000c989a1c9beb4dde03..18e3a34f86b5d7d58565360ca137aaa773e5b19e 100644
--- a/ee/db/geo/post_migrate/20180320013929_remove_last_verification_at_columns_from_geo_project_registry.rb
+++ b/ee/db/geo/post_migrate/20180320013929_remove_last_verification_at_columns_from_geo_project_registry.rb
@@ -1,4 +1,4 @@
-class RemoveLastVerificationAtColumnsFromGeoProjectRegistry < ActiveRecord::Migration
+class RemoveLastVerificationAtColumnsFromGeoProjectRegistry < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/geo/post_migrate/20180326171626_remove_old_repository_verification_checksum_from_geo_project_registry.rb b/ee/db/geo/post_migrate/20180326171626_remove_old_repository_verification_checksum_from_geo_project_registry.rb
index 76f34129355c91ea4e6f209a3320769b3d7807c6..cb28daff59a0a5f810c236441c3996b7d3a89031 100644
--- a/ee/db/geo/post_migrate/20180326171626_remove_old_repository_verification_checksum_from_geo_project_registry.rb
+++ b/ee/db/geo/post_migrate/20180326171626_remove_old_repository_verification_checksum_from_geo_project_registry.rb
@@ -1,4 +1,4 @@
-class RemoveOldRepositoryVerificationChecksumFromGeoProjectRegistry < ActiveRecord::Migration
+class RemoveOldRepositoryVerificationChecksumFromGeoProjectRegistry < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/geo/post_migrate/20180331055706_delete_job_artifacts_from_file_registry.rb b/ee/db/geo/post_migrate/20180331055706_delete_job_artifacts_from_file_registry.rb
index 6c571fc18ad97a4dd81c410a4a054a16dccebc49..300408a7afd51f907d2e59ba9f36393e42c82344 100644
--- a/ee/db/geo/post_migrate/20180331055706_delete_job_artifacts_from_file_registry.rb
+++ b/ee/db/geo/post_migrate/20180331055706_delete_job_artifacts_from_file_registry.rb
@@ -1,4 +1,4 @@
-class DeleteJobArtifactsFromFileRegistry < ActiveRecord::Migration
+class DeleteJobArtifactsFromFileRegistry < ActiveRecord::Migration[4.2]
   def up
     execute("DELETE FROM file_registry WHERE file_type = 'job_artifact'")
     execute('DROP TRIGGER IF EXISTS replicate_job_artifact_registry ON file_registry')
diff --git a/ee/db/migrate/20140319135450_init_ee_schema.rb b/ee/db/migrate/20140319135450_init_ee_schema.rb
index 464f2f0131979fe82a05dc5dde4ba0cece7d352e..a759c8b7dbadc524441da7f7f1e3f2f1401db287 100644
--- a/ee/db/migrate/20140319135450_init_ee_schema.rb
+++ b/ee/db/migrate/20140319135450_init_ee_schema.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class InitEESchema < ActiveRecord::Migration
+class InitEESchema < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20140414093351_create_appearances.rb b/ee/db/migrate/20140414093351_create_appearances.rb
index 4c3fde9b6e39fd061b548e67ceab92bd87fb5c92..2a66943a57eaa49151a174a33489309fd9ec8c22 100644
--- a/ee/db/migrate/20140414093351_create_appearances.rb
+++ b/ee/db/migrate/20140414093351_create_appearances.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateAppearances < ActiveRecord::Migration
+class CreateAppearances < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20140508105809_add_mr_template_to_project.rb b/ee/db/migrate/20140508105809_add_mr_template_to_project.rb
index c16e488a61d120cf7f18720dbe7829f818917438..e11ba80f75ad3cafb26d488e04cb2350e49345d6 100644
--- a/ee/db/migrate/20140508105809_add_mr_template_to_project.rb
+++ b/ee/db/migrate/20140508105809_add_mr_template_to_project.rb
@@ -1,4 +1,4 @@
-class AddMrTemplateToProject < ActiveRecord::Migration
+class AddMrTemplateToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :merge_requests_template, :text
   end
diff --git a/ee/db/migrate/20140513095908_add_username_password_api_version_to_services.rb b/ee/db/migrate/20140513095908_add_username_password_api_version_to_services.rb
index 407c9305253275b78271a46afb006383df59ab45..8e63fb35a58430fadd16d233e513fea92037c15d 100644
--- a/ee/db/migrate/20140513095908_add_username_password_api_version_to_services.rb
+++ b/ee/db/migrate/20140513095908_add_username_password_api_version_to_services.rb
@@ -1,4 +1,4 @@
-class AddUsernamePasswordApiVersionToServices < ActiveRecord::Migration
+class AddUsernamePasswordApiVersionToServices < ActiveRecord::Migration[4.2]
   def change
     add_column :services, :username, :string
     add_column :services, :password, :string
diff --git a/ee/db/migrate/20140811083829_add_unsubscribed_at_field_to_users.rb b/ee/db/migrate/20140811083829_add_unsubscribed_at_field_to_users.rb
index 1e2efcbbf1e456da6f38d97e940b322c9d30b8de..8938a0dc765d0f89c74f2bcdefb9e14d4e7d2aeb 100644
--- a/ee/db/migrate/20140811083829_add_unsubscribed_at_field_to_users.rb
+++ b/ee/db/migrate/20140811083829_add_unsubscribed_at_field_to_users.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddUnsubscribedAtFieldToUsers < ActiveRecord::Migration
+class AddUnsubscribedAtFieldToUsers < ActiveRecord::Migration[4.2]
   def change
     add_column :users, :admin_email_unsubscribed_at, :datetime
   end
diff --git a/ee/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb b/ee/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb
index 7d16156bb5029a0e69e7dd2e1ded27d151251ee8..9c06dbdbd8773ebdbf24d4ae1ad3719738daab55 100644
--- a/ee/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb
+++ b/ee/db/migrate/20140811155127_add_jira_issue_transition_id_to_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddJiraIssueTransitionIdToServices < ActiveRecord::Migration
+class AddJiraIssueTransitionIdToServices < ActiveRecord::Migration[4.2]
   def up
     add_column :services, :jira_issue_transition_id, :string, default: '2'
     Service.reset_column_information
diff --git a/ee/db/migrate/20140813090117_add_ldap_groups_table.rb b/ee/db/migrate/20140813090117_add_ldap_groups_table.rb
index 8cffca4d4ce5e862251e713014c71c6a550f90c6..60d319e4ed94a9b95bb951f439f9b92a6b7ee5ec 100644
--- a/ee/db/migrate/20140813090117_add_ldap_groups_table.rb
+++ b/ee/db/migrate/20140813090117_add_ldap_groups_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class AddLdapGroupsTable < ActiveRecord::Migration
+class AddLdapGroupsTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb b/ee/db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb
index d3e940a96df4c39a009852deae3fea37916bafa1..a9cf2c241d7702650e73277c9d3395b46f944c17 100644
--- a/ee/db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb
+++ b/ee/db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb
@@ -1,4 +1,4 @@
-class RenameLdapGroupToLdapGroupLink < ActiveRecord::Migration
+class RenameLdapGroupToLdapGroupLink < ActiveRecord::Migration[4.2]
   def up
     rename_table :ldap_groups, :ldap_group_links
 
diff --git a/ee/db/migrate/20140907223153_remove_columns_for_services.rb b/ee/db/migrate/20140907223153_remove_columns_for_services.rb
index c8dc67c01b0708415209f1509b2b1a63b33c6e9d..0e964dbd5fb436e1eec4519ebce5a23108006302 100644
--- a/ee/db/migrate/20140907223153_remove_columns_for_services.rb
+++ b/ee/db/migrate/20140907223153_remove_columns_for_services.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveColumnsForServices < ActiveRecord::Migration
+class RemoveColumnsForServices < ActiveRecord::Migration[4.2]
   def change
     remove_column :services, :username, :string
     remove_column :services, :password, :string
diff --git a/ee/db/migrate/20141010132608_add_provider_to_ldap_group_links.rb b/ee/db/migrate/20141010132608_add_provider_to_ldap_group_links.rb
index 2858d97cb6354b1d474c2be8cee8039961920a14..eb1234a5af1949d412856dc0eb59a4c93f7ccdba 100644
--- a/ee/db/migrate/20141010132608_add_provider_to_ldap_group_links.rb
+++ b/ee/db/migrate/20141010132608_add_provider_to_ldap_group_links.rb
@@ -1,4 +1,4 @@
-class AddProviderToLdapGroupLinks < ActiveRecord::Migration
+class AddProviderToLdapGroupLinks < ActiveRecord::Migration[4.2]
   def change
     add_column :ldap_group_links, :provider, :string
   end
diff --git a/ee/db/migrate/20141027173526_add_author_email_regex_to_git_hook.rb b/ee/db/migrate/20141027173526_add_author_email_regex_to_git_hook.rb
index bf58a13e81fc5aa9fe7d95b37ae11def95f6e2e7..8960369a1bc58fe56196b67bcabef5e6292d80b7 100644
--- a/ee/db/migrate/20141027173526_add_author_email_regex_to_git_hook.rb
+++ b/ee/db/migrate/20141027173526_add_author_email_regex_to_git_hook.rb
@@ -1,4 +1,4 @@
-class AddAuthorEmailRegexToGitHook < ActiveRecord::Migration
+class AddAuthorEmailRegexToGitHook < ActiveRecord::Migration[4.2]
   def change
     add_column :git_hooks, :author_email_regex, :string
   end
diff --git a/ee/db/migrate/20141030133853_add_member_check_to_git_hooks.rb b/ee/db/migrate/20141030133853_add_member_check_to_git_hooks.rb
index 078df69d3dae3e1b9d9e2da0e76d9de2ed3b646e..8b4a2636da34eb001b17c077cdde48191bc93365 100644
--- a/ee/db/migrate/20141030133853_add_member_check_to_git_hooks.rb
+++ b/ee/db/migrate/20141030133853_add_member_check_to_git_hooks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMemberCheckToGitHooks < ActiveRecord::Migration
+class AddMemberCheckToGitHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :git_hooks, :member_check, :boolean, default: false, null: false
   end
diff --git a/ee/db/migrate/20141103160516_add_file_name_regex_to_git_hooks.rb b/ee/db/migrate/20141103160516_add_file_name_regex_to_git_hooks.rb
index ce0e1dedd16e567b648599cfd6132482731b1009..6ad63269b9a5dc862eb19452ccb76161f0a482e3 100644
--- a/ee/db/migrate/20141103160516_add_file_name_regex_to_git_hooks.rb
+++ b/ee/db/migrate/20141103160516_add_file_name_regex_to_git_hooks.rb
@@ -1,4 +1,4 @@
-class AddFileNameRegexToGitHooks < ActiveRecord::Migration
+class AddFileNameRegexToGitHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :git_hooks, :file_name_regex, :string
   end
diff --git a/ee/db/migrate/20141212124604_add_group_membership_lock.rb b/ee/db/migrate/20141212124604_add_group_membership_lock.rb
index 8cd0d8d039318d4a047edcd9ee8a62414460c1f0..e8d20ead047b3f5f8b9f7130b3cb0faf637a120e 100644
--- a/ee/db/migrate/20141212124604_add_group_membership_lock.rb
+++ b/ee/db/migrate/20141212124604_add_group_membership_lock.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddGroupMembershipLock < ActiveRecord::Migration
+class AddGroupMembershipLock < ActiveRecord::Migration[4.2]
   def change
     add_column :namespaces, :membership_lock, :boolean, default: false
   end
diff --git a/ee/db/migrate/20141213212220_add_header_logos_to_appearances.rb b/ee/db/migrate/20141213212220_add_header_logos_to_appearances.rb
index 9f3b78772711e945c413a162f8d130edca10ea45..bce84468c2d009b4c5aff4a7a86a041437259159 100644
--- a/ee/db/migrate/20141213212220_add_header_logos_to_appearances.rb
+++ b/ee/db/migrate/20141213212220_add_header_logos_to_appearances.rb
@@ -1,4 +1,4 @@
-class AddHeaderLogosToAppearances < ActiveRecord::Migration
+class AddHeaderLogosToAppearances < ActiveRecord::Migration[4.2]
   def change
     add_column :appearances, :dark_logo, :string
     add_column :appearances, :light_logo, :string
diff --git a/ee/db/migrate/20141230100055_remove_old_fields_from_namespace.rb b/ee/db/migrate/20141230100055_remove_old_fields_from_namespace.rb
index 43fafe1b6ab92d0c72ecf5d623eda31bcd2eb0c9..ff3ae582f54f7bf970f5f34f8efed421e84f9c3e 100644
--- a/ee/db/migrate/20141230100055_remove_old_fields_from_namespace.rb
+++ b/ee/db/migrate/20141230100055_remove_old_fields_from_namespace.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveOldFieldsFromNamespace < ActiveRecord::Migration
+class RemoveOldFieldsFromNamespace < ActiveRecord::Migration[4.2]
   def up
     remove_column :namespaces, :ldap_cn
     remove_column :namespaces, :ldap_access
diff --git a/ee/db/migrate/20150125163158_add_rebase_setting_to_projects.rb b/ee/db/migrate/20150125163158_add_rebase_setting_to_projects.rb
index d53e2b6a24d3f67f6763fc312dcf4118c9818baa..6ccb9897365c04e92417b364c9a8da4869be9b01 100644
--- a/ee/db/migrate/20150125163158_add_rebase_setting_to_projects.rb
+++ b/ee/db/migrate/20150125163158_add_rebase_setting_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddRebaseSettingToProjects < ActiveRecord::Migration
+class AddRebaseSettingToProjects < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :merge_requests_rebase_default, :boolean, default: true
   end
diff --git a/ee/db/migrate/20150225214822_help_text_to_application_settings.rb b/ee/db/migrate/20150225214822_help_text_to_application_settings.rb
index 8594758a48ce201392d0776c0d47bc2c5448c9ee..19fdd02a6851f011aa007676d6a3fbf5ffbf453c 100644
--- a/ee/db/migrate/20150225214822_help_text_to_application_settings.rb
+++ b/ee/db/migrate/20150225214822_help_text_to_application_settings.rb
@@ -1,4 +1,4 @@
-class HelpTextToApplicationSettings < ActiveRecord::Migration
+class HelpTextToApplicationSettings < ActiveRecord::Migration[4.2]
   def change
     add_column :application_settings, :help_text, :text
   end
diff --git a/ee/db/migrate/20150312000132_add_group_id_to_web_hooks.rb b/ee/db/migrate/20150312000132_add_group_id_to_web_hooks.rb
index 460f110c1b0cb6b025bd3a2be34e6b659136b454..4f5557a83a774d37d3c785132be333049298573f 100644
--- a/ee/db/migrate/20150312000132_add_group_id_to_web_hooks.rb
+++ b/ee/db/migrate/20150312000132_add_group_id_to_web_hooks.rb
@@ -1,4 +1,4 @@
-class AddGroupIdToWebHooks < ActiveRecord::Migration
+class AddGroupIdToWebHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :web_hooks, :group_id, :integer, after: :project_id
   end
diff --git a/ee/db/migrate/20150324223425_add_is_sample_to_git_hooks.rb b/ee/db/migrate/20150324223425_add_is_sample_to_git_hooks.rb
index 0a88836e7f663d0eab1b5fdebf1c978231c317de..9cfc49eb4747ed7213561a0efb4e4d021320d571 100644
--- a/ee/db/migrate/20150324223425_add_is_sample_to_git_hooks.rb
+++ b/ee/db/migrate/20150324223425_add_is_sample_to_git_hooks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddIsSampleToGitHooks < ActiveRecord::Migration
+class AddIsSampleToGitHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :git_hooks, :is_sample, :boolean, default: false
   end
diff --git a/ee/db/migrate/20150501095306_create_licenses.rb b/ee/db/migrate/20150501095306_create_licenses.rb
index 54cf6868b5082dfeab022c7630b54b678c2bf2e1..29be6dbee099d904e5b7a910a1c840e68533dda2 100644
--- a/ee/db/migrate/20150501095306_create_licenses.rb
+++ b/ee/db/migrate/20150501095306_create_licenses.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateLicenses < ActiveRecord::Migration
+class CreateLicenses < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20150507194350_create_historical_data.rb b/ee/db/migrate/20150507194350_create_historical_data.rb
index dfb1ef0fe518ad2adcd2069c787d1d16eebb925d..21a87c4e434acdf6e60e400fcac67140e55b02ca 100644
--- a/ee/db/migrate/20150507194350_create_historical_data.rb
+++ b/ee/db/migrate/20150507194350_create_historical_data.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateHistoricalData < ActiveRecord::Migration
+class CreateHistoricalData < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20150605131047_add_max_file_size_to_git_hooks.rb b/ee/db/migrate/20150605131047_add_max_file_size_to_git_hooks.rb
index 49572fa2d144a6ef5428ed6caaed5906a43f5716..d48b7fd14f8ab3c9d1cb1ffe64460ab2edb3e9ce 100644
--- a/ee/db/migrate/20150605131047_add_max_file_size_to_git_hooks.rb
+++ b/ee/db/migrate/20150605131047_add_max_file_size_to_git_hooks.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMaxFileSizeToGitHooks < ActiveRecord::Migration
+class AddMaxFileSizeToGitHooks < ActiveRecord::Migration[4.2]
   def change
     add_column :git_hooks, :max_file_size, :integer, default: 0
   end
diff --git a/ee/db/migrate/20150609113337_create_approves.rb b/ee/db/migrate/20150609113337_create_approves.rb
index c08bd6893118963ab8c8376f1c1edf5c449ebd3b..90ff73340339f49b813cd3721a7c838cefd577b9 100644
--- a/ee/db/migrate/20150609113337_create_approves.rb
+++ b/ee/db/migrate/20150609113337_create_approves.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateApproves < ActiveRecord::Migration
+class CreateApproves < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20150609125332_add_project_merge_approves.rb b/ee/db/migrate/20150609125332_add_project_merge_approves.rb
index 240de4afb5650c4b387317787a093da564ffdfb5..fdcd7aa0507dd32d5d8951fecea25f88a9550383 100644
--- a/ee/db/migrate/20150609125332_add_project_merge_approves.rb
+++ b/ee/db/migrate/20150609125332_add_project_merge_approves.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddProjectMergeApproves < ActiveRecord::Migration
+class AddProjectMergeApproves < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :approvals_before_merge, :integer, null: false, default: 0
   end
diff --git a/ee/db/migrate/20150707222220_add_approvers_table.rb b/ee/db/migrate/20150707222220_add_approvers_table.rb
index dead69ec0f478bb682d87ef81ac81024f1df18e1..4f8e4412c4540f6d141b4e54e5b6ddc7fa550dbd 100644
--- a/ee/db/migrate/20150707222220_add_approvers_table.rb
+++ b/ee/db/migrate/20150707222220_add_approvers_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class AddApproversTable < ActiveRecord::Migration
+class AddApproversTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20150709134649_add_reset_approvers_to_project.rb b/ee/db/migrate/20150709134649_add_reset_approvers_to_project.rb
index f9a760777a92934b0ba60d02e0168ecd49b45d4a..56c7010dfebfa2bf1e3b22ebc90b14dfa6744a5f 100644
--- a/ee/db/migrate/20150709134649_add_reset_approvers_to_project.rb
+++ b/ee/db/migrate/20150709134649_add_reset_approvers_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddResetApproversToProject < ActiveRecord::Migration
+class AddResetApproversToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :reset_approvers_on_push, :boolean, default: true
   end
diff --git a/ee/db/migrate/20150717155058_rename_reset_approvers.rb b/ee/db/migrate/20150717155058_rename_reset_approvers.rb
index cf7e74b659f420591bcf91a9a136329e2a34ea7c..f0b6fb1b8cf97fe58ea0e585a7a523e2a08ffd70 100644
--- a/ee/db/migrate/20150717155058_rename_reset_approvers.rb
+++ b/ee/db/migrate/20150717155058_rename_reset_approvers.rb
@@ -1,4 +1,4 @@
-class RenameResetApprovers < ActiveRecord::Migration
+class RenameResetApprovers < ActiveRecord::Migration[4.2]
   def change
     rename_column :projects, :reset_approvers_on_push, :reset_approvals_on_push
   end
diff --git a/ee/db/migrate/20150731200022_remove_invalid_approvers.rb b/ee/db/migrate/20150731200022_remove_invalid_approvers.rb
index e9d547d14f21271b020308344be2a6f1ef5a8e02..e7eba837f73333fbf308e87a1ab1ba0cfb40de1c 100644
--- a/ee/db/migrate/20150731200022_remove_invalid_approvers.rb
+++ b/ee/db/migrate/20150731200022_remove_invalid_approvers.rb
@@ -1,4 +1,4 @@
-class RemoveInvalidApprovers < ActiveRecord::Migration
+class RemoveInvalidApprovers < ActiveRecord::Migration[4.2]
   def up
     execute("DELETE FROM approvers WHERE user_id = 0")
   end
diff --git a/ee/db/migrate/20150827144737_migrate_rebase_feature.rb b/ee/db/migrate/20150827144737_migrate_rebase_feature.rb
index 5c5ded0651db5c4478fef8e959ae0491bb0ed628..4306aac3366fb1eecb2cd14411b85e53a450c162 100644
--- a/ee/db/migrate/20150827144737_migrate_rebase_feature.rb
+++ b/ee/db/migrate/20150827144737_migrate_rebase_feature.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class MigrateRebaseFeature < ActiveRecord::Migration
+class MigrateRebaseFeature < ActiveRecord::Migration[4.2]
   def up
     execute %q{UPDATE projects SET merge_requests_ff_only_enabled = TRUE WHERE merge_requests_rebase_enabled IS TRUE}
 
diff --git a/ee/db/migrate/20150929160851_add_issues_template_to_project.rb b/ee/db/migrate/20150929160851_add_issues_template_to_project.rb
index 1caf6531c2eb172030726480a7e42bbb77d058d4..be68b4e6ef6a0a9fcdb2e05a335c4c4752b720af 100644
--- a/ee/db/migrate/20150929160851_add_issues_template_to_project.rb
+++ b/ee/db/migrate/20150929160851_add_issues_template_to_project.rb
@@ -1,4 +1,4 @@
-class AddIssuesTemplateToProject < ActiveRecord::Migration
+class AddIssuesTemplateToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :issues_template, :text
   end
diff --git a/ee/db/migrate/20151007110107_update_group_links.rb b/ee/db/migrate/20151007110107_update_group_links.rb
index 5e5eb95a4f121029092e8a5045156ffee7c900b3..0dfcf221a417899e598a0419238ddea335b21696 100644
--- a/ee/db/migrate/20151007110107_update_group_links.rb
+++ b/ee/db/migrate/20151007110107_update_group_links.rb
@@ -1,4 +1,4 @@
-class UpdateGroupLinks < ActiveRecord::Migration
+class UpdateGroupLinks < ActiveRecord::Migration[4.2]
   def change
     provider = quote_string(Gitlab::Auth::LDAP::Config.providers.first)
     execute("UPDATE ldap_group_links SET provider = '#{provider}' WHERE provider IS NULL")
diff --git a/ee/db/migrate/20151110125416_add_mirror_to_project.rb b/ee/db/migrate/20151110125416_add_mirror_to_project.rb
index a71e8db710894fa5746adfcf6c300dc5ebf7445b..169875bd0446fa51a86e673d956a02034ec53791 100644
--- a/ee/db/migrate/20151110125416_add_mirror_to_project.rb
+++ b/ee/db/migrate/20151110125416_add_mirror_to_project.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMirrorToProject < ActiveRecord::Migration
+class AddMirrorToProject < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :mirror, :boolean, default: false, null: false
     add_column :projects, :mirror_last_update_at, :datetime
diff --git a/ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb b/ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb
index 3fddb53c0f8c664417807e4ac006749f47410aaf..22c260f632e540c007ac1a65c0dce0724e9ef4a6 100644
--- a/ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb
+++ b/ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb
@@ -1,4 +1,4 @@
-class CanonicalizeKerberosIdentities < ActiveRecord::Migration
+class CanonicalizeKerberosIdentities < ActiveRecord::Migration[4.2]
   # This migration can be performed online without errors.
   # It makes sure that all Kerberos identities are in canonical form
   # with a realm name (`username` => `username@DEFAULT.REALM`).
diff --git a/ee/db/migrate/20151208110020_add_note_to_users.rb b/ee/db/migrate/20151208110020_add_note_to_users.rb
index 92c4563bfce191efb61506b27abda2be754402a1..194a0cd0246473d9d9b83b361f50bcb61f7d8d28 100644
--- a/ee/db/migrate/20151208110020_add_note_to_users.rb
+++ b/ee/db/migrate/20151208110020_add_note_to_users.rb
@@ -1,4 +1,4 @@
-class AddNoteToUsers < ActiveRecord::Migration
+class AddNoteToUsers < ActiveRecord::Migration[4.2]
   def up
     # Column "note" has been added to schema mistakenly (without actual migration),
     # and this is why it can exist in some instances.
diff --git a/ee/db/migrate/20151209222208_add_weight_to_issue.rb b/ee/db/migrate/20151209222208_add_weight_to_issue.rb
index 69e15e7261a038d5a6ea61946a1c93d17685e05b..ebc02a8e9a98f83be5ca8121ecbef69d79fe4fac 100644
--- a/ee/db/migrate/20151209222208_add_weight_to_issue.rb
+++ b/ee/db/migrate/20151209222208_add_weight_to_issue.rb
@@ -1,4 +1,4 @@
-class AddWeightToIssue < ActiveRecord::Migration
+class AddWeightToIssue < ActiveRecord::Migration[4.2]
   def change
     add_column :issues, :weight, :integer
   end
diff --git a/ee/db/migrate/20151215005729_rename_jenkins_service.rb b/ee/db/migrate/20151215005729_rename_jenkins_service.rb
index 5349c176774d2ff17efd46e127b97c35b19e64a5..452fd406aa3bddf8c5abc608ea870cb66a11997c 100644
--- a/ee/db/migrate/20151215005729_rename_jenkins_service.rb
+++ b/ee/db/migrate/20151215005729_rename_jenkins_service.rb
@@ -1,4 +1,4 @@
-class RenameJenkinsService < ActiveRecord::Migration
+class RenameJenkinsService < ActiveRecord::Migration[4.2]
   def up
     execute "UPDATE services SET type = 'JenkinsDeprecatedService' WHERE type = 'JenkinsService';"
   end
diff --git a/ee/db/migrate/20151228203337_change_max_file_size_to_not_null_on_git_hooks.rb b/ee/db/migrate/20151228203337_change_max_file_size_to_not_null_on_git_hooks.rb
index 4fc12038c778526ea36d83d393fd5eaad311406d..6544de0959f4845a89a4cdfcd4af0a0da00ab739 100644
--- a/ee/db/migrate/20151228203337_change_max_file_size_to_not_null_on_git_hooks.rb
+++ b/ee/db/migrate/20151228203337_change_max_file_size_to_not_null_on_git_hooks.rb
@@ -1,4 +1,4 @@
-class ChangeMaxFileSizeToNotNullOnGitHooks < ActiveRecord::Migration
+class ChangeMaxFileSizeToNotNullOnGitHooks < ActiveRecord::Migration[4.2]
   def change
     change_column_null :git_hooks, :max_file_size, false, 0
   end
diff --git a/ee/db/migrate/20160112174440_create_geo_nodes.rb b/ee/db/migrate/20160112174440_create_geo_nodes.rb
index 70f0ded00b3a30d5af68f1541cdd82e7b0972c29..82cd5a98129739aee5140634d912915c883864d7 100644
--- a/ee/db/migrate/20160112174440_create_geo_nodes.rb
+++ b/ee/db/migrate/20160112174440_create_geo_nodes.rb
@@ -1,4 +1,4 @@
-class CreateGeoNodes < ActiveRecord::Migration
+class CreateGeoNodes < ActiveRecord::Migration[4.2]
   def change
     create_table :geo_nodes do |t|
       t.string :schema
diff --git a/ee/db/migrate/20160119170055_add_mirror_trigger_builds_to_projects.rb b/ee/db/migrate/20160119170055_add_mirror_trigger_builds_to_projects.rb
index c3ea0130a5affea4005ebac6622bef1802bfc836..c1c2d02780b9d35372c3ddcab64256c6b88bda19 100644
--- a/ee/db/migrate/20160119170055_add_mirror_trigger_builds_to_projects.rb
+++ b/ee/db/migrate/20160119170055_add_mirror_trigger_builds_to_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddMirrorTriggerBuildsToProjects < ActiveRecord::Migration
+class AddMirrorTriggerBuildsToProjects < ActiveRecord::Migration[4.2]
   def change
     add_column :projects, :mirror_trigger_builds, :boolean, default: false, null: false
   end
diff --git a/ee/db/migrate/20160129075828_create_index_statuses.rb b/ee/db/migrate/20160129075828_create_index_statuses.rb
index e66b4fbd7aa70f5bc77be5885ff1bea44c0679b7..00d9509d299e91f9e0ebdfc8b58624e5fac64829 100644
--- a/ee/db/migrate/20160129075828_create_index_statuses.rb
+++ b/ee/db/migrate/20160129075828_create_index_statuses.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateIndexStatuses < ActiveRecord::Migration
+class CreateIndexStatuses < ActiveRecord::Migration[4.2]
   def change
     create_table :index_statuses do |t|
       t.integer :project_id, null: false
diff --git a/ee/db/migrate/20160204190809_update_jenkins_service_category.rb b/ee/db/migrate/20160204190809_update_jenkins_service_category.rb
index f1b0f2ee6d8d22c29d74bfccbe62c01418e8dece..b5e3ca640b31c2e6498da4d8770665a87b1a33df 100644
--- a/ee/db/migrate/20160204190809_update_jenkins_service_category.rb
+++ b/ee/db/migrate/20160204190809_update_jenkins_service_category.rb
@@ -1,4 +1,4 @@
-class UpdateJenkinsServiceCategory < ActiveRecord::Migration
+class UpdateJenkinsServiceCategory < ActiveRecord::Migration[4.2]
   def up
     category = quote_column_name('category')
     type = quote_column_name('type')
diff --git a/ee/db/migrate/20160221013512_add_geo_node_key_to_geo_node.rb b/ee/db/migrate/20160221013512_add_geo_node_key_to_geo_node.rb
index df35739b50237d616d2f8ae6e5aa065eb7ea880d..8f06127356056c569357bbdd27837f8a762726c5 100644
--- a/ee/db/migrate/20160221013512_add_geo_node_key_to_geo_node.rb
+++ b/ee/db/migrate/20160221013512_add_geo_node_key_to_geo_node.rb
@@ -1,4 +1,4 @@
-class AddGeoNodeKeyToGeoNode < ActiveRecord::Migration
+class AddGeoNodeKeyToGeoNode < ActiveRecord::Migration[4.2]
   def change
     change_table :geo_nodes do |t|
       t.belongs_to :geo_node_key, index: true
diff --git a/ee/db/migrate/20160229034258_add_doorkeeper_application_to_geo_node.rb b/ee/db/migrate/20160229034258_add_doorkeeper_application_to_geo_node.rb
index 7f0a89c58a472d40d75d8fe91d610f2035a4778c..a1830f20c0389fab879fd7f0b37e6bacc40fb1b2 100644
--- a/ee/db/migrate/20160229034258_add_doorkeeper_application_to_geo_node.rb
+++ b/ee/db/migrate/20160229034258_add_doorkeeper_application_to_geo_node.rb
@@ -1,4 +1,4 @@
-class AddDoorkeeperApplicationToGeoNode < ActiveRecord::Migration
+class AddDoorkeeperApplicationToGeoNode < ActiveRecord::Migration[4.2]
   def change
     change_table :geo_nodes do |t|
       t.belongs_to :oauth_application
diff --git a/ee/db/migrate/20160302141317_rename_header_field_on_appearrance.rb b/ee/db/migrate/20160302141317_rename_header_field_on_appearrance.rb
index fdcf1e9ad9560a8876dcb81d0f2f2ceab8b26d2a..268fb181c1406ec58fd9ae614e7ea4411b2a50a4 100644
--- a/ee/db/migrate/20160302141317_rename_header_field_on_appearrance.rb
+++ b/ee/db/migrate/20160302141317_rename_header_field_on_appearrance.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RenameHeaderFieldOnAppearrance < ActiveRecord::Migration
+class RenameHeaderFieldOnAppearrance < ActiveRecord::Migration[4.2]
   def up
     unless column_exists?(:appearances, :header_logo)
       rename_column :appearances, :light_logo, :header_logo
diff --git a/ee/db/migrate/20160303210802_add_secondary_extern_uid_to_identities.rb b/ee/db/migrate/20160303210802_add_secondary_extern_uid_to_identities.rb
index 92aa7f043e33f26e245f44581f1e529ffc283315..89a78a926d181cc1b16877219d37143d203bd1f7 100644
--- a/ee/db/migrate/20160303210802_add_secondary_extern_uid_to_identities.rb
+++ b/ee/db/migrate/20160303210802_add_secondary_extern_uid_to_identities.rb
@@ -1,4 +1,4 @@
-class AddSecondaryExternUidToIdentities < ActiveRecord::Migration
+class AddSecondaryExternUidToIdentities < ActiveRecord::Migration[4.2]
   def change
     add_column :identities, :secondary_extern_uid, :string
   end
diff --git a/ee/db/migrate/20160316124047_git_hooks_project_id_index.rb b/ee/db/migrate/20160316124047_git_hooks_project_id_index.rb
index f5d78e41942026d154b8bf3d3ed438f5e2dd8d4b..20d5b8a7cc85925309cd9d9e64ad649981d3a070 100644
--- a/ee/db/migrate/20160316124047_git_hooks_project_id_index.rb
+++ b/ee/db/migrate/20160316124047_git_hooks_project_id_index.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class GitHooksProjectIdIndex < ActiveRecord::Migration
+class GitHooksProjectIdIndex < ActiveRecord::Migration[4.2]
   disable_ddl_transaction!
 
   def change
diff --git a/ee/db/migrate/20160317191509_add_last_sync_time_to_groups.rb b/ee/db/migrate/20160317191509_add_last_sync_time_to_groups.rb
index 47976852b74452400cded8109586f57a51d01d93..613200c62fc43e824d24362fbba94fd065aa0390 100644
--- a/ee/db/migrate/20160317191509_add_last_sync_time_to_groups.rb
+++ b/ee/db/migrate/20160317191509_add_last_sync_time_to_groups.rb
@@ -1,5 +1,5 @@
 # rubocop:disable all
-class AddLastSyncTimeToGroups < ActiveRecord::Migration
+class AddLastSyncTimeToGroups < ActiveRecord::Migration[4.2]
   def change
     add_column :namespaces, :last_ldap_sync_at, :datetime
     add_index :namespaces, :last_ldap_sync_at
diff --git a/ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb b/ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb
index 8b4efddc258316e27aad26aff9779325e8f9d4f4..5351706177cac939725f9c581341de57718a69a9 100644
--- a/ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb
+++ b/ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateRemoteMirrorsEE < ActiveRecord::Migration
+class CreateRemoteMirrorsEE < ActiveRecord::Migration[4.2]
   def up
     # When moving from CE to EE, remote_mirrors may already exist
     return if table_exists?(:remote_mirrors)
diff --git a/ee/db/migrate/20160414064845_add_system_hook_to_geo_node.rb b/ee/db/migrate/20160414064845_add_system_hook_to_geo_node.rb
index 974d9d46727467e08b20d59214dca211d9330a95..90a17f1e09ac4e4be58f40e73ad090bf813ebc5e 100644
--- a/ee/db/migrate/20160414064845_add_system_hook_to_geo_node.rb
+++ b/ee/db/migrate/20160414064845_add_system_hook_to_geo_node.rb
@@ -1,4 +1,4 @@
-class AddSystemHookToGeoNode < ActiveRecord::Migration
+class AddSystemHookToGeoNode < ActiveRecord::Migration[4.2]
   def change
     change_table :geo_nodes do |t|
       t.references :system_hook
diff --git a/ee/db/migrate/20160530214349_make_remote_mirrors_disabled_by_default_ee.rb b/ee/db/migrate/20160530214349_make_remote_mirrors_disabled_by_default_ee.rb
index 5aa96ecd6c79350d4a1d6929f0650008c3e19baa..f9bfb8b3b90d4892b23536152781525fefdd5af8 100644
--- a/ee/db/migrate/20160530214349_make_remote_mirrors_disabled_by_default_ee.rb
+++ b/ee/db/migrate/20160530214349_make_remote_mirrors_disabled_by_default_ee.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MakeRemoteMirrorsDisabledByDefaultEE < ActiveRecord::Migration
+class MakeRemoteMirrorsDisabledByDefaultEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/ee/db/migrate/20160601102211_create_path_locks_table.rb b/ee/db/migrate/20160601102211_create_path_locks_table.rb
index 444ab883bb7a4fc264b335692137c2138fbeaf57..4b453c7e752d8ad77d5c919028bad41713db46ac 100644
--- a/ee/db/migrate/20160601102211_create_path_locks_table.rb
+++ b/ee/db/migrate/20160601102211_create_path_locks_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreatePathLocksTable < ActiveRecord::Migration
+class CreatePathLocksTable < ActiveRecord::Migration[4.2]
   def change
     create_table :path_locks do |t|
       t.string :path, null: false, index: true
diff --git a/ee/db/migrate/20160611101122_add_es_to_application_settings.rb b/ee/db/migrate/20160611101122_add_es_to_application_settings.rb
index c8971fefbfa95101e830f86adc2e5f1a1206ccde..c02a43a69408790b7c988f2a3472632536215ff1 100644
--- a/ee/db/migrate/20160611101122_add_es_to_application_settings.rb
+++ b/ee/db/migrate/20160611101122_add_es_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddEsToApplicationSettings < ActiveRecord::Migration
+class AddEsToApplicationSettings < ActiveRecord::Migration[4.2]
   def up
     add_column :application_settings, :elasticsearch_indexing, :boolean, default: false, null: false
     add_column :application_settings, :elasticsearch_search, :boolean, default: false, null: false
diff --git a/ee/db/migrate/20160615092001_disable_mirror_without_import_url.rb b/ee/db/migrate/20160615092001_disable_mirror_without_import_url.rb
index 502c167a6041370de453215a6235598ba5e0df9e..aed19527ed8c3029f2bd54ece1dc78edef927e6c 100644
--- a/ee/db/migrate/20160615092001_disable_mirror_without_import_url.rb
+++ b/ee/db/migrate/20160615092001_disable_mirror_without_import_url.rb
@@ -1,7 +1,7 @@
 # RemoveWrongImportUrlFromProjects migration missed setting the mirror flag to false when making import_url nil
 # for invalid URIs that why we need this migration.
 
-class DisableMirrorWithoutImportUrl < ActiveRecord::Migration
+class DisableMirrorWithoutImportUrl < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def up
diff --git a/ee/db/migrate/20160615142732_add_approvals_before_merge_to_merge_requests.rb b/ee/db/migrate/20160615142732_add_approvals_before_merge_to_merge_requests.rb
index 1c3ce7f34523aeddfd881bb58f664c3f81072708..6fdcd834bca5559a77b7844e853ff84d0301ecb7 100644
--- a/ee/db/migrate/20160615142732_add_approvals_before_merge_to_merge_requests.rb
+++ b/ee/db/migrate/20160615142732_add_approvals_before_merge_to_merge_requests.rb
@@ -1,4 +1,4 @@
-class AddApprovalsBeforeMergeToMergeRequests < ActiveRecord::Migration
+class AddApprovalsBeforeMergeToMergeRequests < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   def change
diff --git a/ee/db/migrate/20160705111606_rename_git_hooks_to_push_rules.rb b/ee/db/migrate/20160705111606_rename_git_hooks_to_push_rules.rb
index 1fe898b2d6821055913d654bcdb83b6977a0238d..21229f08200408eb9f6930736ee445b3aeb79c51 100644
--- a/ee/db/migrate/20160705111606_rename_git_hooks_to_push_rules.rb
+++ b/ee/db/migrate/20160705111606_rename_git_hooks_to_push_rules.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RenameGitHooksToPushRules < ActiveRecord::Migration
+class RenameGitHooksToPushRules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # When using the methods "add_concurrent_index" or "add_column_with_default"
diff --git a/ee/db/migrate/20160718210912_add_ldap_sync_state_to_groups.rb b/ee/db/migrate/20160718210912_add_ldap_sync_state_to_groups.rb
index 080e580b8b8bd19049c36ad4a7bb94a4c4955cea..28c468f7d96063e8e5020cc1259e0bb4863417b8 100644
--- a/ee/db/migrate/20160718210912_add_ldap_sync_state_to_groups.rb
+++ b/ee/db/migrate/20160718210912_add_ldap_sync_state_to_groups.rb
@@ -1,7 +1,7 @@
 # Migration type: online without errors (works on previous version and new one)
 # rubocop:disable Migration/Datetime
 # rubocop:disable Migration/UpdateLargeTable
-class AddLdapSyncStateToGroups < ActiveRecord::Migration
+class AddLdapSyncStateToGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20160718210939_add_ldap_sync_state_indices_to_groups.rb b/ee/db/migrate/20160718210939_add_ldap_sync_state_indices_to_groups.rb
index 84bf35d7eee8140fcec5264d9d27c96c3a443476..6bd90746585dd3df169c5013fcfc693539f2ea5f 100644
--- a/ee/db/migrate/20160718210939_add_ldap_sync_state_indices_to_groups.rb
+++ b/ee/db/migrate/20160718210939_add_ldap_sync_state_indices_to_groups.rb
@@ -1,7 +1,7 @@
 # Migration type: online without errors (works on previous version and new one)
 
 # rubocop:disable RemoveIndex
-class AddLdapSyncStateIndicesToGroups < ActiveRecord::Migration
+class AddLdapSyncStateIndicesToGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20160718211006_remove_last_ldap_sync_status_index_from_groups.rb b/ee/db/migrate/20160718211006_remove_last_ldap_sync_status_index_from_groups.rb
index d8a8dfe5d6f09bc7f6ee9ef1cdae27fdfc15ab52..91e513a62bcf8dcab44caa6f2ee4d6bc7e25aeeb 100644
--- a/ee/db/migrate/20160718211006_remove_last_ldap_sync_status_index_from_groups.rb
+++ b/ee/db/migrate/20160718211006_remove_last_ldap_sync_status_index_from_groups.rb
@@ -1,7 +1,7 @@
 # Migration type: online without errors (works on previous version and new one)
 
 # rubocop:disable RemoveIndex
-class RemoveLastLdapSyncStatusIndexFromGroups < ActiveRecord::Migration
+class RemoveLastLdapSyncStatusIndexFromGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20160718211059_remove_last_ldap_sync_status_from_groups.rb b/ee/db/migrate/20160718211059_remove_last_ldap_sync_status_from_groups.rb
index 091799f9df3cd19b626974cff56172eecbdaeac4..a6fc0e314388947a497da4efd97cd16201c6ef86 100644
--- a/ee/db/migrate/20160718211059_remove_last_ldap_sync_status_from_groups.rb
+++ b/ee/db/migrate/20160718211059_remove_last_ldap_sync_status_from_groups.rb
@@ -1,7 +1,7 @@
 # Migration type: online without errors (works on previous version and new one)
 # rubocop:disable Migration/Datetime
 # rubocop:disable Migration/RemoveColumn
-class RemoveLastLdapSyncStatusFromGroups < ActiveRecord::Migration
+class RemoveLastLdapSyncStatusFromGroups < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20160721042141_add_column_user_id_to_protected_branches_access_levels.rb b/ee/db/migrate/20160721042141_add_column_user_id_to_protected_branches_access_levels.rb
index fc9a0f770b646d1c6c3e649280d39e0e8c5ebc9d..dccee09102db6ee2d1b370230d5a1b6d1e295bb3 100644
--- a/ee/db/migrate/20160721042141_add_column_user_id_to_protected_branches_access_levels.rb
+++ b/ee/db/migrate/20160721042141_add_column_user_id_to_protected_branches_access_levels.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddColumnUserIdToProtectedBranchesAccessLevels < ActiveRecord::Migration
+class AddColumnUserIdToProtectedBranchesAccessLevels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/ee/db/migrate/20160721043623_allow_nulls_for_protected_branch_access_levels.rb b/ee/db/migrate/20160721043623_allow_nulls_for_protected_branch_access_levels.rb
index 64cbe1cc27187a8b36e18ef5d4adec9e994c56e3..048b1c04f118972c55e55b587bf572c38c39aad9 100644
--- a/ee/db/migrate/20160721043623_allow_nulls_for_protected_branch_access_levels.rb
+++ b/ee/db/migrate/20160721043623_allow_nulls_for_protected_branch_access_levels.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AllowNullsForProtectedBranchAccessLevels < ActiveRecord::Migration
+class AllowNullsForProtectedBranchAccessLevels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160810153405_remove_geo_node_key_id_index.rb b/ee/db/migrate/20160810153405_remove_geo_node_key_id_index.rb
index 7fee1cdeb20f5f6a03dcc0c3961dbeccbb261c8d..08aa454231e3769e469421b8ba7962c69e6fa103 100644
--- a/ee/db/migrate/20160810153405_remove_geo_node_key_id_index.rb
+++ b/ee/db/migrate/20160810153405_remove_geo_node_key_id_index.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable RemoveIndex
-class RemoveGeoNodeKeyIdIndex < ActiveRecord::Migration
+class RemoveGeoNodeKeyIdIndex < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160812054342_add_group_id_columns_to_protected_branch_access_levels.rb b/ee/db/migrate/20160812054342_add_group_id_columns_to_protected_branch_access_levels.rb
index 733eb36545bc56c6fd9a929c010c92462a9eeb72..12a5aae146b63d36533ba176dda4bac6d8df10ce 100644
--- a/ee/db/migrate/20160812054342_add_group_id_columns_to_protected_branch_access_levels.rb
+++ b/ee/db/migrate/20160812054342_add_group_id_columns_to_protected_branch_access_levels.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddGroupIdColumnsToProtectedBranchAccessLevels < ActiveRecord::Migration
+class AddGroupIdColumnsToProtectedBranchAccessLevels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/ee/db/migrate/20160829104026_add_repository_size_limit_to_application_settings.rb b/ee/db/migrate/20160829104026_add_repository_size_limit_to_application_settings.rb
index f934281cc9bf29884c980c7226b1ecd6e827559c..079a38f49c36523da3cc19f1f7fcb9c750724d3d 100644
--- a/ee/db/migrate/20160829104026_add_repository_size_limit_to_application_settings.rb
+++ b/ee/db/migrate/20160829104026_add_repository_size_limit_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddRepositorySizeLimitToApplicationSettings < ActiveRecord::Migration
+class AddRepositorySizeLimitToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160831231325_update_mirror_when_empty_import_url_in_projects.rb b/ee/db/migrate/20160831231325_update_mirror_when_empty_import_url_in_projects.rb
index 1f0eb9cb0af42999341476a95e5918ba1c12c5e8..1521aa4a73b8e7764c2085f0483b56cf4fa52d4a 100644
--- a/ee/db/migrate/20160831231325_update_mirror_when_empty_import_url_in_projects.rb
+++ b/ee/db/migrate/20160831231325_update_mirror_when_empty_import_url_in_projects.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/UpdateColumnInBatches
 # rubocop:disable Migration/UpdateLargeTable
-class UpdateMirrorWhenEmptyImportUrlInProjects < ActiveRecord::Migration
+class UpdateMirrorWhenEmptyImportUrlInProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20160906143504_add_ldap_attributes_to_member.rb b/ee/db/migrate/20160906143504_add_ldap_attributes_to_member.rb
index 111903f3e91729732328dafa065718070ce027e6..6af338f0301a4d1223afba0dfb8c167ca7afe7c0 100644
--- a/ee/db/migrate/20160906143504_add_ldap_attributes_to_member.rb
+++ b/ee/db/migrate/20160906143504_add_ldap_attributes_to_member.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddLdapAttributesToMember < ActiveRecord::Migration
+class AddLdapAttributesToMember < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20160913172608_add_repository_size_limit_to_projects.rb b/ee/db/migrate/20160913172608_add_repository_size_limit_to_projects.rb
index 636f3b661182b990fda2b4844c52d8d9c512cc2e..cb51109018f29b910b81c368d09e4a67d1ab52dd 100644
--- a/ee/db/migrate/20160913172608_add_repository_size_limit_to_projects.rb
+++ b/ee/db/migrate/20160913172608_add_repository_size_limit_to_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddRepositorySizeLimitToProjects < ActiveRecord::Migration
+class AddRepositorySizeLimitToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160913172737_add_repository_size_limit_to_namespaces.rb b/ee/db/migrate/20160913172737_add_repository_size_limit_to_namespaces.rb
index 23955d8ab121a026b441edcba6c96e4307b4050f..eb59cbd7d194f8096bf1937c6f69499e8d35f740 100644
--- a/ee/db/migrate/20160913172737_add_repository_size_limit_to_namespaces.rb
+++ b/ee/db/migrate/20160913172737_add_repository_size_limit_to_namespaces.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddRepositorySizeLimitToNamespaces < ActiveRecord::Migration
+class AddRepositorySizeLimitToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160915201649_add_prevent_secrets_to_push_rules.rb b/ee/db/migrate/20160915201649_add_prevent_secrets_to_push_rules.rb
index de347bbeb71afcac4ff891636e7e50b4a98ef2a3..7cb3053f352a42b176e737e53a43d50a825e98c8 100644
--- a/ee/db/migrate/20160915201649_add_prevent_secrets_to_push_rules.rb
+++ b/ee/db/migrate/20160915201649_add_prevent_secrets_to_push_rules.rb
@@ -1,4 +1,4 @@
-class AddPreventSecretsToPushRules < ActiveRecord::Migration
+class AddPreventSecretsToPushRules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20160916101334_add_approver_groups.rb b/ee/db/migrate/20160916101334_add_approver_groups.rb
index 87342ad88c924f798299680f54ba2698c5e1c560..4bccdd46db1569827e0fc70da66c19e570978a6e 100644
--- a/ee/db/migrate/20160916101334_add_approver_groups.rb
+++ b/ee/db/migrate/20160916101334_add_approver_groups.rb
@@ -2,7 +2,7 @@
 # for more information on how to write migrations for GitLab.
 
 # rubocop:disable Migration/Timestamps
-class AddApproverGroups < ActiveRecord::Migration
+class AddApproverGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/ee/db/migrate/20161005144359_add_name_to_boards.rb b/ee/db/migrate/20161005144359_add_name_to_boards.rb
index 9b46b96df733c878a21a09a2a3f6a48ae5cd3009..3d2232957361727269c74133757ed1c1a37ddd57 100644
--- a/ee/db/migrate/20161005144359_add_name_to_boards.rb
+++ b/ee/db/migrate/20161005144359_add_name_to_boards.rb
@@ -1,4 +1,4 @@
-class AddNameToBoards < ActiveRecord::Migration
+class AddNameToBoards < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20161021185735_migrate_ee_sidekiq_queues_from_default.rb b/ee/db/migrate/20161021185735_migrate_ee_sidekiq_queues_from_default.rb
index e04762268e698a1d2da4e0fdf9f1523f4c091b4b..b0e797685363a86847107007636fd136ebb3bc4b 100644
--- a/ee/db/migrate/20161021185735_migrate_ee_sidekiq_queues_from_default.rb
+++ b/ee/db/migrate/20161021185735_migrate_ee_sidekiq_queues_from_default.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MigrateEESidekiqQueuesFromDefault < ActiveRecord::Migration
+class MigrateEESidekiqQueuesFromDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/ee/db/migrate/20161030005533_add_estimate_to_issuables.rb b/ee/db/migrate/20161030005533_add_estimate_to_issuables.rb
index 9d5a0956f101e4c79dd9b470242942499373e2e2..96861ef5cd3c2df5fd2983748a723d1e86151062 100644
--- a/ee/db/migrate/20161030005533_add_estimate_to_issuables.rb
+++ b/ee/db/migrate/20161030005533_add_estimate_to_issuables.rb
@@ -1,4 +1,4 @@
-class AddEstimateToIssuables < ActiveRecord::Migration
+class AddEstimateToIssuables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20161030020610_create_timelogs.rb b/ee/db/migrate/20161030020610_create_timelogs.rb
index dc94e4747978b88b73caca8fe0af39ed8387411e..18a48f524cb4c02b4d0376cdb81781cce42f53c7 100644
--- a/ee/db/migrate/20161030020610_create_timelogs.rb
+++ b/ee/db/migrate/20161030020610_create_timelogs.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateTimelogs < ActiveRecord::Migration
+class CreateTimelogs < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20161230123835_add_squash_to_merge_requests_ee.rb b/ee/db/migrate/20161230123835_add_squash_to_merge_requests_ee.rb
index d8caa8ef2e11c011275412415074f55e998b3d36..89708d6f5196485c5ea21d9a0c5be4e454839583 100644
--- a/ee/db/migrate/20161230123835_add_squash_to_merge_requests_ee.rb
+++ b/ee/db/migrate/20161230123835_add_squash_to_merge_requests_ee.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddSquashToMergeRequestsEE < ActiveRecord::Migration
+class AddSquashToMergeRequestsEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20170106172234_add_shared_runners_minutes_to_application_settings.rb b/ee/db/migrate/20170106172234_add_shared_runners_minutes_to_application_settings.rb
index 7d14f3a5ff7de9046eb2b631edb151518571da73..50b400362cb9b0a3cf04f34dc93ecd0e9be382fa 100644
--- a/ee/db/migrate/20170106172234_add_shared_runners_minutes_to_application_settings.rb
+++ b/ee/db/migrate/20170106172234_add_shared_runners_minutes_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddSharedRunnersMinutesToApplicationSettings < ActiveRecord::Migration
+class AddSharedRunnersMinutesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170106172235_add_shared_runners_minutes_limit_to_namespace.rb b/ee/db/migrate/20170106172235_add_shared_runners_minutes_limit_to_namespace.rb
index 0a00a0221354a1b29ec4c7150b5a127c65bd850d..1b10ab6c6280eceb10dfdaabcd2a8ecd86448f8e 100644
--- a/ee/db/migrate/20170106172235_add_shared_runners_minutes_limit_to_namespace.rb
+++ b/ee/db/migrate/20170106172235_add_shared_runners_minutes_limit_to_namespace.rb
@@ -1,4 +1,4 @@
-class AddSharedRunnersMinutesLimitToNamespace < ActiveRecord::Migration
+class AddSharedRunnersMinutesLimitToNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170106172236_create_table_namespace_statistics.rb b/ee/db/migrate/20170106172236_create_table_namespace_statistics.rb
index 870fe3a28eae17842ccdd3272378d80f2ec3bcdf..65fb2635cc96916386ee81146393b6530a258110 100644
--- a/ee/db/migrate/20170106172236_create_table_namespace_statistics.rb
+++ b/ee/db/migrate/20170106172236_create_table_namespace_statistics.rb
@@ -1,4 +1,4 @@
-class CreateTableNamespaceStatistics < ActiveRecord::Migration
+class CreateTableNamespaceStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170106172237_add_shared_runners_seconds_to_project_statistics.rb b/ee/db/migrate/20170106172237_add_shared_runners_seconds_to_project_statistics.rb
index 6fe1565dd3cc0e1998e6d31f244ff4db0b9d439f..c41a9af2082c2e1371516a6dd125b031409c8084 100644
--- a/ee/db/migrate/20170106172237_add_shared_runners_seconds_to_project_statistics.rb
+++ b/ee/db/migrate/20170106172237_add_shared_runners_seconds_to_project_statistics.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddSharedRunnersSecondsToProjectStatistics < ActiveRecord::Migration
+class AddSharedRunnersSecondsToProjectStatistics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb b/ee/db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb
index 11abb20f50d0a2f24bba7ed93a665d4c218ad372..6003c3eb48a2eef01d6db575b82eb38a5c8d6197 100644
--- a/ee/db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb
+++ b/ee/db/migrate/20170118194941_convert_application_settings_repository_size_limit_to_bytes.rb
@@ -1,6 +1,6 @@
 # rubocop:disable Migration/RemoveColumn
 # rubocop:disable Migration/UpdateColumnInBatches
-class ConvertApplicationSettingsRepositorySizeLimitToBytes < ActiveRecord::Migration
+class ConvertApplicationSettingsRepositorySizeLimitToBytes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb b/ee/db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb
index e3092226509305501c76546365ad403ec2792444..1890e93b3b299f826336cf2989c4addf1ceadc5a 100644
--- a/ee/db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb
+++ b/ee/db/migrate/20170118200338_convert_projects_repository_size_limit_to_bytes.rb
@@ -1,7 +1,7 @@
 # rubocop:disable Migration/UpdateColumnInBatches
 # rubocop:disable Migration/UpdateLargeTable
 # rubocop:disable Migration/RemoveColumn
-class ConvertProjectsRepositorySizeLimitToBytes < ActiveRecord::Migration
+class ConvertProjectsRepositorySizeLimitToBytes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb b/ee/db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb
index 65199ec14c72b66ecc1a5784dd3e584a09582e48..377ae2fe1227314daeae256c4184f16184aaaf2a 100644
--- a/ee/db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb
+++ b/ee/db/migrate/20170118200412_convert_namespaces_repository_size_limit_to_bytes.rb
@@ -1,7 +1,7 @@
 # rubocop:disable Migration/RemoveColumn
 # rubocop:disable Migration/UpdateColumnInBatches
 # rubocop:disable Migration/UpdateLargeTable
-class ConvertNamespacesRepositorySizeLimitToBytes < ActiveRecord::Migration
+class ConvertNamespacesRepositorySizeLimitToBytes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170120123345_add_column_auditor_to_users.rb b/ee/db/migrate/20170120123345_add_column_auditor_to_users.rb
index 0a99054666f1c4fab73cea4cae36b5d0964276d7..0ca201196b25b639f9bd8cde34c56c66d55b287c 100644
--- a/ee/db/migrate/20170120123345_add_column_auditor_to_users.rb
+++ b/ee/db/migrate/20170120123345_add_column_auditor_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 # rubocop:disable Migration/UpdateLargeTable
-class AddColumnAuditorToUsers < ActiveRecord::Migration
+class AddColumnAuditorToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170130113559_add_sync_schedule_to_projects_and_remote_projects.rb b/ee/db/migrate/20170130113559_add_sync_schedule_to_projects_and_remote_projects.rb
index a980910f17b19b10587aee5ca7799c3f43ba6e2f..dbe7718c4a873bfe9dee393ddcc8ac0daf408514 100644
--- a/ee/db/migrate/20170130113559_add_sync_schedule_to_projects_and_remote_projects.rb
+++ b/ee/db/migrate/20170130113559_add_sync_schedule_to_projects_and_remote_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/UpdateLargeTable
-class AddSyncScheduleToProjectsAndRemoteProjects < ActiveRecord::Migration
+class AddSyncScheduleToProjectsAndRemoteProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170202114129_add_milestone_id_to_boards.rb b/ee/db/migrate/20170202114129_add_milestone_id_to_boards.rb
index 977d953de65cf0ba3087df5678d4a8ce3d2fd258..2687fc632a40b8bdad5a464f1466b511d92fd1ea 100644
--- a/ee/db/migrate/20170202114129_add_milestone_id_to_boards.rb
+++ b/ee/db/migrate/20170202114129_add_milestone_id_to_boards.rb
@@ -1,4 +1,4 @@
-class AddMilestoneIdToBoards < ActiveRecord::Migration
+class AddMilestoneIdToBoards < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170207150212_add_indexes_to_mirrors.rb b/ee/db/migrate/20170207150212_add_indexes_to_mirrors.rb
index de6cfc70fd29c3cebaacb346afd56bd9c5aa7861..d70d75c3382abc46d9497a048b14162c47ece8cb 100644
--- a/ee/db/migrate/20170207150212_add_indexes_to_mirrors.rb
+++ b/ee/db/migrate/20170207150212_add_indexes_to_mirrors.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexesToMirrors < ActiveRecord::Migration
+class AddIndexesToMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170208144550_add_index_to_mirrors_last_update_at_fields.rb b/ee/db/migrate/20170208144550_add_index_to_mirrors_last_update_at_fields.rb
index 22e4dceafe101be56ae5da420f2d2a68987b7bd2..6e65a814c40afd5ba56233aaad71f2e13616c98c 100644
--- a/ee/db/migrate/20170208144550_add_index_to_mirrors_last_update_at_fields.rb
+++ b/ee/db/migrate/20170208144550_add_index_to_mirrors_last_update_at_fields.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToMirrorsLastUpdateAtFields < ActiveRecord::Migration
+class AddIndexToMirrorsLastUpdateAtFields < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170210144005_add_global_minimum_mirror_sync_time_to_application_settings.rb b/ee/db/migrate/20170210144005_add_global_minimum_mirror_sync_time_to_application_settings.rb
index 3b700ddb58af8e907c0f2e2dbf766a8b41ec39a3..18c44c678ea7619e7bb9126dccced9606101fd80 100644
--- a/ee/db/migrate/20170210144005_add_global_minimum_mirror_sync_time_to_application_settings.rb
+++ b/ee/db/migrate/20170210144005_add_global_minimum_mirror_sync_time_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddGlobalMinimumMirrorSyncTimeToApplicationSettings < ActiveRecord::Migration
+class AddGlobalMinimumMirrorSyncTimeToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170215151539_add_aws_elasticsearch.rb b/ee/db/migrate/20170215151539_add_aws_elasticsearch.rb
index 623e6625f1d441be0dbc9253a3f038df5046c789..9d31a4f2d24ba355b0bc05049b1168713a5d9de2 100644
--- a/ee/db/migrate/20170215151539_add_aws_elasticsearch.rb
+++ b/ee/db/migrate/20170215151539_add_aws_elasticsearch.rb
@@ -1,4 +1,4 @@
-class AddAwsElasticsearch < ActiveRecord::Migration
+class AddAwsElasticsearch < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170215151540_migrate_old_elasticsearch_settings.rb b/ee/db/migrate/20170215151540_migrate_old_elasticsearch_settings.rb
index 668af1fa066a7e1edd349a31e914c56af160f373..c65bd3674fab64290ac493373fac52250e211f15 100644
--- a/ee/db/migrate/20170215151540_migrate_old_elasticsearch_settings.rb
+++ b/ee/db/migrate/20170215151540_migrate_old_elasticsearch_settings.rb
@@ -1,4 +1,4 @@
-class MigrateOldElasticsearchSettings < ActiveRecord::Migration
+class MigrateOldElasticsearchSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::ArelMethods
   include Gitlab::Database::MigrationHelpers
 
diff --git a/ee/db/migrate/20170215151541_remove_old_elasticsearch_settings.rb b/ee/db/migrate/20170215151541_remove_old_elasticsearch_settings.rb
index 34fbd4b8bbbd1c8f3453dcbf1d9a1ed3276e0fa2..915097f5969c7098affe1cf8c17e948106893133 100644
--- a/ee/db/migrate/20170215151541_remove_old_elasticsearch_settings.rb
+++ b/ee/db/migrate/20170215151541_remove_old_elasticsearch_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveOldElasticsearchSettings < ActiveRecord::Migration
+class RemoveOldElasticsearchSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = true
diff --git a/ee/db/migrate/20170216000450_add_enabled_to_geo_nodes.rb b/ee/db/migrate/20170216000450_add_enabled_to_geo_nodes.rb
index b898081bd36ce1ad23d0b0de6d03147751dee594..f4f0f5499eaee17d54ec4e6a8defc0536b071eff 100644
--- a/ee/db/migrate/20170216000450_add_enabled_to_geo_nodes.rb
+++ b/ee/db/migrate/20170216000450_add_enabled_to_geo_nodes.rb
@@ -1,4 +1,4 @@
-class AddEnabledToGeoNodes < ActiveRecord::Migration
+class AddEnabledToGeoNodes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170224075132_add_access_keys_to_geo_nodes.rb b/ee/db/migrate/20170224075132_add_access_keys_to_geo_nodes.rb
index 0ce4264cdff785098a823bf5cd0b436573bcb8f0..06863648659631db768b8eeea3eecb16071dc41e 100644
--- a/ee/db/migrate/20170224075132_add_access_keys_to_geo_nodes.rb
+++ b/ee/db/migrate/20170224075132_add_access_keys_to_geo_nodes.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddAccessKeysToGeoNodes < ActiveRecord::Migration
+class AddAccessKeysToGeoNodes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170306180725_add_index_to_milestone_id_on_boards.rb b/ee/db/migrate/20170306180725_add_index_to_milestone_id_on_boards.rb
index 30715355d2b6a76cf165343261895d2e48c03273..a52403173f2d92e07421564406d95d92e6a171d1 100644
--- a/ee/db/migrate/20170306180725_add_index_to_milestone_id_on_boards.rb
+++ b/ee/db/migrate/20170306180725_add_index_to_milestone_id_on_boards.rb
@@ -1,5 +1,5 @@
 # rubocop:disable RemoveIndex
-class AddIndexToMilestoneIdOnBoards < ActiveRecord::Migration
+class AddIndexToMilestoneIdOnBoards < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170308015651_add_geo_status_timout_to_application_settings.rb b/ee/db/migrate/20170308015651_add_geo_status_timout_to_application_settings.rb
index 18edfacfc20037e69edb123d8bd48ad6bb8bd80a..ca35080cb5f43bf40db6cec836b3caea2d9908d4 100644
--- a/ee/db/migrate/20170308015651_add_geo_status_timout_to_application_settings.rb
+++ b/ee/db/migrate/20170308015651_add_geo_status_timout_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddGeoStatusTimoutToApplicationSettings < ActiveRecord::Migration
+class AddGeoStatusTimoutToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170403141442_add_elasticsearch_experimental_indexer_to_application_settings.rb b/ee/db/migrate/20170403141442_add_elasticsearch_experimental_indexer_to_application_settings.rb
index fd3020b18ec9a4444ada8b519f68ee1665517683..82fb9d0784e2806e7714017e28d7477320a11058 100644
--- a/ee/db/migrate/20170403141442_add_elasticsearch_experimental_indexer_to_application_settings.rb
+++ b/ee/db/migrate/20170403141442_add_elasticsearch_experimental_indexer_to_application_settings.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/SaferBooleanColumn
-class AddElasticsearchExperimentalIndexerToApplicationSettings < ActiveRecord::Migration
+class AddElasticsearchExperimentalIndexerToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170404223037_add_service_desk_settings.rb b/ee/db/migrate/20170404223037_add_service_desk_settings.rb
index 48e476fe63d9e003e26ee73aa184eb141882f988..95e56dfdac2322995d4e9d6c45d0fc04b7c93ec8 100644
--- a/ee/db/migrate/20170404223037_add_service_desk_settings.rb
+++ b/ee/db/migrate/20170404223037_add_service_desk_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddServiceDeskSettings < ActiveRecord::Migration
+class AddServiceDeskSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170419065104_notes_metadata_remove_approvals_value.rb b/ee/db/migrate/20170419065104_notes_metadata_remove_approvals_value.rb
index 05164216d64bad92de0b9176016e5c4e40a40042..bc48ebc4c55f4bddc4af475d4d19e9a81d918738 100644
--- a/ee/db/migrate/20170419065104_notes_metadata_remove_approvals_value.rb
+++ b/ee/db/migrate/20170419065104_notes_metadata_remove_approvals_value.rb
@@ -1,4 +1,4 @@
-class NotesMetadataRemoveApprovalsValue < ActiveRecord::Migration
+class NotesMetadataRemoveApprovalsValue < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170420200123_remove_service_desk_mail_key_from_projects.rb b/ee/db/migrate/20170420200123_remove_service_desk_mail_key_from_projects.rb
index 0074ab3dd75434764a73ec1d51e415cb10f04580..ca06223e9072b27d8d94dae252d6a381d8bf24fc 100644
--- a/ee/db/migrate/20170420200123_remove_service_desk_mail_key_from_projects.rb
+++ b/ee/db/migrate/20170420200123_remove_service_desk_mail_key_from_projects.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class RemoveServiceDeskMailKeyFromProjects < ActiveRecord::Migration
+class RemoveServiceDeskMailKeyFromProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170421113144_add_index_to_approvals_merge_request_id.rb b/ee/db/migrate/20170421113144_add_index_to_approvals_merge_request_id.rb
index ed600782f8681615112940634b157b505035d627..86657fc723759a1e640ae17df96aefc81fce78fc 100644
--- a/ee/db/migrate/20170421113144_add_index_to_approvals_merge_request_id.rb
+++ b/ee/db/migrate/20170421113144_add_index_to_approvals_merge_request_id.rb
@@ -1,4 +1,4 @@
-class AddIndexToApprovalsMergeRequestId < ActiveRecord::Migration
+class AddIndexToApprovalsMergeRequestId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170427180205_add_last_update_started_at_column_to_remote_mirrors.rb b/ee/db/migrate/20170427180205_add_last_update_started_at_column_to_remote_mirrors.rb
index 897330e02bb2e4c3b7596cd463b2c34618c284d6..b59867c5d3b6228f97ef83ef737aa1831e8a5e33 100644
--- a/ee/db/migrate/20170427180205_add_last_update_started_at_column_to_remote_mirrors.rb
+++ b/ee/db/migrate/20170427180205_add_last_update_started_at_column_to_remote_mirrors.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Datetime
-class AddLastUpdateStartedAtColumnToRemoteMirrors < ActiveRecord::Migration
+class AddLastUpdateStartedAtColumnToRemoteMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170505133904_update_geo_nodes_system_hooks.rb b/ee/db/migrate/20170505133904_update_geo_nodes_system_hooks.rb
index c76812cc33dae0d1d5351dff372ff1fa4cb334cf..6297257146244e3e1f9e4b840520e591064de269 100644
--- a/ee/db/migrate/20170505133904_update_geo_nodes_system_hooks.rb
+++ b/ee/db/migrate/20170505133904_update_geo_nodes_system_hooks.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UpdateGeoNodesSystemHooks < ActiveRecord::Migration
+class UpdateGeoNodesSystemHooks < ActiveRecord::Migration[4.2]
   # Set this constant to true if this migration requires downtime.
   DOWNTIME = false
 
diff --git a/ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb b/ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb
index dc5521468ba103c8b41b0f81b9474784092c7b44..63b7228e3f04fcc9b60ab2dce5ac348880fdf492 100644
--- a/ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb
+++ b/ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb
@@ -1,4 +1,4 @@
-class CreateProjectMirrorDataEE < ActiveRecord::Migration
+class CreateProjectMirrorDataEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170512131952_add_plan_to_namespace.rb b/ee/db/migrate/20170512131952_add_plan_to_namespace.rb
index caf1f758db363fe11dc4fdfc91a72158bbb25926..fb8059b7ae6f65417dd4e17a5a2dccc3f351bf70 100644
--- a/ee/db/migrate/20170512131952_add_plan_to_namespace.rb
+++ b/ee/db/migrate/20170512131952_add_plan_to_namespace.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPlanToNamespace < ActiveRecord::Migration
+class AddPlanToNamespace < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170512173638_add_check_namespace_plan_to_application_settings.rb b/ee/db/migrate/20170512173638_add_check_namespace_plan_to_application_settings.rb
index b1cfe9571dd1f6342102c3121131151148dd7275..14e1777ae51d38160014671c0b9688e8f7a35a24 100644
--- a/ee/db/migrate/20170512173638_add_check_namespace_plan_to_application_settings.rb
+++ b/ee/db/migrate/20170512173638_add_check_namespace_plan_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCheckNamespacePlanToApplicationSettings < ActiveRecord::Migration
+class AddCheckNamespacePlanToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
   disable_ddl_transaction!
 
diff --git a/ee/db/migrate/20170513005817_add_push_rule_branch_name.rb b/ee/db/migrate/20170513005817_add_push_rule_branch_name.rb
index 315240954fa5d96831ed1675eb658b85bfb06117..f2f767aac7fe63db23ff310b5c421a4cc95f0634 100644
--- a/ee/db/migrate/20170513005817_add_push_rule_branch_name.rb
+++ b/ee/db/migrate/20170513005817_add_push_rule_branch_name.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPushRuleBranchName < ActiveRecord::Migration
+class AddPushRuleBranchName < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170515093334_add_mirror_settings_to_application_setting.rb b/ee/db/migrate/20170515093334_add_mirror_settings_to_application_setting.rb
index f19388c4c4876f2276253c8e28da01bc4b325f2f..1ce028b419e08161d1df28fb0e16f08ffb646cc2 100644
--- a/ee/db/migrate/20170515093334_add_mirror_settings_to_application_setting.rb
+++ b/ee/db/migrate/20170515093334_add_mirror_settings_to_application_setting.rb
@@ -1,4 +1,4 @@
-class AddMirrorSettingsToApplicationSetting < ActiveRecord::Migration
+class AddMirrorSettingsToApplicationSetting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170517162048_create_issue_links_table.rb b/ee/db/migrate/20170517162048_create_issue_links_table.rb
index 442b87a208d297a8df00562341ba7d47260c89c9..711b46779f9690b73e64d7d87c138855cea65c2b 100644
--- a/ee/db/migrate/20170517162048_create_issue_links_table.rb
+++ b/ee/db/migrate/20170517162048_create_issue_links_table.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/Timestamps
-class CreateIssueLinksTable < ActiveRecord::Migration
+class CreateIssueLinksTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170522194603_create_geo_repository_updated_events.rb b/ee/db/migrate/20170522194603_create_geo_repository_updated_events.rb
index 561a8bfe87a3e4de3e038493f3ffdaecf0569d2e..9158d9377e6a197cb1fe777abc141ec02fc302b8 100644
--- a/ee/db/migrate/20170522194603_create_geo_repository_updated_events.rb
+++ b/ee/db/migrate/20170522194603_create_geo_repository_updated_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoRepositoryUpdatedEvents < ActiveRecord::Migration
+class CreateGeoRepositoryUpdatedEvents < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170522201800_create_geo_event_log.rb b/ee/db/migrate/20170522201800_create_geo_event_log.rb
index af16966dd4ae1cf0e86e4709bcf0a66e8c403a1e..372e7d4abb628e26c6ad7b76e6f59af987da48a6 100644
--- a/ee/db/migrate/20170522201800_create_geo_event_log.rb
+++ b/ee/db/migrate/20170522201800_create_geo_event_log.rb
@@ -1,4 +1,4 @@
-class CreateGeoEventLog < ActiveRecord::Migration
+class CreateGeoEventLog < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170525174157_create_pipeline_source_pipeline.rb b/ee/db/migrate/20170525174157_create_pipeline_source_pipeline.rb
index 8c00a1526daffe598cdfb2493e8cdeb5f6dd8b9c..b9b297450d764b1e0d1e580efbee7d1f6ccce076 100644
--- a/ee/db/migrate/20170525174157_create_pipeline_source_pipeline.rb
+++ b/ee/db/migrate/20170525174157_create_pipeline_source_pipeline.rb
@@ -1,4 +1,4 @@
-class CreatePipelineSourcePipeline < ActiveRecord::Migration
+class CreatePipelineSourcePipeline < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170525174158_add_ci_pipeline_source_pipeline_indexes.rb b/ee/db/migrate/20170525174158_add_ci_pipeline_source_pipeline_indexes.rb
index 5ab23a701663522665803fe2534776ee18e0d122..ff78cb3305638f6cc5ade92a968c0dcbd4b699fa 100644
--- a/ee/db/migrate/20170525174158_add_ci_pipeline_source_pipeline_indexes.rb
+++ b/ee/db/migrate/20170525174158_add_ci_pipeline_source_pipeline_indexes.rb
@@ -1,4 +1,4 @@
-class AddCiPipelineSourcePipelineIndexes < ActiveRecord::Migration
+class AddCiPipelineSourcePipelineIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170525174159_add_ci_pipeline_source_pipeline_foreign_key.rb b/ee/db/migrate/20170525174159_add_ci_pipeline_source_pipeline_foreign_key.rb
index 068e5b87314e6cb5d7b38eedb51f9e183cd280f3..649c57325a0c646e44303a6c98a4275dfa828fed 100644
--- a/ee/db/migrate/20170525174159_add_ci_pipeline_source_pipeline_foreign_key.rb
+++ b/ee/db/migrate/20170525174159_add_ci_pipeline_source_pipeline_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddCiPipelineSourcePipelineForeignKey < ActiveRecord::Migration
+class AddCiPipelineSourcePipelineForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170602003304_add_clone_url_prefix_to_geo_node.rb b/ee/db/migrate/20170602003304_add_clone_url_prefix_to_geo_node.rb
index fbdb86a0c41b2f890acf4b08d403d8d2a788c9d7..54f76b076b017fc76162627149b2b69d76dcaec9 100644
--- a/ee/db/migrate/20170602003304_add_clone_url_prefix_to_geo_node.rb
+++ b/ee/db/migrate/20170602003304_add_clone_url_prefix_to_geo_node.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCloneUrlPrefixToGeoNode < ActiveRecord::Migration
+class AddCloneUrlPrefixToGeoNode < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170605151307_add_disable_overriding_approvers_per_merge_request_to_project.rb b/ee/db/migrate/20170605151307_add_disable_overriding_approvers_per_merge_request_to_project.rb
index 2442930f7e7c3bc7a5625f14b04a3afe4bfb323a..363d41fb8e917e37d6467eaadbbe78581101bfa9 100644
--- a/ee/db/migrate/20170605151307_add_disable_overriding_approvers_per_merge_request_to_project.rb
+++ b/ee/db/migrate/20170605151307_add_disable_overriding_approvers_per_merge_request_to_project.rb
@@ -1,4 +1,4 @@
-class AddDisableOverridingApproversPerMergeRequestToProject < ActiveRecord::Migration
+class AddDisableOverridingApproversPerMergeRequestToProject < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170614053336_create_geo_repository_deleted_events.rb b/ee/db/migrate/20170614053336_create_geo_repository_deleted_events.rb
index c0d3db8901856244cffeb60a57a76c9c3ec4d224..27cf15cabdabaf803945f4c675a89decf3e418c1 100644
--- a/ee/db/migrate/20170614053336_create_geo_repository_deleted_events.rb
+++ b/ee/db/migrate/20170614053336_create_geo_repository_deleted_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoRepositoryDeletedEvents < ActiveRecord::Migration
+class CreateGeoRepositoryDeletedEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170614061551_add_geo_repository_deleted_events_foreign_key.rb b/ee/db/migrate/20170614061551_add_geo_repository_deleted_events_foreign_key.rb
index 9b21c58ecbb31893042e8ee9bb470bafe14d9909..1d75d15fe621df32d9e1df33a1f7aa2ef5031c89 100644
--- a/ee/db/migrate/20170614061551_add_geo_repository_deleted_events_foreign_key.rb
+++ b/ee/db/migrate/20170614061551_add_geo_repository_deleted_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoRepositoryDeletedEventsForeignKey < ActiveRecord::Migration
+class AddGeoRepositoryDeletedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170620063751_remove_geo_primary_system_hook.rb b/ee/db/migrate/20170620063751_remove_geo_primary_system_hook.rb
index a818d4e8c797ecfd6aabecbd42b511aaddc82c36..7413e409bf4fe3d958c5a09c96209bbbe858d483 100644
--- a/ee/db/migrate/20170620063751_remove_geo_primary_system_hook.rb
+++ b/ee/db/migrate/20170620063751_remove_geo_primary_system_hook.rb
@@ -1,4 +1,4 @@
-class RemoveGeoPrimarySystemHook < ActiveRecord::Migration
+class RemoveGeoPrimarySystemHook < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170620143011_add_slack_integrationtable.rb b/ee/db/migrate/20170620143011_add_slack_integrationtable.rb
index 8b4151e8344c2b02bcdf18ae36511931da0f7bf4..b9a6cdbf3f25c4a380e8a430f23c4ddb8ea574da 100644
--- a/ee/db/migrate/20170620143011_add_slack_integrationtable.rb
+++ b/ee/db/migrate/20170620143011_add_slack_integrationtable.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddSlackIntegrationtable < ActiveRecord::Migration
+class AddSlackIntegrationtable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170622124246_add_ee_foreign_keys_pointing_to_projects.rb b/ee/db/migrate/20170622124246_add_ee_foreign_keys_pointing_to_projects.rb
index e8d9c35cd63a2ea71a2dc18cd51ef918101b3ca7..694c317b71cc16e58a4b22c09db7b87ddf98d4ea 100644
--- a/ee/db/migrate/20170622124246_add_ee_foreign_keys_pointing_to_projects.rb
+++ b/ee/db/migrate/20170622124246_add_ee_foreign_keys_pointing_to_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEEForeignKeysPointingToProjects < ActiveRecord::Migration
+class AddEEForeignKeysPointingToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20170622131529_add_foreign_key_for_approvals.rb b/ee/db/migrate/20170622131529_add_foreign_key_for_approvals.rb
index c1456ce5e574246c64fa1be2ce562b76062e18ca..45629fe392aefe8926bbdd0b5900c5d0372c931a 100644
--- a/ee/db/migrate/20170622131529_add_foreign_key_for_approvals.rb
+++ b/ee/db/migrate/20170622131529_add_foreign_key_for_approvals.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddForeignKeyForApprovals < ActiveRecord::Migration
+class AddForeignKeyForApprovals < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170623195236_create_geo_repository_renamed_events.rb b/ee/db/migrate/20170623195236_create_geo_repository_renamed_events.rb
index eb5de5e90caede4f1b81849773cd29cc2e935a1b..926dc3a5f5daadeca1aca8ac67261b79630cafa4 100644
--- a/ee/db/migrate/20170623195236_create_geo_repository_renamed_events.rb
+++ b/ee/db/migrate/20170623195236_create_geo_repository_renamed_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoRepositoryRenamedEvents < ActiveRecord::Migration
+class CreateGeoRepositoryRenamedEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170623202610_add_geo_repository_renamed_events_foreign_key.rb b/ee/db/migrate/20170623202610_add_geo_repository_renamed_events_foreign_key.rb
index 8f19ede7b332fdc77558401195f5ca8044884680..d39906cccde4e16355daaec5d645467f2d6ba911 100644
--- a/ee/db/migrate/20170623202610_add_geo_repository_renamed_events_foreign_key.rb
+++ b/ee/db/migrate/20170623202610_add_geo_repository_renamed_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoRepositoryRenamedEventsForeignKey < ActiveRecord::Migration
+class AddGeoRepositoryRenamedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170625171421_add_slack_to_application_settings.rb b/ee/db/migrate/20170625171421_add_slack_to_application_settings.rb
index f45c5fd2ae675e1aa1c90ec79631eb5c8e82b9a2..1490789ae01ba42010e1c05df04848d5e27366fc 100644
--- a/ee/db/migrate/20170625171421_add_slack_to_application_settings.rb
+++ b/ee/db/migrate/20170625171421_add_slack_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 # rubocop:disable Migration/SaferBooleanColumn
-class AddSlackToApplicationSettings < ActiveRecord::Migration
+class AddSlackToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170626202753_update_authorized_keys_file.rb b/ee/db/migrate/20170626202753_update_authorized_keys_file.rb
index 091d536e6b3826e4d1e852630e83a3a99d3cf850..e0b4c5f35a1e62a911234bdb872f376732dfb647 100644
--- a/ee/db/migrate/20170626202753_update_authorized_keys_file.rb
+++ b/ee/db/migrate/20170626202753_update_authorized_keys_file.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class UpdateAuthorizedKeysFile < ActiveRecord::Migration
+class UpdateAuthorizedKeysFile < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   class ApplicationSetting < ActiveRecord::Base
diff --git a/ee/db/migrate/20170627211700_add_default_to_authorized_keys_enabled_application_setting.rb b/ee/db/migrate/20170627211700_add_default_to_authorized_keys_enabled_application_setting.rb
index aa26af35b8fa7a489bd0b6d0111b477f2757db91..5b8a86f582b92955dd3c411e669dd6a396de5e52 100644
--- a/ee/db/migrate/20170627211700_add_default_to_authorized_keys_enabled_application_setting.rb
+++ b/ee/db/migrate/20170627211700_add_default_to_authorized_keys_enabled_application_setting.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddDefaultToAuthorizedKeysEnabledApplicationSetting < ActiveRecord::Migration
+class AddDefaultToAuthorizedKeysEnabledApplicationSetting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170706121518_make_service_desk_enabled_by_default.rb b/ee/db/migrate/20170706121518_make_service_desk_enabled_by_default.rb
index c721fcc2088eef862867750f732253f307ea0bea..096089d5626b9325bbdc124fc9ceccf4e454a302 100644
--- a/ee/db/migrate/20170706121518_make_service_desk_enabled_by_default.rb
+++ b/ee/db/migrate/20170706121518_make_service_desk_enabled_by_default.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class MakeServiceDeskEnabledByDefault < ActiveRecord::Migration
+class MakeServiceDeskEnabledByDefault < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170717213940_create_geo_node_namespace_links.rb b/ee/db/migrate/20170717213940_create_geo_node_namespace_links.rb
index 7e19c7e2a1fb26090ab29d96a6dc36d7a9bd144f..28bbfa6a5e35968f68526ce6a54a446addbe7514 100644
--- a/ee/db/migrate/20170717213940_create_geo_node_namespace_links.rb
+++ b/ee/db/migrate/20170717213940_create_geo_node_namespace_links.rb
@@ -1,4 +1,4 @@
-class CreateGeoNodeNamespaceLinks < ActiveRecord::Migration
+class CreateGeoNodeNamespaceLinks < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170718185922_add_group_id_to_boards.rb b/ee/db/migrate/20170718185922_add_group_id_to_boards.rb
index 69c91fca9939270cda798fc1f58f37ea045fa447..c81c4a1228cd6317c68cb417dc19c4d031a361b1 100644
--- a/ee/db/migrate/20170718185922_add_group_id_to_boards.rb
+++ b/ee/db/migrate/20170718185922_add_group_id_to_boards.rb
@@ -1,4 +1,4 @@
-class AddGroupIdToBoards < ActiveRecord::Migration
+class AddGroupIdToBoards < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20170718190627_add_group_boards_indexes.rb b/ee/db/migrate/20170718190627_add_group_boards_indexes.rb
index 6b086c3e8f0b7825c647bccee3e7e1207b83c391..4e7419dce46d2547a8cb9ddca3f910aeb3c2f1a8 100644
--- a/ee/db/migrate/20170718190627_add_group_boards_indexes.rb
+++ b/ee/db/migrate/20170718190627_add_group_boards_indexes.rb
@@ -1,4 +1,4 @@
-class AddGroupBoardsIndexes < ActiveRecord::Migration
+class AddGroupBoardsIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20170719182937_convert_max_mirror_delay_to_minutes_in_application_settings.rb b/ee/db/migrate/20170719182937_convert_max_mirror_delay_to_minutes_in_application_settings.rb
index 925a2b8a0d07aeb75118c9f6539d35411866978c..5ad5baddd00552cb6d0cc6ae1cdf501a302b37b2 100644
--- a/ee/db/migrate/20170719182937_convert_max_mirror_delay_to_minutes_in_application_settings.rb
+++ b/ee/db/migrate/20170719182937_convert_max_mirror_delay_to_minutes_in_application_settings.rb
@@ -1,4 +1,4 @@
-class ConvertMaxMirrorDelayToMinutesInApplicationSettings < ActiveRecord::Migration
+class ConvertMaxMirrorDelayToMinutesInApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170726111039_add_restrict_group_owners_to_admins_option_to_application_settings.rb b/ee/db/migrate/20170726111039_add_restrict_group_owners_to_admins_option_to_application_settings.rb
index 18bdddec60f235b2e0743e1846bc5befc6afe4f1..b199215bd73eb0dbd791cca849df1e874f156f57 100644
--- a/ee/db/migrate/20170726111039_add_restrict_group_owners_to_admins_option_to_application_settings.rb
+++ b/ee/db/migrate/20170726111039_add_restrict_group_owners_to_admins_option_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRestrictGroupOwnersToAdminsOptionToApplicationSettings < ActiveRecord::Migration
+class AddRestrictGroupOwnersToAdminsOptionToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170801200418_geo_repositories_changed_events.rb b/ee/db/migrate/20170801200418_geo_repositories_changed_events.rb
index 6c16f076cf3ca286c8b8a06190b4198aa389bbba..c3da7c215fc68c0e0630f75fec661464df28bc81 100644
--- a/ee/db/migrate/20170801200418_geo_repositories_changed_events.rb
+++ b/ee/db/migrate/20170801200418_geo_repositories_changed_events.rb
@@ -1,4 +1,4 @@
-class GeoRepositoriesChangedEvents < ActiveRecord::Migration
+class GeoRepositoriesChangedEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170801201439_add_geo_repositories_changed_events_foreign_key.rb b/ee/db/migrate/20170801201439_add_geo_repositories_changed_events_foreign_key.rb
index 32e73075da560e7b123fc99aa82b92c8ad798847..299766c9d7f8b258331e670c227cf3771ed8b730 100644
--- a/ee/db/migrate/20170801201439_add_geo_repositories_changed_events_foreign_key.rb
+++ b/ee/db/migrate/20170801201439_add_geo_repositories_changed_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoRepositoriesChangedEventsForeignKey < ActiveRecord::Migration
+class AddGeoRepositoriesChangedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170808005254_add_email_opted_in_fields_to_users.rb b/ee/db/migrate/20170808005254_add_email_opted_in_fields_to_users.rb
index c7508ac0e893f4fbb23879cc0cba0225fdd75d07..f72ca05efdcad08bc8fbbf76208fc86b1e3f8883 100644
--- a/ee/db/migrate/20170808005254_add_email_opted_in_fields_to_users.rb
+++ b/ee/db/migrate/20170808005254_add_email_opted_in_fields_to_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEmailOptedInFieldsToUsers < ActiveRecord::Migration
+class AddEmailOptedInFieldsToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170808155717_create_plans.rb b/ee/db/migrate/20170808155717_create_plans.rb
index 036473a1419abb03e88874a63621decf5edd8efd..19c6e71ea15707bef53ea27ba9ab3a85c9ee25b2 100644
--- a/ee/db/migrate/20170808155717_create_plans.rb
+++ b/ee/db/migrate/20170808155717_create_plans.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreatePlans < ActiveRecord::Migration
+class CreatePlans < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   class Plan < ActiveRecord::Base
diff --git a/ee/db/migrate/20170808155912_add_plan_id_to_namespaces.rb b/ee/db/migrate/20170808155912_add_plan_id_to_namespaces.rb
index 6ab50f509e48ada04d81b8868f05987d8924b70b..d7676e25273139cd6d63ddc0eacbd0dd19dc4051 100644
--- a/ee/db/migrate/20170808155912_add_plan_id_to_namespaces.rb
+++ b/ee/db/migrate/20170808155912_add_plan_id_to_namespaces.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPlanIdToNamespaces < ActiveRecord::Migration
+class AddPlanIdToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170811203342_fix_email_opted_in_at_on_users.rb b/ee/db/migrate/20170811203342_fix_email_opted_in_at_on_users.rb
index 26b3f94ef29d007f2615ec52e4f8bd09c4a7ad71..eb2780ca7130f3bd3d88d5b1c40a29a708979441 100644
--- a/ee/db/migrate/20170811203342_fix_email_opted_in_at_on_users.rb
+++ b/ee/db/migrate/20170811203342_fix_email_opted_in_at_on_users.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class FixEmailOptedInAtOnUsers < ActiveRecord::Migration
+class FixEmailOptedInAtOnUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170818174141_drop_unnecessary_timestamp_columns_in_geo_event_tables.rb b/ee/db/migrate/20170818174141_drop_unnecessary_timestamp_columns_in_geo_event_tables.rb
index e73d24d98d2e1bbfe24da3c76c3e3a816b12bcfb..7ad09e674f92b1ceb5105f7c719858551e030d4f 100644
--- a/ee/db/migrate/20170818174141_drop_unnecessary_timestamp_columns_in_geo_event_tables.rb
+++ b/ee/db/migrate/20170818174141_drop_unnecessary_timestamp_columns_in_geo_event_tables.rb
@@ -1,5 +1,5 @@
 # rubocop:disable Migration/RemoveColumn
-class DropUnnecessaryTimestampColumnsInGeoEventTables < ActiveRecord::Migration
+class DropUnnecessaryTimestampColumnsInGeoEventTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170901133132_create_geo_repository_created_events.rb b/ee/db/migrate/20170901133132_create_geo_repository_created_events.rb
index 87f526b661c15da608744afc435394f1fcd2980e..7bf2f783282adc6960e555f8e94b09185dd1faf2 100644
--- a/ee/db/migrate/20170901133132_create_geo_repository_created_events.rb
+++ b/ee/db/migrate/20170901133132_create_geo_repository_created_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoRepositoryCreatedEvents < ActiveRecord::Migration
+class CreateGeoRepositoryCreatedEvents < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170905201347_add_index_to_geo_event_log_repository_created_event_id.rb b/ee/db/migrate/20170905201347_add_index_to_geo_event_log_repository_created_event_id.rb
index d1e60793cc214a93730447fba1e34c0d405bad3b..8bd233fd31acde574afe033ea14ecff9107a1b06 100644
--- a/ee/db/migrate/20170905201347_add_index_to_geo_event_log_repository_created_event_id.rb
+++ b/ee/db/migrate/20170905201347_add_index_to_geo_event_log_repository_created_event_id.rb
@@ -1,4 +1,4 @@
-class AddIndexToGeoEventLogRepositoryCreatedEventId < ActiveRecord::Migration
+class AddIndexToGeoEventLogRepositoryCreatedEventId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170905202320_add_missing_indexes_to_geo_event_log.rb b/ee/db/migrate/20170905202320_add_missing_indexes_to_geo_event_log.rb
index 423209e384099d24d33da24ae46aca54d31d284f..bf9e991916aed25bca8617aeaaa9049681c2f50c 100644
--- a/ee/db/migrate/20170905202320_add_missing_indexes_to_geo_event_log.rb
+++ b/ee/db/migrate/20170905202320_add_missing_indexes_to_geo_event_log.rb
@@ -1,4 +1,4 @@
-class AddMissingIndexesToGeoEventLog < ActiveRecord::Migration
+class AddMissingIndexesToGeoEventLog < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170906160132_add_geo_repository_created_events_fk_on_geo_event_log.rb b/ee/db/migrate/20170906160132_add_geo_repository_created_events_fk_on_geo_event_log.rb
index 9e36bb64c04ed98aaac503eeb1bf44569de2f50f..27b1dbf088d473a39eab30e078bb09d889641d34 100644
--- a/ee/db/migrate/20170906160132_add_geo_repository_created_events_fk_on_geo_event_log.rb
+++ b/ee/db/migrate/20170906160132_add_geo_repository_created_events_fk_on_geo_event_log.rb
@@ -1,4 +1,4 @@
-class AddGeoRepositoryCreatedEventsFkOnGeoEventLog < ActiveRecord::Migration
+class AddGeoRepositoryCreatedEventsFkOnGeoEventLog < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20170910051507_correct_protected_access_levels_foreign_keys.rb b/ee/db/migrate/20170910051507_correct_protected_access_levels_foreign_keys.rb
index fc4ea29aeeec4c5549ba1bcb08f198dd03953083..e1a30055fbc62c9b185fe230cd9f7afadf363bdf 100644
--- a/ee/db/migrate/20170910051507_correct_protected_access_levels_foreign_keys.rb
+++ b/ee/db/migrate/20170910051507_correct_protected_access_levels_foreign_keys.rb
@@ -1,4 +1,4 @@
-class CorrectProtectedAccessLevelsForeignKeys < ActiveRecord::Migration
+class CorrectProtectedAccessLevelsForeignKeys < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170911133813_drop_cn_constraint_to_ldap_group_links.rb b/ee/db/migrate/20170911133813_drop_cn_constraint_to_ldap_group_links.rb
index c1365c79813cfc8dc876734fb8ef81bce6f0db6a..1b33ac1a935658b0c91b482d93cdeef4cf87a79b 100644
--- a/ee/db/migrate/20170911133813_drop_cn_constraint_to_ldap_group_links.rb
+++ b/ee/db/migrate/20170911133813_drop_cn_constraint_to_ldap_group_links.rb
@@ -1,4 +1,4 @@
-class DropCnConstraintToLdapGroupLinks < ActiveRecord::Migration
+class DropCnConstraintToLdapGroupLinks < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170911134018_add_filter_to_ldap_group_links.rb b/ee/db/migrate/20170911134018_add_filter_to_ldap_group_links.rb
index a98d50836aaf0a643d4db321e9a88e0cde7a2102..154be12159ad62f724e088f34a4812263fb6804a 100644
--- a/ee/db/migrate/20170911134018_add_filter_to_ldap_group_links.rb
+++ b/ee/db/migrate/20170911134018_add_filter_to_ldap_group_links.rb
@@ -1,4 +1,4 @@
-class AddFilterToLdapGroupLinks < ActiveRecord::Migration
+class AddFilterToLdapGroupLinks < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170914012544_add_reject_unsigned_commits_to_push_rules.rb b/ee/db/migrate/20170914012544_add_reject_unsigned_commits_to_push_rules.rb
index 1d9a297585a84babbded6d0377e19e4e7cd5e19c..40beeb9c988adb8188436dc4b3136d122a5ff719 100644
--- a/ee/db/migrate/20170914012544_add_reject_unsigned_commits_to_push_rules.rb
+++ b/ee/db/migrate/20170914012544_add_reject_unsigned_commits_to_push_rules.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddRejectUnsignedCommitsToPushRules < ActiveRecord::Migration
+class AddRejectUnsignedCommitsToPushRules < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20170920091408_add_index_for_pushrules_is_sample.rb b/ee/db/migrate/20170920091408_add_index_for_pushrules_is_sample.rb
index 058a456e0a3e957ddcc08971ee12f3d54bb196f2..7e3cd4fe0f9c2c0e3db667d90e4f0f230fc0b21d 100644
--- a/ee/db/migrate/20170920091408_add_index_for_pushrules_is_sample.rb
+++ b/ee/db/migrate/20170920091408_add_index_for_pushrules_is_sample.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexForPushrulesIsSample < ActiveRecord::Migration
+class AddIndexForPushrulesIsSample < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20170926200545_add_weight_to_boards.rb b/ee/db/migrate/20170926200545_add_weight_to_boards.rb
index edf1909f179cae4bcf8aaad0c68b1dea6ccdd042..02ac2943a6ec9684c38c5bdd41d04a1ff8079a30 100644
--- a/ee/db/migrate/20170926200545_add_weight_to_boards.rb
+++ b/ee/db/migrate/20170926200545_add_weight_to_boards.rb
@@ -1,4 +1,4 @@
-class AddWeightToBoards < ActiveRecord::Migration
+class AddWeightToBoards < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20170926203418_create_board_labels.rb b/ee/db/migrate/20170926203418_create_board_labels.rb
index cf683f7cf7e485ab553046224c1624818335aa26..49b2214bdc373f08e5f8111da63431138a11d858 100644
--- a/ee/db/migrate/20170926203418_create_board_labels.rb
+++ b/ee/db/migrate/20170926203418_create_board_labels.rb
@@ -1,4 +1,4 @@
-class CreateBoardLabels < ActiveRecord::Migration
+class CreateBoardLabels < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20170928081016_add_pipeline_quotas_to_plan.rb b/ee/db/migrate/20170928081016_add_pipeline_quotas_to_plan.rb
index a43b2541e98e248c27b4e19fe9044aeda345a20a..559c73247b53d2332d89c9929699b9aa46286766 100644
--- a/ee/db/migrate/20170928081016_add_pipeline_quotas_to_plan.rb
+++ b/ee/db/migrate/20170928081016_add_pipeline_quotas_to_plan.rb
@@ -1,4 +1,4 @@
-class AddPipelineQuotasToPlan < ActiveRecord::Migration
+class AddPipelineQuotasToPlan < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171002105019_create_missing_free_plan.rb b/ee/db/migrate/20171002105019_create_missing_free_plan.rb
index 96a6823f760f0797bb36ab85ea4eab049487ba98..579e25bd39b6be75f3d9093e1b93eacbd203a61f 100644
--- a/ee/db/migrate/20171002105019_create_missing_free_plan.rb
+++ b/ee/db/migrate/20171002105019_create_missing_free_plan.rb
@@ -1,4 +1,4 @@
-class CreateMissingFreePlan < ActiveRecord::Migration
+class CreateMissingFreePlan < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171006201108_add_commit_committer_check_to_push_rules.rb b/ee/db/migrate/20171006201108_add_commit_committer_check_to_push_rules.rb
index bc5fb7ec756671cfd287bc508f86eb0a881f4bb1..b98775863a70d441e0845c848cd835be253ce9cf 100644
--- a/ee/db/migrate/20171006201108_add_commit_committer_check_to_push_rules.rb
+++ b/ee/db/migrate/20171006201108_add_commit_committer_check_to_push_rules.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCommitCommitterCheckToPushRules < ActiveRecord::Migration
+class AddCommitCommitterCheckToPushRules < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20171010095526_create_board_assignees.rb b/ee/db/migrate/20171010095526_create_board_assignees.rb
index 324d7f96398aa95d70d46737b72988da67895719..e1b5542acf3ebeb6231ea6207ab323c5f0ecf719 100644
--- a/ee/db/migrate/20171010095526_create_board_assignees.rb
+++ b/ee/db/migrate/20171010095526_create_board_assignees.rb
@@ -1,4 +1,4 @@
-class CreateBoardAssignees < ActiveRecord::Migration
+class CreateBoardAssignees < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20171010140746_geo_configurable_max_capacities.rb b/ee/db/migrate/20171010140746_geo_configurable_max_capacities.rb
index 37601ca81dc970986aaf7d3d176a684ecdccff20..92b9b9a643b58d70f82d4c698ea52517ad616de6 100644
--- a/ee/db/migrate/20171010140746_geo_configurable_max_capacities.rb
+++ b/ee/db/migrate/20171010140746_geo_configurable_max_capacities.rb
@@ -1,4 +1,4 @@
-class GeoConfigurableMaxCapacities < ActiveRecord::Migration
+class GeoConfigurableMaxCapacities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171012070521_create_epics.rb b/ee/db/migrate/20171012070521_create_epics.rb
index a2359d0a12b9dbad3816d5d83bed5fce7ae60386..0ffde95956e175c524621cc4a674dbba0b4c74e6 100644
--- a/ee/db/migrate/20171012070521_create_epics.rb
+++ b/ee/db/migrate/20171012070521_create_epics.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateEpics < ActiveRecord::Migration
+class CreateEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171013192542_add_geo_node_clone_protocol.rb b/ee/db/migrate/20171013192542_add_geo_node_clone_protocol.rb
index 6815a53faeb60529a1d05fa357947f7357d96aeb..9b70c5426cdc39a2a6527b2f63a0cd3994fcf4d3 100644
--- a/ee/db/migrate/20171013192542_add_geo_node_clone_protocol.rb
+++ b/ee/db/migrate/20171013192542_add_geo_node_clone_protocol.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddGeoNodeCloneProtocol < ActiveRecord::Migration
+class AddGeoNodeCloneProtocol < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171017125928_add_remote_mirror_available_to_application_settings.rb b/ee/db/migrate/20171017125928_add_remote_mirror_available_to_application_settings.rb
index 039e71c5cbde01dbba4d254158d3787842f573f2..9081f328e6a7765bfcfe4ba9c921605a2c88ff52 100644
--- a/ee/db/migrate/20171017125928_add_remote_mirror_available_to_application_settings.rb
+++ b/ee/db/migrate/20171017125928_add_remote_mirror_available_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddRemoteMirrorAvailableToApplicationSettings < ActiveRecord::Migration
+class AddRemoteMirrorAvailableToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171017130239_add_remote_mirror_available_overridden_to_projects_ee.rb b/ee/db/migrate/20171017130239_add_remote_mirror_available_overridden_to_projects_ee.rb
index 8b94d74ac55c79bc805f172e5bb62a09176e7581..cf79ac3cdd3f04c1b823121865023f29309248af 100644
--- a/ee/db/migrate/20171017130239_add_remote_mirror_available_overridden_to_projects_ee.rb
+++ b/ee/db/migrate/20171017130239_add_remote_mirror_available_overridden_to_projects_ee.rb
@@ -1,4 +1,4 @@
-class AddRemoteMirrorAvailableOverriddenToProjectsEE < ActiveRecord::Migration
+class AddRemoteMirrorAvailableOverriddenToProjectsEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171031055422_create_geo_node_statuses.rb b/ee/db/migrate/20171031055422_create_geo_node_statuses.rb
index 5a277f9619c99e01d8f006d477069b0ba20e1ab7..aed1f272a56e6908818f812ae01c1985a2ab4300 100644
--- a/ee/db/migrate/20171031055422_create_geo_node_statuses.rb
+++ b/ee/db/migrate/20171031055422_create_geo_node_statuses.rb
@@ -1,4 +1,4 @@
-class CreateGeoNodeStatuses < ActiveRecord::Migration
+class CreateGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171107090120_add_composite_index_to_project_mirror_data_next_execution_timestamp_and_retry_count.rb b/ee/db/migrate/20171107090120_add_composite_index_to_project_mirror_data_next_execution_timestamp_and_retry_count.rb
index 2abe0b3758aab3803440ea6ccbec88065c784e8a..0c4205f5e337d90de4520a336483a4bc8eea798c 100644
--- a/ee/db/migrate/20171107090120_add_composite_index_to_project_mirror_data_next_execution_timestamp_and_retry_count.rb
+++ b/ee/db/migrate/20171107090120_add_composite_index_to_project_mirror_data_next_execution_timestamp_and_retry_count.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddCompositeIndexToProjectMirrorDataNextExecutionTimestampAndRetryCount < ActiveRecord::Migration
+class AddCompositeIndexToProjectMirrorDataNextExecutionTimestampAndRetryCount < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171107130813_create_epic_issues_table.rb b/ee/db/migrate/20171107130813_create_epic_issues_table.rb
index 860901d3c85fd23652c31158396e01f91d31d45c..35991a90ec2221a8dc37687c176b4e20b129f382 100644
--- a/ee/db/migrate/20171107130813_create_epic_issues_table.rb
+++ b/ee/db/migrate/20171107130813_create_epic_issues_table.rb
@@ -1,4 +1,4 @@
-class CreateEpicIssuesTable < ActiveRecord::Migration
+class CreateEpicIssuesTable < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20171107144122_create_geo_hashed_storage_migrated_events.rb b/ee/db/migrate/20171107144122_create_geo_hashed_storage_migrated_events.rb
index 861bbf0a292c93f7f66c615147d5b9b7ca6994d0..fab992ad4d7c60b69e0e2dfb815a9a396e2a3b00 100644
--- a/ee/db/migrate/20171107144122_create_geo_hashed_storage_migrated_events.rb
+++ b/ee/db/migrate/20171107144122_create_geo_hashed_storage_migrated_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoHashedStorageMigratedEvents < ActiveRecord::Migration
+class CreateGeoHashedStorageMigratedEvents < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20171107144726_add_geo_hashed_storage_migrated_events_foreign_key.rb b/ee/db/migrate/20171107144726_add_geo_hashed_storage_migrated_events_foreign_key.rb
index 48628530a91d8a6f475ed5622fcc5e32c6cd0cb4..843b6d2d43ff13485921416538bcbe1acf357a5f 100644
--- a/ee/db/migrate/20171107144726_add_geo_hashed_storage_migrated_events_foreign_key.rb
+++ b/ee/db/migrate/20171107144726_add_geo_hashed_storage_migrated_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoHashedStorageMigratedEventsForeignKey < ActiveRecord::Migration
+class AddGeoHashedStorageMigratedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171109115718_add_only_mirror_protected_branches_to_projects.rb b/ee/db/migrate/20171109115718_add_only_mirror_protected_branches_to_projects.rb
index c1000b1eada500d0edd6bdb16680b1577ed86beb..faf6611f6c8256690240aef17373ab33e9cc49d4 100644
--- a/ee/db/migrate/20171109115718_add_only_mirror_protected_branches_to_projects.rb
+++ b/ee/db/migrate/20171109115718_add_only_mirror_protected_branches_to_projects.rb
@@ -1,4 +1,4 @@
-class AddOnlyMirrorProtectedBranchesToProjects < ActiveRecord::Migration
+class AddOnlyMirrorProtectedBranchesToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171110152729_add_only_protected_branches_to_remote_mirrors.rb b/ee/db/migrate/20171110152729_add_only_protected_branches_to_remote_mirrors.rb
index db473703f550998b553edc76f67ca98cf56be602..2fd14cd44e8158a60c81f84e4b0f70f73d6f3a54 100644
--- a/ee/db/migrate/20171110152729_add_only_protected_branches_to_remote_mirrors.rb
+++ b/ee/db/migrate/20171110152729_add_only_protected_branches_to_remote_mirrors.rb
@@ -1,4 +1,4 @@
-class AddOnlyProtectedBranchesToRemoteMirrors < ActiveRecord::Migration
+class AddOnlyProtectedBranchesToRemoteMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171120143816_create_geo_lfs_object_deleted_events.rb b/ee/db/migrate/20171120143816_create_geo_lfs_object_deleted_events.rb
index c43515398f335799358e75d59adb844f1b74a9d6..346426e939b3b926cf49cac435234107d145d792 100644
--- a/ee/db/migrate/20171120143816_create_geo_lfs_object_deleted_events.rb
+++ b/ee/db/migrate/20171120143816_create_geo_lfs_object_deleted_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoLfsObjectDeletedEvents < ActiveRecord::Migration
+class CreateGeoLfsObjectDeletedEvents < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20171120145444_add_geo_lfs_object_deleted_events_foreign_key.rb b/ee/db/migrate/20171120145444_add_geo_lfs_object_deleted_events_foreign_key.rb
index c3c5a2cd24d641ccc89aa9324ed6b69dc95aaa55..85e048052134be31ec8f88d3012d1343011507d5 100644
--- a/ee/db/migrate/20171120145444_add_geo_lfs_object_deleted_events_foreign_key.rb
+++ b/ee/db/migrate/20171120145444_add_geo_lfs_object_deleted_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoLfsObjectDeletedEventsForeignKey < ActiveRecord::Migration
+class AddGeoLfsObjectDeletedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171124070437_add_attachments_migration_to_geo_migration_events.rb b/ee/db/migrate/20171124070437_add_attachments_migration_to_geo_migration_events.rb
index 55ae9905c1a35f12409d65e4e953b0fc02fd4505..0ef2e285d2b4f4316280a26d0b89a4dff73e18ca 100644
--- a/ee/db/migrate/20171124070437_add_attachments_migration_to_geo_migration_events.rb
+++ b/ee/db/migrate/20171124070437_add_attachments_migration_to_geo_migration_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddAttachmentsMigrationToGeoMigrationEvents < ActiveRecord::Migration
+class AddAttachmentsMigrationToGeoMigrationEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171124164248_store_geo_nodes_url_directly.rb b/ee/db/migrate/20171124164248_store_geo_nodes_url_directly.rb
index 5a54c3e360a1d7c7c2b72b7939dc05b15657d4e6..90b91269a24795d962b41efc5cf640be095ab790 100644
--- a/ee/db/migrate/20171124164248_store_geo_nodes_url_directly.rb
+++ b/ee/db/migrate/20171124164248_store_geo_nodes_url_directly.rb
@@ -1,4 +1,4 @@
-class StoreGeoNodesUrlDirectly < ActiveRecord::Migration
+class StoreGeoNodesUrlDirectly < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171124164249_index_geo_nodes_url.rb b/ee/db/migrate/20171124164249_index_geo_nodes_url.rb
index 756f7b7e6df9c6bba54cda3eb68b0e3b83027bb2..c971bb8368ba6012bc1dee27751b5b1762f430f7 100644
--- a/ee/db/migrate/20171124164249_index_geo_nodes_url.rb
+++ b/ee/db/migrate/20171124164249_index_geo_nodes_url.rb
@@ -1,4 +1,4 @@
-class IndexGeoNodesUrl < ActiveRecord::Migration
+class IndexGeoNodesUrl < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171129150921_rename_remote_mirror_available_to_mirror_available.rb b/ee/db/migrate/20171129150921_rename_remote_mirror_available_to_mirror_available.rb
index 178d8a424cfb668abf6a2541e44eba6b38d3aa6f..bf18190b81227a6433982d1482a71427e5d04357 100644
--- a/ee/db/migrate/20171129150921_rename_remote_mirror_available_to_mirror_available.rb
+++ b/ee/db/migrate/20171129150921_rename_remote_mirror_available_to_mirror_available.rb
@@ -1,4 +1,4 @@
-class RenameRemoteMirrorAvailableToMirrorAvailable < ActiveRecord::Migration
+class RenameRemoteMirrorAvailableToMirrorAvailable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171129152659_add_pull_mirror_available_overridden_to_projects.rb b/ee/db/migrate/20171129152659_add_pull_mirror_available_overridden_to_projects.rb
index 29b7c520005b4a08c931c977864cbc82e729ccbf..fa43f89aac82a4ce76c128d018933bd076d81135 100644
--- a/ee/db/migrate/20171129152659_add_pull_mirror_available_overridden_to_projects.rb
+++ b/ee/db/migrate/20171129152659_add_pull_mirror_available_overridden_to_projects.rb
@@ -1,4 +1,4 @@
-class AddPullMirrorAvailableOverriddenToProjects < ActiveRecord::Migration
+class AddPullMirrorAvailableOverriddenToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171130151759_create_geo_upload_deleted_events.rb b/ee/db/migrate/20171130151759_create_geo_upload_deleted_events.rb
index ad859e063f36d2607996558b07a0adceb95c4986..dce59beace975623ba6d767b0218e839e7f4e39e 100644
--- a/ee/db/migrate/20171130151759_create_geo_upload_deleted_events.rb
+++ b/ee/db/migrate/20171130151759_create_geo_upload_deleted_events.rb
@@ -1,4 +1,4 @@
-class CreateGeoUploadDeletedEvents < ActiveRecord::Migration
+class CreateGeoUploadDeletedEvents < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20171130152602_add_geo_upload_deleted_events_foreign_key.rb b/ee/db/migrate/20171130152602_add_geo_upload_deleted_events_foreign_key.rb
index c9701033fc3d045ada9ff50a99ffef19120d2bfa..8dd4097c4d8573c82ad5ab78fe0fcee9a5981cdd 100644
--- a/ee/db/migrate/20171130152602_add_geo_upload_deleted_events_foreign_key.rb
+++ b/ee/db/migrate/20171130152602_add_geo_upload_deleted_events_foreign_key.rb
@@ -1,4 +1,4 @@
-class AddGeoUploadDeletedEventsForeignKey < ActiveRecord::Migration
+class AddGeoUploadDeletedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171204112945_add_geo_replication_slot_status.rb b/ee/db/migrate/20171204112945_add_geo_replication_slot_status.rb
index e5e9331d6891031661cbd1fd947366365f2c753b..a210fb74e8c13b84a82d02e8cf43b88957dc9339 100644
--- a/ee/db/migrate/20171204112945_add_geo_replication_slot_status.rb
+++ b/ee/db/migrate/20171204112945_add_geo_replication_slot_status.rb
@@ -1,4 +1,4 @@
-class AddGeoReplicationSlotStatus < ActiveRecord::Migration
+class AddGeoReplicationSlotStatus < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20171207105719_add_wiki_info_to_geo_node_statuses.rb b/ee/db/migrate/20171207105719_add_wiki_info_to_geo_node_statuses.rb
index aa5e73676538cb6766086b0e9ff23f9e7d062594..17a14cd68403e44f5b87894c0a56964d4b6a343f 100644
--- a/ee/db/migrate/20171207105719_add_wiki_info_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20171207105719_add_wiki_info_to_geo_node_statuses.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddWikiInfoToGeoNodeStatuses < ActiveRecord::Migration
+class AddWikiInfoToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20171211131502_add_external_classification_authorization_settings_to_appliction_settings.rb b/ee/db/migrate/20171211131502_add_external_classification_authorization_settings_to_appliction_settings.rb
index 66e1a35f763dd11fa21e202dcb99019e14473913..a7dec8732fb8b1091f07ab633b9cef80a15be26e 100644
--- a/ee/db/migrate/20171211131502_add_external_classification_authorization_settings_to_appliction_settings.rb
+++ b/ee/db/migrate/20171211131502_add_external_classification_authorization_settings_to_appliction_settings.rb
@@ -1,4 +1,4 @@
-class AddExternalClassificationAuthorizationSettingsToApplictionSettings < ActiveRecord::Migration
+class AddExternalClassificationAuthorizationSettingsToApplictionSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171214115254_add_position_to_epic_issues.rb b/ee/db/migrate/20171214115254_add_position_to_epic_issues.rb
index 288e8c9227417bdafcb02187e6db18e886b89863..3dc9fdabeeb899648719979c2bf9bd82db252562 100644
--- a/ee/db/migrate/20171214115254_add_position_to_epic_issues.rb
+++ b/ee/db/migrate/20171214115254_add_position_to_epic_issues.rb
@@ -1,4 +1,4 @@
-class AddPositionToEpicIssues < ActiveRecord::Migration
+class AddPositionToEpicIssues < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171218140451_add_external_authorization_service_classification_label_to_projects.rb b/ee/db/migrate/20171218140451_add_external_authorization_service_classification_label_to_projects.rb
index d2910513f4a0cb182d7bd2aaf9591a5c3ba65046..7b83580f02557cc5b5c9491fb4e0724bf4dc55cb 100644
--- a/ee/db/migrate/20171218140451_add_external_authorization_service_classification_label_to_projects.rb
+++ b/ee/db/migrate/20171218140451_add_external_authorization_service_classification_label_to_projects.rb
@@ -1,4 +1,4 @@
-class AddExternalAuthorizationServiceClassificationLabelToProjects < ActiveRecord::Migration
+class AddExternalAuthorizationServiceClassificationLabelToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20171222151344_add_regexp_uses_re2_to_push_rules.rb b/ee/db/migrate/20171222151344_add_regexp_uses_re2_to_push_rules.rb
index ed2804fffc49df726b5b5901ff0f36e287b4572b..81741599e138979e1fbe4c8314f314523390bac9 100644
--- a/ee/db/migrate/20171222151344_add_regexp_uses_re2_to_push_rules.rb
+++ b/ee/db/migrate/20171222151344_add_regexp_uses_re2_to_push_rules.rb
@@ -1,4 +1,4 @@
-class AddRegexpUsesRe2ToPushRules < ActiveRecord::Migration
+class AddRegexpUsesRe2ToPushRules < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180103234731_create_geo_job_artifact_deleted_event.rb b/ee/db/migrate/20180103234731_create_geo_job_artifact_deleted_event.rb
index 01bb1be1a69b9a36d084702b3c0b353993770611..b35f75809dd041dc0b9c5e4c3ffd7fd57094f093 100644
--- a/ee/db/migrate/20180103234731_create_geo_job_artifact_deleted_event.rb
+++ b/ee/db/migrate/20180103234731_create_geo_job_artifact_deleted_event.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateGeoJobArtifactDeletedEvent < ActiveRecord::Migration
+class CreateGeoJobArtifactDeletedEvent < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180104001824_add_geo_job_artifact_deleted_events_foreign_key.rb b/ee/db/migrate/20180104001824_add_geo_job_artifact_deleted_events_foreign_key.rb
index a362ed0beabd1c8b89c6973e770358a27bb6df2a..a7997bd1f70325adeccc68f4378d8133e9e056bc 100644
--- a/ee/db/migrate/20180104001824_add_geo_job_artifact_deleted_events_foreign_key.rb
+++ b/ee/db/migrate/20180104001824_add_geo_job_artifact_deleted_events_foreign_key.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddGeoJobArtifactDeletedEventsForeignKey < ActiveRecord::Migration
+class AddGeoJobArtifactDeletedEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180105233807_add_job_artifact_counts_to_geo_node_statuses.rb b/ee/db/migrate/20180105233807_add_job_artifact_counts_to_geo_node_statuses.rb
index 2c28274e930223254f7c0ff802fcf79530892d8d..e82ea2f1041303075316186d57e208f855323bb2 100644
--- a/ee/db/migrate/20180105233807_add_job_artifact_counts_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20180105233807_add_job_artifact_counts_to_geo_node_statuses.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddJobArtifactCountsToGeoNodeStatuses < ActiveRecord::Migration
+class AddJobArtifactCountsToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180109150457_add_remote_name_to_remote_mirrors.rb b/ee/db/migrate/20180109150457_add_remote_name_to_remote_mirrors.rb
index 2ff17c6063a6b482898a2df511271b129a09ad2c..df645b29c598f40058e2104953fcba2c955d89ea 100644
--- a/ee/db/migrate/20180109150457_add_remote_name_to_remote_mirrors.rb
+++ b/ee/db/migrate/20180109150457_add_remote_name_to_remote_mirrors.rb
@@ -1,4 +1,4 @@
-class AddRemoteNameToRemoteMirrors < ActiveRecord::Migration
+class AddRemoteNameToRemoteMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180115013218_create_saml_providers.rb b/ee/db/migrate/20180115013218_create_saml_providers.rb
index c24e7a6921c2f9c213e90bdde1d70cf372e093a3..569cd3584ed92bdbfcf574588b61914e12401f89 100644
--- a/ee/db/migrate/20180115013218_create_saml_providers.rb
+++ b/ee/db/migrate/20180115013218_create_saml_providers.rb
@@ -1,4 +1,4 @@
-class CreateSamlProviders < ActiveRecord::Migration
+class CreateSamlProviders < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180115094742_add_default_project_creation_setting.rb b/ee/db/migrate/20180115094742_add_default_project_creation_setting.rb
index 7b9c0732b7547140469cb3fa2ce8ae81086268c0..22de39e16727b45846c56976d8d296b709127e2a 100644
--- a/ee/db/migrate/20180115094742_add_default_project_creation_setting.rb
+++ b/ee/db/migrate/20180115094742_add_default_project_creation_setting.rb
@@ -1,4 +1,4 @@
-class AddDefaultProjectCreationSetting < ActiveRecord::Migration
+class AddDefaultProjectCreationSetting < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180115113902_add_project_creation_level_to_groups.rb b/ee/db/migrate/20180115113902_add_project_creation_level_to_groups.rb
index 8c64ce1944c876072a3224309242f329d0ec9c62..5a8a9d2764f66e76666eb21d41c844debd2e4efb 100644
--- a/ee/db/migrate/20180115113902_add_project_creation_level_to_groups.rb
+++ b/ee/db/migrate/20180115113902_add_project_creation_level_to_groups.rb
@@ -1,4 +1,4 @@
-class AddProjectCreationLevelToGroups < ActiveRecord::Migration
+class AddProjectCreationLevelToGroups < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180126165535_geo_selective_sync_by_shard.rb b/ee/db/migrate/20180126165535_geo_selective_sync_by_shard.rb
index 17aa0dcba77ee733f0d233f852567860cf78a827..ae9e38fd9d31327cf7aaf6ad1c9cbd1936c7071e 100644
--- a/ee/db/migrate/20180126165535_geo_selective_sync_by_shard.rb
+++ b/ee/db/migrate/20180126165535_geo_selective_sync_by_shard.rb
@@ -1,4 +1,4 @@
-class GeoSelectiveSyncByShard < ActiveRecord::Migration
+class GeoSelectiveSyncByShard < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180131104538_add_date_indexes_to_epics.rb b/ee/db/migrate/20180131104538_add_date_indexes_to_epics.rb
index 51a14d9c8f6408cc023113b1762eeda979238d2e..0a79fd808a089a615fed300d47479bb2b68ec5d3 100644
--- a/ee/db/migrate/20180131104538_add_date_indexes_to_epics.rb
+++ b/ee/db/migrate/20180131104538_add_date_indexes_to_epics.rb
@@ -1,4 +1,4 @@
-class AddDateIndexesToEpics < ActiveRecord::Migration
+class AddDateIndexesToEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180201101405_change_geo_node_status_column_size.rb b/ee/db/migrate/20180201101405_change_geo_node_status_column_size.rb
index 8cb3270e2597a3afabbaef1262dd7a223a975b53..3a93dbc0f2244f294a4b95a69dcc618f112d2f64 100644
--- a/ee/db/migrate/20180201101405_change_geo_node_status_column_size.rb
+++ b/ee/db/migrate/20180201101405_change_geo_node_status_column_size.rb
@@ -1,4 +1,4 @@
-class ChangeGeoNodeStatusColumnSize < ActiveRecord::Migration
+class ChangeGeoNodeStatusColumnSize < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180201192230_store_version_and_revision_in_geo_node_status.rb b/ee/db/migrate/20180201192230_store_version_and_revision_in_geo_node_status.rb
index 713a3cf0342f70891b140680ae1db302240c15d8..c7fff3838d3310d30067951d9894865184327d95 100644
--- a/ee/db/migrate/20180201192230_store_version_and_revision_in_geo_node_status.rb
+++ b/ee/db/migrate/20180201192230_store_version_and_revision_in_geo_node_status.rb
@@ -1,4 +1,4 @@
-class StoreVersionAndRevisionInGeoNodeStatus < ActiveRecord::Migration
+class StoreVersionAndRevisionInGeoNodeStatus < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180206184810_create_project_repository_states.rb b/ee/db/migrate/20180206184810_create_project_repository_states.rb
index 3a17f9b3ed73f6e5ec5c1f728a93e761202c4140..74c609822f6d8e8747edd046d1b79752ad0c3b6a 100644
--- a/ee/db/migrate/20180206184810_create_project_repository_states.rb
+++ b/ee/db/migrate/20180206184810_create_project_repository_states.rb
@@ -1,4 +1,4 @@
-class CreateProjectRepositoryStates < ActiveRecord::Migration
+class CreateProjectRepositoryStates < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180209115333_create_chatops_tables.rb b/ee/db/migrate/20180209115333_create_chatops_tables.rb
index 0ca05365f1969328b3a4d83e1cb12fa68a9a08a9..ff1325bd60d2bfa73d803779a0af76c4f4a46b5a 100644
--- a/ee/db/migrate/20180209115333_create_chatops_tables.rb
+++ b/ee/db/migrate/20180209115333_create_chatops_tables.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class CreateChatopsTables < ActiveRecord::Migration
+class CreateChatopsTables < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180215143644_add_mirror_overwrites_diverged_branches_to_project.rb b/ee/db/migrate/20180215143644_add_mirror_overwrites_diverged_branches_to_project.rb
index d00d3bc2ff366407cbd6b96090e912016abe88cc..514a5c828bf82fc1eac2f89191d95bb854cb9899 100644
--- a/ee/db/migrate/20180215143644_add_mirror_overwrites_diverged_branches_to_project.rb
+++ b/ee/db/migrate/20180215143644_add_mirror_overwrites_diverged_branches_to_project.rb
@@ -1,4 +1,4 @@
-class AddMirrorOverwritesDivergedBranchesToProject < ActiveRecord::Migration
+class AddMirrorOverwritesDivergedBranchesToProject < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180225180932_add_geo_node_verification_status.rb b/ee/db/migrate/20180225180932_add_geo_node_verification_status.rb
index 986bc90ff508e9f4923de55ea302cd66179782a8..1f9251bc981a1a27ea261dd1b5c31c7aec096c93 100644
--- a/ee/db/migrate/20180225180932_add_geo_node_verification_status.rb
+++ b/ee/db/migrate/20180225180932_add_geo_node_verification_status.rb
@@ -1,4 +1,4 @@
-class AddGeoNodeVerificationStatus < ActiveRecord::Migration
+class AddGeoNodeVerificationStatus < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180302230551_add_external_webhook_token_to_projects.rb b/ee/db/migrate/20180302230551_add_external_webhook_token_to_projects.rb
index 3f2eb7d1360bd7a2f352b5c795d670902252ebb8..9e623336a47992d1cc2e3ba20b61f8825c686fe3 100644
--- a/ee/db/migrate/20180302230551_add_external_webhook_token_to_projects.rb
+++ b/ee/db/migrate/20180302230551_add_external_webhook_token_to_projects.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddExternalWebhookTokenToProjects < ActiveRecord::Migration
+class AddExternalWebhookTokenToProjects < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180307164427_disable_mirroring_for_projects_with_invalid_mirror_users.rb b/ee/db/migrate/20180307164427_disable_mirroring_for_projects_with_invalid_mirror_users.rb
index a00d60277fa329cc90de9eb50e6c968c03667905..adddafcba4bbbd763e3909eefb413be0311bfd53 100644
--- a/ee/db/migrate/20180307164427_disable_mirroring_for_projects_with_invalid_mirror_users.rb
+++ b/ee/db/migrate/20180307164427_disable_mirroring_for_projects_with_invalid_mirror_users.rb
@@ -1,4 +1,4 @@
-class DisableMirroringForProjectsWithInvalidMirrorUsers < ActiveRecord::Migration
+class DisableMirroringForProjectsWithInvalidMirrorUsers < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb b/ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb
index 288212e56e386dfc1b61843a92bf960968d83ba6..782e6f1f7933d70b202f3d69a581536eb5a74ab1 100644
--- a/ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb
+++ b/ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Migration
+class AddPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb b/ee/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb
index fb6dad548a9fa85b11dcb7492818464caf673a28..c3c6aa0ddf8333602f169e7479d1517ccd2d967d 100644
--- a/ee/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb
+++ b/ee/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddExternalAuthorizationServiceTimeoutToApplicationSettings < ActiveRecord::Migration
+class AddExternalAuthorizationServiceTimeoutToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb b/ee/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
index 9505dd76cca9e681530747215128afaf150649bb..e17f76274f8788a9b11778f193f44aa1929da73b 100644
--- a/ee/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
+++ b/ee/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
@@ -1,4 +1,4 @@
-class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration
+class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180314174825_add_partial_index_to_project_repository_states_verification_columns.rb b/ee/db/migrate/20180314174825_add_partial_index_to_project_repository_states_verification_columns.rb
index 7bd151850f6737cc2ef0cc3b1625e8c3816f69e2..bb9ed395ac11ee32b646df0961330b7d2c808655 100644
--- a/ee/db/migrate/20180314174825_add_partial_index_to_project_repository_states_verification_columns.rb
+++ b/ee/db/migrate/20180314174825_add_partial_index_to_project_repository_states_verification_columns.rb
@@ -1,4 +1,4 @@
-class AddPartialIndexToProjectRepositoryStatesVerificationColumns < ActiveRecord::Migration
+class AddPartialIndexToProjectRepositoryStatesVerificationColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb b/ee/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb
index f2fda2f673c03954e824ad38aae605f8251d8224..ee3d1078f5e74a937e8b8f45bd2829b355d72f14 100644
--- a/ee/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb
+++ b/ee/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb
@@ -1,4 +1,4 @@
-class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration
+class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180317020334_add_saml_provider_to_identities.rb b/ee/db/migrate/20180317020334_add_saml_provider_to_identities.rb
index b8aa5e82f0b4e4aa81b03313bca74c5de1c3a471..16e66fc7d6c6d0f718af7026a939487a3d1a0abf 100644
--- a/ee/db/migrate/20180317020334_add_saml_provider_to_identities.rb
+++ b/ee/db/migrate/20180317020334_add_saml_provider_to_identities.rb
@@ -1,4 +1,4 @@
-class AddSamlProviderToIdentities < ActiveRecord::Migration
+class AddSamlProviderToIdentities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180320142552_create_prometheus_alerts.rb b/ee/db/migrate/20180320142552_create_prometheus_alerts.rb
index ca9a7afd6eaed311f7c1a83d303faa5b1c770838..a49a6cc42206acd985fd5e37da2c70a11fb21242 100644
--- a/ee/db/migrate/20180320142552_create_prometheus_alerts.rb
+++ b/ee/db/migrate/20180320142552_create_prometheus_alerts.rb
@@ -1,4 +1,4 @@
-class CreatePrometheusAlerts < ActiveRecord::Migration
+class CreatePrometheusAlerts < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180325034910_create_protected_branch_unprotect_access_levels.rb b/ee/db/migrate/20180325034910_create_protected_branch_unprotect_access_levels.rb
index 7f1b43ac27e1da97353d410dfe384469825bc9af..4b6db0f07e9cf6221b00b9d49efbf9aaa4d190ee 100644
--- a/ee/db/migrate/20180325034910_create_protected_branch_unprotect_access_levels.rb
+++ b/ee/db/migrate/20180325034910_create_protected_branch_unprotect_access_levels.rb
@@ -1,4 +1,4 @@
-class CreateProtectedBranchUnprotectAccessLevels < ActiveRecord::Migration
+class CreateProtectedBranchUnprotectAccessLevels < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180329230151_add_missing_on_primary_counts_to_geo_node_statuses.rb b/ee/db/migrate/20180329230151_add_missing_on_primary_counts_to_geo_node_statuses.rb
index ccda49534166af139f8f1af5716592847c3daf92..c31a253df7f45fb23f6c67d97b0c03d42bc96632 100644
--- a/ee/db/migrate/20180329230151_add_missing_on_primary_counts_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20180329230151_add_missing_on_primary_counts_to_geo_node_statuses.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddMissingOnPrimaryCountsToGeoNodeStatuses < ActiveRecord::Migration
+class AddMissingOnPrimaryCountsToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180401213713_add_email_additional_text_to_application_settings.rb b/ee/db/migrate/20180401213713_add_email_additional_text_to_application_settings.rb
index 56c35983767d1e6931074635dd09f9cdc45edcb0..57bffa28b8e975cbb711d43efe4930ebae07b097 100644
--- a/ee/db/migrate/20180401213713_add_email_additional_text_to_application_settings.rb
+++ b/ee/db/migrate/20180401213713_add_email_additional_text_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddEmailAdditionalTextToApplicationSettings < ActiveRecord::Migration
+class AddEmailAdditionalTextToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180416112831_drop_null_constraint_geo_events_storage_path.rb b/ee/db/migrate/20180416112831_drop_null_constraint_geo_events_storage_path.rb
index 861a83b19a231332094bb40043ef9414afb2fe2e..867527627324b13a86be493f5d69f526e76fb2d0 100644
--- a/ee/db/migrate/20180416112831_drop_null_constraint_geo_events_storage_path.rb
+++ b/ee/db/migrate/20180416112831_drop_null_constraint_geo_events_storage_path.rb
@@ -1,4 +1,4 @@
-class DropNullConstraintGeoEventsStoragePath < ActiveRecord::Migration
+class DropNullConstraintGeoEventsStoragePath < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180416205949_add_checksum_fields_to_geo_node_statuses.rb b/ee/db/migrate/20180416205949_add_checksum_fields_to_geo_node_statuses.rb
index 6160598b1578704387d3a2d6cda7d543f178f98c..65b8a2ee7d96441c307d33ec534b34bc2bd41688 100644
--- a/ee/db/migrate/20180416205949_add_checksum_fields_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20180416205949_add_checksum_fields_to_geo_node_statuses.rb
@@ -1,4 +1,4 @@
-class AddChecksumFieldsToGeoNodeStatuses < ActiveRecord::Migration
+class AddChecksumFieldsToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180419031622_add_index_for_tracking_mirrored_ci_cd_repositories.rb b/ee/db/migrate/20180419031622_add_index_for_tracking_mirrored_ci_cd_repositories.rb
index 9aaa575ee63a58cd3ebc0ab48dafb2a537774cce..a8af0121ce845a88c61c8c2ffcd81bf2de781e69 100644
--- a/ee/db/migrate/20180419031622_add_index_for_tracking_mirrored_ci_cd_repositories.rb
+++ b/ee/db/migrate/20180419031622_add_index_for_tracking_mirrored_ci_cd_repositories.rb
@@ -1,4 +1,4 @@
-class AddIndexForTrackingMirroredCiCdRepositories < ActiveRecord::Migration
+class AddIndexForTrackingMirroredCiCdRepositories < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/ee/db/migrate/20180419171038_create_vulnerability_feedback.rb b/ee/db/migrate/20180419171038_create_vulnerability_feedback.rb
index 288d1b048b659bd4c836c13603713123da9f6801..dc8730d53c4d3580c63508e77e6c538d2ce479a6 100644
--- a/ee/db/migrate/20180419171038_create_vulnerability_feedback.rb
+++ b/ee/db/migrate/20180419171038_create_vulnerability_feedback.rb
@@ -1,4 +1,4 @@
-class CreateVulnerabilityFeedback < ActiveRecord::Migration
+class CreateVulnerabilityFeedback < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180423165301_add_negative_matching_commit_message_push_rule.rb b/ee/db/migrate/20180423165301_add_negative_matching_commit_message_push_rule.rb
index 66f2ec9d7f2913a79904af76524eb02d497a6ecf..119f654c477ca2f148f825a9d0baa2bb96982d4c 100644
--- a/ee/db/migrate/20180423165301_add_negative_matching_commit_message_push_rule.rb
+++ b/ee/db/migrate/20180423165301_add_negative_matching_commit_message_push_rule.rb
@@ -1,4 +1,4 @@
-class AddNegativeMatchingCommitMessagePushRule < ActiveRecord::Migration
+class AddNegativeMatchingCommitMessagePushRule < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb b/ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb
index ef0e725d95fb93aa5be9feece38e0497077e8a83..4f96761d877153e05777f7144c8fa8abba3825d5 100644
--- a/ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb
+++ b/ee/db/migrate/20180502124117_add_missing_columns_to_project_mirror_data.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddMissingColumnsToProjectMirrorData < ActiveRecord::Migration
+class AddMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180502125859_add_saml_provider_index_and_constraint_to_identities.rb b/ee/db/migrate/20180502125859_add_saml_provider_index_and_constraint_to_identities.rb
index f5f2613260735e99703fc828d4c3410622eb2bcc..8b00115a5345903cdeebc1cc7da142b0bb9b3597 100644
--- a/ee/db/migrate/20180502125859_add_saml_provider_index_and_constraint_to_identities.rb
+++ b/ee/db/migrate/20180502125859_add_saml_provider_index_and_constraint_to_identities.rb
@@ -1,4 +1,4 @@
-class AddSamlProviderIndexAndConstraintToIdentities < ActiveRecord::Migration
+class AddSamlProviderIndexAndConstraintToIdentities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee.rb b/ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee.rb
index 70f4aaa5e2846a655e9399c162bfc47d76b89bae..ab5316f13c622547153febc674d272e9e0c46c70 100644
--- a/ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee.rb
+++ b/ee/db/migrate/20180503154922_add_indexes_to_project_mirror_data_ee.rb
@@ -1,4 +1,4 @@
-class AddIndexesToProjectMirrorDataEE < ActiveRecord::Migration
+class AddIndexesToProjectMirrorDataEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180520211048_add_discovery_token_to_namespaces.rb b/ee/db/migrate/20180520211048_add_discovery_token_to_namespaces.rb
index 9cab92f32aa69e8c9d214f0da0eb9b3e66b9e756..8a1c5df68e6615074ffcff49f9f3d0c50b02824c 100644
--- a/ee/db/migrate/20180520211048_add_discovery_token_to_namespaces.rb
+++ b/ee/db/migrate/20180520211048_add_discovery_token_to_namespaces.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddDiscoveryTokenToNamespaces < ActiveRecord::Migration
+class AddDiscoveryTokenToNamespaces < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180524115107_add_last_update_started_at_to_applications_prometheus.rb b/ee/db/migrate/20180524115107_add_last_update_started_at_to_applications_prometheus.rb
index 642fa076ec7b7fe84cf854336476c88ffe1a5488..e55c1ad8ab94c2295198becaf917c0c16aaf02c2 100644
--- a/ee/db/migrate/20180524115107_add_last_update_started_at_to_applications_prometheus.rb
+++ b/ee/db/migrate/20180524115107_add_last_update_started_at_to_applications_prometheus.rb
@@ -1,4 +1,4 @@
-class AddLastUpdateStartedAtToApplicationsPrometheus < ActiveRecord::Migration
+class AddLastUpdateStartedAtToApplicationsPrometheus < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180531031410_add_index_for_active_users.rb b/ee/db/migrate/20180531031410_add_index_for_active_users.rb
index fde042922f7adefae18da1abd503acef2ff385fe..699bb9d407a806caffe53f3c4a79d38761d755d7 100644
--- a/ee/db/migrate/20180531031410_add_index_for_active_users.rb
+++ b/ee/db/migrate/20180531031410_add_index_for_active_users.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddIndexForActiveUsers < ActiveRecord::Migration
+class AddIndexForActiveUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180531221734_add_pseudonymizer_enabled_to_application_settings.rb b/ee/db/migrate/20180531221734_add_pseudonymizer_enabled_to_application_settings.rb
index 7517e78a61873125a7dd7714e417b53e24768e1e..41feb0eedf6a56ebf8e7b2b024253340605338c6 100644
--- a/ee/db/migrate/20180531221734_add_pseudonymizer_enabled_to_application_settings.rb
+++ b/ee/db/migrate/20180531221734_add_pseudonymizer_enabled_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddPseudonymizerEnabledToApplicationSettings < ActiveRecord::Migration
+class AddPseudonymizerEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180607154422_add_user_to_list.rb b/ee/db/migrate/20180607154422_add_user_to_list.rb
index 6fbe3069003f3f5d0b62f116b16ab6f629bea264..266b40f11e2d1fd4f1b52742f7ca6eb9c7ceb952 100644
--- a/ee/db/migrate/20180607154422_add_user_to_list.rb
+++ b/ee/db/migrate/20180607154422_add_user_to_list.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUserToList < ActiveRecord::Migration
+class AddUserToList < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180607154516_add_user_index_to_list.rb b/ee/db/migrate/20180607154516_add_user_index_to_list.rb
index c1a2404cd7ff00ba325344c9a3e634ec92e6fd06..38f9b4a8caf4671e5443a91845ae07165799f171 100644
--- a/ee/db/migrate/20180607154516_add_user_index_to_list.rb
+++ b/ee/db/migrate/20180607154516_add_user_index_to_list.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUserIndexToList < ActiveRecord::Migration
+class AddUserIndexToList < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180607154645_add_user_fk_to_list.rb b/ee/db/migrate/20180607154645_add_user_fk_to_list.rb
index 6b6b0bf3dfb95394d2bc34689ccab734968c2fcf..65227380ea50ebf8b6c0a721d935ab3a3cbdf4c8 100644
--- a/ee/db/migrate/20180607154645_add_user_fk_to_list.rb
+++ b/ee/db/migrate/20180607154645_add_user_fk_to_list.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddUserFkToList < ActiveRecord::Migration
+class AddUserFkToList < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180612175636_add_geo_nodes_verification_max_capacity.rb b/ee/db/migrate/20180612175636_add_geo_nodes_verification_max_capacity.rb
index 123708352518552365c5e4f6ca517081a964bb38..3be4bb847986a8328f652d378a20f2c4d1618f9d 100644
--- a/ee/db/migrate/20180612175636_add_geo_nodes_verification_max_capacity.rb
+++ b/ee/db/migrate/20180612175636_add_geo_nodes_verification_max_capacity.rb
@@ -1,4 +1,4 @@
-class AddGeoNodesVerificationMaxCapacity < ActiveRecord::Migration
+class AddGeoNodesVerificationMaxCapacity < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180615152524_add_project_to_application_settings.rb b/ee/db/migrate/20180615152524_add_project_to_application_settings.rb
index 441f6a4c7fba3de8b14e373c7e6ee72a1401cb23..18dc6f7f12db26b6373e804c9307dc559cbb8e78 100644
--- a/ee/db/migrate/20180615152524_add_project_to_application_settings.rb
+++ b/ee/db/migrate/20180615152524_add_project_to_application_settings.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddProjectToApplicationSettings < ActiveRecord::Migration
+class AddProjectToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180621100024_create_software_licenses.rb b/ee/db/migrate/20180621100024_create_software_licenses.rb
index 3cf348995732045cc71b373684125969932d3042..f7230bb1ac628f29c2d46f4008c7528c5a783572 100644
--- a/ee/db/migrate/20180621100024_create_software_licenses.rb
+++ b/ee/db/migrate/20180621100024_create_software_licenses.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 # A software license. Used in the License Management feature for CI/CD.
-class CreateSoftwareLicenses < ActiveRecord::Migration
+class CreateSoftwareLicenses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180621100025_create_software_license_policies.rb b/ee/db/migrate/20180621100025_create_software_license_policies.rb
index 82165b6f130bf71995fdccd62adb8208432cc032..95dceaa7ef46ca67797d475a7914edecc3f7882b 100644
--- a/ee/db/migrate/20180621100025_create_software_license_policies.rb
+++ b/ee/db/migrate/20180621100025_create_software_license_policies.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateSoftwareLicensePolicies < ActiveRecord::Migration
+class CreateSoftwareLicensePolicies < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180623053658_add_trial_ends_on_to_namespaces.rb b/ee/db/migrate/20180623053658_add_trial_ends_on_to_namespaces.rb
index 6ee6b7a67e991e6ebcea037c1db92be8a605c0bf..3ef0829ed45160b4531e5fbeebe7155219021e57 100644
--- a/ee/db/migrate/20180623053658_add_trial_ends_on_to_namespaces.rb
+++ b/ee/db/migrate/20180623053658_add_trial_ends_on_to_namespaces.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddTrialEndsOnToNamespaces < ActiveRecord::Migration
+class AddTrialEndsOnToNamespaces < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180626171125_add_feature_flags_to_projects.rb b/ee/db/migrate/20180626171125_add_feature_flags_to_projects.rb
index c2ade6cc41311743119e478cf3ee1c9d160f9df9..bbdb7dcb245fb83e4a08e081ec6f9d987f621195 100644
--- a/ee/db/migrate/20180626171125_add_feature_flags_to_projects.rb
+++ b/ee/db/migrate/20180626171125_add_feature_flags_to_projects.rb
@@ -1,4 +1,4 @@
-class AddFeatureFlagsToProjects < ActiveRecord::Migration
+class AddFeatureFlagsToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/migrate/20180702114215_schedule_weight_system_note_comma_cleanup.rb b/ee/db/migrate/20180702114215_schedule_weight_system_note_comma_cleanup.rb
index 0c738fc315d0ddcadc283470c1ba3257f3e07201..2cf94d524f2c629e46e87b3b0f4a3ca5927681ba 100644
--- a/ee/db/migrate/20180702114215_schedule_weight_system_note_comma_cleanup.rb
+++ b/ee/db/migrate/20180702114215_schedule_weight_system_note_comma_cleanup.rb
@@ -1,4 +1,4 @@
-class ScheduleWeightSystemNoteCommaCleanup < ActiveRecord::Migration
+class ScheduleWeightSystemNoteCommaCleanup < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180702181530_add_retry_fields_to_project_repository_states.rb b/ee/db/migrate/20180702181530_add_retry_fields_to_project_repository_states.rb
index 8a3de5bafd74a1718fa559b1177c9e1e49cad592..fbdd3915129d289a1cdbfa6c44e7bf808235dd1c 100644
--- a/ee/db/migrate/20180702181530_add_retry_fields_to_project_repository_states.rb
+++ b/ee/db/migrate/20180702181530_add_retry_fields_to_project_repository_states.rb
@@ -1,4 +1,4 @@
-class AddRetryFieldsToProjectRepositoryStates < ActiveRecord::Migration
+class AddRetryFieldsToProjectRepositoryStates < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180709153607_add_custom_project_templates_group_id_to_application_settings.rb b/ee/db/migrate/20180709153607_add_custom_project_templates_group_id_to_application_settings.rb
index a0d249ae66f463f14f0d8252c27bd722f11e55b6..771033b55f9820d87eebb0a9bdad514900738e7f 100644
--- a/ee/db/migrate/20180709153607_add_custom_project_templates_group_id_to_application_settings.rb
+++ b/ee/db/migrate/20180709153607_add_custom_project_templates_group_id_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddCustomProjectTemplatesGroupIdToApplicationSettings < ActiveRecord::Migration
+class AddCustomProjectTemplatesGroupIdToApplicationSettings < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180709183353_add_protected_environments_table.rb b/ee/db/migrate/20180709183353_add_protected_environments_table.rb
index 163a34d58c3c453eabe0b839405d4f186a84573a..d2880e9fc9c146f1c104e75131c8ea3ab6a328bd 100644
--- a/ee/db/migrate/20180709183353_add_protected_environments_table.rb
+++ b/ee/db/migrate/20180709183353_add_protected_environments_table.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddProtectedEnvironmentsTable < ActiveRecord::Migration
+class AddProtectedEnvironmentsTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180709184533_add_protected_environment_deploy_access_level_table.rb b/ee/db/migrate/20180709184533_add_protected_environment_deploy_access_level_table.rb
index 3acd4a1579aa10e3a6f2e0c62d99b9282df59094..97639b00976540d090e98e6c5f282db303f2ad54 100644
--- a/ee/db/migrate/20180709184533_add_protected_environment_deploy_access_level_table.rb
+++ b/ee/db/migrate/20180709184533_add_protected_environment_deploy_access_level_table.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddProtectedEnvironmentDeployAccessLevelTable < ActiveRecord::Migration
+class AddProtectedEnvironmentDeployAccessLevelTable < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180711014025_add_date_columns_to_epics.rb b/ee/db/migrate/20180711014025_add_date_columns_to_epics.rb
index ae4e0ac31606cbb6c1031fd5eb4565800fe7265c..e50bed7dddfc8d8a69983100f80ce92f2de08443 100644
--- a/ee/db/migrate/20180711014025_add_date_columns_to_epics.rb
+++ b/ee/db/migrate/20180711014025_add_date_columns_to_epics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddDateColumnsToEpics < ActiveRecord::Migration
+class AddDateColumnsToEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180711014026_update_date_columns_on_epics.rb b/ee/db/migrate/20180711014026_update_date_columns_on_epics.rb
index c39531940c13807726e2f5682227bf21f7f415f3..ba0b13f193d88bb555309846724b7bbdefe5b237 100644
--- a/ee/db/migrate/20180711014026_update_date_columns_on_epics.rb
+++ b/ee/db/migrate/20180711014026_update_date_columns_on_epics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class UpdateDateColumnsOnEpics < ActiveRecord::Migration
+class UpdateDateColumnsOnEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180718100455_clean_up_from_weight_system_note_comma_migration.rb b/ee/db/migrate/20180718100455_clean_up_from_weight_system_note_comma_migration.rb
index 8a8ff62ef13970eba72080ef64bb36de16226a1e..715a8ebd4901eae6dce0d15ce97068a9c47bde72 100644
--- a/ee/db/migrate/20180718100455_clean_up_from_weight_system_note_comma_migration.rb
+++ b/ee/db/migrate/20180718100455_clean_up_from_weight_system_note_comma_migration.rb
@@ -1,4 +1,4 @@
-class CleanUpFromWeightSystemNoteCommaMigration < ActiveRecord::Migration
+class CleanUpFromWeightSystemNoteCommaMigration < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180719161844_add_storage_configuration_digest.rb b/ee/db/migrate/20180719161844_add_storage_configuration_digest.rb
index c6cc1b30fd3e06b3aa72ab440b2f37159ef4ab8a..801907cea99146a54475f39f87e3a946c1734769 100644
--- a/ee/db/migrate/20180719161844_add_storage_configuration_digest.rb
+++ b/ee/db/migrate/20180719161844_add_storage_configuration_digest.rb
@@ -1,4 +1,4 @@
-class AddStorageConfigurationDigest < ActiveRecord::Migration
+class AddStorageConfigurationDigest < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180720082636_add_name_index_to_ci_builds.rb b/ee/db/migrate/20180720082636_add_name_index_to_ci_builds.rb
index 5d8f692ef272105472f81ecdae708b554a2b38aa..d0343dd3e9a1c0264846599c84b06d2d892dd372 100644
--- a/ee/db/migrate/20180720082636_add_name_index_to_ci_builds.rb
+++ b/ee/db/migrate/20180720082636_add_name_index_to_ci_builds.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddNameIndexToCiBuilds < ActiveRecord::Migration
+class AddNameIndexToCiBuilds < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180720120716_create_packages_packages.rb b/ee/db/migrate/20180720120716_create_packages_packages.rb
index 847e5f86a249f7ab843fd8dc8aa18929195aafb2..351a6a4015a56676d57fe3667e3456ec21432485 100644
--- a/ee/db/migrate/20180720120716_create_packages_packages.rb
+++ b/ee/db/migrate/20180720120716_create_packages_packages.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class CreatePackagesPackages < ActiveRecord::Migration
+class CreatePackagesPackages < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180720120726_create_packages_package_files.rb b/ee/db/migrate/20180720120726_create_packages_package_files.rb
index 307646a0ce258399b9ae1a5bf1cd14f94db92031..b5c0ebc5cc3768830d3d73d1afd7656ca7a37240 100644
--- a/ee/db/migrate/20180720120726_create_packages_package_files.rb
+++ b/ee/db/migrate/20180720120726_create_packages_package_files.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class CreatePackagesPackageFiles < ActiveRecord::Migration
+class CreatePackagesPackageFiles < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180720121404_create_packages_maven_metadata.rb b/ee/db/migrate/20180720121404_create_packages_maven_metadata.rb
index f41d02bb65ff24154978385fd4fb8ec91eb4b8df..36b1614aa17872f15b375df87125b7930305b9a6 100644
--- a/ee/db/migrate/20180720121404_create_packages_maven_metadata.rb
+++ b/ee/db/migrate/20180720121404_create_packages_maven_metadata.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class CreatePackagesMavenMetadata < ActiveRecord::Migration
+class CreatePackagesMavenMetadata < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180723023517_add_new_epic_to_notification_settings.rb b/ee/db/migrate/20180723023517_add_new_epic_to_notification_settings.rb
index 93933c0c5856e7094ebbff0917a8043f3359da16..946a3a29831bbedc4366ad01a720a8e23224b9d6 100644
--- a/ee/db/migrate/20180723023517_add_new_epic_to_notification_settings.rb
+++ b/ee/db/migrate/20180723023517_add_new_epic_to_notification_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddNewEpicToNotificationSettings < ActiveRecord::Migration
+class AddNewEpicToNotificationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180723081631_add_roadmap_layout_to_users.rb b/ee/db/migrate/20180723081631_add_roadmap_layout_to_users.rb
index 3a01379ea70e15ac54f256feb1943c752dfb3609..1da2ff2d1f1e0c69919dfeb4410bd7587f65ad80 100644
--- a/ee/db/migrate/20180723081631_add_roadmap_layout_to_users.rb
+++ b/ee/db/migrate/20180723081631_add_roadmap_layout_to_users.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddRoadmapLayoutToUsers < ActiveRecord::Migration
+class AddRoadmapLayoutToUsers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180723134433_add_basic_snowplow_attributes_to_application_settings.rb b/ee/db/migrate/20180723134433_add_basic_snowplow_attributes_to_application_settings.rb
index 9bf3543216e0156fc4d505b4440b77ab60cb4cd9..d85ec45a71d42a75e7445e7655cc9c3212e6c885 100644
--- a/ee/db/migrate/20180723134433_add_basic_snowplow_attributes_to_application_settings.rb
+++ b/ee/db/migrate/20180723134433_add_basic_snowplow_attributes_to_application_settings.rb
@@ -1,4 +1,4 @@
-class AddBasicSnowplowAttributesToApplicationSettings < ActiveRecord::Migration
+class AddBasicSnowplowAttributesToApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180724161450_add_milestone_to_lists.rb b/ee/db/migrate/20180724161450_add_milestone_to_lists.rb
index 54d077ea57b87fbdf15f53e413e88a4572537f76..b858504ab727215266106efb51625d2ef4585ea1 100644
--- a/ee/db/migrate/20180724161450_add_milestone_to_lists.rb
+++ b/ee/db/migrate/20180724161450_add_milestone_to_lists.rb
@@ -1,4 +1,4 @@
-class AddMilestoneToLists < ActiveRecord::Migration
+class AddMilestoneToLists < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180803001726_add_verification_retry_counts_to_geo_node_statuses.rb b/ee/db/migrate/20180803001726_add_verification_retry_counts_to_geo_node_statuses.rb
index fc91cd55a803d555a0e0bfef9eef41256caccbc6..0203e45ceff985e4b87303265692b8f6e8a6fc67 100644
--- a/ee/db/migrate/20180803001726_add_verification_retry_counts_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20180803001726_add_verification_retry_counts_to_geo_node_statuses.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddVerificationRetryCountsToGeoNodeStatuses < ActiveRecord::Migration
+class AddVerificationRetryCountsToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/migrate/20180803041220_add_projects_count_to_geo_node_statuses.rb b/ee/db/migrate/20180803041220_add_projects_count_to_geo_node_statuses.rb
index e50ef56f5c0b8578fe036a90e902cc24c136c9f9..29567016b9a0e7f553da45d0c23a53094839afbb 100644
--- a/ee/db/migrate/20180803041220_add_projects_count_to_geo_node_statuses.rb
+++ b/ee/db/migrate/20180803041220_add_projects_count_to_geo_node_statuses.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class AddProjectsCountToGeoNodeStatuses < ActiveRecord::Migration
+class AddProjectsCountToGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180806145747_add_index_to_environment_name_for_like.rb b/ee/db/migrate/20180806145747_add_index_to_environment_name_for_like.rb
index 91e4ac8c52bcdbab3f76d7c2a9f3b33edfdd6aeb..776286100ab7da009444d4504e3805d87b51db12 100644
--- a/ee/db/migrate/20180806145747_add_index_to_environment_name_for_like.rb
+++ b/ee/db/migrate/20180806145747_add_index_to_environment_name_for_like.rb
@@ -1,4 +1,4 @@
-class AddIndexToEnvironmentNameForLike < ActiveRecord::Migration
+class AddIndexToEnvironmentNameForLike < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb b/ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb
index 4312b5aa3b400e43fcf9a4d87bbfdf0b79ea5afa..084cb9f19a42dbe12e3986a6059e9bd805892758 100644
--- a/ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb
+++ b/ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddPackagesEnabledToProject < ActiveRecord::Migration
+class AddPackagesEnabledToProject < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180831134049_allow_many_prometheus_alerts.rb b/ee/db/migrate/20180831134049_allow_many_prometheus_alerts.rb
index 5b9d19827ee28684b9a67579949d4e7401dc9c68..b3c952827dc28dfaa8a83334b67ff48f053d8377 100644
--- a/ee/db/migrate/20180831134049_allow_many_prometheus_alerts.rb
+++ b/ee/db/migrate/20180831134049_allow_many_prometheus_alerts.rb
@@ -1,4 +1,4 @@
-class AllowManyPrometheusAlerts < ActiveRecord::Migration
+class AllowManyPrometheusAlerts < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180831152625_add_merge_requests_author_approval_to_projects.rb b/ee/db/migrate/20180831152625_add_merge_requests_author_approval_to_projects.rb
index 40c245be2642e1b2300a8ed8459739e3ca808599..8fef233dd27caf5c7710d44cdbb6220b83250da4 100644
--- a/ee/db/migrate/20180831152625_add_merge_requests_author_approval_to_projects.rb
+++ b/ee/db/migrate/20180831152625_add_merge_requests_author_approval_to_projects.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddMergeRequestsAuthorApprovalToProjects < ActiveRecord::Migration
+class AddMergeRequestsAuthorApprovalToProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180910104020_add_closed_columns_to_epic.rb b/ee/db/migrate/20180910104020_add_closed_columns_to_epic.rb
index a335831bd2421117c006292302da9a935228401c..2ad306b24521586a3c9160e603c37987541f7257 100644
--- a/ee/db/migrate/20180910104020_add_closed_columns_to_epic.rb
+++ b/ee/db/migrate/20180910104020_add_closed_columns_to_epic.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddClosedColumnsToEpic < ActiveRecord::Migration
+class AddClosedColumnsToEpic < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180910105100_add_state_to_epic.rb b/ee/db/migrate/20180910105100_add_state_to_epic.rb
index 4515c7bcb2b17bdc89bf11c0cbdc1e107890c237..f8311853a2967c26f177fdd5256a0dbd541f1159 100644
--- a/ee/db/migrate/20180910105100_add_state_to_epic.rb
+++ b/ee/db/migrate/20180910105100_add_state_to_epic.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class AddStateToEpic < ActiveRecord::Migration
+class AddStateToEpic < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917145556_create_draft_notes.rb b/ee/db/migrate/20180917145556_create_draft_notes.rb
index 66ba767b53c876c0d26dd3e1051a5a3c6d559acb..38dae0fd94c16e0bbd1edd592e0b5db79e019ad7 100644
--- a/ee/db/migrate/20180917145556_create_draft_notes.rb
+++ b/ee/db/migrate/20180917145556_create_draft_notes.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
-class CreateDraftNotes < ActiveRecord::Migration
+class CreateDraftNotes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917171038_create_vulnerability_scanners.rb b/ee/db/migrate/20180917171038_create_vulnerability_scanners.rb
index fdf057f0c8a527698d3aa1df9c2146c3756d468d..070839791a024750c70a2960a8b01818d806e3b4 100644
--- a/ee/db/migrate/20180917171038_create_vulnerability_scanners.rb
+++ b/ee/db/migrate/20180917171038_create_vulnerability_scanners.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateVulnerabilityScanners < ActiveRecord::Migration
+class CreateVulnerabilityScanners < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917171533_create_vulnerability_occurrences.rb b/ee/db/migrate/20180917171533_create_vulnerability_occurrences.rb
index 23e4b36ba0719602f081f2379e76b562be3435fa..01074083db34881ea3e1ccb730cb52607bdbfd5d 100644
--- a/ee/db/migrate/20180917171533_create_vulnerability_occurrences.rb
+++ b/ee/db/migrate/20180917171533_create_vulnerability_occurrences.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateVulnerabilityOccurrences < ActiveRecord::Migration
+class CreateVulnerabilityOccurrences < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917171534_create_vulnerability_identifiers.rb b/ee/db/migrate/20180917171534_create_vulnerability_identifiers.rb
index 0321a332bbfcfeacbb0e259096d8950a3950d630..3c77d79b9edb356536d7e0195a4b2e9940fdf290 100644
--- a/ee/db/migrate/20180917171534_create_vulnerability_identifiers.rb
+++ b/ee/db/migrate/20180917171534_create_vulnerability_identifiers.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateVulnerabilityIdentifiers < ActiveRecord::Migration
+class CreateVulnerabilityIdentifiers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917171535_create_vulnerability_occurrence_identifiers.rb b/ee/db/migrate/20180917171535_create_vulnerability_occurrence_identifiers.rb
index 0d1388fc91d45516ed542e6ec5cdbc0a8b4f6ebf..4bb9e7dac34cc7e04b3399f4efe8dab1c4ecc4cb 100644
--- a/ee/db/migrate/20180917171535_create_vulnerability_occurrence_identifiers.rb
+++ b/ee/db/migrate/20180917171535_create_vulnerability_occurrence_identifiers.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateVulnerabilityOccurrenceIdentifiers < ActiveRecord::Migration
+class CreateVulnerabilityOccurrenceIdentifiers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917213751_create_geo_reset_checksum_events.rb b/ee/db/migrate/20180917213751_create_geo_reset_checksum_events.rb
index 59b11a3886bf25e1cdcdde038d7592ec07d483bd..2a47afc8619a564c9cafc3d51a85ae9a725854e2 100644
--- a/ee/db/migrate/20180917213751_create_geo_reset_checksum_events.rb
+++ b/ee/db/migrate/20180917213751_create_geo_reset_checksum_events.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateGeoResetChecksumEvents < ActiveRecord::Migration
+class CreateGeoResetChecksumEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180917214204_add_geo_reset_checksum_events_foreign_key.rb b/ee/db/migrate/20180917214204_add_geo_reset_checksum_events_foreign_key.rb
index 7c92cf2d62645c87d421fb29ca1988debdd6f2a3..70f8480cefb1dc20c74e3c2ab89c64224d100c95 100644
--- a/ee/db/migrate/20180917214204_add_geo_reset_checksum_events_foreign_key.rb
+++ b/ee/db/migrate/20180917214204_add_geo_reset_checksum_events_foreign_key.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddGeoResetChecksumEventsForeignKey < ActiveRecord::Migration
+class AddGeoResetChecksumEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180920043317_add_foreign_key_to_epics.rb b/ee/db/migrate/20180920043317_add_foreign_key_to_epics.rb
index fb59418d3696d2fff59062d2be999bd8cff827e9..efa6545b8bcd4e30dcbe1089b41a3fcf0e895208 100644
--- a/ee/db/migrate/20180920043317_add_foreign_key_to_epics.rb
+++ b/ee/db/migrate/20180920043317_add_foreign_key_to_epics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddForeignKeyToEpics < ActiveRecord::Migration
+class AddForeignKeyToEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180924070647_add_label_event_epic_column.rb b/ee/db/migrate/20180924070647_add_label_event_epic_column.rb
index a2bc6b8447d73f8a3b21689a161f6b734c340e8c..58fb56f92266c3e39721f7a63efb8e7a572c2cc7 100644
--- a/ee/db/migrate/20180924070647_add_label_event_epic_column.rb
+++ b/ee/db/migrate/20180924070647_add_label_event_epic_column.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddLabelEventEpicColumn < ActiveRecord::Migration
+class AddLabelEventEpicColumn < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/migrate/20180926101838_add_namespace_file_template_project_id.rb b/ee/db/migrate/20180926101838_add_namespace_file_template_project_id.rb
index 0070bb2cdb06a965cfbd8c53f2cc7fe056b6ab76..222bb1019bbefd213ecd8ae97294025beeec0dd2 100644
--- a/ee/db/migrate/20180926101838_add_namespace_file_template_project_id.rb
+++ b/ee/db/migrate/20180926101838_add_namespace_file_template_project_id.rb
@@ -1,4 +1,4 @@
-class AddNamespaceFileTemplateProjectId < ActiveRecord::Migration
+class AddNamespaceFileTemplateProjectId < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180926140319_create_prometheus_alert_events.rb b/ee/db/migrate/20180926140319_create_prometheus_alert_events.rb
index 893ef73ed011e03d6ce9b575f05dbc379fc42fbc..c6dc366833e74de38be5da813179c1cebfbec252 100644
--- a/ee/db/migrate/20180926140319_create_prometheus_alert_events.rb
+++ b/ee/db/migrate/20180926140319_create_prometheus_alert_events.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreatePrometheusAlertEvents < ActiveRecord::Migration
+class CreatePrometheusAlertEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20180930171532_recreate_vulnerability_occurrences_and_vulnerability_occurrence_identifiers.rb b/ee/db/migrate/20180930171532_recreate_vulnerability_occurrences_and_vulnerability_occurrence_identifiers.rb
index 35cf206ac45ed75e7c1c150a1f142855bea41956..c47eb386a37bb5a0b9e627a280ab7fdd7c955efc 100644
--- a/ee/db/migrate/20180930171532_recreate_vulnerability_occurrences_and_vulnerability_occurrence_identifiers.rb
+++ b/ee/db/migrate/20180930171532_recreate_vulnerability_occurrences_and_vulnerability_occurrence_identifiers.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class RecreateVulnerabilityOccurrencesAndVulnerabilityOccurrenceIdentifiers < ActiveRecord::Migration
+class RecreateVulnerabilityOccurrencesAndVulnerabilityOccurrenceIdentifiers < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181001172126_create_geo_cache_invalidation_events.rb b/ee/db/migrate/20181001172126_create_geo_cache_invalidation_events.rb
index 4bd5d36fb951d3b8ddc91c82d9a75605257b5024..5d395a24072869b81bcea9a2918258be95fe61ca 100644
--- a/ee/db/migrate/20181001172126_create_geo_cache_invalidation_events.rb
+++ b/ee/db/migrate/20181001172126_create_geo_cache_invalidation_events.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateGeoCacheInvalidationEvents < ActiveRecord::Migration
+class CreateGeoCacheInvalidationEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181001172651_add_geo_cache_invalidation_events_foreign_key.rb b/ee/db/migrate/20181001172651_add_geo_cache_invalidation_events_foreign_key.rb
index 9b131f642722d2f6bc1db7450b1a139bfcb7d0fb..59264ab42fce30590552b5ec5dfd2636af631867 100644
--- a/ee/db/migrate/20181001172651_add_geo_cache_invalidation_events_foreign_key.rb
+++ b/ee/db/migrate/20181001172651_add_geo_cache_invalidation_events_foreign_key.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddGeoCacheInvalidationEventsForeignKey < ActiveRecord::Migration
+class AddGeoCacheInvalidationEventsForeignKey < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181004131020_change_vuln_occurrence_columns.rb b/ee/db/migrate/20181004131020_change_vuln_occurrence_columns.rb
index 8362ac45e9a9648ef39c70d2fe8d7192edfbbccb..e5e66754271389784d70d239181385b3e5b50c96 100644
--- a/ee/db/migrate/20181004131020_change_vuln_occurrence_columns.rb
+++ b/ee/db/migrate/20181004131020_change_vuln_occurrence_columns.rb
@@ -1,4 +1,4 @@
-class ChangeVulnOccurrenceColumns < ActiveRecord::Migration
+class ChangeVulnOccurrenceColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181004131025_add_vuln_occurrence_pipelines.rb b/ee/db/migrate/20181004131025_add_vuln_occurrence_pipelines.rb
index 6227c7fadffbb7cb487e0c56f584018048d170ee..c59f566119b1c969db970bfcb3d779da01594961 100644
--- a/ee/db/migrate/20181004131025_add_vuln_occurrence_pipelines.rb
+++ b/ee/db/migrate/20181004131025_add_vuln_occurrence_pipelines.rb
@@ -1,4 +1,4 @@
-class AddVulnOccurrencePipelines < ActiveRecord::Migration
+class AddVulnOccurrencePipelines < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181012151642_create_users_ops_dashboard_projects.rb b/ee/db/migrate/20181012151642_create_users_ops_dashboard_projects.rb
index 55518ace6662e125c3437d330ccf8e62286697c4..a9906dd8658f8d1fde30bae7c1f051a34e3b962d 100644
--- a/ee/db/migrate/20181012151642_create_users_ops_dashboard_projects.rb
+++ b/ee/db/migrate/20181012151642_create_users_ops_dashboard_projects.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateUsersOpsDashboardProjects < ActiveRecord::Migration
+class CreateUsersOpsDashboardProjects < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb b/ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb
index 55fb2ac5f5a105b4458ff771049c1faa8d64952c..304bc8af65a1055901187e7c6ca16994e88eef67 100644
--- a/ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb
+++ b/ee/db/migrate/20181017131623_add_missing_geo_even_log_indexes.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddMissingGeoEvenLogIndexes < ActiveRecord::Migration
+class AddMissingGeoEvenLogIndexes < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181022131445_add_index_to_namespace_trial_ends_on.rb b/ee/db/migrate/20181022131445_add_index_to_namespace_trial_ends_on.rb
index c70c3820e924cf7540f3d89f30fafb4244fd8ffc..a93e0ed8b730643a72a4ea2eb12585d2492a3f97 100644
--- a/ee/db/migrate/20181022131445_add_index_to_namespace_trial_ends_on.rb
+++ b/ee/db/migrate/20181022131445_add_index_to_namespace_trial_ends_on.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToNamespaceTrialEndsOn < ActiveRecord::Migration
+class AddIndexToNamespaceTrialEndsOn < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181025000427_add_tracing_settings.rb b/ee/db/migrate/20181025000427_add_tracing_settings.rb
index 3cafbef75b85edf0662d5da9003ad6898de7ccf9..552bbfdcef369bdca1587a2333df1cb8892746f3 100644
--- a/ee/db/migrate/20181025000427_add_tracing_settings.rb
+++ b/ee/db/migrate/20181025000427_add_tracing_settings.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddTracingSettings < ActiveRecord::Migration
+class AddTracingSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181028092114_create_smartcard_identities.rb b/ee/db/migrate/20181028092114_create_smartcard_identities.rb
index a1efcecfacc19fe4ee3bf2f47e3df96f14803b1d..65fd56dd8c427ce5c004a818e5cc9d1e00fd0e6d 100644
--- a/ee/db/migrate/20181028092114_create_smartcard_identities.rb
+++ b/ee/db/migrate/20181028092114_create_smartcard_identities.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class CreateSmartcardIdentities < ActiveRecord::Migration
+class CreateSmartcardIdentities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181028092115_add_index_to_smartcard_identities.rb b/ee/db/migrate/20181028092115_add_index_to_smartcard_identities.rb
index db6cc1652509528798a24c6355dd193a47854865..0ad53c081b86010a49318f759fbbb5ed45a82dad 100644
--- a/ee/db/migrate/20181028092115_add_index_to_smartcard_identities.rb
+++ b/ee/db/migrate/20181028092115_add_index_to_smartcard_identities.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddIndexToSmartcardIdentities < ActiveRecord::Migration
+class AddIndexToSmartcardIdentities < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/migrate/20181105122803_add_missing_indexes_for_foreign_keys_ee.rb b/ee/db/migrate/20181105122803_add_missing_indexes_for_foreign_keys_ee.rb
index 4fccd3fc20da764de104ab168589ff90155a2840..c61730e49df7625a0ca1ec65d1e4f1202548f6ab 100644
--- a/ee/db/migrate/20181105122803_add_missing_indexes_for_foreign_keys_ee.rb
+++ b/ee/db/migrate/20181105122803_add_missing_indexes_for_foreign_keys_ee.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class AddMissingIndexesForForeignKeysEE < ActiveRecord::Migration
+class AddMissingIndexesForForeignKeysEE < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20170427111108_remove_sync_time_column_from_remote_mirrors.rb b/ee/db/post_migrate/20170427111108_remove_sync_time_column_from_remote_mirrors.rb
index d26325c838fd1011f69d5b890c672fe29de02b01..90072f4808d218ba8a3a62cb4ec18793e61f5a7b 100644
--- a/ee/db/post_migrate/20170427111108_remove_sync_time_column_from_remote_mirrors.rb
+++ b/ee/db/post_migrate/20170427111108_remove_sync_time_column_from_remote_mirrors.rb
@@ -1,4 +1,4 @@
-class RemoveSyncTimeColumnFromRemoteMirrors < ActiveRecord::Migration
+class RemoveSyncTimeColumnFromRemoteMirrors < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20170510101016_remove_sync_time_from_project_mirrors_and_minimum_mirror_sync_time_from_application_settings.rb b/ee/db/post_migrate/20170510101016_remove_sync_time_from_project_mirrors_and_minimum_mirror_sync_time_from_application_settings.rb
index c5bc5581cb99f2b6232a8f6dd9f1308742cf22a4..53de74868adeaa0f2a3b545bb47e6315421fb51c 100644
--- a/ee/db/post_migrate/20170510101016_remove_sync_time_from_project_mirrors_and_minimum_mirror_sync_time_from_application_settings.rb
+++ b/ee/db/post_migrate/20170510101016_remove_sync_time_from_project_mirrors_and_minimum_mirror_sync_time_from_application_settings.rb
@@ -1,4 +1,4 @@
-class RemoveSyncTimeFromProjectMirrorsAndMinimumMirrorSyncTimeFromApplicationSettings < ActiveRecord::Migration
+class RemoveSyncTimeFromProjectMirrorsAndMinimumMirrorSyncTimeFromApplicationSettings < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20170530111134_ensure_project_mirror_data.rb b/ee/db/post_migrate/20170530111134_ensure_project_mirror_data.rb
index d62f9a2452b0733de610bc8e2ac6f138d30860aa..7f9a7d9a9c6cc4ed0fa1b825a56b89e0bbc518d1 100644
--- a/ee/db/post_migrate/20170530111134_ensure_project_mirror_data.rb
+++ b/ee/db/post_migrate/20170530111134_ensure_project_mirror_data.rb
@@ -1,4 +1,4 @@
-class EnsureProjectMirrorData < ActiveRecord::Migration
+class EnsureProjectMirrorData < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20170808163512_remove_plan_from_namespaces.rb b/ee/db/post_migrate/20170808163512_remove_plan_from_namespaces.rb
index e4daea5d920870e431ce4c36f9a459c7ee059a09..71010a85c9a8e980666c70ebceec9e47b447317d 100644
--- a/ee/db/post_migrate/20170808163512_remove_plan_from_namespaces.rb
+++ b/ee/db/post_migrate/20170808163512_remove_plan_from_namespaces.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemovePlanFromNamespaces < ActiveRecord::Migration
+class RemovePlanFromNamespaces < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def change
diff --git a/ee/db/post_migrate/20170811082658_remove_system_hook_from_geo_nodes.rb b/ee/db/post_migrate/20170811082658_remove_system_hook_from_geo_nodes.rb
index 03f3009beb24b380573362b78a0c37c384990661..9a05a845a5c51eac861db3ed1db92772f256fc4c 100644
--- a/ee/db/post_migrate/20170811082658_remove_system_hook_from_geo_nodes.rb
+++ b/ee/db/post_migrate/20170811082658_remove_system_hook_from_geo_nodes.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveSystemHookFromGeoNodes < ActiveRecord::Migration
+class RemoveSystemHookFromGeoNodes < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/post_migrate/20171103152048_geo_drain_redis_queues.rb b/ee/db/post_migrate/20171103152048_geo_drain_redis_queues.rb
index 71d9ef0b029418b4db25f3de68a4cfbfcb66eb70..411a7bf7acdfa08cd28541bbbd8a6a30aa69eb10 100644
--- a/ee/db/post_migrate/20171103152048_geo_drain_redis_queues.rb
+++ b/ee/db/post_migrate/20171103152048_geo_drain_redis_queues.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class GeoDrainRedisQueues < ActiveRecord::Migration
+class GeoDrainRedisQueues < ActiveRecord::Migration[4.2]
   DOWNTIME = false
   GEO_NAMESPACE = 'geo:gitlab'.freeze
 
diff --git a/ee/db/post_migrate/20171124165823_remove_geo_nodes_url_part_columns.rb b/ee/db/post_migrate/20171124165823_remove_geo_nodes_url_part_columns.rb
index b4b725da56a5f71127401914b384f8500f17b92b..8dedcbed1f1500cbe737d2119ddf04a7a2d4ca24 100644
--- a/ee/db/post_migrate/20171124165823_remove_geo_nodes_url_part_columns.rb
+++ b/ee/db/post_migrate/20171124165823_remove_geo_nodes_url_part_columns.rb
@@ -1,4 +1,4 @@
-class RemoveGeoNodesUrlPartColumns < ActiveRecord::Migration
+class RemoveGeoNodesUrlPartColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20171124182517_remove_geo_ssh_repo_sync.rb b/ee/db/post_migrate/20171124182517_remove_geo_ssh_repo_sync.rb
index 581940c488f09b6e6bd56388a21c904814a07776..7a2ec7ab05262f0f643903600785bc43ba7c0d54 100644
--- a/ee/db/post_migrate/20171124182517_remove_geo_ssh_repo_sync.rb
+++ b/ee/db/post_migrate/20171124182517_remove_geo_ssh_repo_sync.rb
@@ -1,4 +1,4 @@
-class RemoveGeoSshRepoSync < ActiveRecord::Migration
+class RemoveGeoSshRepoSync < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20171201140229_cleanup_remote_mirror_available_rename.rb b/ee/db/post_migrate/20171201140229_cleanup_remote_mirror_available_rename.rb
index acab2f524adbce6cb4ee9fc3b06b60ab2826a5b1..2971b65f24ad188d1bd71d1d70a493dbb88086b5 100644
--- a/ee/db/post_migrate/20171201140229_cleanup_remote_mirror_available_rename.rb
+++ b/ee/db/post_migrate/20171201140229_cleanup_remote_mirror_available_rename.rb
@@ -1,4 +1,4 @@
-class CleanupRemoteMirrorAvailableRename < ActiveRecord::Migration
+class CleanupRemoteMirrorAvailableRename < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180309215236_remove_last_verication_at_columns_from_project_repository_states.rb b/ee/db/post_migrate/20180309215236_remove_last_verication_at_columns_from_project_repository_states.rb
index 6da9cc82052aecda47555160a0e31f2b625d6d1b..e03beca48cb69871cadb6d2b995c34fa10a11bb4 100644
--- a/ee/db/post_migrate/20180309215236_remove_last_verication_at_columns_from_project_repository_states.rb
+++ b/ee/db/post_migrate/20180309215236_remove_last_verication_at_columns_from_project_repository_states.rb
@@ -1,4 +1,4 @@
-class RemoveLastVericationAtColumnsFromProjectRepositoryStates < ActiveRecord::Migration
+class RemoveLastVericationAtColumnsFromProjectRepositoryStates < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/post_migrate/20180314172513_remove_last_verication_failed_columns_from_project_repository_states.rb b/ee/db/post_migrate/20180314172513_remove_last_verication_failed_columns_from_project_repository_states.rb
index ee36cc32785d7973a5a1380ef7c1b00e216a5708..58f48905e90313f8dd31ecdc46bdda21ddf91fd5 100644
--- a/ee/db/post_migrate/20180314172513_remove_last_verication_failed_columns_from_project_repository_states.rb
+++ b/ee/db/post_migrate/20180314172513_remove_last_verication_failed_columns_from_project_repository_states.rb
@@ -1,4 +1,4 @@
-class RemoveLastVericationFailedColumnsFromProjectRepositoryStates < ActiveRecord::Migration
+class RemoveLastVericationFailedColumnsFromProjectRepositoryStates < ActiveRecord::Migration[4.2]
   DOWNTIME = false
 
   def up
diff --git a/ee/db/post_migrate/20180417102933_drop_repository_storage_events_for_geo_events.rb b/ee/db/post_migrate/20180417102933_drop_repository_storage_events_for_geo_events.rb
index 0767f860e05915c1af8eef784b7a6d6664d400e7..b10de2c22f38291f83c0b3319f04e824a71810bf 100644
--- a/ee/db/post_migrate/20180417102933_drop_repository_storage_events_for_geo_events.rb
+++ b/ee/db/post_migrate/20180417102933_drop_repository_storage_events_for_geo_events.rb
@@ -1,7 +1,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class DropRepositoryStorageEventsForGeoEvents < ActiveRecord::Migration
+class DropRepositoryStorageEventsForGeoEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   disable_ddl_transaction!
diff --git a/ee/db/post_migrate/20180502130136_migrate_mirror_attributes_data_from_projects_to_import_state.rb b/ee/db/post_migrate/20180502130136_migrate_mirror_attributes_data_from_projects_to_import_state.rb
index ccdf2917acd73521d5391ff78263bbfafd994dab..d1f90950f7c3e0a3700bc465daf146598f97d2b1 100644
--- a/ee/db/post_migrate/20180502130136_migrate_mirror_attributes_data_from_projects_to_import_state.rb
+++ b/ee/db/post_migrate/20180502130136_migrate_mirror_attributes_data_from_projects_to_import_state.rb
@@ -1,4 +1,4 @@
-class MigrateMirrorAttributesDataFromProjectsToImportState < ActiveRecord::Migration
+class MigrateMirrorAttributesDataFromProjectsToImportState < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180509091305_remove_project_mirror_data_created_at_updated_at.rb b/ee/db/post_migrate/20180509091305_remove_project_mirror_data_created_at_updated_at.rb
index 768882d079baa8a72db84f5b38a8f65a9de7ca9e..0ad54357d85abba5270353d6ce609d2e6d489b3b 100644
--- a/ee/db/post_migrate/20180509091305_remove_project_mirror_data_created_at_updated_at.rb
+++ b/ee/db/post_migrate/20180509091305_remove_project_mirror_data_created_at_updated_at.rb
@@ -1,4 +1,4 @@
-class RemoveProjectMirrorDataCreatedAtUpdatedAt < ActiveRecord::Migration
+class RemoveProjectMirrorDataCreatedAtUpdatedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb b/ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb
index e191bc479a49f109a5091a359e9a78101f1f6a6b..3257db11e4ba8427fd1ff48d913a9d0a668a9d70 100644
--- a/ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb
+++ b/ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb
@@ -1,4 +1,4 @@
-class FixPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Migration
+class FixPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180608150653_add_index_to_projects_on_repository_storage_last_repository_updated_at.rb b/ee/db/post_migrate/20180608150653_add_index_to_projects_on_repository_storage_last_repository_updated_at.rb
index ad9825c41db59fbc2842c4041eca6fcd2d7ed50c..9bcc836a8a82f45f1da697db2480276b651a9389 100644
--- a/ee/db/post_migrate/20180608150653_add_index_to_projects_on_repository_storage_last_repository_updated_at.rb
+++ b/ee/db/post_migrate/20180608150653_add_index_to_projects_on_repository_storage_last_repository_updated_at.rb
@@ -1,4 +1,4 @@
-class AddIndexToProjectsOnRepositoryStorageLastRepositoryUpdatedAt < ActiveRecord::Migration
+class AddIndexToProjectsOnRepositoryStorageLastRepositoryUpdatedAt < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180618193715_schedule_prune_orphaned_geo_events.rb b/ee/db/post_migrate/20180618193715_schedule_prune_orphaned_geo_events.rb
index e445f7f91e324819db219030acfbc6aec22bc807..e03596047ff1b164ae607fba9e0990b6bd3c57cf 100644
--- a/ee/db/post_migrate/20180618193715_schedule_prune_orphaned_geo_events.rb
+++ b/ee/db/post_migrate/20180618193715_schedule_prune_orphaned_geo_events.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class SchedulePruneOrphanedGeoEvents < ActiveRecord::Migration
+class SchedulePruneOrphanedGeoEvents < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180713171825_update_epic_dates_from_milestones.rb b/ee/db/post_migrate/20180713171825_update_epic_dates_from_milestones.rb
index d71840b3d7bed0919be2a62e02384371143b4fbe..7268d554bf43d761677115b83557b6b23c31f15b 100644
--- a/ee/db/post_migrate/20180713171825_update_epic_dates_from_milestones.rb
+++ b/ee/db/post_migrate/20180713171825_update_epic_dates_from_milestones.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class UpdateEpicDatesFromMilestones < ActiveRecord::Migration
+class UpdateEpicDatesFromMilestones < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180815043102_remove_wikis_count_and_repositories_count_from_geo_node_statuses.rb b/ee/db/post_migrate/20180815043102_remove_wikis_count_and_repositories_count_from_geo_node_statuses.rb
index 4f8c81f28e7c2259a65eab25c9eb494efb3d6073..f3ade1bb6e00e774a7cc6c9e56b0454b60557365 100644
--- a/ee/db/post_migrate/20180815043102_remove_wikis_count_and_repositories_count_from_geo_node_statuses.rb
+++ b/ee/db/post_migrate/20180815043102_remove_wikis_count_and_repositories_count_from_geo_node_statuses.rb
@@ -2,7 +2,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class RemoveWikisCountAndRepositoriesCountFromGeoNodeStatuses < ActiveRecord::Migration
+class RemoveWikisCountAndRepositoriesCountFromGeoNodeStatuses < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20180914195058_schedule_repository_checksum_cleanup.rb b/ee/db/post_migrate/20180914195058_schedule_repository_checksum_cleanup.rb
index a0d302b01f88c5e980cec21e54e408c8e7f50c66..9c710b5b4582e3c90786fab808039c47d1f68d0e 100644
--- a/ee/db/post_migrate/20180914195058_schedule_repository_checksum_cleanup.rb
+++ b/ee/db/post_migrate/20180914195058_schedule_repository_checksum_cleanup.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class ScheduleRepositoryChecksumCleanup < ActiveRecord::Migration
+class ScheduleRepositoryChecksumCleanup < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/ee/db/post_migrate/20181014131030_enqueue_redact_links_in_epics.rb b/ee/db/post_migrate/20181014131030_enqueue_redact_links_in_epics.rb
index 2a3e7fe89fe2bb03fe4df58d77d9d6d39968d0a4..33de14ee946e8456f4848e1e306b968b531485dc 100644
--- a/ee/db/post_migrate/20181014131030_enqueue_redact_links_in_epics.rb
+++ b/ee/db/post_migrate/20181014131030_enqueue_redact_links_in_epics.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class EnqueueRedactLinksInEpics < ActiveRecord::Migration
+class EnqueueRedactLinksInEpics < ActiveRecord::Migration[4.2]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/generator_templates/active_record/migration/create_table_migration.rb b/generator_templates/active_record/migration/create_table_migration.rb
index 92e963911d0a9885e9356e21447df81e8c75c3f4..4a6bea2796cebcec6c1639b93dc0e61b889c1eb0 100644
--- a/generator_templates/active_record/migration/create_table_migration.rb
+++ b/generator_templates/active_record/migration/create_table_migration.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class <%= migration_class_name %> < ActiveRecord::Migration
+class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/generator_templates/active_record/migration/migration.rb b/generator_templates/active_record/migration/migration.rb
index 38edab825509f209e232b890c9632bf69401ef7c..153280cd4b7ecb3fdcde1f744fc77cac041e6654 100644
--- a/generator_templates/active_record/migration/migration.rb
+++ b/generator_templates/active_record/migration/migration.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class <%= migration_class_name %> < ActiveRecord::Migration
+class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
   include Gitlab::Database::MigrationHelpers
 
   # Set this constant to true if this migration requires downtime.
diff --git a/generator_templates/rails/post_deployment_migration/migration.rb b/generator_templates/rails/post_deployment_migration/migration.rb
index 353709f7c9ca1ca6699121fdcc6167791d069dc2..4c1685545b55849b2859ce478a969effcc4a7e22 100644
--- a/generator_templates/rails/post_deployment_migration/migration.rb
+++ b/generator_templates/rails/post_deployment_migration/migration.rb
@@ -3,7 +3,7 @@
 # See http://doc.gitlab.com/ce/development/migration_style_guide.html
 # for more information on how to write migrations for GitLab.
 
-class <%= migration_class_name %> < ActiveRecord::Migration
+class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
   include Gitlab::Database::MigrationHelpers
 
   DOWNTIME = false
diff --git a/lib/rails4_migration_version.rb b/lib/rails4_migration_version.rb
new file mode 100644
index 0000000000000000000000000000000000000000..ae48734dfad0699a7b546229452764e2a3fddbd9
--- /dev/null
+++ b/lib/rails4_migration_version.rb
@@ -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