You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
global current_user_id -> uuid;
global current_user := (select User filter .id ?= global current_user_id);
type User {
multi link following -> User {
property created_at -> datetime {
default := datetime_current();
readonly := true;
}
};
multi link followers := .<following[is User];
property is_followed := global current_user in .followers;
}
is rejected with an error
error: definition dependency cycle between property 'is_followed' of object type 'default::User' and global 'default::current_user'
That's not really fair, though. The reference to current_user is just in a computed, and that computed isn't used by the global anyway.
The error comes from SDL processing. If you try to do this directly with DDL, it works just fine.
The text was updated successfully, but these errors were encountered:
Access policy gives CycleError. Commenting access policy allows creating first migration and uncommenting it again allows creating second migration that matches this schema.
global login -> str;
alias current_user := (select Users filter .login = global login limit 1);
type Companies {
required property name -> str { constraint exclusive };
### this access policy gives CycleError:
### dependency cycle between ('create', 'default::__|company@default|CompanyData') and ('create', 'default::__|company@default|Users')
access policy login_can_read_own
allow select
using ( current_user.company.id ?= .id );
}
abstract type CompanyData {
required link company -> Companies
{
default := (select Companies limit 1);
};
}
type Users extending CompanyData {
required property login -> str { constraint exclusive; };
}
}
Gives CycleError:
File "/home/roman/.local/share/edgedb/portable/3.0-dev.7198/lib/python3.10/site-packages/edb/common/topological.py", line 149, in visit
raise CycleError(
edb.common.topological.CycleError: dependency cycle between ('create', 'default::__|company@default|CompanyData') and ('create', 'default::__|company@default|Users')
is rejected with an error
That's not really fair, though. The reference to current_user is just in a computed, and that computed isn't used by the global anyway.
The error comes from SDL processing. If you try to do this directly with DDL, it works just fine.
The text was updated successfully, but these errors were encountered: