Skip to content

Create initial type orm database migration#866

Open
Habibah371 wants to merge 2 commits into
DistinctCodes:mainfrom
Habibah371:Create-initial-TypeORM-database-migration
Open

Create initial type orm database migration#866
Habibah371 wants to merge 2 commits into
DistinctCodes:mainfrom
Habibah371:Create-initial-TypeORM-database-migration

Conversation

@Habibah371
Copy link
Copy Markdown

[BE-33] Create Initial TypeORM Database Migration Infrastructure for OpsCE

Summary

This PR introduces the initial TypeORM migration setup for the OpsCE module and replaces automatic schema synchronization with a migration-driven workflow. The change establishes a safer and more maintainable database management process suitable for staging and production environments.

Problem

The application currently relies on synchronize: true within the TypeORM configuration. While convenient during development, automatic schema synchronization can introduce unintended database changes and data integrity risks in non-local environments.

Additionally, the project lacks migration files, making schema changes difficult to track, review, version, and roll back.

Changes Implemented

Database Configuration

  • Added backend/src/opsce/database/dataSource.ts for TypeORM CLI operations.
  • Updated TypeORM configuration to use synchronize: false.

Migration Tooling

  • Added migration management scripts to backend/package.json:

    • migration:generate
    • migration:run
    • migration:revert

Initial Schema Migration

  • Generated and committed the initial migration based on all OpsCE entities created in BE-01 through BE-06.
  • Ensured the migration accurately reflects the current database schema.

Testing & Verification

  • Verified that npm run migration:run successfully creates the complete database schema.
  • Verified that npm run migration:revert successfully rolls back the latest migration.
  • Confirmed application startup works correctly with migrations applied and without schema synchronization enabled.

Benefits

  • Prevents uncontrolled schema modifications during application startup.
  • Enables version-controlled database evolution.
  • Improves deployment reliability across environments.
  • Provides a clear rollback path for schema changes.
  • Aligns the project with TypeORM best practices for production systems.

Acceptance Criteria

  • backend/src/opsce/database/dataSource.ts created for TypeORM CLI usage
  • synchronize: false configured in AppModule
  • Migration scripts added to backend/package.json
  • Initial migration generated and committed covering all OpsCE entities
  • npm run migration:run applies the schema successfully
  • npm run migration:revert rolls back the latest migration successfully
    Closes [BE-33] Create initial TypeORM database migration files in opsce module #758

add environment variable validation with Joi in opsce module
Create-initial-TypeORM-database-migration
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Habibah371 is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Habibah371 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[BE-33] Create initial TypeORM database migration files in opsce module

1 participant