-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2931 from SeedCompany/edgedb/project-context
- Loading branch information
Showing
24 changed files
with
609 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
CREATE MIGRATION m1mhq7b2c53yr7fxf7x5sgjogvrkg4hjj2nhpdivxja66sjpc5amza | ||
ONTO m1unudoy7u4j3s2waa5jadkb43qedra7r6eab3ndzk22fhf4p5bfwq | ||
{ | ||
CREATE FUNCTION default::str_sortable(value: std::str) -> std::str USING (std::str_lower(std::re_replace('Ñ', 'N', std::str_trim(std::re_replace(r'[ [\]|,\-$]+', ' ', value, flags := 'g')), flags := 'g'))); | ||
ALTER TYPE default::Language { | ||
CREATE INDEX ON (default::str_sortable(.name)); | ||
CREATE INDEX ON (.sensitivity); | ||
CREATE INDEX ON ((.name, .sensitivity, .leastOfThese, .isSignLanguage, .isDialect)); | ||
ALTER TRIGGER recalculateProjectSens USING (UPDATE | ||
(SELECT | ||
default::TranslationProject | ||
FILTER | ||
((__new__ IN .languages) AND (.sensitivity != (std::max(.languages.sensitivity) ?? default::Sensitivity.High))) | ||
) | ||
SET { | ||
sensitivity := (std::max(.languages.sensitivity) ?? default::Sensitivity.High) | ||
}); | ||
}; | ||
ALTER TYPE default::LanguageEngagement { | ||
ALTER TRIGGER recalculateProjectSensOnDelete USING (WITH | ||
removedLang := | ||
__old__.language | ||
UPDATE | ||
(SELECT | ||
default::TranslationProject | ||
FILTER | ||
((__old__ IN .languages) AND (.sensitivity != (std::max(((.languages EXCEPT removedLang)).sensitivity) ?? default::Sensitivity.High))) | ||
) | ||
SET { | ||
sensitivity := (std::max(((.languages EXCEPT removedLang)).sensitivity) ?? default::Sensitivity.High) | ||
}); | ||
ALTER TRIGGER recalculateProjectSensOnInsert USING (UPDATE | ||
(SELECT | ||
default::TranslationProject | ||
FILTER | ||
((__new__ IN .languages) AND (.sensitivity != (std::max(.languages.sensitivity) ?? default::Sensitivity.High))) | ||
) | ||
SET { | ||
sensitivity := (std::max(.languages.sensitivity) ?? default::Sensitivity.High) | ||
}); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CREATE MIGRATION m1hjnudahjdbrqvoi7ikqsalk5uv4gyfk5rbzcnonq2qoauw4ee2ea | ||
ONTO m1mhq7b2c53yr7fxf7x5sgjogvrkg4hjj2nhpdivxja66sjpc5amza | ||
{ | ||
ALTER TYPE default::InternshipEngagement { | ||
ALTER LINK project { | ||
RESET OPTIONALITY; | ||
RESET TYPE; | ||
}; | ||
}; | ||
ALTER TYPE default::LanguageEngagement { | ||
ALTER LINK project { | ||
RESET OPTIONALITY; | ||
RESET TYPE; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE MIGRATION m17wcugznjhc34awd734qo7mxst3vzwhc54xjrqawsjtlcuhbafdga | ||
ONTO m1hjnudahjdbrqvoi7ikqsalk5uv4gyfk5rbzcnonq2qoauw4ee2ea | ||
{ | ||
ALTER TYPE Project::Resource { | ||
DROP PROPERTY sensitivity; | ||
}; | ||
ALTER TYPE default::Language { | ||
DROP INDEX ON (.sensitivity); | ||
DROP PROPERTY effectiveSensitivity; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE MIGRATION m1rtq3fw45vdkon7lgrpisvdak2g663tcv7bekfed2bfxgkj23lu4q | ||
ONTO m17wcugznjhc34awd734qo7mxst3vzwhc54xjrqawsjtlcuhbafdga | ||
{ | ||
ALTER TYPE default::Language { | ||
ALTER PROPERTY sensitivity { | ||
RENAME TO ownSensitivity; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE MIGRATION m1kgkikeo6qaen7zzrnuhvhfiqak32ap254imd6or7naaatelnf24q | ||
ONTO m1rtq3fw45vdkon7lgrpisvdak2g663tcv7bekfed2bfxgkj23lu4q | ||
{ | ||
ALTER TYPE default::Project { | ||
ALTER PROPERTY sensitivity { | ||
RENAME TO ownSensitivity; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CREATE MIGRATION m1bl5usbsd57f2obaikame74dp7p3oitsmulfitpvducp2k4oetwea | ||
ONTO m1kgkikeo6qaen7zzrnuhvhfiqak32ap254imd6or7naaatelnf24q | ||
{ | ||
ALTER TYPE Project::Resource { | ||
DROP PROPERTY isMember; | ||
}; | ||
CREATE TYPE Project::Context; | ||
CREATE ABSTRACT TYPE Project::HasContext { | ||
CREATE REQUIRED LINK projectContext: Project::Context { | ||
SET default := (INSERT | ||
Project::Context | ||
); | ||
}; | ||
CREATE PROPERTY ownSensitivity: default::Sensitivity; | ||
}; | ||
ALTER TYPE default::Language { | ||
DROP PROPERTY isMember; | ||
}; | ||
ALTER TYPE default::Project { | ||
DROP PROPERTY isMember; | ||
EXTENDING Project::HasContext LAST; | ||
}; | ||
ALTER TYPE Project::Context { | ||
CREATE MULTI LINK projects: default::Project { | ||
ON TARGET DELETE ALLOW; | ||
}; | ||
}; | ||
ALTER TYPE Project::HasContext { | ||
CREATE REQUIRED SINGLE PROPERTY isMember := (EXISTS (.projectContext.projects.membership)); | ||
}; | ||
ALTER TYPE default::Project { | ||
ALTER PROPERTY ownSensitivity { | ||
RESET OPTIONALITY; | ||
RESET TYPE; | ||
}; | ||
}; | ||
ALTER TYPE Project::Resource { | ||
CREATE PROPERTY isMember := (.project.isMember); | ||
}; | ||
ALTER TYPE Project::HasContext { | ||
CREATE REQUIRED SINGLE PROPERTY sensitivity := ((std::max(.projectContext.projects.ownSensitivity) ?? (.ownSensitivity ?? default::Sensitivity.High))); | ||
}; | ||
ALTER TYPE default::Language { | ||
CREATE PROPERTY isMember := (EXISTS (.projects.isMember)); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE MIGRATION m1je52dmicyhild43tygqtxydgf4mp5nymhqyibrzv2a2yg5kbf4yq | ||
ONTO m1bl5usbsd57f2obaikame74dp7p3oitsmulfitpvducp2k4oetwea | ||
{ | ||
ALTER TYPE Ethnologue::Language { | ||
CREATE REQUIRED LINK language: default::Language { | ||
ON TARGET DELETE DELETE SOURCE; | ||
SET REQUIRED USING (SELECT | ||
default::Language FILTER | ||
(.ethnologue = __source__) | ||
LIMIT | ||
1 | ||
); | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::Language { | ||
ALTER LINK ethnologue { | ||
RESET default; | ||
USING (std::assert_exists(std::assert_single(.<language[IS Ethnologue::Language]))); | ||
RESET ON SOURCE DELETE; | ||
SET SINGLE; | ||
}; | ||
CREATE TRIGGER connectEthnologue | ||
AFTER INSERT | ||
FOR EACH DO (INSERT | ||
Ethnologue::Language | ||
{ | ||
language := __new__ | ||
}); | ||
}; | ||
}; |
Oops, something went wrong.