Add inserted_at to lightning_columns
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 5
- Forks
- 10
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 17
Description
Summary
lightning_clients doesn't record when a client was provisioned, so we can't tell when a client was added, and a future client list command would have nothing to sort or display by.
The runner records each applied filename in _migrations and only runs files it hasn't recorded yet (platform/src/db/migrate.ts:40-45); that table is the source of truth, not the IF NOT EXISTS guards in the DDL (platform/src/db/migrate.ts:5-7).
Proposed change
- Add
platform/migrations/0002_lightning_clients_inserted_at.sqlwith:
Existing rows backfill to the migration time, which is fine for a provisioning timestamp.ALTER TABLE lightning_clients ADD COLUMN IF NOT EXISTS inserted_at TIMESTAMPTZ NOT NULL DEFAULT now(); - No change needed in
store.ts:insertClientnames its columns explicitly (name,auth_token_hash,anthropic_api_key), andDEFAULT now()fills ininserted_aton insert (platform/src/auth/client/store.ts:34-37). Verified. - Extend the column assertions in
db.test.tsto expectinserted_at(platform/test/db.test.ts:36-39).
Acceptance criteria
-
platform/migrations/0002_lightning_clients_inserted_at.sqladdsinserted_at TIMESTAMPTZ NOT NULL DEFAULT now()viaALTER TABLE ... ADD COLUMN IF NOT EXISTS -
0001_lightning_clients.sqlis left untouched -
bun run migrateapplies0002against a DB that already has0001recorded, and is a no-op on a second run (platform/src/db/migrate.ts:42-47) - Existing rows have
inserted_atbackfilled to the migration time -
db.test.tsassertsinserted_atis present inlightning_clients(platform/test/db.test.ts:36-39) - No change required to
insertClientinstore.ts(confirmed the default populates it)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with platform/src/db/migrate.ts:40-47 and platform/test/db.test.ts:36-39, then inspect the existing migration format in platform/migrations/0001_lightning_clients.sql. Run bun run migrate against a database with 0001 recorded and execute the database tests. Done means 0002 applies once, existing rows receive inserted_at, and the column assertion passes without changes to store.ts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, sql, typescript
- Domain
- database, testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100