migrating to 55 (#12537)

- Adjusting the upgrade command to add the 55 command
- Adding a correction to move types to core schema
This commit is contained in:
Guillim
2025-06-11 16:41:12 +02:00
committed by GitHub
parent 3233734d2c
commit 4cea354838
2 changed files with 30 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import { FixCreatedByDefaultValueCommand } from 'src/database/commands/upgrade-v
import { FixStandardSelectFieldsPositionCommand } from 'src/database/commands/upgrade-version-command/0-54/0-54-fix-standard-select-fields-position.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 { DeduplicateIndexedFieldsCommand } from 'src/database/commands/upgrade-version-command/0-55/0-55-deduplicate-indexed-fields.command';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
@ -131,6 +132,9 @@ export class UpgradeCommand extends UpgradeCommandRunner {
protected readonly cleanNotFoundFilesCommand: CleanNotFoundFilesCommand,
protected readonly lowercaseUserAndInvitationEmailsCommand: LowercaseUserAndInvitationEmailsCommand,
protected readonly migrateDefaultAvatarUrlToUserWorkspaceCommand: MigrateDefaultAvatarUrlToUserWorkspaceCommand,
// 0.55 Commands
protected readonly deduplicateIndexedFieldsCommand: DeduplicateIndexedFieldsCommand,
) {
super(
workspaceRepository,
@ -139,6 +143,11 @@ export class UpgradeCommand extends UpgradeCommandRunner {
syncWorkspaceMetadataCommand,
);
const commands_053: VersionCommands = {
beforeSyncMetadata: [],
afterSyncMetadata: [],
};
const commands_054: VersionCommands = {
beforeSyncMetadata: [
this.fixStandardSelectFieldsPositionCommand,
@ -151,8 +160,15 @@ export class UpgradeCommand extends UpgradeCommandRunner {
],
};
const commands_055: VersionCommands = {
beforeSyncMetadata: [],
afterSyncMetadata: [this.deduplicateIndexedFieldsCommand],
};
this.allCommands = {
'0.53.0': commands_053,
'0.54.0': commands_054,
'0.55.0': commands_055,
};
}

View File

@ -9,6 +9,20 @@ export class RemoveUselessServerlessFunctionColumn1748942397538
await queryRunner.query(
`ALTER TABLE "core"."serverlessFunction" DROP COLUMN "syncStatus"`,
);
const metadataSchemaExists = await queryRunner.query(
`SELECT 1 FROM information_schema.schemata WHERE schema_name = 'metadata';`,
);
if (metadataSchemaExists && metadataSchemaExists.length > 0) {
await queryRunner.query(`
ALTER TYPE "metadata"."dataSource_type_enum" SET SCHEMA "core";
ALTER TYPE "metadata"."indexMetadata_indextype_enum" SET SCHEMA "core";
ALTER TYPE "metadata"."relationMetadata_ondeleteaction_enum" SET SCHEMA "core";
ALTER TYPE "metadata"."serverlessFunction_syncstatus_enum" SET SCHEMA "core";
`);
}
await queryRunner.query(
`DROP TYPE "core"."serverlessFunction_syncstatus_enum"`,
);