[chore] Update a bunch of database dependencies (#1772)

* [chore] Update a bunch of database dependencies

* fix lil thing
This commit is contained in:
tobi 2023-05-12 14:33:40 +02:00 committed by GitHub
commit ec325fee14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
402 changed files with 35068 additions and 35401 deletions

View file

@ -33,8 +33,8 @@ import (
"codeberg.org/gruf/go-bytesize"
"github.com/google/uuid"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/stdlib"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/stdlib"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations"
@ -94,14 +94,11 @@ func doMigration(ctx context.Context, db *bun.DB) error {
}
group, err := migrator.Migrate(ctx)
if err != nil {
if err.Error() == "migrate: there are no any migrations" {
return nil
}
if err != nil && !strings.Contains(err.Error(), "no migrations") {
return err
}
if group.ID == 0 {
if group == nil || group.ID == 0 {
log.Info(ctx, "there are no new migrations to run")
return nil
}
@ -132,9 +129,8 @@ func NewBunDBService(ctx context.Context, state *state.State) (db.DB, error) {
return nil, fmt.Errorf("database type %s not supported for bundb", t)
}
// Add database query hook
// Add database query hooks.
conn.DB.AddQueryHook(queryHook{})
if config.GetTracingEnabled() {
conn.DB.AddQueryHook(tracing.InstrumentBun())
}
@ -431,7 +427,6 @@ func deriveBunDBPGOptions() (*pgx.ConnConfig, error) {
cfg.TLSConfig = tlsConfig
}
cfg.Database = database
cfg.PreferSimpleProtocol = true
cfg.RuntimeParams["application_name"] = config.GetApplicationName()
return cfg, nil