merge: issue/0015-db-migrations — SQL migration system
# Conflicts: # registry.db
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Migration
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type Migration struct {
|
||||
Version int
|
||||
Name string
|
||||
UpSQL string
|
||||
DownSQL string
|
||||
AppliedAt time.Time
|
||||
}
|
||||
description: "Migracion SQL parseada desde un archivo .sql con marcadores -- +up / -- +down. Version es el numero secuencial, AppliedAt es zero value si pendiente."
|
||||
tags: [migration, database, sql, schema, sqlite]
|
||||
uses_types: []
|
||||
file_path: "functions/infra/migration.go"
|
||||
---
|
||||
|
||||
## Notas
|
||||
|
||||
Tipo producto — todos los campos siempre presentes. `AppliedAt` es `time.Time{}` (zero value) si la migracion aun no fue aplicada. `UpSQL` y `DownSQL` son el contenido de los bloques delimitados por `-- +up` y `-- +down` en el archivo .sql.
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: MigrationStatus
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
type MigrationStatus struct {
|
||||
Version int
|
||||
Name string
|
||||
Applied bool
|
||||
AppliedAt time.Time
|
||||
}
|
||||
description: "Estado de una migracion respecto a una base de datos concreta. Applied=true si ya fue ejecutada, AppliedAt indica cuando."
|
||||
tags: [migration, database, sql, schema, sqlite, status]
|
||||
uses_types: []
|
||||
file_path: "functions/infra/migration.go"
|
||||
---
|
||||
|
||||
## Notas
|
||||
|
||||
Tipo producto. `Applied` es `false` y `AppliedAt` es zero value para migraciones pendientes. Se usa como resultado de `migration_status` para cruzar archivos en disco con registros en `_migrations`.
|
||||
Reference in New Issue
Block a user