package testutils import ( "path/filepath" "runtime" ) // GetMigrationsPath 获取数据库迁移文件的路径 func GetMigrationsPath() string { _, filename, _, ok := runtime.Caller(0) if !ok { panic("无法获取当前文件路径") } projectRoot := filepath.Join(filepath.Dir(filename), "..", "..") migrationsPath := filepath.Join(projectRoot, "migrations") return migrationsPath }