Keep item revisions and edge decisions as records, and refuse to treat a missing index as no impact. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
729 B
Go
28 lines
729 B
Go
package traceimpact
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestMigrationDownKeepsDecisionLedger(t *testing.T) {
|
|
b, err := os.ReadFile("../../deploy/postgres/goose/00059_2026-09-20-project-trace.sql")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
parts := strings.Split(string(b), "-- +goose Down")
|
|
if len(parts) != 2 {
|
|
t.Fatal("missing goose down")
|
|
}
|
|
down := strings.ToLower(parts[1])
|
|
for _, forbidden := range []string{"drop table", "delete from", "truncate"} {
|
|
if strings.Contains(down, forbidden) {
|
|
t.Fatalf("down migration must not %s the trace ledger", forbidden)
|
|
}
|
|
}
|
|
if !strings.Contains(down, "project_trace_edge_decisions") {
|
|
t.Fatal("down comment should name the decision ledger it refuses to drop")
|
|
}
|
|
}
|