CRUD de contas (corrente/poupança/investimento/cartão) com saldo calculado automaticamente. account_id nullable em transactions. Widget patrimônio no dashboard. Tela /contas. Seletor de conta nas transações manuais. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
32 lines
570 B
Go
32 lines
570 B
Go
package migration
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
"fmt"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
)
|
|
|
|
//go:embed sql/001_initial.sql
|
|
var m001 string
|
|
|
|
//go:embed sql/002_add_external_id.sql
|
|
var m002 string
|
|
|
|
//go:embed sql/003_recurring_ignores.sql
|
|
var m003 string
|
|
|
|
//go:embed sql/004_accounts.sql
|
|
var m004 string
|
|
|
|
func Run(ctx context.Context, pool *pgxpool.Pool) error {
|
|
migrations := []string{m001, m002, m003, m004}
|
|
for i, sql := range migrations {
|
|
if _, err := pool.Exec(ctx, sql); err != nil {
|
|
return fmt.Errorf("migration %03d: %w", i+1, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|