优化结构

This commit is contained in:
Yvan
2026-08-21 10:29:14 +08:00
parent 56980c8087
commit 055f6811ca
340 changed files with 382 additions and 382 deletions
+32
View File
@@ -0,0 +1,32 @@
package data
import (
datapayment "kra/internal/data/payment"
datasystem "kra/internal/data/repository"
"kra/pkg/database/migration"
"kra/pkg/module"
"gorm.io/gorm"
)
func InfrastructureMigrations() []migration.Step {
return []migration.Step{{
ID: "202608200001_data_infrastructure",
Migrate: func(db *gorm.DB) error {
return migration.CreateMissingTables(db, &integrationConfigPO{})
},
}}
}
// migrateAll is the single data-layer migration entry point. Module-specific
// schema work stays with the module that owns its persistent objects.
func migrateAll(db *gorm.DB, catalogs ...module.Catalog) error {
steps := InfrastructureMigrations()
if len(catalogs) > 0 && len(catalogs[0].MigrationSteps()) > 0 {
steps = append(steps, catalogs[0].MigrationSteps()...)
} else {
steps = append(steps, datasystem.Migrations()...)
steps = append(steps, datapayment.Migrations()...)
}
return migration.Run(db, steps)
}