Fix seed script

This commit is contained in:
Kalle 2023-01-14 14:43:14 +02:00
parent c9cd840e58
commit 7fab35a461

View File

@ -42,6 +42,7 @@ const basicSeeds = [
users,
userProfiles,
lastMonthsVoting,
syncPlusTiers,
lastMonthSuggestions,
thisMonthsSuggestions,
badgesToAdmin,
@ -83,8 +84,8 @@ function wipeDB() {
"CalendarEventBadge",
"CalendarEvent",
"UserWeapon",
"PlusTier",
"User",
"PlusVote",
"PlusSuggestion",
"PlusVote",
"TournamentBadgeOwner",
@ -299,6 +300,16 @@ function thisMonthsSuggestions() {
}
}
function syncPlusTiers() {
sql
.prepare(
/* sql */ `
insert into "PlusTier" ("userId", "tier") select "userId", "tier" from "FreshPlusTier" where "tier" is not null;
`
)
.run();
}
function badgesToAdmin() {
const availableBadgeIds = shuffle(
sql