On Fri, Feb 26, 2021 at 10:10 AM Mark Allen <[email protected]> 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 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/CADGZSSfQK8wHO3O8w%2BYOQWqAaYnE9o%3DGTpdcV6j_cR9zDfGF9w%40mail.gmail.com.

Reply via email to