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

Removing required constraint on link fails to create migration #4371

Closed
jackfischer opened this issue Sep 16, 2022 · 6 comments · Fixed by #4376
Closed

Removing required constraint on link fails to create migration #4371

jackfischer opened this issue Sep 16, 2022 · 6 comments · Fixed by #4376
Assignees
Labels
compiler migrations need info Need more information from submitter

Comments

@jackfischer
Copy link
Contributor

  • EdgeDB Version: EdgeDB CLI 2.0.5+53f9c9b, EdgeDB 2.1+9c4bc9f
  • OS Version: macOS 12.6

(Follow up from discord)

Steps to Reproduce:

  1. Drop a required constraint on a link, making it optional.
-        required link subject -> SignalSubject;
+        link subject -> SignalSubject;
$  edgedb migration create
did you make link 'subject' of object type 'default::Signal' optional? [y,n,l,c,b,s,q,?]
> l
The following DDL statements will be applied:
    ALTER TYPE default::Signal {
        ALTER LINK subject {
            RESET OPTIONALITY;
        };
    };
did you make link 'subject' of object type 'default::Signal' optional? [y,n,l,c,b,s,q,?]
> y
edgedb error: EdgeDB could not resolve migration with the provided answers. Please retry with different answers.

Schema:

@jackfischer
Copy link
Contributor Author

jackfischer commented Sep 16, 2022

This appears more complicated than the above; just made the same change on another required link successfully:

  ALTER TYPE default::StrategyNode {
      ALTER LINK documentVersion {
          RESET OPTIONALITY;
      };
  };

Both required links were originally created the same way. From the original migration,

CREATE TYPE default::StrategyNode EXTENDING default::SignalSubject {
        CREATE REQUIRED LINK documentVersion -> default::DocumentVersion;
...
CREATE TYPE default::Signal {
        CREATE REQUIRED LINK subject -> default::SignalSubject;

The only difference I see is that the target of the failing link is abstract.

@msullivan msullivan added compiler migrations need info Need more information from submitter labels Sep 16, 2022
@msullivan
Copy link
Member

I was unable to reproduce this issue while doing the obvious thing, so there must be something more subtle going on that is triggering this for you.
Do you have a more complete example of a schema where it is failing? Are there a lot of migrations that have been run already?

@jackfischer
Copy link
Contributor Author

Attempted to reproduce more cleanly here.

Unfortunately my theory it was due to SignalSubject being abstract is wrong
jackfischer/edgedb-4371@4bee1e7

@jackfischer
Copy link
Contributor Author

Found it!!

Making the following change to remove the computed backlink for this relationship allowed the removal of required.

   abstract type SignalSubject {
-        multi link signals := .<subject[is Signal];
+        # multi link signals := .<subject[is Signal];
     }

@msullivan
Copy link
Member

Great! Do you have a small reproducing case you can share, then?

@jackfischer
Copy link
Contributor Author

Yup live here - https://github.com/jackfischer/edgedb-4371, default.esdl is edited so it's ready for the failing edgedb migration create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler migrations need info Need more information from submitter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants