skip ForeignKeyChecker for rails 6+ multiple databases setup
Closed this issue · 3 comments
uxxman commented
ForeignKeyChecker should ignore when the underlying association tables belong to different databases, since a foreign key cannot be defined here.
production:
primary:
database: my_primary_database
animals:
database: my_animals_database
migrations_paths: db/animals_migrate
class User < ApplicationRecord
has_many :dogs
end
class AnimalsRecord < ApplicationRecord
self.abstract_class = true
connects_to database: { writing: :animals, reading: :animals }
end
class Dog < AnimalsRecord
belongs_to :user
end
ForeignKeyChecker fail Dog User should have foreign key in the database