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

Migration with cardinality dependency in default #3275

Closed
fantix opened this issue Dec 14, 2021 · 0 comments · Fixed by #3295
Closed

Migration with cardinality dependency in default #3275

fantix opened this issue Dec 14, 2021 · 0 comments · Fixed by #3295

Comments

@fantix
Copy link
Member

fantix commented Dec 14, 2021

With schema:

type C {
    required property val -> str {
        constraint exclusive;
    }
}

type ROLinksA {
    required link rol1 -> C {
        readonly := True;
        default := (SELECT C FILTER .val = 'D00');
    }
}

Migration fails:

edgedb> start migration to { module default {} }; populate migration; DESCRIBE CURRENT MIGRATION; commit migration;
OK: START MIGRATION
OK: POPULATE MIGRATION
{
  'ALTER TYPE default::C {
    ALTER PROPERTY val {
        DROP CONSTRAINT std::exclusive;
    };
};
DROP TYPE default::ROLinksA;
DROP TYPE default::C;
DROP MODULE test;',
}
edgedb error: SchemaDefinitionError: cannot alter property 'val' of object type 'default::C' because this affects default expression of link 'rol1' of object type 'default::ROLinksA'
  Detail: possibly more than one element returned by the default expression for link 'rol1' declared as 'single'

It would be nice if the populated migration could handle similar situations.

msullivan added a commit that referenced this issue Dec 17, 2021
…nality

This fixes problems where a constraint will be deleted before deleting
schema expressions that reference it and that need to be single.

Fixes #3275.
msullivan added a commit that referenced this issue Dec 20, 2021
…nality (#3295)

This fixes problems where a constraint will be deleted before deleting
schema expressions that reference it and that need to be single.

Fixes #3275.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants