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>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user