mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-03 00:42:25 -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
31
vendor/github.com/uptrace/bun/migrate/diff.go
generated
vendored
31
vendor/github.com/uptrace/bun/migrate/diff.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package migrate
|
||||
|
||||
import (
|
||||
"github.com/uptrace/bun/internal/ordered"
|
||||
"github.com/uptrace/bun/migrate/sqlschema"
|
||||
)
|
||||
|
||||
|
|
@ -22,8 +23,8 @@ func diff(got, want sqlschema.Database, opts ...diffOption) *changeset {
|
|||
}
|
||||
|
||||
func (d *detector) detectChanges() *changeset {
|
||||
currentTables := d.current.GetTables()
|
||||
targetTables := d.target.GetTables()
|
||||
currentTables := toOrderedMap(d.current.GetTables())
|
||||
targetTables := toOrderedMap(d.target.GetTables())
|
||||
|
||||
RenameCreate:
|
||||
for _, wantPair := range targetTables.Pairs() {
|
||||
|
|
@ -99,10 +100,19 @@ RenameCreate:
|
|||
return &d.changes
|
||||
}
|
||||
|
||||
// detechColumnChanges finds renamed columns and, if checkType == true, columns with changed type.
|
||||
// toOrderedMap transforms a slice of objects to an ordered map, using return of GetName() as key.
|
||||
func toOrderedMap[V interface{ GetName() string }](named []V) *ordered.Map[string, V] {
|
||||
m := ordered.NewMap[string, V]()
|
||||
for _, v := range named {
|
||||
m.Store(v.GetName(), v)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// detectColumnChanges finds renamed columns and, if checkType == true, columns with changed type.
|
||||
func (d *detector) detectColumnChanges(current, target sqlschema.Table, checkType bool) {
|
||||
currentColumns := current.GetColumns()
|
||||
targetColumns := target.GetColumns()
|
||||
currentColumns := toOrderedMap(current.GetColumns())
|
||||
targetColumns := toOrderedMap(target.GetColumns())
|
||||
|
||||
ChangeRename:
|
||||
for _, tPair := range targetColumns.Pairs() {
|
||||
|
|
@ -265,7 +275,7 @@ type detector struct {
|
|||
// cmpType determines column type equivalence.
|
||||
// Default is direct comparison with '==' operator, which is inaccurate
|
||||
// due to the existence of dialect-specific type aliases. The caller
|
||||
// should pass a concrete InspectorDialect.EquuivalentType for robust comparison.
|
||||
// should pass a concrete InspectorDialect.EquivalentType for robust comparison.
|
||||
cmpType CompareTypeFunc
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +293,7 @@ func (d detector) equalColumns(col1, col2 sqlschema.Column) bool {
|
|||
}
|
||||
|
||||
func (d detector) makeTargetColDef(current, target sqlschema.Column) sqlschema.Column {
|
||||
// Avoid unneccessary type-change migrations if the types are equivalent.
|
||||
// Avoid unnecessary type-change migrations if the types are equivalent.
|
||||
if d.cmpType(current, target) {
|
||||
target = &sqlschema.BaseColumn{
|
||||
Name: target.GetName(),
|
||||
|
|
@ -311,8 +321,7 @@ func equalSignatures(t1, t2 sqlschema.Table, eq CompareTypeFunc) bool {
|
|||
// signature is a set of column definitions, which allows "relation/name-agnostic" comparison between them;
|
||||
// meaning that two columns are considered equal if their types are the same.
|
||||
type signature struct {
|
||||
|
||||
// underlying stores the number of occurences for each unique column type.
|
||||
// underlying stores the number of occurrences for each unique column type.
|
||||
// It helps to account for the fact that a table might have multiple columns that have the same type.
|
||||
underlying map[sqlschema.BaseColumn]int
|
||||
|
||||
|
|
@ -330,7 +339,7 @@ func newSignature(t sqlschema.Table, eq CompareTypeFunc) signature {
|
|||
|
||||
// scan iterates over table's field and counts occurrences of each unique column definition.
|
||||
func (s *signature) scan(t sqlschema.Table) {
|
||||
for _, icol := range t.GetColumns().Values() {
|
||||
for _, icol := range t.GetColumns() {
|
||||
scanCol := icol.(*sqlschema.BaseColumn)
|
||||
// This is slightly more expensive than if the columns could be compared directly
|
||||
// and we always did s.underlying[col]++, but we get type-equivalence in return.
|
||||
|
|
@ -368,7 +377,7 @@ func (s *signature) Equals(other signature) bool {
|
|||
}
|
||||
|
||||
// refMap is a utility for tracking superficial changes in foreign keys,
|
||||
// which do not require any modificiation in the database.
|
||||
// which do not require any modification in the database.
|
||||
// Modern SQL dialects automatically updated foreign key constraints whenever
|
||||
// a column or a table is renamed. Detector can use refMap to ignore any
|
||||
// differences in foreign keys which were caused by renamed column/table.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue