backend: update migration README to clarify schema versioning and MIGRATION_REV timestamp requirements
This commit is contained in:
parent
2a1575768f
commit
3142f9fe79
@ -54,11 +54,13 @@ export const INTERNAL_CONFIG = {
|
||||
// MongoDB Schema Versions
|
||||
// These define the current schema version for each collection
|
||||
// Increment when making breaking changes to the schema structure
|
||||
GLOBAL_CONFIG_SCHEMA_VERSION: 1 as SchemaVersion,
|
||||
USER_SCHEMA_VERSION: 1 as SchemaVersion,
|
||||
API_KEY_SCHEMA_VERSION: 1 as SchemaVersion,
|
||||
ROOM_SCHEMA_VERSION: 1 as SchemaVersion,
|
||||
RECORDING_SCHEMA_VERSION: 1 as SchemaVersion
|
||||
// IMPORTANT: whenever you increment a schema version, update the MIGRATION_REV timestamp too.
|
||||
// This helps surface merge conflicts when multiple branches create schema migrations concurrently.
|
||||
GLOBAL_CONFIG_SCHEMA_VERSION: 1 as SchemaVersion, // MIGRATION_REV: 1771328577054
|
||||
USER_SCHEMA_VERSION: 1 as SchemaVersion, // MIGRATION_REV: 1771328577054
|
||||
API_KEY_SCHEMA_VERSION: 1 as SchemaVersion, // MIGRATION_REV: 1771328577054
|
||||
ROOM_SCHEMA_VERSION: 1 as SchemaVersion, // MIGRATION_REV: 1771328577054
|
||||
RECORDING_SCHEMA_VERSION: 1 as SchemaVersion // MIGRATION_REV: 1771328577054
|
||||
};
|
||||
|
||||
// This function is used to set private configuration values for testing purposes.
|
||||
|
||||
@ -76,17 +76,25 @@ export interface MeetRoom extends MeetRoomOptions {
|
||||
|
||||
### Step 2: Update Schema Version in Configuration
|
||||
|
||||
In `src/config/internal-config.ts`, increment the version constant:
|
||||
In `src/config/internal-config.ts`, increment the version constant and update the `MIGRATION_REV` timestamp comment on the same line:
|
||||
|
||||
```typescript
|
||||
// internal-config.ts
|
||||
export const INTERNAL_CONFIG = {
|
||||
// ... other config
|
||||
ROOM_SCHEMA_VERSION: 2 // Was 1
|
||||
ROOM_SCHEMA_VERSION: 2 as SchemaVersion // MIGRATION_REV: 1771328577054
|
||||
// ...
|
||||
};
|
||||
```
|
||||
|
||||
`MIGRATION_REV` is a unique marker (current timestamp in milliseconds) used to make concurrent schema-version bumps more visible during Git merges.
|
||||
|
||||
If a merge conflict appears in that line, it means multiple migrations were created in parallel; resolve it by:
|
||||
|
||||
1. Keeping all migration code changes.
|
||||
2. Re-evaluating the final schema version number.
|
||||
3. Updating `MIGRATION_REV` again with a new timestamp.
|
||||
|
||||
### Step 3: Update Moongose Schema
|
||||
|
||||
Update the Mongoose schema to reflect the changes (new fields, etc.):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user