-
Notifications
You must be signed in to change notification settings - Fork 215
fix(simulation): resolve infinite hang during deletion (#5886) #6254
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e8186c7
fix: fix simulation delete
savacano28 2d4d071
fix: fix simulation delete
savacano28 4710555
fix: fix simulation delete
savacano28 17de050
fix: fix simulation delete
savacano28 4fb5268
fix: fix simulation delete
savacano28 2cfb0a2
fix: fix simulation delete
savacano28 3c92a60
fix: fix simulation delete
savacano28 56f47a0
fix: fix simulation delete
savacano28 f164fa5
fix: fix simulation delete
savacano28 7bbed0e
fix: fix simulation delete
savacano28 f10ff5a
fix: fix simulation delete
savacano28 e97ef97
fix: refact without query native
savacano28 058c1cf
Revert "fix: refact without query native"
savacano28 6f87484
fix: review comments
savacano28 19434b8
fix: review comments
savacano28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...src/main/java/io/openaev/migration/V5_21__Add_delete_cascade_exercise_email_reply_to.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package io.openaev.migration; | ||
|
|
||
| import java.sql.Statement; | ||
| import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
| import org.flywaydb.core.api.migration.Context; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class V5_21__Add_delete_cascade_exercise_email_reply_to extends BaseJavaMigration { | ||
|
|
||
| @Override | ||
| public void migrate(Context context) throws Exception { | ||
| try (Statement statement = context.getConnection().createStatement()) { | ||
| statement.execute( | ||
| """ | ||
| DO $$ | ||
| BEGIN | ||
| -- Drop existing constraint if present | ||
| IF EXISTS ( | ||
| SELECT 1 FROM pg_constraint | ||
| WHERE conname = 'fk_exercise_id' | ||
| AND conrelid = 'exercise_mails_reply_to'::regclass | ||
| ) THEN | ||
| ALTER TABLE exercise_mails_reply_to DROP CONSTRAINT fk_exercise_id; | ||
| END IF; | ||
|
|
||
| -- Re-create with ON DELETE CASCADE if not already present | ||
| IF NOT EXISTS ( | ||
| SELECT 1 FROM pg_constraint | ||
| WHERE conname = 'fk_exercise_id' | ||
| AND conrelid = 'exercise_mails_reply_to'::regclass | ||
| ) THEN | ||
|
Copilot marked this conversation as resolved.
|
||
| ALTER TABLE exercise_mails_reply_to | ||
| ADD CONSTRAINT fk_exercise_id | ||
| FOREIGN KEY (exercise_id) REFERENCES exercises(exercise_id) ON DELETE CASCADE; | ||
| END IF; | ||
| END $$; | ||
| """); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.