+1 on a DIY format. And I wouldn't justify it strictly on source control: I'd like it for other reasons too. Maybe a config/schema_format.rb ?
On Tue, May 19, 2015 at 9:19 AM, Kevin Deisz <[email protected]> wrote: > With all of these threads about schema.rb format - would it just be easier > to allow you to specify your own formatter? Have something that responds to > format_for(table, columns) or something to that effect? The issue here is > that everyone is going to want something different from that file. > > On Tue, May 19, 2015 at 8:16 AM, Matias Korhonen <[email protected]> > wrote: > >> How about some sort of normalize_schema option that could be turned off >> if required? I can't imagine that all that many developers are taking >> advantage of specific column ordering. For one thing, PostgreSQL doesn't >> allow you to reorder columns >> <https://wiki.postgresql.org/wiki/Alter_column_position> (without going >> to a whole lot of trouble). >> >> The constant non-meaningful changes to the schema.rb file seem like a >> distraction that end up masking what might be important changes. >> >> Anyone on the Rails Core team want to chime in whether a PR like this >> might be accepted? >> >> >> — Matias >> >> >> On Saturday, 17 January 2015 12:01:52 UTC+2, vesan wrote: >>> >>> When multiple people are working on a single Rails codebase and they add >>> migrations with new columns (or tables) and run the migrations in different >>> order there is a problem with schema.rb. After this every time migrations >>> are run the columns swap places if the previous version of the schema.rb >>> file has been commited by the other developer who did run the migrations in >>> different order. >>> >>> Because of this the developers have to discard the lines where columns >>> swap places to keep the source control clean. Could this be fixed by >>> putting the tables and columns on schema.rb in alphabetical order? Or are >>> people relying on the database's order of the tables and columns? >>> >>> It seems you could implement it by sticking `.sort_by(&:name)` to >>> https://github.com/rails/rails/blob/3f96b6973b82ad17e443dd1d21be05996fb6fbf0/activerecord/lib/active_record/schema_dumper.rb#L134 >>> >>> – Vesa Vänskä >>> [email protected] >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > *Kevin D. Deisz* > *TrialNetworks* - part of DrugDev > Software Developer > 383 Elliot Street, Suite G > Newton, MA 02464 > +1 617.952.4071 x134 (office) > +1 703.615.0396 (mobile) > [email protected] > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- http://mobiledyne.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
