package db9

import (
	"strings"
	"testing"
)

func TestDB9SchemaRepairAddsAppendLogLayoutColumns(t *testing.T) {
	stmts := db9SchemaRepairStatements()
	for _, want := range []string{
		"ALTER TABLE files ADD COLUMN IF NOT EXISTS content_layout",
		"ALTER TABLE contents ADD COLUMN IF NOT EXISTS content_layout",
		"ALTER TABLE file_gc_tasks ADD COLUMN IF NOT EXISTS content_layout",
	} {
		found := false
		for _, stmt := range stmts {
			if strings.HasPrefix(stmt, want) {
				found = true
				break
			}
		}
		if !found {
			t.Fatalf("schema repair statements missing %q: %q", want, stmts)
		}
	}
}
