Skip to content

ci: add TypeORM migration consistency check to CI #41

@snowrugar-beep

Description

@snowrugar-beep

Problem Statement

No migration consistency check exists in CI. Entity changes may be deployed without corresponding migrations, causing schema drift between code and database.

Evidence

  • infrastructure/ci/quality-gates.yml — No migration check
  • Entity files: gist.entity.ts — defines columns
  • Migration files: CreateGistsTable.ts — defines columns

Impact

Entity changes may be deployed without corresponding migrations. Schema drift leads to runtime errors.

Proposed Solution

  1. Add CI step that runs npm run migration:generate in dry-run mode
  2. Compare generated migration with existing migrations
  3. Fail CI if there are pending changes
  4. Report the pending changes in CI output

Technical Requirements

  • Must run against a test database (use PostgreSQL service container)
  • Must not auto-generate migration files (dry-run only)

Acceptance Criteria

  1. CI step detects entity-migration drift
  2. CI fails if entity changes exist without corresponding migration
  3. CI reports which changes are pending
  4. No pending changes means all checks pass

File Inventory

  • infrastructure/ci/quality-gates.yml

Dependencies

Issue #32 (EnablePostGIS migration) must be created first.

Testing Strategy

  • Add a test entity change, verify CI detects it

Security Considerations

Prevents schema-related security issues (e.g., missing column constraints).

Definition of Done

  • Migration check in CI
  • Working correctly with drift detection

Metadata

Metadata

Assignees

Labels

Type

No type
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