Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove migrate_column_to_bigint spec helper (#29805)

Bianca Nenciu4f11d16deb6d
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 1133ee99496..9f143f6bd85 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -476,23 +476,19 @@ RSpec.configure do |config|
Capybara::Selenium::Driver.new(app, **mobile_driver_options)
end
- migrate_column_to_bigint(PostAction, :post_action_type_id)
- migrate_column_to_bigint(Reviewable, :target_id)
- migrate_column_to_bigint(ReviewableHistory, :reviewable_id)
- migrate_column_to_bigint(ReviewableScore, :reviewable_id)
- migrate_column_to_bigint(ReviewableScore, :reviewable_score_type)
- migrate_column_to_bigint(SidebarSectionLink, :linkable_id)
- migrate_column_to_bigint(SidebarSectionLink, :sidebar_section_id)
- migrate_column_to_bigint(User, :last_seen_reviewable_id)
- migrate_column_to_bigint(User, :required_fields_version)
-
- $columns_to_migrate_to_bigint.each do |model, column|
- if model.is_a?(String)
- DB.exec("ALTER TABLE #{model} ALTER #{column} TYPE bigint")
- else
- DB.exec("ALTER TABLE #{model.table_name} ALTER #{column} TYPE bigint")
- model.reset_column_information
- end
+ [
+ [PostAction, :post_action_type_id],
+ [Reviewable, :target_id],
+ [ReviewableHistory, :reviewable_id],
+ [ReviewableScore, :reviewable_id],
+ [ReviewableScore, :reviewable_score_type],
+ [SidebarSectionLink, :linkable_id],
+ [SidebarSectionLink, :sidebar_section_id],
+ [User, :last_seen_reviewable_id],
+ [User, :required_fields_version],
+ ].each do |model, column|
+ DB.exec("ALTER TABLE #{model.table_name} ALTER #{column} TYPE bigint")
+ model.reset_column_information
end
# Sets sequence's value to be greater than the max value that an INT column can hold. This is done to prevent
@@ -1050,10 +1046,6 @@ def apply_base_chrome_options(options)
end
end
-def migrate_column_to_bigint(model, column)
- ($columns_to_migrate_to_bigint ||= []) << [model, column]
-end
-
class SpecSecureRandom
class << self
attr_accessor :value