3 ms·
Question about pg/rails approach... This seems to tie the database closely to the ORM. What if there are multiple applications using the schema? Wouldn't it be
by pnathan 13y ago
Question about pg/rails approach...
This seems to tie the database closely to the ORM. What if there are multiple applications using the schema? Wouldn't it be better to have the database code & controlling system separate?
I've found it more convenient to have a set of SQL files for specifying tables & indexes and to have the app not control the database schema directly (Perhaps I just don't see the clear advantage, or perhaps Rails tooling is so good it obviates my concerns. :-) ).
- josephlord 13y agoRails makes it easier to do migrations and roll them back if necessary but you can dump the SQL from Postgres easily and you can choose whether Rails stores the schema in SQL or in its own format. I use SQL as at least in 3.2 Rails' own format didn't support all the features of Postgres (partial indexes etc.) When doing a new deploy you shouldn't usually go through the migrations but just load the schema.
- bratsche 13y agoIf you prefer, you can store your schema in SQL instead of schema.rb. In config/application.rb: config.active_record.schema_format = :sql