Skip to content

synchronize is enabled for every non-production env, which now fights migrations #1210

Description

@RUKAYAT-CODER

src/config/database.config.ts sets synchronize: process.env.NODE_ENV !== 'production'. Now that a baseline migration exists (#1193) and migrations own the schema, any non-production env (dev, staging, CI where NODE_ENV isn't exactly production) that boots the app with TypeOrmModule.forRoot(getDatabaseConfig()) will have TypeORM synchronize the schema — which, given the entity↔migration drift in #1194, will drop migration-managed columns (e.g. users.country_code, course.currency, user_preferences.currency) because the entities don't declare them.

Fix: default synchronize to false everywhere and rely on migrations (optionally keep a narrowly-scoped dev-only opt-in via an env flag).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions