Skip to content

Commit 153626d

Browse files
authored
Merge pull request #3043 from SeedCompany/edgedb/seed/polish
[EdgeDB] Meaningful seed execution logs / Remove placeholder entries
2 parents 0cad09b + a1b982b commit 153626d

File tree

3 files changed

+56
-42
lines changed

3 files changed

+56
-42
lines changed
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
for fa in {
2-
("Not Specified", 0),
3-
("Asia - Mainland", 1),
4-
("Africa", 2),
5-
("Asia - Islands", 3),
6-
("Asia - South", 4),
7-
("Americas, Eurasia", 5),
8-
("Pacific", 7)
9-
}
10-
union (
11-
(select FundingAccount filter .name = fa.0) ??
12-
(insert FundingAccount {
13-
name := fa.0,
14-
accountNumber := fa.1
15-
})
16-
);
1+
with fundingAccounts := (
2+
for fa in {
3+
("Asia - Mainland", 1),
4+
("Africa", 2),
5+
("Asia - Islands", 3),
6+
("Asia - South", 4),
7+
("Americas, Eurasia", 5),
8+
("Pacific", 7)
9+
}
10+
union (
11+
(select FundingAccount filter .name = fa.0) ??
12+
(insert FundingAccount {
13+
name := fa.0,
14+
accountNumber := fa.1
15+
})
16+
)
17+
),
18+
new := (select fundingAccounts filter .createdAt = datetime_of_statement())
19+
select { `Added Funding Accounts` := (new.accountNumber, new.name) }
20+
filter count(new) > 0;
Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
with
22
root := (select RootUser),
3-
zones := array_agg((
3+
zones := (
44
for name in {
55
"Americas, Pacific, Eurasia",
66
"Africa",
7-
"Not Specified",
87
"Asia"
98
}
109
union (
@@ -14,29 +13,38 @@ with
1413
director := root
1514
})
1615
)
17-
)),
16+
),
17+
new := (select zones filter .createdAt = datetime_of_statement())
18+
select { `Added Field Zones` := new.name }
19+
filter count(new) > 0;
20+
with
21+
root := (select RootUser),
1822
regions := (
19-
for region in {
20-
("Americas", zones[0]),
21-
("Pacific", zones[0]),
22-
("Eurasia", zones[0]),
23-
("Africa - Southern", zones[1]),
24-
("Africa - Anglophone East", zones[1]),
25-
("Africa - Sahel", zones[1]),
26-
("Africa - Congo Basin", zones[1]),
27-
("Africa - Anglophone West", zones[1]),
28-
("any", zones[2]),
29-
("Asia - Islands", zones[3]),
30-
("Asia - South", zones[3]),
31-
("Asia - Mainland", zones[3]),
23+
for item in {
24+
(zone := "Americas, Pacific, Eurasia", regions := {"Americas", "Pacific", "Eurasia"}),
25+
(zone := "Africa", regions := {
26+
"Africa - Southern",
27+
"Africa - Anglophone East",
28+
"Africa - Sahel",
29+
"Africa - Congo Basin",
30+
"Africa - Anglophone West"}),
31+
(zone := "Asia", regions := {"Asia - Islands", "Asia - South", "Asia - Mainland"})
3232
}
3333
union (
34-
(select FieldRegion filter .name = region.0) ??
35-
(insert FieldRegion {
36-
name := region.0,
37-
fieldZone := region.1,
38-
director := root
39-
})
34+
with zone := (select FieldZone filter .name = item.zone)
35+
select (
36+
for region in item.regions
37+
union (
38+
(select FieldRegion filter .name = region) ??
39+
(insert FieldRegion {
40+
name := region,
41+
fieldZone := zone,
42+
director := root
43+
})
44+
)
45+
)
4046
)
41-
)
42-
select regions;
47+
),
48+
new := (select regions filter .createdAt = datetime_of_statement())
49+
select { `Added Field Regions` := new.name }
50+
filter count(new) > 0;

dbschema/seeds/003.locations.edgeql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,5 +1615,7 @@ with
16151615
type := Location::Type.Country
16161616
})
16171617
)
1618-
)
1619-
select locations;
1618+
),
1619+
new := (select locations filter .createdAt = datetime_of_statement())
1620+
select { `Added Locations` := (count(new), array_agg(new.name)[:10] ++ if count(new) > 10 then ['...'] else []) }
1621+
filter count(new) > 0;

0 commit comments

Comments
 (0)