fix: make scripts/seeddb work again

This commit is contained in:
Sam 2023-03-08 02:07:46 +01:00
parent 11363d6769
commit c4b8b26ec7
Signed by: sam
GPG key ID: B4EF20DDE721CAA1

View file

@ -48,16 +48,10 @@ func main() {
os.Exit(1) os.Exit(1)
} }
err = pg.SetUserNames(ctx, tx, u.ID, []db.Name{ err = pg.SetUserNamesPronouns(ctx, tx, u.ID, []db.FieldEntry{
{Name: "testing 1", Status: db.StatusFavourite}, {Value: "testing 1", Status: db.StatusFavourite},
{Name: "testing 2", Status: db.StatusOkay}, {Value: "testing 2", Status: db.StatusOkay},
}) }, []db.PronounEntry{
if err != nil {
fmt.Println("error setting names:", err)
os.Exit(1)
}
err = pg.SetUserPronouns(ctx, tx, u.ID, []db.Pronoun{
{Pronouns: "it/it/its/its/itself", DisplayText: ptr("it/its"), Status: db.StatusFavourite}, {Pronouns: "it/it/its/its/itself", DisplayText: ptr("it/its"), Status: db.StatusFavourite},
{Pronouns: "they/them/their/theirs/themself", Status: db.StatusOkay}, {Pronouns: "they/them/their/theirs/themself", Status: db.StatusOkay},
}) })
@ -68,44 +62,54 @@ func main() {
err = pg.SetUserFields(ctx, tx, u.ID, []db.Field{ err = pg.SetUserFields(ctx, tx, u.ID, []db.Field{
{ {
Name: "Field 1", Name: "Field 1",
Favourite: []string{"Favourite 1"}, Entries: []db.FieldEntry{
Okay: []string{"Okay 1"}, {Value: "Favourite 1", Status: db.StatusFavourite},
Jokingly: []string{"Jokingly 1"}, {Value: "Okay 1", Status: db.StatusOkay},
FriendsOnly: []string{"Friends only 1"}, {Value: "Jokingly 1", Status: db.StatusJokingly},
Avoid: []string{"Avoid 1"}, {Value: "Friends only 1", Status: db.StatusFriendsOnly},
{Value: "Avoid 1", Status: db.StatusAvoid},
},
}, },
{ {
Name: "Field 2", Name: "Field 2",
Favourite: []string{"Favourite 2"}, Entries: []db.FieldEntry{
Okay: []string{"Okay 2"}, {Value: "Favourite 2", Status: db.StatusFavourite},
Jokingly: []string{"Jokingly 2"}, {Value: "Okay 2", Status: db.StatusOkay},
FriendsOnly: []string{"Friends only 2"}, {Value: "Jokingly 2", Status: db.StatusJokingly},
Avoid: []string{"Avoid 2"}, {Value: "Friends only 2", Status: db.StatusFriendsOnly},
{Value: "Avoid 2", Status: db.StatusAvoid},
},
}, },
{ {
Name: "Field 3", Name: "Field 3",
Favourite: []string{"Favourite 3"}, Entries: []db.FieldEntry{
Okay: []string{"Okay 3"}, {Value: "Favourite 3", Status: db.StatusFavourite},
Jokingly: []string{"Jokingly 3"}, {Value: "Okay 3", Status: db.StatusOkay},
FriendsOnly: []string{"Friends only 3"}, {Value: "Jokingly 3", Status: db.StatusJokingly},
Avoid: []string{"Avoid 3"}, {Value: "Friends only 3", Status: db.StatusFriendsOnly},
{Value: "Avoid 3", Status: db.StatusAvoid},
},
}, },
{ {
Name: "Field 4", Name: "Field 4",
Favourite: []string{"Favourite 4"}, Entries: []db.FieldEntry{
Okay: []string{"Okay 4"}, {Value: "Favourite 4", Status: db.StatusFavourite},
Jokingly: []string{"Jokingly 4"}, {Value: "Okay 4", Status: db.StatusOkay},
FriendsOnly: []string{"Friends only 4"}, {Value: "Jokingly 4", Status: db.StatusJokingly},
Avoid: []string{"Avoid 4"}, {Value: "Friends only 4", Status: db.StatusFriendsOnly},
{Value: "Avoid 4", Status: db.StatusAvoid},
},
}, },
{ {
Name: "Field 5", Name: "Field 5",
Favourite: []string{"Favourite 5"}, Entries: []db.FieldEntry{
Okay: []string{"Okay 5"}, {Value: "Favourite 5", Status: db.StatusFavourite},
Jokingly: []string{"Jokingly 5"}, {Value: "Okay 5", Status: db.StatusOkay},
FriendsOnly: []string{"Friends only 5"}, {Value: "Jokingly 5", Status: db.StatusJokingly},
Avoid: []string{"Avoid 5"}, {Value: "Friends only 5", Status: db.StatusFriendsOnly},
{Value: "Avoid 5", Status: db.StatusAvoid},
},
}, },
}) })
if err != nil { if err != nil {