Ctrl K
ComunidadGuías…

internal/enrollment/migrations.go

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
package enrollment

import (
	"os"
	"path/filepath"

	"github.com/yeomyeonggeori/blueclaw/migrations"
)

func writeMigrations(directoryPath string) error {
	if errorValue := os.MkdirAll(directoryPath, 0o755); errorValue != nil {
		return errorValue
	}
	migrationEntries, errorValue := migrations.Files.ReadDir(".")
	if errorValue != nil {
		return errorValue
	}
	for _, migrationEntry := range migrationEntries {
		migrationBytes, errorValue := migrations.Files.ReadFile(migrationEntry.Name())
		if errorValue != nil {
			return errorValue
		}
		if errorValue := os.WriteFile(filepath.Join(directoryPath, migrationEntry.Name()), migrationBytes, 0o644); errorValue != nil {
			return errorValue
		}
	}
	return nil
}