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

EdgeDB Project Context Schema #2931

Merged
merged 16 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dbschema/engagement.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ module default {
select TranslationProject
filter __new__ in .languages
# Filter out projects without change, so modifiedAt isn't bumped
and .sensitivity != max(.languages.ownSensitivity) ?? Sensitivity.High
and .ownSensitivity != max(.languages.ownSensitivity) ?? Sensitivity.High
)
set { sensitivity := max(.languages.ownSensitivity) ?? Sensitivity.High }
set { ownSensitivity := max(.languages.ownSensitivity) ?? Sensitivity.High }
);
trigger recalculateProjectSensOnDelete after delete for each do (
with removedLang := __old__.language
update (
select TranslationProject
filter __old__ in .languages
# Filter out projects without change, so modifiedAt isn't bumped
and .sensitivity != max((.languages except removedLang).ownSensitivity) ?? Sensitivity.High
and .ownSensitivity != max((.languages except removedLang).ownSensitivity) ?? Sensitivity.High
)
set { sensitivity := max((.languages except removedLang).ownSensitivity) ?? Sensitivity.High }
set { ownSensitivity := max((.languages except removedLang).ownSensitivity) ?? Sensitivity.High }
);
}

Expand Down
6 changes: 3 additions & 3 deletions dbschema/language.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ module default {
}
# index on (.ownSensitivity);

# property sensitivity := max(.projects.sensitivity) ?? .ownSensitivity;
# property sensitivity := max(.projects.ownSensitivity) ?? .ownSensitivity;
trigger recalculateProjectSens after update for each do (
update (
select TranslationProject
filter __new__ in .languages
# Filter out projects without change, so modifiedAt isn't bumped
and .sensitivity != max(.languages.ownSensitivity) ?? Sensitivity.High
and .ownSensitivity != max(.languages.ownSensitivity) ?? Sensitivity.High
)
set { sensitivity := max(.languages.ownSensitivity) ?? Sensitivity.High }
set { ownSensitivity := max(.languages.ownSensitivity) ?? Sensitivity.High }
);

required ethnologue: Ethnologue::Language {
Expand Down
9 changes: 9 additions & 0 deletions dbschema/migrations/00009.edgeql
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;
};
};
};
6 changes: 3 additions & 3 deletions dbschema/project.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module default {
constraint exclusive;
};

required sensitivity: Sensitivity {
required ownSensitivity: Sensitivity {
annotation description := "The sensitivity of the project. \
This is user settable for internships and calculated for translation projects";
default := Sensitivity.High;
Expand Down Expand Up @@ -57,7 +57,7 @@ module default {

trigger confirmProjectSens after update for each do (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal pet peeve...sensitivity is spelled out 90% of the places...why not make it consistent and spell it out everywhere? It doesn't add much space to do so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean you don't like this either? 🙈

scalar type Sens extending Sensitivity;

I can spell out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't, but there's more of a reason to do it there. Feel free to ignore.

assert(
__new__.sensitivity = max(__new__.languages.ownSensitivity) ?? Sensitivity.High,
__new__.ownSensitivity = max(__new__.languages.ownSensitivity) ?? Sensitivity.High,
message := "TranslationProject sensitivity is automatically set to \
(and required to be) the highest sensitivity Language engaged"
)
Expand All @@ -76,7 +76,7 @@ module Project {
on target delete delete source;
};

# property sensitivity := .project.sensitivity;
# property sensitivity := .project.ownSensitivity;
property isMember := .project.isMember;
}

Expand Down