package database

import "gorm.io/gorm"

func MigrateStructure(db ...*gorm.DB) error {
	// Use provided DB or default to database.DB
	var targetDB *gorm.DB
	if len(db) > 0 && db[0] != nil {
		targetDB = db[0]
	} else {
		targetDB = DB
	}

	err := targetDB.AutoMigrate()
	if err != nil {
		return err
	}
	return nil
}
