The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix email migration (#7298)
Raphaël Bosi942281f4b04c
diff --git a/packages/twenty-server/src/database/commands/upgrade-version/0-30/0-30-migrate-email-fields-to-emails.command.ts b/packages/twenty-server/src/database/commands/upgrade-version/0-30/0-30-migrate-email-fields-to-emails.command.tsindex 87ff3e5b0f6..2e4969297a6 100644--- a/packages/twenty-server/src/database/commands/upgrade-version/0-30/0-30-migrate-email-fields-to-emails.command.ts+++ b/packages/twenty-server/src/database/commands/upgrade-version/0-30/0-30-migrate-email-fields-to-emails.command.ts@@ -305,14 +305,6 @@ export class MigrateEmailFieldsToEmailsCommand extends ActiveWorkspacesCommandRu) {this.logger.log(`Migrating person email field of type EMAIL to EMAILS`);- await this.migrateDataWithinTable({- sourceColumnName: 'email',- targetColumnName: 'emailsPrimaryEmail',- tableName: 'person',- workspaceQueryRunner,- dataSourceMetadata,- });-const personEmailFieldMetadata = await this.fieldMetadataRepository.findOne({where: {@@ -322,6 +314,22 @@ export class MigrateEmailFieldsToEmailsCommand extends ActiveWorkspacesCommandRu},);+ if (!personEmailFieldMetadata) {+ this.logger.log(+ `Could not find person email field with standardId ${PERSON_STANDARD_FIELD_IDS.email}, skipping migration`,+ );++ return;+ }++ await this.migrateDataWithinTable({+ sourceColumnName: 'email',+ targetColumnName: 'emailsPrimaryEmail',+ tableName: 'person',+ workspaceQueryRunner,+ dataSourceMetadata,+ });+if (personEmailFieldMetadata) {await this.fieldMetadataService.deleteOneField({