You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to get companies or users or hypothetically users_orders from a bun model for this use case?
I need to update the sequence of a lot of tables because inserting fixtures with static ids doesn't update the sequences in postges
var Models []interface{} = []interface{}{
(*Company)(nil),
(*User)(nil),
(*Order)(nil),
}
for _, model := range models.Models {
// get name of struct using reflect / inflection packages?
_, err = db.NewRaw("SELECT setval(pg_get_serial_sequence('?', 'id'), (SELECT MAX(id) FROM ?));").Exec(context.Background())
if err != nil {
panic(err)
}
}
The text was updated successfully, but these errors were encountered:
Is there a way to get
companies
orusers
or hypotheticallyusers_orders
from a bun model for this use case?I need to update the sequence of a lot of tables because inserting fixtures with static ids doesn't update the sequences in postges
The text was updated successfully, but these errors were encountered: