Update workspace entities to make all TEXT nullable (#16144)
Follow up on #15926 --------- Co-authored-by: Etienne <45695613+etiennejouan@users.noreply.github.com> Co-authored-by: guillim <guigloo@msn.com>
This commit is contained in:
+5
@@ -1,6 +1,7 @@
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Command } from 'nest-commander';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { ActiveOrSuspendedWorkspacesMigrationCommandRunner } from 'src/database/commands/command-runners/active-or-suspended-workspaces-migration.command-runner';
|
||||
@@ -62,6 +63,10 @@ export class MigrateAttachmentTypeToFileCategoryCommand extends ActiveOrSuspende
|
||||
for (const attachment of attachments) {
|
||||
const { id, type } = attachment;
|
||||
|
||||
if (!isDefined(type)) {
|
||||
throw new Error(`Attachment ${id} has no type`);
|
||||
}
|
||||
|
||||
const fileCategory =
|
||||
TYPE_TO_FILE_CATEGORY_MAPPING[type] ||
|
||||
TYPE_TO_FILE_CATEGORY_MAPPING.Other;
|
||||
|
||||
Reference in New Issue
Block a user