mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-17 21:43:01 -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
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