[LRUG] Rails schema line order changing

Stuart Harrison pezholio at gmail.com
Mon Mar 1 01:58:23 PST 2021


Lovely, thanks for all the tips! I do like the look of the
fix-db-schema-conflicts gem, but it seems to be suffering from some bitrot,
and the original owner seems to have disappeared, which is a shame.

On Mon, Mar 1, 2021 at 9:36 AM Tim Diggins <tim at red56.uk> wrote:

> Hi Stuart
>
> I use the gem "fix-db-schema-conflicts" -- ever since adding that to my
> Gemfile on each project it ensures that all schema changes are alphabetised
> (and otherwise normalised) and git diffs are much easier to read.
>
> I agree with Ed that whatever the extra support (like the
> fix-db-schema-conflicts gem), the individual committer should be
> responsible for adjusting their commits.
>
> all the best
>
> Tim
>
> On Mon, 1 Mar 2021 at 08:15, Ed James <ed.james.spam at gmail.com> wrote:
>
>> The only reliable “solution” I’ve come across is to ensure your team
>> treat the “schema.rb” file the same way they treat their own own when
>> raising a pull request i.e. if I add a migration the schema file should *only
>> reflect my change* - if it doesn’t that is a signal to me that I need to
>> rebuild my database:
>>
>> rails db:drop db:create db:schema:load db:seed
>>
>> Once your colleagues get used to this (and it’s pretty easy really)
>> you’ll find you have very little churn on your schema file.
>>
>> Good luck!
>>
>> ------------------------------
>>
>> Ed James
>> I will respect your spam <ed.james.spam at gmail.com>
>>
>> On 1 Mar 2021, at 08:09, Stuart Harrison <pezholio at gmail.com> wrote:
>>
>> Morning LRUG
>>
>> I wanted to share an annoyance I've had on multiple projects, and
>> wondered if anyone had any fixes for it?
>>
>> If there are multiple devs on a project committing a bunch of migrations
>> and running `db:migrate`, it seems that, over time, the order of columns in
>> the schema.rb file jumps around every time the command is run.
>>
>> I can get around this by only committing the relevant line(s) when I run
>> a migration, but this does get annoying.
>>
>> I'm sure there is a solution, but it's disappeared out of my head, and
>> seems to be an ungoogleable problem, so was wondering if anyone had come
>> across a solution?
>>
>> Cheers
>>
>> Stu
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20210301/2de5fadb/attachment.html>


More information about the Chat mailing list