Skip to content

Commit 00141e4

Browse files
atGit2021CarsonF
andauthored
[EdgeDB] Partnership schema (#3064)
Co-authored-by: Carson Full <[email protected]>
1 parent f62a054 commit 00141e4

File tree

4 files changed

+76
-8
lines changed

4 files changed

+76
-8
lines changed

dbschema/migrations/00049.edgeql

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CREATE MIGRATION m1kzwpoy3r3awvbzqxxzz3upkkemxjtf33ra53zkuxzexsc7r5x4zq
2+
ONTO m1tn7o5vizqaygjvghqysxzw6ruf4xohudb2usgfg4z622ens24mba
3+
{
4+
CREATE MODULE Partnership IF NOT EXISTS;
5+
ALTER SCALAR TYPE Partner::FinancialReportingType RENAME TO Partnership::FinancialReportingType;
6+
CREATE SCALAR TYPE Partnership::AgreementStatus EXTENDING enum<NotAttached, AwaitingSignature, Signed>;
7+
CREATE TYPE default::Partnership EXTENDING Project::Child {
8+
CREATE REQUIRED LINK partner: default::Partner;
9+
CREATE CONSTRAINT std::exclusive ON ((.project, .partner));
10+
CREATE LINK agreement: default::File;
11+
CREATE LINK mou: default::File;
12+
CREATE LINK organization := (.partner.organization);
13+
CREATE PROPERTY mouEndOverride: cal::local_date;
14+
CREATE PROPERTY mouEnd := ((.mouEndOverride ?? .project.mouEnd));
15+
CREATE PROPERTY mouStartOverride: cal::local_date;
16+
CREATE PROPERTY mouStart := ((.mouStartOverride ?? .project.mouStart));
17+
CREATE REQUIRED PROPERTY agreementStatus: Partnership::AgreementStatus {
18+
SET default := (Partnership::AgreementStatus.NotAttached);
19+
};
20+
CREATE PROPERTY financialReportingType: Partnership::FinancialReportingType;
21+
CREATE REQUIRED PROPERTY mouStatus: Partnership::AgreementStatus {
22+
SET default := (Partnership::AgreementStatus.NotAttached);
23+
};
24+
CREATE REQUIRED PROPERTY primary: std::bool {
25+
SET default := false;
26+
};
27+
CREATE MULTI PROPERTY types: Partner::Type;
28+
};
29+
ALTER TYPE default::Project {
30+
CREATE LINK partnerships := (.<project[IS default::Partnership]);
31+
};
32+
};

dbschema/partner.esdl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module default {
1717

1818
#address: str; #TODO - this needs figured out - needed on here and Organization?
1919
multi types: Partner::Type;
20-
multi financialReportingTypes: Partner::FinancialReportingType;
20+
multi financialReportingTypes: Partnership::FinancialReportingType;
2121

2222
pointOfContact: User;
2323
languageOfWiderCommunication: Language;
@@ -40,11 +40,4 @@ module Partner {
4040
Technical,
4141
Resource
4242
>;
43-
44-
#TODO - probably move to Partnership?
45-
scalar type FinancialReportingType extending enum<
46-
Funded,
47-
FieldEngaged,
48-
Hybrid
49-
>;
5043
}

dbschema/partnership.esdl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module default {
2+
type Partnership extending Project::Child {
3+
required partner: Partner;
4+
constraint exclusive on ((.project, .partner));
5+
organization := .partner.organization;
6+
7+
required primary: bool {
8+
default := false;
9+
};
10+
multi types: Partner::Type;
11+
financialReportingType: Partnership::FinancialReportingType;
12+
13+
mouStart := .mouStartOverride ?? .project.mouStart;
14+
mouEnd := .mouEndOverride ?? .project.mouEnd;
15+
mouStartOverride: cal::local_date;
16+
mouEndOverride: cal::local_date;
17+
18+
agreement: File;
19+
required agreementStatus: Partnership::AgreementStatus {
20+
default := Partnership::AgreementStatus.NotAttached;
21+
};
22+
mou: File;
23+
required mouStatus: Partnership::AgreementStatus {
24+
default := Partnership::AgreementStatus.NotAttached;
25+
};
26+
}
27+
}
28+
29+
module Partnership {
30+
scalar type AgreementStatus extending enum<
31+
NotAttached,
32+
AwaitingSignature,
33+
Signed
34+
>;
35+
36+
scalar type FinancialReportingType extending enum<
37+
Funded,
38+
FieldEngaged,
39+
Hybrid
40+
>;
41+
}

dbschema/project.esdl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ module default {
8181

8282
link rootDirectory: Directory;
8383

84+
partnerships := .<project[is Partnership];
85+
8486
overloaded link projectContext: Project::Context {
8587
default := (insert Project::Context {
8688
# https://github.com/edgedb/edgedb/issues/3960

0 commit comments

Comments
 (0)