Schema dump support for multiple schemas

35 views
Skip to first unread message

Stenver Jerkku

unread,
May 5, 2015, 10:33:16 PM5/5/15
to rubyonra...@googlegroups.com

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.

Yves Senn

unread,
May 6, 2015, 3:14:55 AM5/6/15
to rubyonra...@googlegroups.com
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. 


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

Cheers,
-- Yves

Stenver Jerkku

unread,
May 6, 2015, 4:14:17 AM5/6/15
to rubyonra...@googlegroups.com
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.

Andrey Novikov

unread,
May 6, 2015, 9:13:19 AM5/6/15
to rubyonra...@googlegroups.com
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).

среда, 6 мая 2015 г., 10:14:55 UTC+3 пользователь Yves Senn написал:
Reply all
Reply to author
Forward
0 new messages