Rename enum types when tables are renamed (#8794)

## Context
Enum are named after this pattern
`${schema}_${tableName}_${columnName}_enum` however now that we allowed
table name update, we need to make sure their enums are renamed as well.
This commit is contained in:
Weiko
2024-11-28 15:39:20 +01:00
committed by GitHub
parent fbe042db3b
commit 75f5afb968
5 changed files with 185 additions and 5 deletions

View File

@ -443,14 +443,17 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
objectMetadataForUpdate.workspaceId,
);
await this.objectMetadataMigrationService.recomputeEnumNames(
objectMetadataForUpdate,
objectMetadataForUpdate.workspaceId,
);
const recomputedIndexes =
await this.indexMetadataService.recomputeIndexMetadataForObject(
objectMetadataForUpdate.workspaceId,
objectMetadataForUpdate,
);
// TODO: recompute foreign keys indexes as well (in the related object and not objectMetadataForUpdate)
await this.indexMetadataService.createIndexRecomputeMigrations(
objectMetadataForUpdate.workspaceId,
objectMetadataForUpdate,