5b6c52c64b
As a follow-up of https://github.com/twentyhq/twenty/pull/9304, we are here creating a migration to run at the next release, aiming at adding the new aggregate operation options (CountEmpty, CountNotEmpty, ..., PercentEmpty, PercentNotEmpty) to the enums on View and ViewField's aggregateOperations fields. --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { InjectRepository } from '@nestjs/typeorm';
|
|
|
|
import { Command } from 'nest-commander';
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { ActiveWorkspacesCommandRunner } from 'src/database/commands/active-workspaces.command';
|
|
import { BaseCommandOptions } from 'src/database/commands/base.command';
|
|
import { MigrateAggregateOperationOptionsCommand } from 'src/database/commands/upgrade-version/0-40/0-40-migrate-aggregate-operations-options.command';
|
|
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
|
|
|
@Command({
|
|
name: 'upgrade-0.40',
|
|
description: 'Upgrade to 0.40',
|
|
})
|
|
export class UpgradeTo0_40Command extends ActiveWorkspacesCommandRunner {
|
|
constructor(
|
|
@InjectRepository(Workspace, 'core')
|
|
protected readonly workspaceRepository: Repository<Workspace>,
|
|
private readonly migrateAggregateOperationOptionsCommand: MigrateAggregateOperationOptionsCommand,
|
|
) {
|
|
super(workspaceRepository);
|
|
}
|
|
|
|
async executeActiveWorkspacesCommand(
|
|
passedParam: string[],
|
|
options: BaseCommandOptions,
|
|
workspaceIds: string[],
|
|
): Promise<void> {
|
|
this.logger.log('Running command to upgrade to 0.40');
|
|
|
|
await this.migrateAggregateOperationOptionsCommand.executeActiveWorkspacesCommand(
|
|
passedParam,
|
|
options,
|
|
workspaceIds,
|
|
);
|
|
}
|
|
}
|