Skip to content

[EdgeDB] Add Pins Seeding #3212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading