Skip to content

Commit e813e31

Browse files
committed
Switch to constraint expression instead of fn call
Currently bugged: geldata/gel#6699 Expression is a workaround.
1 parent 5fa44f5 commit e813e31

File tree

5 files changed

+91
-11
lines changed

5 files changed

+91
-11
lines changed

dbschema/funding-account.esdl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ module default {
55
}
66

77
required accountNumber: int16 {
8-
constraint min_value(0);
9-
constraint max_value(9);
8+
constraint expression on (__subject__ >= 0 and __subject__ <= 9);
109
}
1110
}
1211
}

dbschema/language.esdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module default {
8888
}
8989

9090
scalar type population extending int32 {
91-
constraint min_value(0);
91+
constraint expression on (__subject__ >= 0);
9292
}
9393
}
9494

dbschema/migrations/00042.edgeql

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
CREATE MIGRATION m1r3t2ku2jysgjliaq54y7saj4tuxecilnajoxgwa2blsb3p64svzq
2+
ONTO m1xhtylawlv6ksvlfkuw6bien5fobo6mtlj3xgr33uya6hnhcnmn7a
3+
{
4+
ALTER TYPE Scripture::Verse {
5+
ALTER PROPERTY chapter {
6+
CREATE CONSTRAINT std::expression ON (((__subject__ >= 1) AND (__subject__ <= 150)));
7+
};
8+
};
9+
ALTER TYPE Scripture::Verse {
10+
ALTER PROPERTY chapter {
11+
DROP CONSTRAINT std::max_value(150);
12+
};
13+
};
14+
ALTER TYPE Scripture::Verse {
15+
ALTER PROPERTY chapter {
16+
DROP CONSTRAINT std::min_value(1);
17+
};
18+
};
19+
ALTER TYPE Scripture::Verse {
20+
ALTER PROPERTY verse {
21+
CREATE CONSTRAINT std::expression ON (((__subject__ >= 1) AND (__subject__ <= 176)));
22+
};
23+
};
24+
ALTER TYPE Scripture::Verse {
25+
ALTER PROPERTY verse {
26+
DROP CONSTRAINT std::max_value(176);
27+
};
28+
};
29+
ALTER TYPE Scripture::Verse {
30+
ALTER PROPERTY verse {
31+
DROP CONSTRAINT std::min_value(1);
32+
};
33+
};
34+
ALTER TYPE Scripture::Verse {
35+
ALTER PROPERTY verseId {
36+
CREATE CONSTRAINT std::expression ON (((__subject__ >= 0) AND (__subject__ <= 31101)));
37+
};
38+
};
39+
ALTER TYPE Scripture::Verse {
40+
ALTER PROPERTY verseId {
41+
DROP CONSTRAINT std::max_value(31101);
42+
};
43+
};
44+
ALTER TYPE Scripture::Verse {
45+
ALTER PROPERTY verseId {
46+
DROP CONSTRAINT std::min_value(0);
47+
};
48+
};
49+
ALTER TYPE default::FundingAccount {
50+
ALTER PROPERTY accountNumber {
51+
CREATE CONSTRAINT std::expression ON (((__subject__ >= 0) AND (__subject__ <= 9)));
52+
};
53+
};
54+
ALTER TYPE default::FundingAccount {
55+
ALTER PROPERTY accountNumber {
56+
DROP CONSTRAINT std::max_value(9);
57+
};
58+
};
59+
ALTER TYPE default::FundingAccount {
60+
ALTER PROPERTY accountNumber {
61+
DROP CONSTRAINT std::min_value(0);
62+
};
63+
};
64+
ALTER TYPE default::Project {
65+
ALTER PROPERTY departmentId {
66+
CREATE CONSTRAINT std::expression ON (((__subject__ >= 10000) AND (__subject__ <= 99999)));
67+
};
68+
};
69+
ALTER TYPE default::Project {
70+
ALTER PROPERTY departmentId {
71+
DROP CONSTRAINT std::max_value(99999);
72+
};
73+
};
74+
ALTER TYPE default::Project {
75+
ALTER PROPERTY departmentId {
76+
DROP CONSTRAINT std::min_value(10000);
77+
};
78+
};
79+
ALTER SCALAR TYPE default::population {
80+
CREATE CONSTRAINT std::expression ON ((__subject__ >= 0));
81+
};
82+
ALTER SCALAR TYPE default::population {
83+
DROP CONSTRAINT std::min_value(0);
84+
};
85+
};

dbschema/project.esdl

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

1313
departmentId: int32 {
1414
constraint exclusive;
15-
constraint min_value(10000);
16-
constraint max_value(99999);
15+
constraint expression on (__subject__ >= 10000 and __subject__ <= 99999);
1716
# Temporarily disabled. Upstream fix in progress.
1817
# rewrite update using (
1918
# if (

dbschema/scripture.esdl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,15 @@ module Scripture {
3737
}
3838
required chapter: int16 {
3939
readonly := true;
40-
constraint min_value(1);
41-
constraint max_value(150); # Psalms
40+
constraint expression on (__subject__ >= 1 and __subject__ <= 150); # Psalms
4241
}
4342
required verse: int16 {
4443
readonly := true;
45-
constraint min_value(1);
46-
constraint max_value(176); # Psalms 119
44+
constraint expression on (__subject__ >= 1 and __subject__ <= 176); # Psalms 119
4745
}
4846
required verseId: int16 {
4947
readonly := true;
50-
constraint min_value(0);
51-
constraint max_value(31101);
48+
constraint expression on (__subject__ >= 0 and __subject__ <= 31101);
5249
}
5350
}
5451
}

0 commit comments

Comments
 (0)