-
Notifications
You must be signed in to change notification settings - Fork 2
fix: sync search data when groups or projects are removed #1075
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
Open
eikek
wants to merge
8
commits into
main
Choose a base branch
from
eikek/931-entity-removal-search
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
239f61d
Add failing test case
eikek f4f8cc0
Update search with project data connectors if project is removed
eikek d439244
Delete containing data connectors with a project
eikek 1f437a1
Delete containing data connectors and projects with a group
eikek b9d382a
Update search with removed entities when a group is removed
eikek 684a561
Remove obsolete tests
eikek f85c7be
Add magic files to make pytest find test cases
eikek 0ded9e6
Change comment in __init__py in tests
eikek 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
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...nku_data_services/migrations/versions/42049656cdb8_remove_cleanup_after_slug_deletion_.py
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,42 @@ | ||
| """remove cleanup_after_slug_deletion trigger | ||
|
|
||
| Removes the cleanup trigger added in revision 8413f10ef77f | ||
|
|
||
| Revision ID: 42049656cdb8 | ||
| Revises: d437be68a4fb | ||
| Create Date: 2025-10-23 09:55:19.905709 | ||
|
|
||
| """ | ||
|
|
||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "42049656cdb8" | ||
| down_revision = "d437be68a4fb" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.execute("DROP TRIGGER IF EXISTS cleanup_after_slug_deletion ON common.entity_slugs") | ||
| op.execute("DROP FUNCTION cleanup_after_slug_deletion") | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.execute("""CREATE OR REPLACE FUNCTION cleanup_after_slug_deletion() | ||
| RETURNS TRIGGER AS | ||
| $$ | ||
| BEGIN | ||
| IF OLD.project_id IS NOT NULL AND OLD.data_connector_id IS NULL THEN | ||
| DELETE FROM projects.projects WHERE projects.id = OLD.project_id; | ||
| ELSIF old.data_connector_id IS NOT NULL THEN | ||
| DELETE FROM storage.data_connectors WHERE data_connectors.id = OLD.data_connector_id; | ||
| END IF; | ||
| RETURN OLD; | ||
| END; | ||
| $$ | ||
| LANGUAGE plpgsql;""") | ||
| op.execute("""CREATE OR REPLACE TRIGGER cleanup_after_slug_deletion | ||
| AFTER DELETE ON common.entity_slugs | ||
| FOR EACH ROW | ||
| EXECUTE FUNCTION cleanup_after_slug_deletion();""") |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Namespaces test module.""" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this is too many projects at the moment, see this comment: #1004 (comment)
If there was any data connector in a project that was moved out, then there is a remaining entry in the
EntitySlugORMtable which will match that moved project and the project will get wrongly deleted.We can look at merging this PR now or decide to fix the slug table issue first. Not sure what is best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, great you spotted this! Unfortunate, but I probably would fix the other issue first or maybe disable the "move a project" feature for the next release so things get not messed up even more.