Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for migrating triggers #352

Open
hillac opened this issue May 8, 2024 · 1 comment
Open

Support for migrating triggers #352

hillac opened this issue May 8, 2024 · 1 comment

Comments

@hillac
Copy link

hillac commented May 8, 2024

Will there be support for migrating triggers? Also, can pre-existing or new triggers interfere at all with the migration process?

@andrew-farries
Copy link
Collaborator

pgroll doesn't currently support migrating triggers. It's not something that we currently have plans to add. The full list of supported operations is in the docs. There is always the 'escape hatch' of using a raw SQL migration however, which can be used to create whatever kind of database object you need.

During a migration that alters an existing column or adds a new one, pgroll installs up to two triggers on the affected table, named according to this pattern:

 _pgroll_trigger_<table-name>_<column-name> BEFORE INSERT OR UPDATE ON <table> FOR EACH ROW EXECUTE FUNCTION _pgroll_trigger_<table-name>_<column-name>()

In the presence of another BEFORE INSERT OR UPDATE trigger on the same table, Postgres will run the triggers in alphabetical order by trigger name, so interaction between triggers on the same table is possible. If this becomes an issue we may need a way to control the naming of pgroll triggers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants