Declare only the tables and columns pixa writes and reads (closes #310)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Removes output_content and request_cache, which nothing writes, and every column that was written but never read: the host, path, query and fetched_at of source_content, the content_type and created_at of variant_content, and the status_code, error_message and fetched_at of negative_cache. StoreVariant no longer takes a content type and StoreNegative no longer takes a status code or message, so extractStatusCode and the status constants, which only fed status_code, are gone. Reconciliation adopts a variant file without opening it, as its row no longer records a content type. Tests that set or checked a removed column follow. Model: opus-5-5
This commit is contained in:
@@ -128,7 +128,7 @@ func storeEvictionTestVariant(
|
||||
) {
|
||||
t.Helper()
|
||||
|
||||
err := cache.StoreVariant(t.Context(), key, bytes.NewReader(content), "image/webp")
|
||||
err := cache.StoreVariant(t.Context(), key, bytes.NewReader(content))
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant(%s) failed: %v", key, err)
|
||||
}
|
||||
@@ -437,7 +437,7 @@ func assertDisabledCacheWritesAreNoOps(
|
||||
ctx := t.Context()
|
||||
|
||||
err := cache.StoreVariant(
|
||||
ctx, imagerequest.CacheKey(req), bytes.NewReader([]byte("data")), "image/webp",
|
||||
ctx, imagerequest.CacheKey(req), bytes.NewReader([]byte("data")),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("StoreVariant on disabled cache must be a no-op, got error: %v", err)
|
||||
@@ -667,9 +667,8 @@ func TestStartEvictionReconcilesAccountingWithDisk(t *testing.T) {
|
||||
|
||||
// An accounting row whose file is missing must be dropped.
|
||||
_, err = cache.db.ExecContext(t.Context(),
|
||||
`INSERT INTO variant_content (cache_key, size_bytes, content_type)
|
||||
VALUES (?, ?, ?)`,
|
||||
"deadbeef0001", 700, "image/webp",
|
||||
`INSERT INTO variant_content (cache_key, size_bytes) VALUES (?, ?)`,
|
||||
"deadbeef0001", 700,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to insert stale variant accounting row: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user