Make the schema file describe only the tables and columns pixa uses #310

Open
opened 2026-10-21 12:49:55 +02:00 by clawbot · 1 comment
Collaborator

Item 4 of 15 of #168: "Rewrite the schema file to describe only what exists". Starts when #309 is squash-merged to next; #308 and #309 change the source and variant tables first, and this item edits what is left.

Today (next at 989da78)

internal/db/migrations/001_schema.sql carries two tables nothing writes (output_content, request_cache), source_metadata columns never written (expires_at, etag, last_modified) or always the same (status_code), negative_cache.status_code (502 for every row extractStatusCode can produce for a cached error), source_metadata.id (its only reader, Cache.GetSourceMetadataID, has no caller) and path_hash (there only to name the unread JSON file). Its comments describe a .meta file and directories that the earlier items remove. The schema is the first thing a newcomer reads to learn the data model.

Definition of done

  • 001_schema.sql, edited in place with no new migration file, declares only the tables, columns and indexes pixa writes and reads at that point; a column that only ever receives one value is gone, and so is every index on a removed column.
  • output_content and request_cache are gone, and so is anything left of source_metadata after #308.
  • The schema's comments describe only files and directories pixa writes today.
  • Code and tests that name a removed table or column are updated; a value that was always the same becomes a constant where the code still needs it.
  • README.md, where it describes the database, matches.

Approval and tests

sneak asked for each main recommendation of #168 to be its own issue, built before 1.0, one at a time in the order listed (#168 (comment)). That instruction is his approval of this item. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped.

Model: opus-5-5

Item 4 of 15 of https://git.eeqj.de/sneak/pixa/issues/168: "Rewrite the schema file to describe only what exists". Starts when https://git.eeqj.de/sneak/pixa/issues/309 is squash-merged to `next`; https://git.eeqj.de/sneak/pixa/issues/308 and https://git.eeqj.de/sneak/pixa/issues/309 change the source and variant tables first, and this item edits what is left. ## Today (`next` at `989da78`) `internal/db/migrations/001_schema.sql` carries two tables nothing writes (`output_content`, `request_cache`), `source_metadata` columns never written (`expires_at`, `etag`, `last_modified`) or always the same (`status_code`), `negative_cache.status_code` (502 for every row `extractStatusCode` can produce for a cached error), `source_metadata.id` (its only reader, `Cache.GetSourceMetadataID`, has no caller) and `path_hash` (there only to name the unread JSON file). Its comments describe a `.meta` file and directories that the earlier items remove. The schema is the first thing a newcomer reads to learn the data model. ## Definition of done - `001_schema.sql`, edited in place with no new migration file, declares only the tables, columns and indexes pixa writes and reads at that point; a column that only ever receives one value is gone, and so is every index on a removed column. - `output_content` and `request_cache` are gone, and so is anything left of `source_metadata` after https://git.eeqj.de/sneak/pixa/issues/308. - The schema's comments describe only files and directories pixa writes today. - Code and tests that name a removed table or column are updated; a value that was always the same becomes a constant where the code still needs it. - `README.md`, where it describes the database, matches. ## Approval and tests sneak asked for each main recommendation of https://git.eeqj.de/sneak/pixa/issues/168 to be its own issue, built before 1.0, one at a time in the order listed (https://git.eeqj.de/sneak/pixa/issues/168#issuecomment-153513). That instruction is his approval of this item. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-10-21 12:49:55 +02:00
clawbot self-assigned this 2026-10-21 12:49:55 +02:00
Author
Collaborator

Built in #326: 001_schema.sql loses output_content, request_cache and every column written but never read, in source_content, variant_content and negative_cache. The PR body lists each removal and why.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/pixa/pulls/326: `001_schema.sql` loses `output_content`, `request_cache` and every column written but never read, in `source_content`, `variant_content` and `negative_cache`. The PR body lists each removal and why. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#310