Remove connected account feature flag (#19286)
Co-authored-by: martmull <martmull@hotmail.fr> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <github-actions@twenty.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+3
-30
@@ -2,7 +2,6 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { Command } from 'nest-commander';
|
||||
import { FeatureFlagKey } from 'twenty-shared/types';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { ActiveOrSuspendedWorkspaceCommandRunner } from 'src/database/commands/command-runners/active-or-suspended-workspace.command-runner';
|
||||
@@ -15,9 +14,7 @@ import { ConnectedAccountEntity } from 'src/engine/metadata-modules/connected-ac
|
||||
import { MessageChannelEntity } from 'src/engine/metadata-modules/message-channel/entities/message-channel.entity';
|
||||
import { MessageFolderEntity } from 'src/engine/metadata-modules/message-folder/entities/message-folder.entity';
|
||||
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
|
||||
import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
import { type MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity';
|
||||
import { type MessageFolderWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-folder.workspace-entity';
|
||||
import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
|
||||
|
||||
@@ -51,19 +48,6 @@ export class MigrateMessagingInfrastructureToMetadataCommand extends ActiveOrSus
|
||||
}: RunOnWorkspaceArgs): Promise<void> {
|
||||
const isDryRun = options.dryRun ?? false;
|
||||
|
||||
const isAlreadyMigrated = await this.featureFlagService.isFeatureEnabled(
|
||||
FeatureFlagKey.IS_CONNECTED_ACCOUNT_MIGRATED,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (isAlreadyMigrated) {
|
||||
this.logger.log(
|
||||
`IS_CONNECTED_ACCOUNT_MIGRATED already enabled for workspace ${workspaceId}, skipping`,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const connectedAccountWorkspaceRepository =
|
||||
await this.twentyORMGlobalManager.getRepository<ConnectedAccountWorkspaceEntity>(
|
||||
workspaceId,
|
||||
@@ -71,13 +55,13 @@ export class MigrateMessagingInfrastructureToMetadataCommand extends ActiveOrSus
|
||||
);
|
||||
|
||||
const messageChannelWorkspaceRepository =
|
||||
await this.twentyORMGlobalManager.getRepository<MessageChannelWorkspaceEntity>(
|
||||
await this.twentyORMGlobalManager.getRepository<MessageChannelEntity>(
|
||||
workspaceId,
|
||||
'messageChannel',
|
||||
);
|
||||
|
||||
const calendarChannelWorkspaceRepository =
|
||||
await this.twentyORMGlobalManager.getRepository<CalendarChannelWorkspaceEntity>(
|
||||
await this.twentyORMGlobalManager.getRepository<CalendarChannelEntity>(
|
||||
workspaceId,
|
||||
'calendarChannel',
|
||||
);
|
||||
@@ -203,9 +187,7 @@ export class MigrateMessagingInfrastructureToMetadataCommand extends ActiveOrSus
|
||||
});
|
||||
|
||||
if (coreConnectedAccounts.length > 0) {
|
||||
await this.connectedAccountRepository.save(
|
||||
coreConnectedAccounts as unknown as ConnectedAccountEntity[],
|
||||
);
|
||||
await this.connectedAccountRepository.save(coreConnectedAccounts);
|
||||
this.logger.log(
|
||||
`Migrated ${coreConnectedAccounts.length} connected accounts for workspace ${workspaceId}`,
|
||||
);
|
||||
@@ -352,15 +334,6 @@ export class MigrateMessagingInfrastructureToMetadataCommand extends ActiveOrSus
|
||||
`Migrated ${coreMessageFolders.length} message folders for workspace ${workspaceId}`,
|
||||
);
|
||||
}
|
||||
|
||||
await this.featureFlagService.enableFeatureFlags(
|
||||
[FeatureFlagKey.IS_CONNECTED_ACCOUNT_MIGRATED],
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
this.logger.log(
|
||||
`Enabled IS_CONNECTED_ACCOUNT_MIGRATED for workspace ${workspaceId}`,
|
||||
);
|
||||
}
|
||||
|
||||
private async buildWorkspaceMemberIdToUserWorkspaceIdMap(
|
||||
|
||||
Reference in New Issue
Block a user