Skip to content

Add deleted_at column to streams schema and fix missing Drizzle imports in src/db/schema.ts #183

Description

@greatest0fallt1me

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

  • src/db/schema.ts imports all symbols it uses and compiles with no unresolved references.
  • The streams table defines a nullable deleted_at timestamp column.
  • A new migration file is generated via drizzle-kit generate and committed.
  • Stream includes deletedAt and existing repository queries type-check against it.
  • npm run build exits 0.
  • docs/data-model.md is updated to mention the soft-delete column.

Suggested execution

1. Fork the repo and create a branchgit 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GRANTFOX OSSGrantFox OSS programMAYBE REWARDEDGrantFox — potentially rewardedOFFICIAL CAMPAIGNGrantFox official campaignbackendBackend serviceimprovementRefactor, performance, or tech-debtintermediateModerate complexity

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions