Skip to content

Commit

Permalink
[EdgeDB] Add Pins Seeding (#3212)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjnelson authored May 22, 2024
1 parent 60f22ea commit d226f4d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions dbschema/seeds/019.pins.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
with
usersJson := to_json('[
{
"name": "Bilbo",
"pinnables": [
"Sindarin",
"Quenya",
"Dwarvish/Elvish Alliance",
"Fellowship of Halfing Languages",
"Emyn Muil",
"Arnor Lake",
"South Downs"
]
},
{
"name": "Peregrin",
"pinnables": [
"English",
"Sindarin",
"Eriador Church",
"The Rivendell Partnership",
"Misty Mountains",
"Lothlorien"
]
},
{
"name": "Aragorn",
"pinnables": [
"Sindarin",
"Eriador Church",
"The Rivendell Partnership",
"Emyn Muil",
"Misty Mountains",
"Lothlorien"
]
}
]'),
users := distinct (
for user in json_array_unpack(usersJson)
union (
update User
filter .realFirstName = <str>user['name']
set {
pins += (
select Mixin::Pinnable
filter [is Mixin::Named].name = <str>json_array_unpack(user['pinnables'])
)
}
)
),
modified := (select users filter .modifiedAt = datetime_of_statement())
select {`Modified Users` := modified.realFirstName ++ ' ' ++ modified.realLastName}
filter count(modified) > 0;

0 comments on commit d226f4d

Please sign in to comment.