Files
twenty/packages/twenty-server
Félix Malfait 7a4599321b Prepare for schema fusion (#11922)
## Architecture Detail

The goal is to merge the two TypeORM schemas.
Having two schemas prevent doing things like fieldMetadata.workspace in
TypeORM, and create useless debates since there is no clear line (is a
serverlessFunction core or metadata? What about events? etc.)

### Before
```
┌───────────────────┐    ┌───────────────────┐
│  core schema      │    │  metadata schema  │
├───────────────────┤    ├───────────────────┤
│- User             │    │- ObjectMetadata   │
│- Workspace        │    │- FieldMetadata    │
│- UserWorkspace    │    │- RelationMetadata │
│- etc.             │    │- etc.             │
└───────────────────┘    └───────────────────┘
```

### After the Migration
```
┌───────────────────────────────────────────┐
│              engine schema                │
├───────────────────────────────────────────┤
│- User                - ObjectMetadata     │
│- Workspace           - FieldMetadata      │
│- UserWorkspace       - RelationMetadata   │
│- etc.                - etc.               │
└───────────────────────────────────────────┘
```

## Strategy

1. During 0.53 we backfill the *_typeorm_migrations* table of the core
schema with all metadata migrations
2. That way in 0.54 we can move the metadata migrations from the
metadata folder to the core folder. We will also edit the migration
files to reference "core" instead of "metadata". For people doing a
fresh install this will run smoothly and create the tables in Core
directly. For people on an existing install, this migrations will not
run because they were added to the *_typeorm_migrations* in 0.53
3. In 0.55 we will rename "core" to something else (for example
"engine")

Note: if someone jumps version, for example skips to 0.54 directly
without having run 0.53 then this could cause issue. In 0.54 we should
consider gating the "migrate:prod" in the docker file so that it's
controlled and run by the upgrade command (and not run if the command
wasn't executed properly)
2025-05-07 15:13:47 +00:00
..
2024-09-18 17:35:08 +02:00
2025-05-07 15:13:47 +00:00
2024-09-20 11:02:52 +02:00
2025-05-07 09:39:18 +02:00