fix(server): incr metadata version (#12907)
Following https://github.com/twentyhq/twenty/pull/12883
This commit is contained in:
@ -10,6 +10,7 @@ import {
|
|||||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { computeMetadataNameFromLabel } from 'src/engine/metadata-modules/utils/validate-name-and-label-are-sync-or-throw.util';
|
import { computeMetadataNameFromLabel } from 'src/engine/metadata-modules/utils/validate-name-and-label-are-sync-or-throw.util';
|
||||||
|
import { WorkspaceMetadataVersionService } from 'src/engine/metadata-modules/workspace-metadata-version/services/workspace-metadata-version.service';
|
||||||
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
||||||
|
|
||||||
@Command({
|
@Command({
|
||||||
@ -24,6 +25,7 @@ export class FixUpdateStandardFieldsIsLabelSyncedWithName extends ActiveOrSuspen
|
|||||||
protected readonly twentyORMGlobalManager: TwentyORMGlobalManager,
|
protected readonly twentyORMGlobalManager: TwentyORMGlobalManager,
|
||||||
@InjectRepository(FieldMetadataEntity, 'core')
|
@InjectRepository(FieldMetadataEntity, 'core')
|
||||||
private readonly fieldMetadataRepository: Repository<FieldMetadataEntity>,
|
private readonly fieldMetadataRepository: Repository<FieldMetadataEntity>,
|
||||||
|
private readonly workspaceMetadataVersionService: WorkspaceMetadataVersionService,
|
||||||
) {
|
) {
|
||||||
super(workspaceRepository, twentyORMGlobalManager);
|
super(workspaceRepository, twentyORMGlobalManager);
|
||||||
}
|
}
|
||||||
@ -60,6 +62,11 @@ export class FixUpdateStandardFieldsIsLabelSyncedWithName extends ActiveOrSuspen
|
|||||||
this.logger.log(`Updated isLabelSyncedMetadata for field ${field.id}`);
|
this.logger.log(`Updated isLabelSyncedMetadata for field ${field.id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!options.dryRun && updatedFields > 0) {
|
||||||
|
await this.workspaceMetadataVersionService.incrementMetadataVersion(
|
||||||
|
workspaceId,
|
||||||
|
);
|
||||||
|
}
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`Updated ${updatedFields} field.s for workspace ${workspaceId}`,
|
`Updated ${updatedFields} field.s for workspace ${workspaceId}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import { FixStandardSelectFieldsPositionCommand } from 'src/database/commands/up
|
|||||||
import { LowercaseUserAndInvitationEmailsCommand } from 'src/database/commands/upgrade-version-command/0-54/0-54-lowercase-user-and-invitation-emails.command';
|
import { LowercaseUserAndInvitationEmailsCommand } from 'src/database/commands/upgrade-version-command/0-54/0-54-lowercase-user-and-invitation-emails.command';
|
||||||
import { MigrateDefaultAvatarUrlToUserWorkspaceCommand } from 'src/database/commands/upgrade-version-command/0-54/0-54-migrate-default-avatar-url-to-user-workspace.command';
|
import { MigrateDefaultAvatarUrlToUserWorkspaceCommand } from 'src/database/commands/upgrade-version-command/0-54/0-54-migrate-default-avatar-url-to-user-workspace.command';
|
||||||
import { DeduplicateIndexedFieldsCommand } from 'src/database/commands/upgrade-version-command/0-55/0-55-deduplicate-indexed-fields.command';
|
import { DeduplicateIndexedFieldsCommand } from 'src/database/commands/upgrade-version-command/0-55/0-55-deduplicate-indexed-fields.command';
|
||||||
|
import { FixUpdateStandardFieldsIsLabelSyncedWithName } from 'src/database/commands/upgrade-version-command/1-1/1-1-fix-update-standard-field-is-label-synced-with-name.command';
|
||||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||||
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
||||||
@ -135,6 +136,9 @@ export class UpgradeCommand extends UpgradeCommandRunner {
|
|||||||
|
|
||||||
// 0.55 Commands
|
// 0.55 Commands
|
||||||
protected readonly deduplicateIndexedFieldsCommand: DeduplicateIndexedFieldsCommand,
|
protected readonly deduplicateIndexedFieldsCommand: DeduplicateIndexedFieldsCommand,
|
||||||
|
|
||||||
|
// 1.1 Commands
|
||||||
|
protected readonly fixUpdateStandardFieldsIsLabelSyncedWithNameCommand: FixUpdateStandardFieldsIsLabelSyncedWithName,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
workspaceRepository,
|
workspaceRepository,
|
||||||
@ -176,8 +180,10 @@ export class UpgradeCommand extends UpgradeCommandRunner {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const commands_110: VersionCommands = {
|
const commands_110: VersionCommands = {
|
||||||
|
beforeSyncMetadata: [
|
||||||
|
this.fixUpdateStandardFieldsIsLabelSyncedWithNameCommand,
|
||||||
|
],
|
||||||
afterSyncMetadata: [],
|
afterSyncMetadata: [],
|
||||||
beforeSyncMetadata: [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.allCommands = {
|
this.allCommands = {
|
||||||
|
|||||||
Reference in New Issue
Block a user