I have a database rakefile that allows me to do just this:
https://gist.github.com/kenaniah/3909be6da12228e2104f9c6f1ee8ac1f

Please note this is for a Rails 5 app and is PostgreSQL-specific, but this
may be a good staring point. YMMV.

On Wed, Aug 28, 2019 at 7:05 AM Jeremy Evans <[email protected]> wrote:

> On Wednesday, August 28, 2019 at 5:44:29 AM UTC-7, Nicolò Benigni wrote:
>>
>> I have a Rails app with 4 years of migrations and everytime I start a new
>> machine and try to run them all they give ton of errors.
>> So I usually use rake db:schema:load but would prefer to "squash"
>> togheter all my migrations to have a fresh start.
>>
>> Does anyone have experience on something like this?
>> I think I could use this:
>> https://github.com/jeremyevans/sequel/blob/master/doc/migration.rdoc#dumping-the-current-schema-as-a-migration
>>
>> Am I missing something important or do anyone have better suggestion?
>>
>
> You can use that approach if it results in the same schema. I would
> definitely check that by dumping the schema using that approach with the
> database's dump tool and comparing it with the output of the expected
> schema. There are a lot of things that the schema dumper can't handle
> (database permissions, functions, etc.).
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sequel-talk/9d6202ee-95ee-4c7d-8186-5bd6900361e5%40googlegroups.com
> <https://groups.google.com/d/msgid/sequel-talk/9d6202ee-95ee-4c7d-8186-5bd6900361e5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CA%2Br_aq-nREiORU%3D%2B9QhkB1k5Zo5R6Nfq1H-fRRqF21bRcOhHxA%40mail.gmail.com.

Reply via email to