[request] schema-aware disabling of referential integrity while using fixtures
The problem is that when using fixtures for testing, rails disables referential integrity by using table names only. This requires putting all necessary schema names into a schema_search_path in config/database.yml
. This is quite a PITA to remember. It would be nice if it was done automagically.
Rails calls ActiveRecord::ConnectionAdapters::PostgreSQL::ReferentialIntegrity#disable_referential_integrity
that uses ActiveRecord::ConnectionAdapters::SchemaStatements#tables
which returns table names only without schema name to be quoted in #disable_referential_integrity
. I feel like something could be done by returning already enquoted (as in PG format() with %I) name within ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#data_source_sql
or somewhere there.
I'm not sure how doable it is or whether it is better to file a bug somewhere upstream, but I'll leave it here as an idea.