feat: migration can be applied on a specific schema & some enhancements (#2998)

* fix: remove old metadata seed files

* feat: wip standard to core relation

* fix: lint

* fix: merge

* fix: remove debug files

* feat: add feature flag for core object metadata

* fix: remove debug

* feat: always disable the standard core relation

* fix: missing feature flag

* fix: remove debug

* fix: feature flag doesn't seems to disable relation

* fix: delete .vscode folder, change this in another PR

* Update packages/twenty-server/src/workspace/workspace-sync-metadata/reflective-metadata.factory.ts

Co-authored-by: Weiko <corentin@twenty.com>

* Update packages/twenty-server/src/workspace/workspace-sync-metadata/reflective-metadata.factory.ts

Co-authored-by: Weiko <corentin@twenty.com>

* Update packages/twenty-server/src/workspace/workspace-sync-metadata/workspace-sync.metadata.service.ts

Co-authored-by: Weiko <corentin@twenty.com>

* fix: remove optional fields from metadata entities

* fix: renamed variable

* fix: put back CursorScalarType

* fix: delete test command

* fix: remove unused workspace standard migration command

* fix: drop core object metadata declaration

* fix: rename variable

* fix: drop creation of core datasource

* fix: remove feature flag

* fix: drop support of standard to core relations

* feat: add user email field on workspace-member standard object

* fix: update seed accordingly

* fix: missing remove command file

* fix: datasource label should remain nullable

* fix: better asserts

* Remove unused code

* Remove unused code

---------

Co-authored-by: Weiko <corentin@twenty.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2023-12-21 19:15:05 +01:00
committed by GitHub
parent 3234134a30
commit d532f22fbb
112 changed files with 714 additions and 6381 deletions

View File

@ -230,11 +230,13 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
{
name: createdObjectMetadata.targetTableName,
action: 'create',
schemaName: createdObjectMetadata.dataSource.schema,
} satisfies WorkspaceMigrationTableAction,
// Add activity target relation
{
name: activityTargetObjectMetadata.targetTableName,
action: 'alter',
schemaName: activityTargetObjectMetadata.dataSource.schema,
columns: [
{
action: WorkspaceMigrationColumnActionType.CREATE,
@ -247,6 +249,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
{
name: activityTargetObjectMetadata.targetTableName,
action: 'alter',
schemaName: activityTargetObjectMetadata.dataSource.schema,
columns: [
{
action: WorkspaceMigrationColumnActionType.RELATION,
@ -260,6 +263,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
{
name: createdObjectMetadata.targetTableName,
action: 'alter',
schemaName: createdObjectMetadata.dataSource.schema,
columns: [
{
action: WorkspaceMigrationColumnActionType.CREATE,
@ -313,16 +317,16 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
options: FindOneOptions<ObjectMetadataEntity>,
): Promise<ObjectMetadataEntity | null> {
return this.objectMetadataRepository.findOne({
...options,
where: {
...options.where,
workspaceId,
},
relations: [
'fields',
'fields.fromRelationMetadata',
'fields.toRelationMetadata',
],
...options,
where: {
...options.where,
workspaceId,
},
});
}
@ -331,17 +335,17 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
options?: FindManyOptions<ObjectMetadataEntity>,
) {
return this.objectMetadataRepository.find({
...options,
where: {
...options?.where,
workspaceId,
},
relations: [
'fields',
'fields.fromRelationMetadata',
'fields.toRelationMetadata',
'fields.fromRelationMetadata.toObjectMetadata',
],
...options,
where: {
...options?.where,
workspaceId,
},
});
}