rails-composer
rails-composer copied to clipboard
[FEATURE] Support for `db/structure.sql`
First of all, thank you for this gem!
In some of our projects we use db/structure.sql
as with db/schema.rb
some PostgreSQL schemas are not supported. Also it looks like it deals better with non-linear migration due to Git merges.
Could such an option be integrated into the Rails Composer or is it an rarely used feature and we should write a template ourselves?
I've never encountered this before but perhaps other people use it. Could you provide more information? Any blog posts or articles describing this?
Howdy @paulepanter , did you end up writing the template yourselves or do you have any further thoughts on this? :)
@Schwad, no I did not write a template. From Stack Overflow:
The main difference is that schema.rb is a Ruby representation of the database, and it is generally database-agnostic. structure.sql instead is a SQL representation of the database and it depends on the specific database you selected.
You only use the structure if you have specific database features that you need and that can't be represented by the schema.rb. For example, in the past some people replaced schema.rb with structure.sql in order to use PostgreSQL JSONB fields or foreign key constraints at database level.
Both features are now supported in the migrations, therefore you don't need to switch to structure.sql anymore (in these cases).
In general, I suggest you to use the schema.rb
@paulepanter good to know, thanks for the link! Are you happy with how rails composer is and we can close the issue or is there anything else outstanding you'd like to see done?