Schema dump support for multiple schemas

What do you guys think of adding support for multiple schemas in the schema dump. The way it would work is instead of exporting create_table 'table_name' in schema.rb, it would create_table 'schema.table_name' This could be figured with some configuration flag.

I would be happy to work on this PR myself if you guys think its a good idea. If not, please let me know why not.

I personally don’t think we should spend time on expanding the horizon of db/schema.rb for specific database adapters. Sure, there are already very specific things in there but they generally lead to issues down the line. With db/structure.sql we have a working solution, maintained by the database vendor. Recently we included a config option to make it easy to dump

more schemas.

See Add config.active_record.dump_schemas. by rywall · Pull Request #19347 · rails/rails · GitHub

I’d much rather make db/structure.sql a first-class citizen and fix any issues related to it’s usage.

Cheers,

– Yves

Thanks you for you answer and the git reference.

However, the problem with db/structure.sql is that its very unreadable. A 1000 line schema.rb will become 6000 line structure.sql. I was hoping that i wouldnt need to use the structure.sql for that reason.

As far as I know schemas are part of SQL standard and MySQL and SQLite just does not support them (but PostgreSQL does). IMHO, it should not be treated as “database specific” just for that. Schemas may be very useful when you have a lot of tables (e.g. to move dictionaries to another namespace).