Noticed whilst landing #476.
.claude/golang-expert/notification-channels.md states that a column added by a
migration must also be added to the CREATE TABLE in collector/src/database/schema.go,
so that a fresh install gets the final shape from migration 1 rather than depending on a
later migration's ALTER/DROP CONSTRAINT IF EXISTS path, which is the more fragile of
the two.
Migration 12 from #384 (query_id on metrics.pg_stat_activity) does not do this: the
partitioned parent's CREATE TABLE has no query_id column, so fresh installs get it
only via the migration. #476 restored the equivalent base-table change for its own
migration 14, which is what surfaced the difference.
So the convention is currently applied inconsistently in the tree, and one of two things
should happen: either add the column to the base table for migration 12, or drop the
convention from the knowledge base and say plainly that migrations alone define the
final shape. A knowledge-base entry that the code contradicts is the outcome worth
avoiding either way.
Noticed whilst landing #476.
.claude/golang-expert/notification-channels.mdstates that a column added by amigration must also be added to the
CREATE TABLEincollector/src/database/schema.go,so that a fresh install gets the final shape from migration 1 rather than depending on a
later migration's
ALTER/DROP CONSTRAINT IF EXISTSpath, which is the more fragile ofthe two.
Migration 12 from #384 (
query_idonmetrics.pg_stat_activity) does not do this: thepartitioned parent's
CREATE TABLEhas noquery_idcolumn, so fresh installs get itonly via the migration. #476 restored the equivalent base-table change for its own
migration 14, which is what surfaced the difference.
So the convention is currently applied inconsistently in the tree, and one of two things
should happen: either add the column to the base table for migration 12, or drop the
convention from the knowledge base and say plainly that migrations alone define the
final shape. A knowledge-base entry that the code contradicts is the outcome worth
avoiding either way.