test: add skip segment overrides table check

This commit is contained in:
2026-06-03 09:10:28 +02:00
committed by Milas Holsting
parent 8c0f345bde
commit 1e6e619a3f
2 changed files with 29 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package db
import (
"context"
"database/sql"
"errors"
"fmt"
)
@@ -67,6 +68,9 @@ func (q *Queries) HasSkipSegmentOverrideTable(ctx context.Context) (bool, error)
const query = `SELECT name FROM sqlite_master WHERE type='table' AND name='skip_segment_override' LIMIT 1;`
var name sql.NullString
if err := q.db.QueryRowContext(ctx, query).Scan(&name); err != nil {
if errors.Is(err, sql.ErrNoRows) {
return false, nil
}
return false, fmt.Errorf("check skip segment override table: %w", err)
}
return name.Valid && name.String != "", nil