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

Colllection not removed if has group, when apply schema #19385

Closed
vadikk006 opened this issue Aug 10, 2023 · 2 comments · May be fixed by #19410
Closed

Colllection not removed if has group, when apply schema #19385

vadikk006 opened this issue Aug 10, 2023 · 2 comments · May be fixed by #19410
Assignees
Labels

Comments

@vadikk006
Copy link

vadikk006 commented Aug 10, 2023

Describe the Bug

if collection was removed localy and when generate schema. Collection not removed on server

To Reproduce

  1. Create folder in Directus Data model
  2. Create collection in this folder.
  3. generate schema
  4. apply schema on server or another pc
  5. remove collection
  6. generate schema again
  7. apply new schema on server or another pc

result:

collection not removed

reason:

api/src/utils/apply-diff.ts -> deleteCollections has condition return collectionDiff.kind === DiffKind.DELETE && collectionDiff.lhs?.meta?.group === null;

solution

remove collectionDiff.lhs?.meta?.group === null in condition

Directus Version

v12.1.2

Hosting Strategy

Self-Hosted (Docker Image)

@DanielBiegler DanielBiegler self-assigned this Aug 10, 2023
@DanielBiegler
Copy link
Contributor

Hi there! :) So I applied a schema, which worked.

[14:38:40.859] INFO: Snapshot applied successfully

image

Now check the diff for removing the collection in the folder, like you mentioned:


Collections:
  - Delete temp_todo_delete

Would you like to continue? Yes
[14:43:50.683] INFO: Snapshot applied successfully

Looks correct but now like you mention, it is indeed not deleted!

image

Very nice find, thank you for the concise writeup! <3 🚀

@jaads
Copy link
Member

jaads commented Aug 11, 2023

Duplicate of #16683

@jaads jaads marked this as a duplicate of #16683 Aug 11, 2023
@rijkvanzanten rijkvanzanten closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants