Files
fn_registry/functions/infra/migration.go
T
egutierrez ec36278c7b feat: tipos Migration/MigrationStatus y funciones puras migration_parse + migration_validate
Fase 1 del issue 0015. Tipos Go en functions/infra/migration.go con metadata en
types/infra/. Funciones puras: MigrationParse (parsea filename NNN_name.sql +
bloques -- +up/-- +down) y MigrationValidate (verifica secuencia, huecos,
duplicados, bloques vacios). 16 tests, todos pasan.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 02:01:34 +02:00

21 lines
746 B
Go

package infra
import "time"
// Migration represents a migration parsed from a .sql file.
type Migration struct {
Version int // sequential number (1, 2, 3...)
Name string // descriptive name (create_entities, add_status_column)
UpSQL string // SQL block to apply the migration
DownSQL string // SQL block to revert the migration
AppliedAt time.Time // zero value if not yet applied
}
// MigrationStatus represents the state of a migration relative to a database.
type MigrationStatus struct {
Version int // sequential number
Name string // descriptive name
Applied bool // true if already applied in the database
AppliedAt time.Time // when it was applied (zero value if pending)
}