Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a dependency ordering issue in SQL migration generation by ensuring triggers are dropped before their associated functions when functions are being replaced or removed. This prevents PostgreSQL errors where a function cannot be dropped while triggers still reference it.
Key changes:
- Added
generateDropTriggersFromModifiedTablesfunction to collect and drop triggers from modified tables before functions are dropped - Integrated this function into the
generateDropSQLworkflow to enforce proper dependency ordering - Updated test data to reflect the corrected drop order
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/diff/trigger.go | Added new function to handle dropping triggers from modified tables with proper ordering |
| internal/diff/diff.go | Integrated trigger drop function into the drop SQL generation workflow |
| testdata/diff/dependency/function_to_trigger/*.sql | Updated test data to reflect correct drop order (trigger first, then function) |
| testdata/diff/dependency/function_to_trigger/*.txt | Updated plan output showing correct execution order |
| testdata/diff/dependency/function_to_trigger/*.json | Updated JSON plan with proper step ordering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5e5a978 to
6c6c5e2
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6c6c5e2 to
e2a43ee
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix #148