feat(datastore): add last_pulled_at column to tags table
What
Adds a nullable last_pulled_at timestamptz column to the tags table. This is the foundational schema change for pull-activity-based cleanup policies — recording when a tag was last pulled.
No backfill: existing tags stay NULL until populated by a later change. Nothing reads or writes the column yet; this MR is schema-only.
Prerequisite for gitlab#600850. Related to #2311.
Scope
This MR was intentionally reduced to step 1: the column only, per review feedback (thread). The write path and API exposure follow as separate MRs so each is small and easy to review/roll back:
- This MR — add the
last_pulled_atcolumn (premigration + regeneratedstructure.sql). - Follow-up: write path — populate the column off the hot manifest-pull path using an async, batched approach (in-memory aggregation + periodic bulk
UPDATE), rather than a synchronous per-pull statement. - Follow-up: API — expose
last_pulled_aton the GitLab v1tags/listandtags/detailresponses once the column is populated.
Changes
premigrations/20260529120000_add_tags_last_pulled_at_column.go—ALTER TABLE tags ADD COLUMN IF NOT EXISTS last_pulled_at timestamp WITH time zone(idempotent up/down).structure.sql— regenerated to include the new column.
Open question
The column is named last_pulled_at to match existing pull terminology in the handlers and queue bridge. Flagging in case last_downloaded_at is preferred — easiest to settle before it ships.
Testing
go build ./... and go vet pass. The structure.sql-consistency test runs in CI against a registry Postgres.