Phase 3 added deployment strutures migration to migrateAllStructures

This commit is contained in:
2026-01-16 16:44:57 +01:00
parent 4b8113aada
commit 0438307700
2 changed files with 21 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
package migrations
import (
"gorm.io/gorm"
)
// MigrateStructure migrates all deployment-related structures to the database
func MigrateStructure(db *gorm.DB) error {
// Migrate deployment package structures (schema_version and migration_history tables)
return db.AutoMigrate(
&SchemaVersion{},
&MigrationHistory{},
)
}
+7
View File
@@ -3,6 +3,7 @@ package maintenance
import (
"bamort/config"
"bamort/database"
"bamort/deployment/migrations"
"bamort/logger"
"bamort/models"
"bamort/user"
@@ -52,6 +53,12 @@ func migrateAllStructures(db *gorm.DB) error {
return fmt.Errorf("failed to migrate gsmaster structures: %w", err)
}
logger.Debug("Migriere Deployment-Strukturen...")
if err := migrations.MigrateStructure(db); err != nil {
logger.Error("Fehler beim Migrieren der Deployment-Strukturen: %s", err.Error())
return fmt.Errorf("failed to migrate deployment structures: %w", err)
}
/*if err := importer.MigrateStructure(db); err != nil {
return fmt.Errorf("failed to migrate importer structures: %w", err)
}*/