Skip to content

feat(schema): add schema versioning, tracking, diff visualization, and history access#668

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Jess52487:feature/schema-tracking
May 27, 2026
Merged

feat(schema): add schema versioning, tracking, diff visualization, and history access#668
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Jess52487:feature/schema-tracking

Conversation

@Jess52487
Copy link
Copy Markdown
Contributor

closes #637

Overview

Implements a complete schema‑versioning subsystem that:

  • Persists each schema snapshot in a schema_version table (checksum‑based deduplication)
  • Records granular changes in a schema_change table for every snapshot
  • Provides a diff service that returns a structured list of SchemaChangeDiff objects
  • Exposes REST endpoints for:
    • Capturing a new version (POST /schema/versions)
    • Listing historical versions (GET /schema/versions)
    • Fetching a specific version (GET /schema/:id)
    • Getting a diff between two versions (GET /schema/:id/diff/:previousId)

Why

  • Enables auditability of schema evolution over time.
  • Allows developers and operators to visualize exactly what changed between releases.
  • Supports rollback planning and impact analysis.

Implementation Details

  • Entities: SchemaVersion, SchemaChange
  • Migration: Creates the two tables with appropriate indexes.
  • DTOs: CreateSchemaVersionDto, GetSchemaDiffDto
  • Services:
    • SchemaDiffService (pure diff logic)
    • SchemaTrackingService (persistence & retrieval)
  • Controller: SchemaController with the above endpoints.
  • Module: SchemaTrackingModule (self‑contained; not imported into AppModule).
  • Tests:
    • Unit tests for SchemaTrackingService
    • E2E tests for SchemaController routes.

Verification

  • Run npm test (unit + e2e) – all pass.
  • Execute migration scripts against a test DB.
  • Use curl or Postman to verify each endpoint returns the expected JSON payloads.

Staged Commits

  1. Entities & migrationentities/*.entity.ts, migration file.
  2. DTOsdto/*.dto.ts.
  3. Diff utility serviceservices/schema-diff.service.ts.
  4. Tracking serviceservices/schema-tracking.service.ts.
  5. Controller & routingcontrollers/schema.controller.ts.
  6. Module wiringmodules/schema-tracking.module.ts.
  7. Unit teststests/schema-tracking.service.spec.ts.
  8. E2E teststests/schema.controller.e2e-spec.ts.

Related Issue

Closes #<ISSUE‑ID> – Track schema changes over time


You can now open the PR with the above title and description. Let me know if any tweaks are needed!

@RUKAYAT-CODER RUKAYAT-CODER merged commit f31f089 into rinafcode:main May 27, 2026
5 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement automated schema versioning

2 participants