Skip to content

Commit a1b982b

Browse files
committed
Give meaningful dev output to seed results
1 parent c8be470 commit a1b982b

File tree

3 files changed

+56
-39
lines changed

3 files changed

+56
-39
lines changed
Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
for fa in {
2-
("Asia - Mainland", 1),
3-
("Africa", 2),
4-
("Asia - Islands", 3),
5-
("Asia - South", 4),
6-
("Americas, Eurasia", 5),
7-
("Pacific", 7)
8-
}
9-
union (
10-
(select FundingAccount filter .name = fa.0) ??
11-
(insert FundingAccount {
12-
name := fa.0,
13-
accountNumber := fa.1
14-
})
15-
);
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 & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
with
22
root := (select RootUser),
3-
zones := array_agg((
3+
zones := (
44
for name in {
55
"Americas, Pacific, Eurasia",
66
"Africa",
@@ -13,28 +13,38 @@ with
1313
director := root
1414
})
1515
)
16-
)),
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),
1722
regions := (
18-
for region in {
19-
("Americas", zones[0]),
20-
("Pacific", zones[0]),
21-
("Eurasia", zones[0]),
22-
("Africa - Southern", zones[1]),
23-
("Africa - Anglophone East", zones[1]),
24-
("Africa - Sahel", zones[1]),
25-
("Africa - Congo Basin", zones[1]),
26-
("Africa - Anglophone West", zones[1]),
27-
("Asia - Islands", zones[2]),
28-
("Asia - South", zones[2]),
29-
("Asia - Mainland", zones[2]),
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"})
3032
}
3133
union (
32-
(select FieldRegion filter .name = region.0) ??
33-
(insert FieldRegion {
34-
name := region.0,
35-
fieldZone := region.1,
36-
director := root
37-
})
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+
)
3846
)
39-
)
40-
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)