Files
errors.bitreport.pt/database/error_reporting
1sonhadorandPaperclip b0b733d5e1 feat(BIT-247): consolidate error reporting repo from OTT
Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc,
docker-compose, and deployment docs into the dedicated repository. Paths updated
for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout.

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 18:20:27 +00:00
..

Error Reporting Database (BIT-178)

This folder contains the relational data model for the Error Reporting platform epic (BIT-154), implemented for task BIT-178.

Status and dependency:

  • Stack baseline is defined by docs/architecture/ADR-002-error-reporting-platform-phase1.md (Fastify + PostgreSQL + Redis queue for phase 1).
  • Schema changes must continue through versioned SQL migrations only (up + down), never ad hoc DDL.

Migration layout

Migrations are versioned and reversible (up + down), timestamped, and idempotent:

  1. 20260322043000_create_error_reporting_core.*
  2. 20260322044000_create_error_occurrences_and_states.*
  3. 20260322044500_add_ingest_idempotency.*
  4. 20260322045000_create_collectors_retention_and_audit.*

Apply manually (example)

psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f database/error_reporting/migrations/20260322043000_create_error_reporting_core.up.sql
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f database/error_reporting/migrations/20260322044000_create_error_occurrences_and_states.up.sql
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f database/error_reporting/migrations/20260322044500_add_ingest_idempotency.up.sql
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f database/error_reporting/migrations/20260322045000_create_collectors_retention_and_audit.up.sql

Rollback in reverse order with the matching *.down.sql files.

Dev seed fixtures

For local integration tests:

  • seed/dev_two_projects.sql creates two sample projects and ingest keys.
  • seed/dev_collector_http_fixture.sql creates one demo HTTP polling source.