Skip to content

Commit

Permalink
Release 0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Aug 5, 2024
1 parent 48f4e41 commit 72a69d5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MigrateMessageChannelSyncStatusEnumCommand } from 'src/database/command
import { SetWorkspaceActivationStatusCommand } from 'src/database/commands/upgrade-version/0-23/0-23-set-workspace-activation-status.command';
import { UpdateActivitiesCommand } from 'src/database/commands/upgrade-version/0-23/0-23-update-activities.command';
import { UpdateFileFolderStructureCommand } from 'src/database/commands/upgrade-version/0-23/0-23-update-file-folder-structure.command';
import { SyncWorkspaceMetadataCommand } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/sync-workspace-metadata.command';

interface UpdateTo0_23CommandOptions {
workspaceId?: string;
Expand All @@ -18,6 +19,7 @@ interface UpdateTo0_23CommandOptions {
})
export class UpgradeTo0_23Command extends CommandRunner {
constructor(
private readonly syncWorkspaceMetadataCommand: SyncWorkspaceMetadataCommand,
private readonly updateFileFolderStructureCommandOptions: UpdateFileFolderStructureCommand,
private readonly migrateLinkFieldsToLinks: MigrateLinkFieldsToLinksCommand,
private readonly migrateDomainNameFromTextToLinks: MigrateDomainNameFromTextToLinksCommand,
Expand Down Expand Up @@ -54,6 +56,10 @@ export class UpgradeTo0_23Command extends CommandRunner {
_passedParam,
options,
);
await this.syncWorkspaceMetadataCommand.run(_passedParam, {
...options,
force: true,
});
await this.updateActivitiesCommand.run(_passedParam, options);
await this.backfillNewOnboardingUserVarsCommand.run(_passedParam, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadat
import { ObjectMetadataModule } from 'src/engine/metadata-modules/object-metadata/object-metadata.module';
import { WorkspaceCacheVersionModule } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.module';
import { WorkspaceStatusModule } from 'src/engine/workspace-manager/workspace-status/workspace-manager.module';
import { WorkspaceSyncMetadataCommandsModule } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/workspace-sync-metadata-commands.module';
import { ViewModule } from 'src/modules/view/view.module';

@Module({
imports: [
WorkspaceSyncMetadataCommandsModule,
TypeOrmModule.forFeature([Workspace], 'core'),
FileStorageModule,
OnboardingModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Injectable } from '@nestjs/common';

import { isDeepStrictEqual } from 'util';

import { WorkspaceMigrationBuilderAction } from 'src/engine/workspace-manager/workspace-migration-builder/interfaces/workspace-migration-builder-action.interface';

import {
Expand Down Expand Up @@ -126,30 +128,37 @@ export class WorkspaceMigrationFieldFactory {
continue;
}

const migrations: WorkspaceMigrationTableAction[] = [
{
name: computeObjectTargetTable(
originalObjectMetadataMap[
fieldMetadataUpdate.current.objectMetadataId
],
if (
!isDeepStrictEqual(
fieldMetadataUpdate.current,
fieldMetadataUpdate.altered,
)
) {
const migrations: WorkspaceMigrationTableAction[] = [
{
name: computeObjectTargetTable(
originalObjectMetadataMap[
fieldMetadataUpdate.current.objectMetadataId
],
),
action: WorkspaceMigrationTableActionType.ALTER,
columns: this.workspaceMigrationFactory.createColumnActions(
WorkspaceMigrationColumnActionType.ALTER,
fieldMetadataUpdate.current,
fieldMetadataUpdate.altered,
),
},
];

workspaceMigrations.push({
workspaceId: fieldMetadataUpdate.current.workspaceId,
name: generateMigrationName(
`update-${fieldMetadataUpdate.altered.name}`,
),
action: WorkspaceMigrationTableActionType.ALTER,
columns: this.workspaceMigrationFactory.createColumnActions(
WorkspaceMigrationColumnActionType.ALTER,
fieldMetadataUpdate.current,
fieldMetadataUpdate.altered,
),
},
];

workspaceMigrations.push({
workspaceId: fieldMetadataUpdate.current.workspaceId,
name: generateMigrationName(
`update-${fieldMetadataUpdate.altered.name}`,
),
isCustom: false,
migrations,
});
isCustom: false,
migrations,
});
}
}

return workspaceMigrations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ import { SyncWorkspaceLoggerService } from './services/sync-workspace-logger.ser
ConvertRecordPositionsToIntegers,
SyncWorkspaceLoggerService,
],
exports: [SyncWorkspaceMetadataCommand],
})
export class WorkspaceSyncMetadataCommandsModule {}

0 comments on commit 72a69d5

Please sign in to comment.