How zara-te05/marga works
Marga versions database schema through reversible migrations: users create and share changes, then apply them to named environments with drift and risk checks. The principal path runs from the CLI through project files and the migrator to a database engine; the server provides shared repository history and environment reporting over an API, with a web front end. README documents additional branch databases, SQL console, interactive UI, and risk analysis. Edges reflect shown calls or README statements; unsampled capabilities are retained without guessed internal wiring.
Main entry points: cli Marga commands · handlers.go REST API · migrador.go Migration runner · main.go Marga server
Components 24
CLI workflows
- Marga commands
internal/controladores/cli - Project migrations
internal/datos/proyecto/proyecto.go - Local Git
internal/datos/gitlocal/gitlocal.go - Branch databases
internal/datos/ramabd/ramabd.go - Remote API client
internal/datos/remoto/remoto.go
Migration runtime
- Migration runner
internal/datos/migrador/migrador.go - Database engine
internal/datos/motor - Schema reader
internal/datos/motor/postgres/leer.go - Migration SQL generator
internal/datos/motor/postgres/generar_objetos.go - User database
Shared service
- Marga server
cmd/marga-server/main.go - REST API
internal/controladores/api/handlers.go - History and repository store
internal/datos/store/commits.go - Server PostgreSQL
internal/datos/database/database.go - Authentication security
internal/servicios/security/security.go
Domain logic
- Schema and diffs
internal/modelos/esquema - SQL risk analysis
internal/modelos/riesgo/riesgo.go - Migration checksums
internal/modelos/checksum/checksum.go
User interfaces
- Web dashboard
internal/vistas/web - Terminal themes
internal/vistas/terminal - Interactive UI
internal/controladores/cli/ui_vista.go - SQL console
internal/controladores/cli/sqlconsola.go
Other components
- Engineer
- Browser user
Connections 26
- Engineer → Marga commands: runs commands
- Marga commands → Project migrations: reads migrations
internal/controladores/cli/migrar.go - Marga commands → Migration runner: applies changes
internal/controladores/cli/migrar.go - Migration runner → Project migrations: loads migrations
internal/datos/migrador/migrador.go - Migration runner → Database engine: uses engine
internal/datos/migrador/migrador.go - Migration runner → User database: records and applies
internal/datos/migrador/migrador.go - Database engine → Schema reader: reads schema
internal/datos/motor/motor.go - Marga commands → Migration SQL generator: generates migration
- Migration SQL generator → Schema and diffs: uses schema model
internal/datos/motor/postgres/generar_objetos.go - Marga commands → SQL risk analysis: checks SQL risk
internal/controladores/cli/migrar.go - Marga commands → Remote API client: syncs history
- Remote API client → REST API: sends API requests
- Marga server → REST API: serves routes
cmd/marga-server/main.go - Marga server → Server PostgreSQL: opens database
cmd/marga-server/main.go - Marga server → History and repository store: creates store
cmd/marga-server/main.go - History and repository store → Server PostgreSQL: stores history
- REST API → History and repository store: handles repository data
internal/controladores/api/handlers.go - REST API → Authentication security: checks credentials
internal/controladores/api/handlers.go - REST API → Web dashboard: serves front end
- Browser user → REST API: uses dashboard API
- Marga commands → Local Git: reads branch state
internal/controladores/cli/ramasbd.go - Marga commands → Branch databases: manages branch databases
- Marga commands → Interactive UI: opens interactive UI
- Interactive UI → Terminal themes: renders themes
internal/controladores/cli/ui_vista.go - Marga commands → SQL console: opens SQL console
- Marga commands → Migration checksums: checks migration identity