Disable StrongMigrations

This commit is contained in:
Eugene Burmakin 2025-11-09 23:08:10 +01:00
parent eaf66c8bbd
commit b6d1f1d46d
3 changed files with 27 additions and 27 deletions

View file

@ -1,31 +1,31 @@
# frozen_string_literal: true # frozen_string_literal: true
return unless Rails.env.development? # return unless Rails.env.development?
# Mark existing migrations as safe # # Mark existing migrations as safe
StrongMigrations.start_after = 20_250_122_150_500 # StrongMigrations.start_after = 20_250_122_150_500
# Set timeouts for migrations # # Set timeouts for migrations
# PgBouncer in transaction mode doesn't support SET commands # # PgBouncer in transaction mode doesn't support SET commands
# Timeouts should be set on the database user instead # # Timeouts should be set on the database user instead
# StrongMigrations.lock_timeout = 10.seconds # # StrongMigrations.lock_timeout = 10.seconds
# StrongMigrations.statement_timeout = 1.hour # # StrongMigrations.statement_timeout = 1.hour
# Analyze tables after indexes are added # # Analyze tables after indexes are added
# Outdated statistics can sometimes hurt performance # # Outdated statistics can sometimes hurt performance
StrongMigrations.auto_analyze = true # StrongMigrations.auto_analyze = true
# Set the version of the production database # # Set the version of the production database
# so the right checks are run in development # # so the right checks are run in development
# StrongMigrations.target_version = 10 # # StrongMigrations.target_version = 10
# Add custom checks # # Add custom checks
# StrongMigrations.add_check do |method, args| # # StrongMigrations.add_check do |method, args|
# if method == :add_index && args[0].to_s == "users" # # if method == :add_index && args[0].to_s == "users"
# stop! "No more indexes on the users table" # # stop! "No more indexes on the users table"
# end # # end
# end # # end
# Make some operations safe by default # # Make some operations safe by default
# See https://github.com/ankane/strong_migrations#safe-by-default # # See https://github.com/ankane/strong_migrations#safe-by-default
# StrongMigrations.safe_by_default = true # # StrongMigrations.safe_by_default = true

View file

@ -2,10 +2,10 @@
class AddVisitedCountriesToTrips < ActiveRecord::Migration[8.0] class AddVisitedCountriesToTrips < ActiveRecord::Migration[8.0]
def change def change
safety_assured do # safety_assured do
execute <<-SQL execute <<-SQL
ALTER TABLE trips ADD COLUMN visited_countries JSONB DEFAULT '{}'::jsonb NOT NULL; ALTER TABLE trips ADD COLUMN visited_countries JSONB DEFAULT '{}'::jsonb NOT NULL;
SQL SQL
end # end
end end
end end

View file

@ -5,10 +5,10 @@ class AddH3HexIdsToStats < ActiveRecord::Migration[8.0]
def change def change
add_column :stats, :h3_hex_ids, :jsonb, default: {}, if_not_exists: true add_column :stats, :h3_hex_ids, :jsonb, default: {}, if_not_exists: true
safety_assured do # safety_assured do
add_index :stats, :h3_hex_ids, using: :gin, add_index :stats, :h3_hex_ids, using: :gin,
where: "(h3_hex_ids IS NOT NULL AND h3_hex_ids != '{}'::jsonb)", where: "(h3_hex_ids IS NOT NULL AND h3_hex_ids != '{}'::jsonb)",
algorithm: :concurrently, if_not_exists: true algorithm: :concurrently, if_not_exists: true
end # end
end end
end end