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

Changing OnDelete annotations from SetNull to Cascade don't apply during migration #1625

Closed
2 tasks done
ivanvanderbyl opened this issue Jun 4, 2021 · 3 comments
Closed
2 tasks done

Comments

@ivanvanderbyl
Copy link
Contributor

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Adding the following annotation to an edge should replace the existing constraint on that edge from ON DELETE SET NULL to ON DELETE CASCADE:

entsql.Annotation{OnDelete: entsql.Cascade}

When migrating it doesn't generate a change for this constraint because it already exists by name.

Expected Behavior 🤔

It should drop the previous constraint, and then add the new one.

Steps to Reproduce 🕹

Steps:

  1. Add the Annotation: entsql.Annotation{OnDelete: entsql.Cascade} to an edge that doesn't currently have any OnDelete annotations.
  2. Migrate
  3. Observe that this change is not applied, and the edge is still SET NULL.

Your Environment 🌎

Tech Version
Go 1.16.3
Ent 0.8
Database Postgres
@a8m
Copy link
Member

a8m commented Jun 4, 2021

Hey @ivanvanderbyl! It's great to see you here again 😃

We're working on the new migration implementation and this issue should be addressed there.

@a8m a8m added the migration label Jun 4, 2021
@adayNU
Copy link
Contributor

adayNU commented Nov 12, 2021

This still seems to be an issue. Is there any proposed workaround here until this is resolved?

@a8m
Copy link
Member

a8m commented Jan 24, 2022

Hey @ivanvanderbyl and @adayNU.

The issue should was resolved with the Atlas migration. See https://entgo.io/docs/migrate#atlas-integration for more info.

Closing, but please let me know if you have any issues with it. Thanks 🙏

@a8m a8m closed this as completed Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants