package data

import (
	datapayment "kra/internal/modules/system/data/payment"
	datasystem "kra/internal/modules/system/data/repository"
	"kra/internal/platform/database/migration"

	"gorm.io/gorm"
)

// 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) error {
	steps := []migration.Step{{
		ID: "202608200001_data_infrastructure",
		Migrate: func(db *gorm.DB) error {
			return migration.CreateMissingTables(db, &integrationConfigPO{})
		},
	}}
	steps = append(steps, datasystem.Migrations()...)
	steps = append(steps, datapayment.Migrations()...)
	return migration.Run(db, steps)
}
