Skip to content

Commit cf8c5cc

Browse files
committed
[Gel] Add Project.primaryPartnership & avoid path resolution bug blocking upgrade
1 parent 5403cce commit cf8c5cc

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

dbschema/migrations/00023-m1gur4j.edgeql

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dbschema/project.gel

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ module default {
3030
.step >= Project::Step.PendingFinanceConfirmation
3131
) then ((
3232
with block := (
33-
if __subject__ is MultiplicationTranslationProject then (
34-
assert_exists(
35-
assert_exists(
36-
(select __subject__.partnerships filter .primary).partner,
37-
message := "Project must have a primary partnership"
38-
).departmentIdBlock,
33+
if __subject__ is MultiplicationTranslationProject then ((
34+
with primaryPartnership := assert_exists(
35+
__subject__.primaryPartnership,
36+
message := "Project must have a primary partnership"
37+
)
38+
select assert_exists(
39+
primaryPartnership.partner.departmentIdBlock,
3940
message := "Available Department IDs have not been declared"
4041
)
41-
) else (
42+
)) else (
4243
assert_exists(
4344
assert_exists(
4445
__subject__.primaryLocation,
@@ -102,6 +103,13 @@ module default {
102103
link rootDirectory: Directory;
103104

104105
partnerships := .<project[is Partnership];
106+
primaryPartnership := (
107+
# avoiding backlink here because of partial path resolution bug
108+
# https://github.com/geldata/gel/issues/8633
109+
select Partnership
110+
filter Partnership.primary and Partnership.project = __source__
111+
limit 1
112+
);
105113

106114
overloaded link projectContext: Project::Context {
107115
default := (insert Project::Context {

0 commit comments

Comments
 (0)