mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-09 22:17:29 -06:00
[chore] update go dependencies (#4304)
- github.com/KimMachineGun/automemlimit v0.7.2 => v0.7.3
- github.com/gin-contrib/cors v1.7.5 => v1.7.6
- github.com/minio/minio-go/v7 v7.0.92 => v7.0.94
- github.com/spf13/cast v1.8.0 => v1.9.2
- github.com/uptrace/bun{,/*} v1.2.11 => v1.2.14
- golang.org/x/image v0.27.0 => v0.28.0
- golang.org/x/net v0.40.0 => v0.41.0
- code.superseriousbusiness.org/go-swagger v0.31.0-gts-go1.23-fix => v0.32.3-gts-go1.23-fix
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4304
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
7712885038
commit
8b0ea56027
294 changed files with 139999 additions and 21873 deletions
53
vendor/github.com/uptrace/bun/migrate/auto.go
generated
vendored
53
vendor/github.com/uptrace/bun/migrate/auto.go
generated
vendored
|
|
@ -17,17 +17,21 @@ import (
|
|||
|
||||
type AutoMigratorOption func(m *AutoMigrator)
|
||||
|
||||
// WithModel adds a bun.Model to the scope of migrations.
|
||||
// WithModel adds a bun.Model to the migration scope.
|
||||
func WithModel(models ...interface{}) AutoMigratorOption {
|
||||
return func(m *AutoMigrator) {
|
||||
m.includeModels = append(m.includeModels, models...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithExcludeTable tells the AutoMigrator to ignore a table in the database.
|
||||
// WithExcludeTable tells AutoMigrator to exclude database tables from the migration scope.
|
||||
// This prevents AutoMigrator from dropping tables which may exist in the schema
|
||||
// but which are not used by the application.
|
||||
//
|
||||
// Expressions may make use of the wildcards supported by the SQL LIKE operator:
|
||||
// - % as a wildcard
|
||||
// - _ as a single character
|
||||
//
|
||||
// Do not exclude tables included via WithModel, as BunModelInspector ignores this setting.
|
||||
func WithExcludeTable(tables ...string) AutoMigratorOption {
|
||||
return func(m *AutoMigrator) {
|
||||
|
|
@ -35,7 +39,17 @@ func WithExcludeTable(tables ...string) AutoMigratorOption {
|
|||
}
|
||||
}
|
||||
|
||||
// WithSchemaName changes the default database schema to migrate objects in.
|
||||
// WithExcludeForeignKeys tells AutoMigrator to exclude a foreign key constaint
|
||||
// from the migration scope. This prevents AutoMigrator from dropping foreign keys
|
||||
// that are defined manually via CreateTableQuery.ForeignKey().
|
||||
func WithExcludeForeignKeys(fks ...sqlschema.ForeignKey) AutoMigratorOption {
|
||||
return func(m *AutoMigrator) {
|
||||
m.excludeForeignKeys = append(m.excludeForeignKeys, fks...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithSchemaName sets the database schema to migrate objects in.
|
||||
// By default, dialects' default schema is used.
|
||||
func WithSchemaName(schemaName string) AutoMigratorOption {
|
||||
return func(m *AutoMigrator) {
|
||||
m.schemaName = schemaName
|
||||
|
|
@ -82,7 +96,7 @@ func WithMigrationsDirectoryAuto(directory string) AutoMigratorOption {
|
|||
// database schema automatically.
|
||||
//
|
||||
// Usage:
|
||||
// 1. Generate migrations and apply them au once with AutoMigrator.Migrate().
|
||||
// 1. Generate migrations and apply them at once with AutoMigrator.Migrate().
|
||||
// 2. Create up- and down-SQL migration files and apply migrations using Migrator.Migrate().
|
||||
//
|
||||
// While both methods produce complete, reversible migrations (with entries in the database
|
||||
|
|
@ -124,8 +138,8 @@ type AutoMigrator struct {
|
|||
// includeModels define the migration scope.
|
||||
includeModels []interface{}
|
||||
|
||||
// excludeTables are excluded from database inspection.
|
||||
excludeTables []string
|
||||
excludeTables []string // excludeTables are excluded from database inspection.
|
||||
excludeForeignKeys []sqlschema.ForeignKey // excludeForeignKeys are excluded from database inspection.
|
||||
|
||||
// diffOpts are passed to detector constructor.
|
||||
diffOpts []diffOption
|
||||
|
|
@ -150,7 +164,11 @@ func NewAutoMigrator(db *bun.DB, opts ...AutoMigratorOption) (*AutoMigrator, err
|
|||
}
|
||||
am.excludeTables = append(am.excludeTables, am.table, am.locksTable)
|
||||
|
||||
dbInspector, err := sqlschema.NewInspector(db, sqlschema.WithSchemaName(am.schemaName), sqlschema.WithExcludeTables(am.excludeTables...))
|
||||
dbInspector, err := sqlschema.NewInspector(db,
|
||||
sqlschema.WithSchemaName(am.schemaName),
|
||||
sqlschema.WithExcludeTables(am.excludeTables...),
|
||||
sqlschema.WithExcludeForeignKeys(am.excludeForeignKeys...),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -252,12 +270,12 @@ func (am *AutoMigrator) createSQLMigrations(ctx context.Context, transactional b
|
|||
migrations := NewMigrations(am.migrationsOpts...)
|
||||
migrations.Add(Migration{
|
||||
Name: name,
|
||||
Up: changes.Up(am.dbMigrator),
|
||||
Down: changes.Down(am.dbMigrator),
|
||||
Up: wrapMigrationFunc(changes.Up(am.dbMigrator)),
|
||||
Down: wrapMigrationFunc(changes.Down(am.dbMigrator)),
|
||||
Comment: "Changes detected by bun.AutoMigrator",
|
||||
})
|
||||
|
||||
// Append .tx.up.sql or .up.sql to migration name, dependin if it should be transactional.
|
||||
// Append .tx.up.sql or .up.sql to migration name, depending if it should be transactional.
|
||||
fname := func(direction string) string {
|
||||
return name + map[bool]string{true: ".tx.", false: "."}[transactional] + direction + ".sql"
|
||||
}
|
||||
|
|
@ -336,7 +354,7 @@ func (c *changeset) apply(ctx context.Context, db *bun.DB, m sqlschema.Migrator)
|
|||
}
|
||||
|
||||
for _, op := range c.operations {
|
||||
if _, isComment := op.(*comment); isComment {
|
||||
if _, skip := op.(*Unimplemented); skip {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -359,17 +377,22 @@ func (c *changeset) WriteTo(w io.Writer, m sqlschema.Migrator) error {
|
|||
|
||||
b := internal.MakeQueryBytes()
|
||||
for _, op := range c.operations {
|
||||
if c, isComment := op.(*comment); isComment {
|
||||
if comment, isComment := op.(*Unimplemented); isComment {
|
||||
b = append(b, "/*\n"...)
|
||||
b = append(b, *c...)
|
||||
b = append(b, *comment...)
|
||||
b = append(b, "\n*/"...)
|
||||
continue
|
||||
}
|
||||
|
||||
b, err = m.AppendSQL(b, op)
|
||||
// Append each query separately, merge later.
|
||||
// Dialects assume that the []byte only holds
|
||||
// the contents of a single query and may be misled.
|
||||
queryBytes := internal.MakeQueryBytes()
|
||||
queryBytes, err = m.AppendSQL(queryBytes, op)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write changeset: %w", err)
|
||||
}
|
||||
b = append(b, queryBytes...)
|
||||
b = append(b, ";\n"...)
|
||||
}
|
||||
if _, err := w.Write(b); err != nil {
|
||||
|
|
@ -409,7 +432,7 @@ func (c *changeset) ResolveDependencies() error {
|
|||
}
|
||||
|
||||
// visit iterates over c.operations until it finds all operations that depend on the current one
|
||||
// or runs into cirtular dependency, in which case it will return an error.
|
||||
// or runs into circular dependency, in which case it will return an error.
|
||||
visit = func(op Operation) error {
|
||||
switch status[op] {
|
||||
case visited:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue