Skip to content

Unable to delete relation via apply-snapshot once it is already created in DB #23175

Open
@itszeeshan

Description

@itszeeshan

Describe the Bug

Hi,

Create a snapshot of the current data model without relationships using npx directus schema snapshot. Create a relationship between two collections. Apply the snapshot using npx directus schema apply, and you will encounter an error because the relationship already exists (Products collection: supplier is Many to One, Supplier collection: products is One to Many). But the apply schema just can't delete it.

To Reproduce

  • Create a snapshot of current data model without relationship between two collections using```npx directus schema snapshot``.
  • Create a relationship between two collections.
  • Now update this data model using npx directus schema apply with the snapshot you got from step 1. Without the relationship.
  • You'll get this error
Screenshot 2024-08-05 at 3 23 27 PM
  • The relationship between these two collections already exists. In Products Collection supplier is Many to One and in Supplier Collection products is One to Many.

Directus Version

10.13.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

postgres:latest

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions