feat: add cross-module tag resolution to revert functionality #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Use RESTRICT for dropping extensions in revert process
Summary
This PR modifies the extension dropping behavior during the revert process to be safer and more predictable. The key change is switching from
DROP EXTENSION ... CASCADEtoDROP EXTENSION ... RESTRICTwith proper error handling for dependency conflicts.Key Changes:
packages/core/src/projects/revert.ts2BP01(dependent_objects_still_exist)Motivation:
The CASCADE approach was too aggressive and could accidentally remove important migration functions and other database objects. RESTRICT provides safer behavior by explicitly failing when dependencies exist, allowing us to handle those cases gracefully.
Review & Testing Checklist for Human
launchql_migrateschema functions remain intact after revert operationsRecommended Test Plan:
Diagram
%%{ init : { "theme" : "default" }}%% graph TD Test["forked-deployment-scenarios.test.ts"]:::context RevertTS["packages/core/src/projects/revert.ts"]:::major-edit ClientTS["packages/core/src/migrate/client.ts"]:::context Test -->|"calls"| RevertTS RevertTS -->|"uses migration functions from"| ClientTS RevertTS -->|"DROP EXTENSION RESTRICT"| DB[("PostgreSQL Database<br/>Extensions & Functions")]:::context subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#F5F5F5Notes
is_deployedfunction was missing after revert operations2BP01is PostgreSQL-specific for "dependent objects still exist"