Standard Agent, Role, Role target (#16499)

# Introduction
In this pullrequest have been migrated to the flat standard entities:
Role, Agent and RoleTargets.

## What happens
- Removed createStandardMorph tool util in favor of dynamic typing of
`createMorphOrRelationStandardField`
- Implemented a command to remove standard agents and their role that
has been removed in https://github.com/twentyhq/twenty/pull/16513 also
added a default role target to data manipulator role to the only
remaining agent
- Implemented an agent deleteMany service handler
This commit is contained in:
Paul Rastoin
2025-12-16 14:17:31 +01:00
committed by GitHub
parent 553efe0cee
commit 75bba5a8ee
66 changed files with 1046 additions and 434 deletions
@@ -16,11 +16,12 @@ import { MigrateStandardInvalidEntitiesCommand } from 'src/database/commands/upg
import { MigrateTimelineActivityToMorphRelationsCommand } from 'src/database/commands/upgrade-version-command/1-13/1-13-migrate-timeline-activity-to-morph-relations.command';
import { RenameIndexNameCommand } from 'src/database/commands/upgrade-version-command/1-13/1-13-rename-index.command';
import { UpdateRoleTargetsUniqueConstraintMigrationCommand } from 'src/database/commands/upgrade-version-command/1-13/1-13-update-role-targets-unique-constraint-migration.command';
import { DeleteRemovedAgentsCommand } from 'src/database/commands/upgrade-version-command/1-14/1-14-delete-removed-agents.command';
import { UpdateCreatedByEnumCommand } from 'src/database/commands/upgrade-version-command/1-14/1-14-update-created-by-enum.command';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
import { UpdateCreatedByEnumCommand } from 'src/database/commands/upgrade-version-command/1-14/1-14-update-created-by-enum.command';
@Command({
name: 'upgrade',
@@ -47,6 +48,7 @@ export class UpgradeCommand extends UpgradeCommandRunner {
// 1.14 Commands
protected readonly updateCreatedByEnumCommand: UpdateCreatedByEnumCommand,
protected readonly deleteRemovedAgentsCommand: DeleteRemovedAgentsCommand,
) {
super(
workspaceRepository,
@@ -68,7 +70,10 @@ export class UpgradeCommand extends UpgradeCommandRunner {
this.renameIndexNameCommand,
];
const commands_1140: VersionCommands = [this.updateCreatedByEnumCommand];
const commands_1140: VersionCommands = [
this.updateCreatedByEnumCommand,
this.deleteRemovedAgentsCommand,
];
this.allCommands = {
'1.12.0': commands_1120,