Spoke a little too soon, when I move the previous code from inline @ the
top of my migration file, into the actual gem, there's what I assume is a
load-order issue. Seems like the gem is being loaded before
Sequel::MigrationReverser is defined, so the reverser is not being updated
obviously because of this condition if defined?(Sequel::MigrationReverser)



On Fri, Feb 26, 2021 at 1:52 PM Mark Allen <mark.al...@vydia.com> wrote:

> Perfect, I found this in pg_enum extension
> https://github.com/jeremyevans/sequel/blob/c24909f5182d633673c9e8d78813c24f0a4bbb88/lib/sequel/extensions/pg_enum.rb#L185-L197
>
> Adapted to work with the comments gem and it seems to work great, that was
> way too easy hah. Thanks!
>
> if defined?(Sequel::MigrationReverser)
> class Sequel::MigrationReverser
> private
> def comment_on(*args)
> @actions << [:comment_on, *args[0...-1], nil]
> end
> end
> end
>
>
>
> On Fri, Feb 26, 2021 at 1:25 PM Jeremy Evans <jeremyeva...@gmail.com>
> wrote:
>
>> On Fri, Feb 26, 2021 at 10:10 AM Mark Allen <mark.al...@vydia.com> wrote:
>>
>>> The main thing missing in the gem (once forked and updated to even run
>>> properly at all) is reversible migration functions. Any advice or source
>>> code you could link to that could give me an idea how to implement a
>>> reversible migration method that can be used in a `change` block?
>>>
>>
>> You can modify Sequel::MigrationReverser and
>> or Sequel::MigrationAlterTableReverser to try to add support.  The pg_enum
>> extension has an example of adding reversible migration support to an
>> external extension.  You'll also want to look at the migration extension so
>> you can understand how it works.  Not sure how easy it will be to write a
>> reversible comment migration, since the migration code doesn't know the
>> previous comment value.
>>
>> Reversible migration support is fairly limited in general, there are tons
>> of things that don't work in reversible migrations.  70% of the time I
>> write a migration, it isn't reversible.  There's about 30% where it is just
>> a simple create_table or alter_table, but most of the time I'm modifying
>> data or running custom SQL (functions, triggers, etc.).  That's for apps
>> where I'm not using separate database users for security.  For apps where I
>> am, it's probably around 90% not reversible, since most migrations require
>> permission changes.
>>
>> Thanks,
>> Jeremy
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sequel-talk" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sequel-talk/EpAe_N__FeU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sequel-talk+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sequel-talk/CADGZSSfQK8wHO3O8w%2BYOQWqAaYnE9o%3DGTpdcV6j_cR9zDfGF9w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/sequel-talk/CADGZSSfQK8wHO3O8w%2BYOQWqAaYnE9o%3DGTpdcV6j_cR9zDfGF9w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
> *Mark Allen, *Vice President, Engineering, Vydia, Inc.
>
> Website: vydia.com
>
> <https://linkedin.com/in/markivanallen>
> <https://facebook.com/vydiaofficial>  <https://twitter.com/vydiaofficial>
>


-- 

*Mark Allen, *Vice President, Engineering, Vydia, Inc.

Website: vydia.com

<https://linkedin.com/in/markivanallen>
<https://facebook.com/vydiaofficial>  <https://twitter.com/vydiaofficial>

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CA%2B%2BobE_eD7YX_FXfosTVUhsNQhEGdb73sefpdf1RcPGU1CBR%2Bg%40mail.gmail.com.

Reply via email to