Description
src/db/schema.ts references index(...) (lines 25-29), jsonb(...) (line 38), boolean(...) (line 71), and integer(...) (lines 85, 89) but only imports pgTable, uuid, varchar, timestamp, decimal, pgEnum, json, text on line 1, so the schema does not compile. Separately, the streams table has no deleted_at column, yet StreamRepository.findById/findAll already filter on streams.deletedAt and README.md documents a soft-delete flow. This issue makes the schema buildable and adds the missing soft-delete column plus a migration.
Requirements and context
- Extend the
drizzle-orm/pg-core import to include index, jsonb, boolean, and integer.
- Add
deletedAt: timestamp("deleted_at") (nullable) to the streams table so streams.deletedAt IS NULL filters compile and run.
- Generate a Drizzle migration that adds the
deleted_at column (and any index needed by findForExport's (created_at, id) ordering).
- Keep the existing
Stream/NewStream inferred types valid after the change.
- Non-functional:
npm run build must pass; the migration must be idempotent and live under drizzle/.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b feature/streams-deleted-at.
2. Implement changes — update the import line and table definition in src/db/schema.ts; run npm run db:generate to emit the migration under drizzle/.
3. Write/extend tests — this repo uses Jest + Supertest. Extend src/repositories/streamRepository.test.ts to assert that default queries exclude soft-deleted rows and includeDeleted: true returns them (the mock-query harness already exists there).
4. Test and commit —
npm run lint -- --max-warnings 0
npm run build
npm test
Example commit message
fix(db): add streams.deleted_at column and missing pg-core imports
Guidelines
Match the repo coverage standard (95% per jest.config.js) for any touched data-access code. Update docs/data-model.md. Do not alter unrelated columns or enums. Timeframe: 96 hours.
Description
src/db/schema.tsreferencesindex(...)(lines 25-29),jsonb(...)(line 38),boolean(...)(line 71), andinteger(...)(lines 85, 89) but only importspgTable, uuid, varchar, timestamp, decimal, pgEnum, json, texton line 1, so the schema does not compile. Separately, thestreamstable has nodeleted_atcolumn, yetStreamRepository.findById/findAllalready filter onstreams.deletedAtandREADME.mddocuments a soft-delete flow. This issue makes the schema buildable and adds the missing soft-delete column plus a migration.Requirements and context
drizzle-orm/pg-coreimport to includeindex,jsonb,boolean, andinteger.deletedAt: timestamp("deleted_at")(nullable) to thestreamstable sostreams.deletedAt IS NULLfilters compile and run.deleted_atcolumn (and any index needed byfindForExport's(created_at, id)ordering).Stream/NewStreaminferred types valid after the change.npm run buildmust pass; the migration must be idempotent and live underdrizzle/.Acceptance criteria
src/db/schema.tsimports all symbols it uses and compiles with no unresolved references.streamstable defines a nullabledeleted_attimestamp column.drizzle-kit generateand committed.StreamincludesdeletedAtand existing repository queries type-check against it.npm run buildexits 0.docs/data-model.mdis updated to mention the soft-delete column.Suggested execution
1. Fork the repo and create a branch —
git checkout -b feature/streams-deleted-at.2. Implement changes — update the import line and table definition in
src/db/schema.ts; runnpm run db:generateto emit the migration underdrizzle/.3. Write/extend tests — this repo uses Jest + Supertest. Extend
src/repositories/streamRepository.test.tsto assert that default queries exclude soft-deleted rows andincludeDeleted: truereturns them (the mock-query harness already exists there).4. Test and commit —
npm run lint -- --max-warnings 0 npm run build npm testExample commit message
Guidelines
Match the repo coverage standard (95% per
jest.config.js) for any touched data-access code. Updatedocs/data-model.md. Do not alter unrelated columns or enums. Timeframe: 96 hours.