Cells: Iteration 2: Introduce `CrossDatabaseIgnoredTables` helper
Problem
As a temporary violation allowance we need to allow modifying tables (assigned to different schemas) while saving active record models. Without that it will trigger cross-DB violations that are not fixable at the current moment. To allow us to gracefully handle cross-DB violations by marking them, creating issues, getting pipeline green, and fixing them later.
Example case:
- User does create personal namespace on user creation
- Ideally, User model should create personal namespace asynchronously. Today this is done in-sync.
Proposal
- Introduce
cross_database_ignore_tables
helper method that will temporarily ignore cross-DB violations for a given tables on a given callback conditions, while requiring to passurl:
(similar toallow_cross_joins_across_databases
)
Example usage:
class User
# allow namespaces to be created within a transaction that does violate cross-DB
cross_database_ignore_tables %w[namespaces], on: [:create, :destroy], url: "http://TODO"
cross_database_ignore_tables %w[namespaces], on: [:update], if: -> { namespace&.changed? }, url: "http://TODO"
end
References
Edited by Kamil Trzciński (Back 2025-01-01)