summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-12-12 18:22:34 +0000
committerRobert Speicher <rspeicher@gmail.com>2018-12-12 18:22:34 +0000
commita9be222fa98733f07f6e2390401e01c7521a2d2d (patch)
tree5ded4bbf8b881424fd96bc72505d308121887a72
parentbfe7f7bdc7b0e5ba19304c218345376684bcbd26 (diff)
parent25ea6fdd5ee723dbe98b719c9966b19668cb7cda (diff)
downloadgitlab-ce-a9be222fa98733f07f6e2390401e01c7521a2d2d.tar.gz
Merge branch 'database-deprecation-warnings' into 'master'
Resolve various database deprecation warnings See merge request gitlab-org/gitlab-ce!23772
-rw-r--r--config/initializers/postgresql_opclasses_support.rb2
-rw-r--r--db/migrate/20181101191341_create_clusters_applications_cert_manager.rb2
-rw-r--r--db/migrate/20181108091549_cleanup_environments_external_url.rb2
-rw-r--r--db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb2
-rw-r--r--db/migrate/20181116050532_knative_external_ip.rb2
-rw-r--r--db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb2
-rw-r--r--db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb2
-rw-r--r--db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb2
-rw-r--r--db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb2
-rw-r--r--db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb2
-rw-r--r--db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb2
-rw-r--r--db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb2
-rw-r--r--db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb2
-rw-r--r--db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb2
-rw-r--r--db/post_migrate/20181121111200_schedule_runners_token_encryption.rb2
-rw-r--r--doc/development/background_migrations.md4
-rw-r--r--doc/development/migration_style_guide.md16
-rw-r--r--doc/development/prometheus_metrics.md2
-rw-r--r--doc/development/sql.md4
-rw-r--r--doc/development/what_requires_downtime.md14
-rw-r--r--spec/rubocop/cop/migration/add_timestamps_spec.rb6
-rw-r--r--spec/rubocop/cop/migration/datetime_spec.rb8
-rw-r--r--spec/rubocop/cop/migration/timestamps_spec.rb6
-rw-r--r--spec/support/helpers/fake_migration_classes.rb2
24 files changed, 46 insertions, 46 deletions
diff --git a/config/initializers/postgresql_opclasses_support.rb b/config/initializers/postgresql_opclasses_support.rb
index 07b06629dea..5d643b75dd8 100644
--- a/config/initializers/postgresql_opclasses_support.rb
+++ b/config/initializers/postgresql_opclasses_support.rb
@@ -81,7 +81,7 @@ module ActiveRecord
if index_name.length > max_index_length
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{max_index_length} characters"
end
- if table_exists?(table_name) && index_name_exists?(table_name, index_name, false)
+ if data_source_exists?(table_name) && index_name_exists?(table_name, index_name, false)
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
end
index_columns = quoted_columns_for_index(column_names, options).join(", ")
diff --git a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb b/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb
index 4966b89964a..0b6155356d9 100644
--- a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb
+++ b/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class CreateClustersApplicationsCertManager < ActiveRecord::Migration
+class CreateClustersApplicationsCertManager < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181108091549_cleanup_environments_external_url.rb b/db/migrate/20181108091549_cleanup_environments_external_url.rb
index 8d6c20a4b15..8439f6e55e6 100644
--- a/db/migrate/20181108091549_cleanup_environments_external_url.rb
+++ b/db/migrate/20181108091549_cleanup_environments_external_url.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class CleanupEnvironmentsExternalUrl < ActiveRecord::Migration
+class CleanupEnvironmentsExternalUrl < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb b/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb
index 36d9ad45b19..5b2bb4f6b08 100644
--- a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb
+++ b/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration
+class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181116050532_knative_external_ip.rb b/db/migrate/20181116050532_knative_external_ip.rb
index f1f903fb692..5645b040a23 100644
--- a/db/migrate/20181116050532_knative_external_ip.rb
+++ b/db/migrate/20181116050532_knative_external_ip.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 KnativeExternalIp < ActiveRecord::Migration
+class KnativeExternalIp < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb b/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb
index b92b1b50218..dcf565cd6c0 100644
--- a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb
+++ b/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration
+class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb b/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb
index 53e475bd180..13cd80e5c8b 100644
--- a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb
+++ b/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration
+class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb b/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb
index 65476109c61..f96d80787f9 100644
--- a/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb
+++ b/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddMergeRequestIdToCiPipelines < ActiveRecord::Migration
+class AddMergeRequestIdToCiPipelines < ActiveRecord::Migration[4.2]
DOWNTIME = false
def up
diff --git a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb b/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb
index 03f677a4678..f8b46395941 100644
--- a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb
+++ b/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration
+class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb b/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb
index 40db6b399ab..8b990451adc 100644
--- a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb
+++ b/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddTokenEncryptedToCiRunners < ActiveRecord::Migration
+class AddTokenEncryptedToCiRunners < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb b/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb
index 5b47a279438..a524709faf8 100644
--- a/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb
+++ b/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.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 AddCiBuildsPartialIndexOnProjectIdAndStatus < ActiveRecord::Migration
+class AddCiBuildsPartialIndexOnProjectIdAndStatus < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb b/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb
index a0a02e81323..e4fb703e887 100644
--- a/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb
+++ b/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.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 RemoveRedundantCiBuildsPartialIndex < ActiveRecord::Migration
+class RemoveRedundantCiBuildsPartialIndex < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb b/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb
index e9ab45ae9a1..247f5980f7e 100644
--- a/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb
+++ b/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class BackfillStoreProjectFullPathInRepo < ActiveRecord::Migration
+class BackfillStoreProjectFullPathInRepo < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb b/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb
index ff5510e8eb7..7c2df832882 100644
--- a/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb
+++ b/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class MigrateForbiddenRedirectUris < ActiveRecord::Migration
+class MigrateForbiddenRedirectUris < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb b/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb
index 753e052f7a7..ba82072fc98 100644
--- a/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb
+++ b/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class ScheduleRunnersTokenEncryption < ActiveRecord::Migration
+class ScheduleRunnersTokenEncryption < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md
index bb9a296ef12..dd4a9e058d7 100644
--- a/doc/development/background_migrations.md
+++ b/doc/development/background_migrations.md
@@ -211,7 +211,7 @@ existing data. Since we're dealing with a lot of rows we'll schedule jobs in
batches instead of doing this one by one:
```ruby
-class ScheduleExtractServicesUrl < ActiveRecord::Migration
+class ScheduleExtractServicesUrl < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
class Service < ActiveRecord::Base
@@ -242,7 +242,7 @@ jobs and manually run on any un-migrated rows. Such a migration would look like
this:
```ruby
-class ConsumeRemainingExtractServicesUrlJobs < ActiveRecord::Migration
+class ConsumeRemainingExtractServicesUrlJobs < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
class Service < ActiveRecord::Base
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index a99267bfbba..d0a054c3290 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -67,7 +67,7 @@ body:
For example:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
DOWNTIME = true
DOWNTIME_REASON = 'This migration requires downtime because ...'
@@ -95,7 +95,7 @@ migration. For this to work your migration needs to include the module
`Gitlab::Database::MultiThreadedMigration`:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
include Gitlab::Database::MultiThreadedMigration
end
@@ -105,7 +105,7 @@ You can then use the method `with_multiple_threads` to perform work in separate
threads. For example:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
include Gitlab::Database::MultiThreadedMigration
@@ -139,7 +139,7 @@ by calling the method `disable_ddl_transaction!` in the body of your migration
class like so:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -167,7 +167,7 @@ the method `disable_ddl_transaction!` in the body of your migration class like
so:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -193,7 +193,7 @@ Here's an example where we add a new column with a foreign key
constraint. Note it includes `index: true` to create an index for it.
```ruby
-class Migration < ActiveRecord::Migration
+class Migration < ActiveRecord::Migration[4.2]
def change
add_reference :model, :other_model, index: true, foreign_key: { on_delete: :cascade }
@@ -216,7 +216,7 @@ For example, to add the column `foo` to the `projects` table with a default
value of `10` you'd write the following:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -365,7 +365,7 @@ If you need more complex logic you can define and use models local to a
migration. For example:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
class Project < ActiveRecord::Base
self.table_name = 'projects'
end
diff --git a/doc/development/prometheus_metrics.md b/doc/development/prometheus_metrics.md
index b6b6d9665ea..0511e735843 100644
--- a/doc/development/prometheus_metrics.md
+++ b/doc/development/prometheus_metrics.md
@@ -30,7 +30,7 @@ You might want to add additional database migration that makes a decision what t
For example: you might be interested in migrating all dependent data to a different metric.
```ruby
-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/doc/development/sql.md b/doc/development/sql.md
index e1e1d31a85f..06005a0a6f8 100644
--- a/doc/development/sql.md
+++ b/doc/development/sql.md
@@ -106,7 +106,7 @@ transaction. Transactions for migrations can be disabled using the following
pattern:
```ruby
-class MigrationName < ActiveRecord::Migration
+class MigrationName < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
end
```
@@ -114,7 +114,7 @@ end
For example:
```ruby
-class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration
+class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
diff --git a/doc/development/what_requires_downtime.md b/doc/development/what_requires_downtime.md
index 3630a28fae9..24edd05da2f 100644
--- a/doc/development/what_requires_downtime.md
+++ b/doc/development/what_requires_downtime.md
@@ -88,7 +88,7 @@ renaming. For example
```ruby
# A regular migration in db/migrate
-class RenameUsersUpdatedAtToUpdatedAtTimestamp < ActiveRecord::Migration
+class RenameUsersUpdatedAtToUpdatedAtTimestamp < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -118,7 +118,7 @@ We can perform this cleanup using
```ruby
# A post-deployment migration in db/post_migrate
-class CleanupUsersUpdatedAtRename < ActiveRecord::Migration
+class CleanupUsersUpdatedAtRename < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -157,7 +157,7 @@ as follows:
```ruby
# A regular migration in db/migrate
-class ChangeUsersUsernameStringToText < ActiveRecord::Migration
+class ChangeUsersUsernameStringToText < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -178,7 +178,7 @@ Next we need to clean up our changes using a post-deployment migration:
```ruby
# A post-deployment migration in db/post_migrate
-class ChangeUsersUsernameStringToTextCleanup < ActiveRecord::Migration
+class ChangeUsersUsernameStringToTextCleanup < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -213,7 +213,7 @@ the work / load over a longer time period, without slowing down deployments.
For example, to change the column type using a background migration:
```ruby
-class ExampleMigration < ActiveRecord::Migration
+class ExampleMigration < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -257,7 +257,7 @@ release) by a cleanup migration, which should steal from the queue and handle
any remaining rows. For example:
```ruby
-class MigrateRemainingIssuesClosedAt < ActiveRecord::Migration
+class MigrateRemainingIssuesClosedAt < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
@@ -322,7 +322,7 @@ Migrations can take advantage of this by using the method
`add_concurrent_index`. For example:
```ruby
-class MyMigration < ActiveRecord::Migration
+class MyMigration < ActiveRecord::Migration[4.2]
def up
add_concurrent_index :projects, :column_name
end
diff --git a/spec/rubocop/cop/migration/add_timestamps_spec.rb b/spec/rubocop/cop/migration/add_timestamps_spec.rb
index 3a41c91add2..fae0177d5f5 100644
--- a/spec/rubocop/cop/migration/add_timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/add_timestamps_spec.rb
@@ -11,7 +11,7 @@ describe RuboCop::Cop::Migration::AddTimestamps do
subject(:cop) { described_class.new }
let(:migration_with_add_timestamps) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -24,7 +24,7 @@ describe RuboCop::Cop::Migration::AddTimestamps do
let(:migration_without_add_timestamps) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -36,7 +36,7 @@ describe RuboCop::Cop::Migration::AddTimestamps do
let(:migration_with_add_timestamps_with_timezone) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
diff --git a/spec/rubocop/cop/migration/datetime_spec.rb b/spec/rubocop/cop/migration/datetime_spec.rb
index 9e844325371..f2d9483d8d3 100644
--- a/spec/rubocop/cop/migration/datetime_spec.rb
+++ b/spec/rubocop/cop/migration/datetime_spec.rb
@@ -12,7 +12,7 @@ describe RuboCop::Cop::Migration::Datetime do
let(:migration_with_datetime) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -25,7 +25,7 @@ describe RuboCop::Cop::Migration::Datetime do
let(:migration_with_timestamp) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -38,7 +38,7 @@ describe RuboCop::Cop::Migration::Datetime do
let(:migration_without_datetime) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -50,7 +50,7 @@ describe RuboCop::Cop::Migration::Datetime do
let(:migration_with_datetime_with_timezone) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
diff --git a/spec/rubocop/cop/migration/timestamps_spec.rb b/spec/rubocop/cop/migration/timestamps_spec.rb
index 685bdb21803..1812818692a 100644
--- a/spec/rubocop/cop/migration/timestamps_spec.rb
+++ b/spec/rubocop/cop/migration/timestamps_spec.rb
@@ -11,7 +11,7 @@ describe RuboCop::Cop::Migration::Timestamps do
subject(:cop) { described_class.new }
let(:migration_with_timestamps) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -27,7 +27,7 @@ describe RuboCop::Cop::Migration::Timestamps do
let(:migration_without_timestamps) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
@@ -42,7 +42,7 @@ describe RuboCop::Cop::Migration::Timestamps do
let(:migration_with_timestamps_with_timezone) do
%q(
- class Users < ActiveRecord::Migration
+ class Users < ActiveRecord::Migration[4.2]
DOWNTIME = false
def change
diff --git a/spec/support/helpers/fake_migration_classes.rb b/spec/support/helpers/fake_migration_classes.rb
index b0fc8422857..c7766df7a52 100644
--- a/spec/support/helpers/fake_migration_classes.rb
+++ b/spec/support/helpers/fake_migration_classes.rb
@@ -1,4 +1,4 @@
-class FakeRenameReservedPathMigrationV1 < ActiveRecord::Migration
+class FakeRenameReservedPathMigrationV1 < ActiveRecord::Migration[4.2]
include Gitlab::Database::RenameReservedPathsMigration::V1
def version