mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-08 21:01:10 -06:00
[chore] Update a bunch of database dependencies (#1772)
* [chore] Update a bunch of database dependencies * fix lil thing
This commit is contained in:
parent
66df974143
commit
ec325fee14
402 changed files with 35068 additions and 35401 deletions
12
vendor/github.com/uptrace/bun/migrate/migration.go
generated
vendored
12
vendor/github.com/uptrace/bun/migrate/migration.go
generated
vendored
|
|
@ -97,10 +97,15 @@ func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error {
|
|||
}
|
||||
|
||||
var retErr error
|
||||
var execErr error
|
||||
|
||||
defer func() {
|
||||
if tx, ok := idb.(bun.Tx); ok {
|
||||
retErr = tx.Commit()
|
||||
if execErr != nil {
|
||||
retErr = tx.Rollback()
|
||||
} else {
|
||||
retErr = tx.Commit()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +118,9 @@ func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error {
|
|||
}()
|
||||
|
||||
for _, q := range queries {
|
||||
if _, err := idb.ExecContext(ctx, q); err != nil {
|
||||
return err
|
||||
_, execErr = idb.ExecContext(ctx, q)
|
||||
if execErr != nil {
|
||||
return execErr
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
2
vendor/github.com/uptrace/bun/migrate/migrations.go
generated
vendored
2
vendor/github.com/uptrace/bun/migrate/migrations.go
generated
vendored
|
|
@ -157,7 +157,7 @@ func migrationFile() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
var fnameRE = regexp.MustCompile(`^(\d{14})_([0-9a-z_\-]+)\.`)
|
||||
var fnameRE = regexp.MustCompile(`^(\d{1,14})_([0-9a-z_\-]+)\.`)
|
||||
|
||||
func extractMigrationName(fpath string) (string, string, error) {
|
||||
fname := filepath.Base(fpath)
|
||||
|
|
|
|||
10
vendor/github.com/uptrace/bun/migrate/migrator.go
generated
vendored
10
vendor/github.com/uptrace/bun/migrate/migrator.go
generated
vendored
|
|
@ -217,6 +217,7 @@ func (m *Migrator) Rollback(ctx context.Context, opts ...MigrationOption) (*Migr
|
|||
|
||||
type goMigrationConfig struct {
|
||||
packageName string
|
||||
goTemplate string
|
||||
}
|
||||
|
||||
type GoMigrationOption func(cfg *goMigrationConfig)
|
||||
|
|
@ -227,12 +228,19 @@ func WithPackageName(name string) GoMigrationOption {
|
|||
}
|
||||
}
|
||||
|
||||
func WithGoTemplate(template string) GoMigrationOption {
|
||||
return func(cfg *goMigrationConfig) {
|
||||
cfg.goTemplate = template
|
||||
}
|
||||
}
|
||||
|
||||
// CreateGoMigration creates a Go migration file.
|
||||
func (m *Migrator) CreateGoMigration(
|
||||
ctx context.Context, name string, opts ...GoMigrationOption,
|
||||
) (*MigrationFile, error) {
|
||||
cfg := &goMigrationConfig{
|
||||
packageName: "migrations",
|
||||
goTemplate: goTemplate,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(cfg)
|
||||
|
|
@ -245,7 +253,7 @@ func (m *Migrator) CreateGoMigration(
|
|||
|
||||
fname := name + ".go"
|
||||
fpath := filepath.Join(m.migrations.getDirectory(), fname)
|
||||
content := fmt.Sprintf(goTemplate, cfg.packageName)
|
||||
content := fmt.Sprintf(cfg.goTemplate, cfg.packageName)
|
||||
|
||||
if err := ioutil.WriteFile(fpath, []byte(content), 0o644); err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue