支持 S3 兼容对象存储 (#336)
* feat(storage): 支持 S3 对象存储 * fix(storage): 补齐 S3 对象文件后缀
This commit is contained in:
36
backend/cmd/migrate-sqlite-postgres/main_test.go
Normal file
36
backend/cmd/migrate-sqlite-postgres/main_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"infinite-canvas/backend/internal/database"
|
||||
|
||||
"gorm.io/gorm/schema"
|
||||
)
|
||||
|
||||
func TestMigrationListCoversSchemaModels(t *testing.T) {
|
||||
want := make(map[string]bool, len(database.Models()))
|
||||
cache := &sync.Map{}
|
||||
for _, value := range database.Models() {
|
||||
parsed, err := schema.Parse(value, cache, schema.NamingStrategy{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want[parsed.Table] = false
|
||||
}
|
||||
for _, migration := range migrations() {
|
||||
if _, exists := want[migration.name]; !exists {
|
||||
t.Fatalf("migration list contains unknown table %q", migration.name)
|
||||
}
|
||||
if want[migration.name] {
|
||||
t.Fatalf("migration list contains duplicate table %q", migration.name)
|
||||
}
|
||||
want[migration.name] = true
|
||||
}
|
||||
for table, covered := range want {
|
||||
if !covered {
|
||||
t.Errorf("migration list is missing table %q", table)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user