27 lines
655 B
Go
27 lines
655 B
Go
package research_contracts_test
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestTruthBundlePersistenceMigrationIsOwnedAndIdempotent(t *testing.T) {
|
|
payload, err := os.ReadFile("../../database/migrations/034_epistemics_truth_bundles.sql")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
script := string(payload)
|
|
for _, required := range []string{
|
|
"SET ROLE epistemics_role",
|
|
"CREATE TABLE IF NOT EXISTS epistemics.truth_bundles",
|
|
"UNIQUE (snapshot_id, excerpt_id, claim_id)",
|
|
"CREATE INDEX IF NOT EXISTS truth_bundles_source_time_idx",
|
|
"RESET ROLE",
|
|
} {
|
|
if !strings.Contains(script, required) {
|
|
t.Fatalf("migration missing %q", required)
|
|
}
|
|
}
|
|
}
|