From d16d0460262a0ead9c792e3d0148f0f17743b479 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Mon, 21 Oct 2024 16:20:13 +0300 Subject: [PATCH 01/42] Remove IPFS across the application --- alkemio.yml | 2 +- src/app.module.ts | 2 - src/common/enums/alkemio.error.status.ts | 5 -- src/common/enums/logging.context.ts | 1 - src/common/exceptions/http/index.ts | 1 - .../http/ipfs.not.found.http.exception.ts | 14 ------ .../ipfs.file.not.found.exception.ts | 8 --- .../exceptions/ipfs/ipfs.delete.exception.ts | 19 ------- .../exceptions/ipfs/ipfs.gc.exception.ts | 19 ------- .../exceptions/ipfs/ipfs.upload.exception.ts | 19 ------- src/domain/common/scalars/scalar.cid.ts | 50 ------------------- src/domain/common/scalars/scalars.module.ts | 2 - .../storage/document/document.service.ts | 8 +-- .../adapters/storage/storage.service.type.ts | 1 - .../api-rest/ipfs-log/ipfs.log.controller.ts | 27 ---------- .../api-rest/ipfs-log/ipfs.log.module.ts | 8 --- 16 files changed, 5 insertions(+), 181 deletions(-) delete mode 100644 src/common/exceptions/http/ipfs.not.found.http.exception.ts delete mode 100644 src/common/exceptions/ipfs.file.not.found.exception.ts delete mode 100644 src/common/exceptions/ipfs/ipfs.delete.exception.ts delete mode 100644 src/common/exceptions/ipfs/ipfs.gc.exception.ts delete mode 100644 src/common/exceptions/ipfs/ipfs.upload.exception.ts delete mode 100644 src/domain/common/scalars/scalar.cid.ts delete mode 100644 src/services/api-rest/ipfs-log/ipfs.log.controller.ts delete mode 100644 src/services/api-rest/ipfs-log/ipfs.log.module.ts diff --git a/alkemio.yml b/alkemio.yml index 94660ef671..3e16d3fcfa 100644 --- a/alkemio.yml +++ b/alkemio.yml @@ -285,7 +285,7 @@ communications: enabled: ${COMMUNICATIONS_DISCUSSIONS_ENABLED}:true ## storage ## -# Alkemio uses multiple types of persistent storage, including SQL database and IPFS. +# Alkemio uses multiple types of persistent storage, including SQL database, postgres database, file storage, redis. storage: file: # 20MB diff --git a/src/app.module.ts b/src/app.module.ts index 1ca393fe84..8535138bdd 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -66,7 +66,6 @@ import { ChatGuidanceModule } from '@services/api/chat-guidance/chat.guidance.mo import { LookupModule } from '@services/api/lookup'; import { AuthResetSubscriberModule } from '@services/auth-reset/subscriber/auth-reset.subscriber.module'; import { APP_ID_PROVIDER } from '@common/app.id.provider'; -import { IpfsLogModule } from '@services/api-rest/ipfs-log/ipfs.log.module'; import { ContributionMoveModule } from '@domain/collaboration/callout-contribution/callout.contribution.move.module'; import { TaskGraphqlModule } from '@domain/task/task.module'; import { ActivityFeedModule } from '@domain/activity-feed'; @@ -278,7 +277,6 @@ import { AdminUsersModule } from '@platform/admin/users/admin.users.module'; InnovationHubModule, SsiCredentialFlowModule, StorageAccessModule, - IpfsLogModule, MeModule, ExcalidrawServerModule, ChatGuidanceModule, diff --git a/src/common/enums/alkemio.error.status.ts b/src/common/enums/alkemio.error.status.ts index ae133bff08..6977af0450 100644 --- a/src/common/enums/alkemio.error.status.ts +++ b/src/common/enums/alkemio.error.status.ts @@ -24,9 +24,6 @@ export enum AlkemioErrorStatus { NOT_SUPPORTED = 'NOT_SUPPORTED', NOT_ENABLED = 'NOT_ENABLED', USER_NOT_REGISTERED = 'USER_NOT_REGISTERED', - IPFS_UPLOAD_FAILED = 'IPFS_UPLOAD_FAILED', - IPFS_DELETE_FAILED = 'IPFS_DELETE_FAILED', - IPFS_GARBAGE_COLLECTION_FAILED = 'IPFS_GARBAGE_COLLECTION_FAILED', LICENSE_NOT_FOUND = 'LICENSE_NOT_FOUND', MATRIX_ENTITY_NOT_FOUND_ERROR = 'MATRIX_ENTITY_NOT_FOUND_ERROR', BOOTSTRAP_FAILED = 'BOOTSTRAP_FAILED', @@ -41,7 +38,6 @@ export enum AlkemioErrorStatus { STORAGE_BUCKET_NOT_FOUND = 'STORAGE_BUCKET_NOT_FOUND', TAGSET_NOT_FOUND = 'TAGSET_NOT_FOUND', MIME_TYPE_NOT_FOUND = 'MIME_TYPE_NOT_FOUND', - IPFS_FILE_NOT_FOUND = 'IPFS_FILE_NOT_FOUND', SUBSCRIPTION_USER_NOT_AUTHENTICATED = 'SUBSCRIPTION_USER_NOT_AUTHENTICATED', PAGINATION_INPUT_OUT_OF_BOUND = 'PAGINATION_INPUT_OUT_OF_BOUND', PAGINATION_NOT_FOUND = 'PAGINATION_NOT_FOUND', @@ -62,7 +58,6 @@ export enum AlkemioErrorStatus { FORUM_DISCUSSION_CATEGORY = 'FORUM_DISCUSSION_CATEGORY', OPERATION_NOT_ALLOWED = 'OPERATION_NOT_ALLOWED', NOT_FOUND = 'NOT_FOUND', - IPFS_NOT_FOUND = 'IPFS_NOT_FOUND', EXCALIDRAW_AMQP_RESULT_ERROR = 'EXCALIDRAW_AMQP_RESULT_ERROR', EXCALIDRAW_REDIS_ADAPTER_INIT = 'EXCALIDRAW_REDIS_INIT', EXCALIDRAW_SERVER_INIT = 'EXCALIDRAW_SERVER_INIT', diff --git a/src/common/enums/logging.context.ts b/src/common/enums/logging.context.ts index c19ef34456..34939685e2 100644 --- a/src/common/enums/logging.context.ts +++ b/src/common/enums/logging.context.ts @@ -26,7 +26,6 @@ export enum LogContext { SEARCH_EXTRACT = 'search-extract', SEARCH_RESULT = 'search-result', OPPORTUNITY = 'opportunity', - IPFS = 'ipfs', LIFECYCLE = 'lifecycle', UNSPECIFIED = 'not_specified', NOTIFICATIONS = 'notifications', diff --git a/src/common/exceptions/http/index.ts b/src/common/exceptions/http/index.ts index 54299d62fc..15a069922c 100644 --- a/src/common/exceptions/http/index.ts +++ b/src/common/exceptions/http/index.ts @@ -2,4 +2,3 @@ export * from './base.http.exception'; export * from './forbidden.http.exception'; export * from './not.found.http.exception'; -export * from './ipfs.not.found.http.exception'; diff --git a/src/common/exceptions/http/ipfs.not.found.http.exception.ts b/src/common/exceptions/http/ipfs.not.found.http.exception.ts deleted file mode 100644 index 74976d289e..0000000000 --- a/src/common/exceptions/http/ipfs.not.found.http.exception.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { LogContext, AlkemioErrorStatus } from '@common/enums'; -import { BaseHttpException } from './base.http.exception'; -import { HttpStatus } from '@nestjs/common'; - -export class IpfsNotFoundHttpException extends BaseHttpException { - constructor(message: string, context: LogContext, code?: AlkemioErrorStatus) { - super( - message, - HttpStatus.NOT_FOUND, - context, - code ?? AlkemioErrorStatus.IPFS_NOT_FOUND - ); - } -} diff --git a/src/common/exceptions/ipfs.file.not.found.exception.ts b/src/common/exceptions/ipfs.file.not.found.exception.ts deleted file mode 100644 index 329e826083..0000000000 --- a/src/common/exceptions/ipfs.file.not.found.exception.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { LogContext, AlkemioErrorStatus } from '@common/enums'; -import { BaseException } from './base.exception'; - -export class IpfsFileNotFoundException extends BaseException { - constructor(error: string, context: LogContext, code?: AlkemioErrorStatus) { - super(error, context, code ?? AlkemioErrorStatus.IPFS_FILE_NOT_FOUND); - } -} diff --git a/src/common/exceptions/ipfs/ipfs.delete.exception.ts b/src/common/exceptions/ipfs/ipfs.delete.exception.ts deleted file mode 100644 index 6f05749ec1..0000000000 --- a/src/common/exceptions/ipfs/ipfs.delete.exception.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GraphQLError } from 'graphql'; -import { LogContext, AlkemioErrorStatus } from '@common/enums'; - -export class IpfsDeleteFailedException extends GraphQLError { - private context: LogContext; - - constructor(message = 'Ipfs delete file failed!') { - super(message, { - extensions: { - code: AlkemioErrorStatus.IPFS_DELETE_FAILED, - }, - }); - this.context = LogContext.IPFS; - } - - getContext(): LogContext { - return this.context; - } -} diff --git a/src/common/exceptions/ipfs/ipfs.gc.exception.ts b/src/common/exceptions/ipfs/ipfs.gc.exception.ts deleted file mode 100644 index b1dbbf1c33..0000000000 --- a/src/common/exceptions/ipfs/ipfs.gc.exception.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GraphQLError } from 'graphql'; -import { LogContext, AlkemioErrorStatus } from '@common/enums'; - -export class IpfsGCFailedException extends GraphQLError { - private context: LogContext; - - constructor(message = 'Ipfs garbage collection failed!') { - super(message, { - extensions: { - code: AlkemioErrorStatus.IPFS_GARBAGE_COLLECTION_FAILED, - }, - }); - this.context = LogContext.IPFS; - } - - getContext(): LogContext { - return this.context; - } -} diff --git a/src/common/exceptions/ipfs/ipfs.upload.exception.ts b/src/common/exceptions/ipfs/ipfs.upload.exception.ts deleted file mode 100644 index b26a96c177..0000000000 --- a/src/common/exceptions/ipfs/ipfs.upload.exception.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GraphQLError } from 'graphql'; -import { LogContext, AlkemioErrorStatus } from '@common/enums'; - -export class IpfsUploadFailedException extends GraphQLError { - private context: LogContext; - - constructor(message = 'Ipfs upload file failed!') { - super(message, { - extensions: { - code: AlkemioErrorStatus.IPFS_UPLOAD_FAILED, - }, - }); - this.context = LogContext.IPFS; - } - - getContext(): LogContext { - return this.context; - } -} diff --git a/src/domain/common/scalars/scalar.cid.ts b/src/domain/common/scalars/scalar.cid.ts deleted file mode 100644 index da90974fb9..0000000000 --- a/src/domain/common/scalars/scalar.cid.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { LogContext } from '@common/enums'; -import { ValidationException } from '@common/exceptions'; -import { Scalar, CustomScalar } from '@nestjs/graphql'; -import { Kind, ValueNode } from 'graphql'; -import CidClass = require('cids'); - -@Scalar('CID') -export class CID implements CustomScalar { - description = 'A Content identifier for IPFS(CID).'; - - parseValue(value: unknown): string { - return this.validate(value); - } - - serialize(value: any): string { - return value; // value sent to the client - } - - parseLiteral(ast: ValueNode): string { - if (ast.kind === Kind.STRING) { - return this.validate(ast.value); - } - return ''; - } - - validate = (value: any) => { - if (typeof value !== 'string') { - throw new ValidationException( - `CID must be a string: ${value}`, - LogContext.API - ); - } - - if (!CID.isValidFormat(value)) { - throw new ValidationException(`CID not valid: ${value}`, LogContext.API); - } - - return value; - }; - - static isValidFormat = (value: string) => { - try { - new CidClass(value); - } catch (error) { - return false; - } - - return true; - }; -} diff --git a/src/domain/common/scalars/scalars.module.ts b/src/domain/common/scalars/scalars.module.ts index 8a88c96b7b..a3161a7492 100644 --- a/src/domain/common/scalars/scalars.module.ts +++ b/src/domain/common/scalars/scalars.module.ts @@ -7,7 +7,6 @@ import { DID } from './scalar.did'; import { Markdown } from './scalar.markdown'; import { MessageID } from './scalar.messageid'; import { LifecycleDefinitionScalar } from './scalar.lifecycle.definition'; -import { CID } from './scalar.cid'; import { Emoji } from './scalar.emoji'; import { WhiteboardContent } from './scalar.whiteboard.content'; @@ -20,7 +19,6 @@ import { WhiteboardContent } from './scalar.whiteboard.content'; UUID_NAMEID, UUID_NAMEID_EMAIL, DID, - CID, Markdown, MessageID, LifecycleDefinitionScalar, diff --git a/src/domain/storage/document/document.service.ts b/src/domain/storage/document/document.service.ts index 97872a8a68..31d0bda597 100644 --- a/src/domain/storage/document/document.service.ts +++ b/src/domain/storage/document/document.service.ts @@ -58,8 +58,8 @@ export class DocumentService { const document = await this.getDocumentOrFail(documentID, { relations: { tagset: true }, }); - const DELETE_IPFS_CONTENTS = false; - if (DELETE_IPFS_CONTENTS) { + const DELETE_FILE = false; + if (DELETE_FILE) { // Delete the underlying document try { await this.removeFile(document.externalID); @@ -218,7 +218,7 @@ export class DocumentService { } catch (error: any) { throw new DocumentDeleteFailedException( `Removing file ${CID} failed!`, - LogContext.IPFS, + LogContext.LOCAL_STORAGE, { message: error?.message, originalException: error, @@ -234,7 +234,7 @@ export class DocumentService { } catch (error: any) { throw new DocumentSaveFailedException( `Uploading ${fileName} failed!`, - LogContext.IPFS, + LogContext.LOCAL_STORAGE, { message: error?.message, originalException: error, diff --git a/src/services/adapters/storage/storage.service.type.ts b/src/services/adapters/storage/storage.service.type.ts index 09de813c6c..e05caac467 100644 --- a/src/services/adapters/storage/storage.service.type.ts +++ b/src/services/adapters/storage/storage.service.type.ts @@ -1,4 +1,3 @@ export enum StorageServiceType { - IPFS = 'ipfs', LOCAL_STORAGE = 'local_storage', } diff --git a/src/services/api-rest/ipfs-log/ipfs.log.controller.ts b/src/services/api-rest/ipfs-log/ipfs.log.controller.ts deleted file mode 100644 index 7d5d36297a..0000000000 --- a/src/services/api-rest/ipfs-log/ipfs.log.controller.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - Controller, - Get, - Param, - StreamableFile, - UseGuards, -} from '@nestjs/common'; -import { CurrentUser } from '@common/decorators/current-user.decorator'; -import { AgentInfo } from '@core/authentication.agent.info/agent.info'; -import { RestGuard } from '@core/authorization/rest.guard'; -import { LogContext } from '@common/enums'; -import { IpfsNotFoundHttpException } from '@common/exceptions/http'; - -@Controller('/ipfs') -export class IpfsLogController { - @UseGuards(RestGuard) - @Get(':id') - async document( - @CurrentUser() agentInfo: AgentInfo, - @Param('id') id: string - ): Promise { - throw new IpfsNotFoundHttpException( - `IPFS accessed from user: ${agentInfo.email} for document with id: ${id}`, - LogContext.IPFS - ); - } -} diff --git a/src/services/api-rest/ipfs-log/ipfs.log.module.ts b/src/services/api-rest/ipfs-log/ipfs.log.module.ts deleted file mode 100644 index 9baca25e2c..0000000000 --- a/src/services/api-rest/ipfs-log/ipfs.log.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from '@nestjs/common'; -import { IpfsLogController } from './ipfs.log.controller'; - -@Module({ - controllers: [IpfsLogController], - exports: [], -}) -export class IpfsLogModule {} From 5eefcdd79a224db43672d50d09981f3f61f3e664 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Fri, 25 Oct 2024 18:07:50 +0300 Subject: [PATCH 02/42] fix subspace-admin credential removal + small refactor --- .../access/role-set/role.set.service.ts | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/domain/access/role-set/role.set.service.ts b/src/domain/access/role-set/role.set.service.ts index 0e89656a22..4af09e1373 100644 --- a/src/domain/access/role-set/role.set.service.ts +++ b/src/domain/access/role-set/role.set.service.ts @@ -8,7 +8,7 @@ import { ValidationException, } from '@common/exceptions'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; -import { FindOneOptions, Repository } from 'typeorm'; +import { FindOneOptions, Not, Repository } from 'typeorm'; import { AuthorizationPolicy } from '@domain/common/authorization-policy'; import { AuthorizationPolicyService } from '@domain/common/authorization-policy/authorization.policy.service'; import { LogContext } from '@common/enums/logging.context'; @@ -686,8 +686,8 @@ export class RoleSetService { ); if (!hasAnotherAdminRole) { - await this.removeContributorToImplicitRole( - parentRoleSet, + await this.removeContributorFromImplicitRole( + roleSet, agent, CommunityRoleImplicit.SUBSPACE_ADMIN ); @@ -882,7 +882,7 @@ export class RoleSetService { }); } - private async removeContributorToImplicitRole( + private async removeContributorFromImplicitRole( roleSet: IRoleSet, agent: IAgent, role: CommunityRoleImplicit @@ -1227,20 +1227,12 @@ export class RoleSetService { parentRoleSet: IRoleSet, childRoleSet: IRoleSet ): Promise { - const peerRoleSets: IRoleSet[] = await this.roleSetRepository.find({ + return this.roleSetRepository.find({ where: { - parentRoleSet: { - id: parentRoleSet.id, - }, + parentRoleSet: { id: parentRoleSet.id }, + id: Not(childRoleSet.id), }, }); - const result: IRoleSet[] = []; - for (const roleSet of peerRoleSets) { - if (roleSet && !(roleSet.id === childRoleSet.id)) { - result.push(roleSet); - } - } - return result; } public async setParentRoleSetAndCredentials( From 71faa062b728a9611e598dd5e9aff8b5328d8fb5 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 31 Oct 2024 11:50:43 +0200 Subject: [PATCH 03/42] Schema setup --- src/migrations/1705618345186-schemaSetup.ts | 1703 ----------- .../1705843901852-addConstraints.ts | 302 -- src/migrations/1707155838075-linkProfile.ts | 23 - src/migrations/1707304590364-linkEntity.ts | 272 -- .../1708354354175-whiteboardToRt.ts | 225 -- src/migrations/1708769388221-flowStates.ts | 449 --- src/migrations/1709970166009-account.ts | 475 --- src/migrations/1710272553085-calloutGroups.ts | 182 -- ...10305801060-AddMissingRelationOnCallout.ts | 13 - .../1710670020390-communityGuidelines.ts | 136 - .../1710843986344-AddReleaseForumCategory.ts | 27 - src/migrations/1710843986354-spaceSettings.ts | 293 -- .../1711017129997-AddMissingStorageBuckets.ts | 201 -- ...mmunityGuidelinesProfileRelationOptions.ts | 23 - .../1711636518886-communityGuidelines2.ts | 150 - src/migrations/1711636518888-subspaces.ts | 145 - .../1712213355890-virtualContributor.ts | 83 - ...-addCommunicationIDToVirtualContributor.ts | 17 - ...akePersonaIdNonUniqueVirtualContributor.ts | 35 - src/migrations/1712649061199-journeyMerge.ts | 218 -- .../1713255211876-fixVcFeatureFlags.ts | 30 - .../1713264430226-allCalloutsInRightColumn.ts | 130 - ...etDefaultAllowedMimeTypesAndMaxFileSize.ts | 49 - .../1714040354734-moveCalloutsHome.ts | 40 - src/migrations/1714401683721-accountHost.ts | 37 - src/migrations/1714410262128-licensePolicy.ts | 114 - ...5169195439-fixSubspaceCalloutsGroupName.ts | 41 - src/migrations/1715169195500-globalRoles.ts | 100 - .../1715575211966-subspaceCredentials.ts | 35 - ...15618480443-communityGuidelinesTemplate.ts | 50 - src/migrations/1715661558908-subspaceAdmin.ts | 38 - .../1715780931509-fixPersonaEngines.ts | 14 - .../1715874015062-subspaceInvitations.ts | 23 - .../1715936821326-accountInnovationHub.ts | 35 - src/migrations/1715957704292-agentAccount.ts | 54 - src/migrations/1716108478921-licensing.ts | 86 - .../1716199897459-updateVirtualPersona.ts | 46 - .../1716202782049-updateVirtualContributor.ts | 151 - ...3-updateVirtualPersonaEngineAndPlatform.ts | 13 - .../1716293512214-plansTableColumns.ts | 124 - .../1716805934325-communitPolicyParentCred.ts | 66 - .../1716810317354-removeUserAccountHost.ts | 29 - .../1716831433146-licensePlanAssignment.ts | 94 - ...717058223813-revertVirtualPersonaPrompt.ts | 27 - .../1717079559696-optionalBodyOfKnowledge.ts | 63 - .../1717573360692-increasePdfSize.ts | 15 - .../1717750717135-extendMimeTypes.ts | 34 - ...7751497484-updateDocumentMimeTypeLength.ts | 17 - .../1718174556242-invitationContributor.ts | 24 - .../1718174556250-discussionPrivacy.ts | 26 - src/migrations/1718860939735-aiServerSetup.ts | 227 -- src/migrations/1719032308707-forum.ts | 106 - .../1719038314268-featureFlagsCredentials.ts | 241 -- .../1719225622768-licensePlanType.ts | 36 - .../1719225623900-spaceTypeKnowledge.ts | 22 - .../1719225624444-aiPersonaFields.ts | 37 - ...10254726-generateFeatureFlagCredentials.ts | 113 - .../1719431685862-platformInvitations.ts | 29 - ...719487568442-contributorCommunicationID.ts | 16 - .../1719550326418-accountStorage.ts | 114 - src/migrations/1719859107990-communityType.ts | 11 - .../1720510767439-createInteraction.ts | 22 - .../1721140750386-aiPersonaFields.ts | 27 - src/migrations/1721373372024-genderUser.ts | 11 - .../1721649196399-innovationPacksAccount.ts | 208 -- .../1721737522043-innovationHubAccount.ts | 104 - src/migrations/1721767553604-vcStorage.ts | 88 - .../1721803817721-levelZeroSpaceID.ts | 33 - .../1721830892863-spaceVisibility.ts | 72 - .../1721897303394-fixPhantomVCInvitations.ts | 20 - ...62858-innovationHubs-storageAggregators.ts | 42 - ...23121607785-deleteAccountsWithoutSpaces.ts | 33 - src/migrations/1723121607799-agentType.ts | 55 - .../1723121607999-storageAggregatorType.ts | 68 - ...1723390789346-orphanedStorageAggregator.ts | 46 - .../1723391280682-removeRelation.ts | 26 - .../1723391280999-authorizationPolicyType.ts | 115 - .../1723391281999-spaceLibraryDefaults.ts | 127 - .../1723391282999-accountsUserOrg.ts | 370 --- .../1723391283999-accountHostCredential.ts | 50 - ...24255463216-whiteboardTemplatesAuthType.ts | 13 - .../1724319295054-ContributionSortOrder.ts | 38 - ...3087-addBoKLastUpdateToAiPersonaService.ts | 23 - src/migrations/1724417095448-convergance.ts | 955 ------ src/migrations/1724751579592-accountType.ts | 284 -- .../1724832530050-OrgSpaceVClicense.ts | 15 - .../1726060322894-indexConvergence.ts | 110 - src/migrations/1726062072715-fixSpaceFK.ts | 50 - ...726150255887-dropAllIndexesFKsRelations.ts | 101 - .../1726153799415-fixIndexesFKsRelations-1.ts | 2693 ----------------- .../1726153912745-fixIndexesFKsRelations-2.ts | 823 ----- .../1726216394652-fixInnovationFlowFK.ts | 23 - src/migrations/1726217001134-templates.ts | 362 --- src/migrations/1726477422137-tempStorage.ts | 17 - ...7409-SetAssignToNewOrganizationAccounts.ts | 21 - src/migrations/1726843779059-roleSet.ts | 377 --- ...727431656698-calloutTemplatesVisibility.ts | 20 - ...erviceAndVcInteractionForGenericEngines.ts | 30 - .../1727872794564-cleanupRolesIndexes.ts | 91 - .../1727930288139-invitationToRole.ts | 25 - ...728032163157-dropAllIndexesFKsRelations.ts | 103 - .../1728033296139-fixIndexesFKsRelations-2.ts | 779 ----- ...8936661201-invitationCommunityExtraRole.ts | 29 - src/migrations/1729361588097-xstate5.ts | 17 - ...pEmptyExternalMetadataForVcInteractions.ts | 15 - ...ions-1.ts => 1730367336792-schemaSetup.ts} | 2102 ++++--------- 106 files changed, 621 insertions(+), 17541 deletions(-) delete mode 100644 src/migrations/1705618345186-schemaSetup.ts delete mode 100644 src/migrations/1705843901852-addConstraints.ts delete mode 100644 src/migrations/1707155838075-linkProfile.ts delete mode 100644 src/migrations/1707304590364-linkEntity.ts delete mode 100644 src/migrations/1708354354175-whiteboardToRt.ts delete mode 100644 src/migrations/1708769388221-flowStates.ts delete mode 100644 src/migrations/1709970166009-account.ts delete mode 100644 src/migrations/1710272553085-calloutGroups.ts delete mode 100644 src/migrations/1710305801060-AddMissingRelationOnCallout.ts delete mode 100644 src/migrations/1710670020390-communityGuidelines.ts delete mode 100644 src/migrations/1710843986344-AddReleaseForumCategory.ts delete mode 100644 src/migrations/1710843986354-spaceSettings.ts delete mode 100644 src/migrations/1711017129997-AddMissingStorageBuckets.ts delete mode 100644 src/migrations/1711636518883-UpdateCommunityGuidelinesProfileRelationOptions.ts delete mode 100644 src/migrations/1711636518886-communityGuidelines2.ts delete mode 100644 src/migrations/1711636518888-subspaces.ts delete mode 100644 src/migrations/1712213355890-virtualContributor.ts delete mode 100644 src/migrations/1712596874894-addCommunicationIDToVirtualContributor.ts delete mode 100644 src/migrations/1712597102891-makePersonaIdNonUniqueVirtualContributor.ts delete mode 100644 src/migrations/1712649061199-journeyMerge.ts delete mode 100644 src/migrations/1713255211876-fixVcFeatureFlags.ts delete mode 100644 src/migrations/1713264430226-allCalloutsInRightColumn.ts delete mode 100644 src/migrations/1713526131435-SetDefaultAllowedMimeTypesAndMaxFileSize.ts delete mode 100644 src/migrations/1714040354734-moveCalloutsHome.ts delete mode 100644 src/migrations/1714401683721-accountHost.ts delete mode 100644 src/migrations/1714410262128-licensePolicy.ts delete mode 100644 src/migrations/1715169195439-fixSubspaceCalloutsGroupName.ts delete mode 100644 src/migrations/1715169195500-globalRoles.ts delete mode 100644 src/migrations/1715575211966-subspaceCredentials.ts delete mode 100644 src/migrations/1715618480443-communityGuidelinesTemplate.ts delete mode 100644 src/migrations/1715661558908-subspaceAdmin.ts delete mode 100644 src/migrations/1715780931509-fixPersonaEngines.ts delete mode 100644 src/migrations/1715874015062-subspaceInvitations.ts delete mode 100644 src/migrations/1715936821326-accountInnovationHub.ts delete mode 100644 src/migrations/1715957704292-agentAccount.ts delete mode 100644 src/migrations/1716108478921-licensing.ts delete mode 100644 src/migrations/1716199897459-updateVirtualPersona.ts delete mode 100644 src/migrations/1716202782049-updateVirtualContributor.ts delete mode 100644 src/migrations/1716209492183-updateVirtualPersonaEngineAndPlatform.ts delete mode 100644 src/migrations/1716293512214-plansTableColumns.ts delete mode 100644 src/migrations/1716805934325-communitPolicyParentCred.ts delete mode 100644 src/migrations/1716810317354-removeUserAccountHost.ts delete mode 100644 src/migrations/1716831433146-licensePlanAssignment.ts delete mode 100644 src/migrations/1717058223813-revertVirtualPersonaPrompt.ts delete mode 100644 src/migrations/1717079559696-optionalBodyOfKnowledge.ts delete mode 100644 src/migrations/1717573360692-increasePdfSize.ts delete mode 100644 src/migrations/1717750717135-extendMimeTypes.ts delete mode 100644 src/migrations/1717751497484-updateDocumentMimeTypeLength.ts delete mode 100644 src/migrations/1718174556242-invitationContributor.ts delete mode 100644 src/migrations/1718174556250-discussionPrivacy.ts delete mode 100644 src/migrations/1718860939735-aiServerSetup.ts delete mode 100644 src/migrations/1719032308707-forum.ts delete mode 100644 src/migrations/1719038314268-featureFlagsCredentials.ts delete mode 100644 src/migrations/1719225622768-licensePlanType.ts delete mode 100644 src/migrations/1719225623900-spaceTypeKnowledge.ts delete mode 100644 src/migrations/1719225624444-aiPersonaFields.ts delete mode 100644 src/migrations/1719410254726-generateFeatureFlagCredentials.ts delete mode 100644 src/migrations/1719431685862-platformInvitations.ts delete mode 100644 src/migrations/1719487568442-contributorCommunicationID.ts delete mode 100644 src/migrations/1719550326418-accountStorage.ts delete mode 100644 src/migrations/1719859107990-communityType.ts delete mode 100644 src/migrations/1720510767439-createInteraction.ts delete mode 100644 src/migrations/1721140750386-aiPersonaFields.ts delete mode 100644 src/migrations/1721373372024-genderUser.ts delete mode 100644 src/migrations/1721649196399-innovationPacksAccount.ts delete mode 100644 src/migrations/1721737522043-innovationHubAccount.ts delete mode 100644 src/migrations/1721767553604-vcStorage.ts delete mode 100644 src/migrations/1721803817721-levelZeroSpaceID.ts delete mode 100644 src/migrations/1721830892863-spaceVisibility.ts delete mode 100644 src/migrations/1721897303394-fixPhantomVCInvitations.ts delete mode 100644 src/migrations/1722591262858-innovationHubs-storageAggregators.ts delete mode 100644 src/migrations/1723121607785-deleteAccountsWithoutSpaces.ts delete mode 100644 src/migrations/1723121607799-agentType.ts delete mode 100644 src/migrations/1723121607999-storageAggregatorType.ts delete mode 100644 src/migrations/1723390789346-orphanedStorageAggregator.ts delete mode 100644 src/migrations/1723391280682-removeRelation.ts delete mode 100644 src/migrations/1723391280999-authorizationPolicyType.ts delete mode 100644 src/migrations/1723391281999-spaceLibraryDefaults.ts delete mode 100644 src/migrations/1723391282999-accountsUserOrg.ts delete mode 100644 src/migrations/1723391283999-accountHostCredential.ts delete mode 100644 src/migrations/1724255463216-whiteboardTemplatesAuthType.ts delete mode 100644 src/migrations/1724319295054-ContributionSortOrder.ts delete mode 100644 src/migrations/1724333243087-addBoKLastUpdateToAiPersonaService.ts delete mode 100644 src/migrations/1724417095448-convergance.ts delete mode 100644 src/migrations/1724751579592-accountType.ts delete mode 100644 src/migrations/1724832530050-OrgSpaceVClicense.ts delete mode 100644 src/migrations/1726060322894-indexConvergence.ts delete mode 100644 src/migrations/1726062072715-fixSpaceFK.ts delete mode 100644 src/migrations/1726150255887-dropAllIndexesFKsRelations.ts delete mode 100644 src/migrations/1726153799415-fixIndexesFKsRelations-1.ts delete mode 100644 src/migrations/1726153912745-fixIndexesFKsRelations-2.ts delete mode 100644 src/migrations/1726216394652-fixInnovationFlowFK.ts delete mode 100644 src/migrations/1726217001134-templates.ts delete mode 100644 src/migrations/1726477422137-tempStorage.ts delete mode 100644 src/migrations/1726582217409-SetAssignToNewOrganizationAccounts.ts delete mode 100644 src/migrations/1726843779059-roleSet.ts delete mode 100644 src/migrations/1727431656698-calloutTemplatesVisibility.ts delete mode 100644 src/migrations/1727787748227-extendAiPersonaServiceAndVcInteractionForGenericEngines.ts delete mode 100644 src/migrations/1727872794564-cleanupRolesIndexes.ts delete mode 100644 src/migrations/1727930288139-invitationToRole.ts delete mode 100644 src/migrations/1728032163157-dropAllIndexesFKsRelations.ts delete mode 100644 src/migrations/1728033296139-fixIndexesFKsRelations-2.ts delete mode 100644 src/migrations/1728936661201-invitationCommunityExtraRole.ts delete mode 100644 src/migrations/1729361588097-xstate5.ts delete mode 100644 src/migrations/1729511643484-setUpEmptyExternalMetadataForVcInteractions.ts rename src/migrations/{1728033222394-fixIndexesFKsRelations-1.ts => 1730367336792-schemaSetup.ts} (60%) diff --git a/src/migrations/1705618345186-schemaSetup.ts b/src/migrations/1705618345186-schemaSetup.ts deleted file mode 100644 index 16b40bea70..0000000000 --- a/src/migrations/1705618345186-schemaSetup.ts +++ /dev/null @@ -1,1703 +0,0 @@ -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { - allowedTypes, - maxAllowedFileSize, -} from './utils/storage/storage-bucket-utils'; - -export class schemaSetup1705618345186 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - const [tablesCount] = await queryRunner.query( - `SELECT COUNT(*) AS total_tables - FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA = 'alkemio';` - ); - - // We assume an empty schema has no tables or has only the migrations table - // If the schema is not empty we exit the migration - if (tablesCount.total_tables > 1) { - await this.addMissingConstraints(queryRunner); - return; - } - - // If there are migrations executed on the environment we exit the migration - const migrations = await queryRunner.query( - `SELECT name FROM migrations_typeorm;` - ); - - if (migrations.length > 0) { - await this.addMissingConstraints(queryRunner); - return; - } - - await queryRunner.query( - `CREATE TABLE \`activity\` (\`rowId\` int(11) NOT NULL AUTO_INCREMENT,\`id\` char(36) NOT NULL,\`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6),\`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),\`version\` int(11) NOT NULL,\`triggeredBy\` char(36) DEFAULT NULL,\`collaborationID\` char(36) DEFAULT NULL,\`resourceID\` char(36) DEFAULT NULL,\`description\` varchar(255) NOT NULL,\`type\` varchar(128) NOT NULL,\`parentID\` char(36) DEFAULT NULL,\`messageID\` char(44) DEFAULT NULL,\`visibility\` tinyint(1) DEFAULT 1,PRIMARY KEY (\`id\`),UNIQUE INDEX \`IDX_0f03c61020ea0dfa0198c60304\` (\`rowId\`)) ENGINE=InnoDB AUTO_INCREMENT=3113 DEFAULT CHARSET=utf8mb4` - ); - await queryRunner.query(`CREATE TABLE \`actor\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`description\` text DEFAULT NULL, - \`value\` text DEFAULT NULL, - \`impact\` varchar(255) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`actorGroupId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_a2afa3851ea733de932251b3a1\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`actor_group\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`description\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`ecosystemModelId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_bde98d59e8984e7d17034c3b93\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`agent\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`parentDisplayID\` text DEFAULT NULL, - \`did\` varchar(255) DEFAULT NULL, - \`password\` varchar(255) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`agreement\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`description\` text DEFAULT NULL, - \`projectId\` char(36) DEFAULT NULL, - \`tagsetId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_22348b89c2f802a3d75d52fbd5\` (\`tagsetId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`application\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`spaceId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - \`userId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_56f5614fff0028d40370499582\` (\`authorizationId\`), - UNIQUE INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` (\`lifecycleId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`application_questions\` ( - \`applicationId\` char(36) NOT NULL, - \`nvpId\` char(36) NOT NULL, - PRIMARY KEY (\`applicationId\`, \`nvpId\`), - INDEX \`IDX_8495fae86f13836b0745642baa\` (\`applicationId\`), - INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` (\`nvpId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`authorization_policy\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`credentialRules\` text NOT NULL, - \`verifiedCredentialRules\` text NOT NULL, - \`anonymousReadAccess\` tinyint(4) NOT NULL, - \`privilegeRules\` text NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - - await queryRunner.query(`CREATE TABLE \`calendar\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_94994efc5eb5936ed70f2c55903\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`calendar_event\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`createdBy\` char(36) DEFAULT NULL, - \`commentsId\` char(36) DEFAULT NULL, - \`startDate\` datetime(6) DEFAULT NULL, - \`wholeDay\` tinyint(4) DEFAULT NULL, - \`multipleDays\` tinyint(4) DEFAULT NULL, - \`durationMinutes\` int(11) DEFAULT NULL, - \`durationDays\` int(11) DEFAULT NULL, - \`type\` varchar(255) NOT NULL, - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`nameID\` varchar(36) NOT NULL, - \`calendarId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_22222ccdda9ba57d8e3a634cd8\` (\`authorizationId\`), - UNIQUE INDEX \`REL_222adf666c59b9eb5ce394714cf\` (\`commentsId\`), - UNIQUE INDEX \`REL_a3693e1d3472c5ef8b00e51acfd\` (\`profileId\`), - UNIQUE INDEX \`IDX_111838434c7198a323ea6f475fb\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`type\` text NOT NULL, - \`visibility\` text NOT NULL DEFAULT ('draft'), - \`authorizationId\` char(36) DEFAULT NULL, - \`commentsId\` char(36) DEFAULT NULL, - \`collaborationId\` char(36) DEFAULT NULL, - \`sortOrder\` int(11) NOT NULL, - \`publishedBy\` char(36) DEFAULT NULL, - \`publishedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`createdBy\` char(36) DEFAULT NULL, - \`framingId\` char(36) DEFAULT NULL, - \`contributionPolicyId\` char(36) DEFAULT NULL, - \`contributionDefaultsId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_6289dee12effb51320051c6f1f\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` (\`contributionPolicyId\`), - UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` (\`contributionDefaultsId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout_contribution\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`whiteboardId\` char(36) DEFAULT NULL, - \`postId\` char(36) DEFAULT NULL, - \`linkId\` char(36) DEFAULT NULL, - \`calloutId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_dfa86c46f509a61c6510536cd9\` (\`authorizationId\`), - UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`), - UNIQUE INDEX \`REL_97fefc97fb254c30577696e1c0\` (\`postId\`), - UNIQUE INDEX \`REL_bdf2d0eced5c95968a85caaaae\` (\`linkId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout_contribution_defaults\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`postDescription\` text DEFAULT NULL, - \`whiteboardContent\` longtext DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout_contribution_policy\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`allowedContributionTypes\` text NOT NULL, - \`state\` varchar(255) NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout_framing\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`whiteboardId\` char(36) DEFAULT NULL, - \`whiteboardRtId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` (\`authorizationId\`), - UNIQUE INDEX \`REL_f53e2d266432e58e538a366705\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`callout_template\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`framingId\` char(36) DEFAULT NULL, - \`contributionDefaultsId\` char(36) DEFAULT NULL, - \`contributionPolicyId\` char(36) DEFAULT NULL, - \`type\` varchar(255) NOT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_6c90723f8f1424e2dd08dddb39\` (\`authorizationId\`), - UNIQUE INDEX \`REL_75d5ced6c2e92cbbb5d8d0a913\` (\`profileId\`), - UNIQUE INDEX \`REL_b94beb9cefe0a8814dceddd10f\` (\`framingId\`), - UNIQUE INDEX \`REL_83bbc10ba2ddee4502bf327f1f\` (\`contributionDefaultsId\`), - UNIQUE INDEX \`REL_bffd07760b73be1aad13b6d00c\` (\`contributionPolicyId\`), - INDEX \`FK_7c434491e8e9ee8af12caff7db3\` (\`templatesSetId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`challenge\` ( - \`rowId\` int(11) NOT NULL AUTO_INCREMENT, - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) DEFAULT NULL, - \`spaceId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`contextId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - \`agentId\` char(36) DEFAULT NULL, - \`parentChallengeId\` char(36) DEFAULT NULL, - \`parentSpaceId\` char(36) DEFAULT NULL, - \`preferenceSetId\` char(36) DEFAULT NULL, - \`collaborationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`innovationFlowId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_e3b287bbffe59aba827d97d5fa\` (\`rowId\`), - UNIQUE INDEX \`REL_178fa41e46fd331f3501a62f6b\` (\`authorizationId\`), - UNIQUE INDEX \`REL_1deebaabfc620e881858333b0d\` (\`contextId\`), - UNIQUE INDEX \`REL_aa9668dd2340c2d794b414577b\` (\`communityId\`), - UNIQUE INDEX \`REL_b025a2720e5ee0e5b38774f7a8\` (\`agentId\`), - UNIQUE INDEX \`IDX_88592bee71718eec66a3bfc63f\` (\`preferenceSetId\`), - UNIQUE INDEX \`IDX_d4551f18fed106ae2e20c70f7c\` (\`collaborationId\`) - ) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`collaboration\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`tagsetTemplateSetId\` char(36) DEFAULT NULL, - \`timelineId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_262ecf3f5d70b82a4833618425\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`communication\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`displayName\` varchar(255) NOT NULL, - \`spaceID\` char(36) NOT NULL, - \`updatesId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`discussionCategories\` text DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_a20c5901817dd09d5906537e08\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`community\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`spaceID\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`parentCommunityId\` char(36) DEFAULT NULL, - \`communicationId\` char(36) DEFAULT NULL, - \`type\` varchar(16) NOT NULL, - \`parentID\` varchar(36) NOT NULL, - \`policyId\` char(36) DEFAULT NULL, - \`applicationFormId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_7fbe50fa78a37776ad962cb764\` (\`communicationId\`), - UNIQUE INDEX \`IDX_c9ff67519d26140f98265a542e\` (\`policyId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`community_policy\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`member\` text DEFAULT NULL, - \`lead\` text DEFAULT NULL, - \`admin\` text DEFAULT NULL, - \`host\` text DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`context\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`vision\` text DEFAULT NULL, - \`impact\` text DEFAULT NULL, - \`who\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`ecosystemModelId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` (\`authorizationId\`), - UNIQUE INDEX \`REL_a03169c3f86480ba3863924f4d\` (\`ecosystemModelId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`credential\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`resourceID\` char(36) NOT NULL, - \`type\` varchar(255) NOT NULL, - \`agentId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`discussion\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`category\` text NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`communicationId\` char(36) DEFAULT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`nameID\` varchar(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`commentsId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`document\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`createdBy\` char(36) DEFAULT NULL, - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`storageBucketId\` char(36) DEFAULT NULL, - \`displayName\` varchar(255) DEFAULT NULL, - \`tagsetId\` char(36) DEFAULT NULL, - \`mimeType\` varchar(36) DEFAULT NULL, - \`size\` int(11) DEFAULT NULL, - \`externalID\` varchar(128) DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`ecosystem_model\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`description\` varchar(255) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_658580aea4e1a892227e27db90\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`feature_flag\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` text NOT NULL, - \`enabled\` tinyint(1) NOT NULL, - \`licenseId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`form\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`description\` text DEFAULT NULL, - \`questions\` text DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`innovation_flow\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`spaceID\` char(36) NOT NULL, - \`type\` varchar(255) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_98a7abc9f297ffcacb53087dc8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`innovation_flow_template\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`definition\` longtext NOT NULL, - \`type\` varchar(128) NOT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_76542ccdda9ba57d8e3a634cd8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`innovation_hub\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(255) NOT NULL, - \`subdomain\` varchar(255) NOT NULL, - \`type\` varchar(255) NOT NULL, - \`spaceVisibilityFilter\` varchar(255) DEFAULT NULL, - \`spaceListFilter\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` (\`subdomain\`), - UNIQUE INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` (\`nameID\`), - UNIQUE INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` (\`authorizationId\`), - UNIQUE INDEX \`REL_36c8905c2c6c59467c60d94fd8\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`innovation_pack\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`nameID\` varchar(36) NOT NULL, - \`libraryId\` char(36) DEFAULT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_22222ccdda9ba57d8e3a634cd8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`invitation\` ( - \`id\` varchar(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`invitedUser\` char(36) DEFAULT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`authorizationId\` varchar(36) DEFAULT NULL, - \`lifecycleId\` varchar(36) DEFAULT NULL, - \`communityId\` varchar(36) DEFAULT NULL, - \`welcomeMessage\` varchar(512) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_b132226941570cb650a4023d49\` (\`authorizationId\`), - UNIQUE INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`invitation_external\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`email\` varchar(255) NOT NULL, - \`firstName\` varchar(255) DEFAULT NULL, - \`lastName\` varchar(255) DEFAULT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`welcomeMessage\` varchar(512) DEFAULT NULL, - \`profileCreated\` tinyint(4) NOT NULL DEFAULT 0, - \`authorizationId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_42a7abc9f297ffcacb53087da8\` (\`authorizationId\`), - INDEX \`FK_2a985f774bd4de2a9aead6bd5b1\` (\`communityId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`library\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_33333ccdda9ba57d8e3a634cd8\` (\`authorizationId\`), - INDEX \`FK_6664d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`license\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`visibility\` varchar(36) DEFAULT 'active', - \`authorizationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_bfd01743815f0dd68ac1c5c45c\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`lifecycle\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`machineState\` text DEFAULT NULL, - \`machineDef\` text DEFAULT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`location\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`city\` varchar(255) NOT NULL, - \`country\` varchar(255) NOT NULL, - \`addressLine1\` varchar(128) NOT NULL DEFAULT '', - \`addressLine2\` varchar(128) NOT NULL DEFAULT '', - \`stateOrProvince\` varchar(128) NOT NULL DEFAULT '', - \`postalCode\` varchar(128) NOT NULL DEFAULT '', - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`nvp\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`value\` varchar(512) DEFAULT NULL, - \`sortOrder\` int(11) NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`opportunity\` ( - \`rowId\` int(11) NOT NULL AUTO_INCREMENT, - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) DEFAULT NULL, - \`spaceID\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`contextId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - \`agentId\` char(36) DEFAULT NULL, - \`challengeId\` char(36) DEFAULT NULL, - \`collaborationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`innovationFlowId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_313c12afe69143a9ee3779b4f6\` (\`rowId\`), - UNIQUE INDEX \`REL_a344b754f33792cbbc58e41e89\` (\`authorizationId\`), - UNIQUE INDEX \`REL_9c169eb500e2d3823154c7b603\` (\`contextId\`), - UNIQUE INDEX \`REL_1c7744df92f39ab567084fd8c0\` (\`communityId\`), - UNIQUE INDEX \`REL_c814aa7dc8a68f27d96d5d1782\` (\`agentId\`), - UNIQUE INDEX \`IDX_fa617e79d6b2926edc7b4a3878\` (\`collaborationId\`), - INDEX \`FK_0e2c355dbb2950851dbc17a4490\` (\`challengeId\`), - INDEX \`FK_91231450cf75dc486700ca034c6\` (\`profileId\`), - INDEX \`FK_4840f1e3ae5509245bdb5c401f3\` (\`innovationFlowId\`), - INDEX \`FK_89894d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`) - ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`organization\` ( - \`rowId\` int(11) NOT NULL AUTO_INCREMENT, - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`agentId\` char(36) DEFAULT NULL, - \`legalEntityName\` varchar(255) NOT NULL, - \`domain\` varchar(255) NOT NULL, - \`website\` varchar(255) NOT NULL, - \`contactEmail\` varchar(255) NOT NULL, - \`verificationId\` char(36) DEFAULT NULL, - \`preferenceSetId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_266bc44a18601f893566962df7\` (\`rowId\`), - UNIQUE INDEX \`REL_badc07674ce4e44801e5a5f36c\` (\`authorizationId\`), - UNIQUE INDEX \`REL_037ba4b170844c039e74aa22ec\` (\`profileId\`), - UNIQUE INDEX \`REL_7671a7e33f6665764f4534a596\` (\`agentId\`), - UNIQUE INDEX \`IDX_95bbac07221e98072beafa6173\` (\`verificationId\`), - UNIQUE INDEX \`REL_95bbac07221e98072beafa6173\` (\`verificationId\`), - UNIQUE INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` (\`preferenceSetId\`), - INDEX \`FK_3334d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`) - ) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`organization_verification\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`organizationID\` char(36) DEFAULT NULL, - \`status\` varchar(255) NOT NULL DEFAULT 'not-verified', - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_3795f9dd15ef3ef2dd1d27e309\` (\`authorizationId\`), - UNIQUE INDEX \`REL_22be0d440df7972d9b3a94aa6d\` (\`lifecycleId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`platform\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`libraryId\` char(36) DEFAULT NULL, - \`communicationId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_44333ccdda9ba57d8e3a634cd8\` (\`authorizationId\`), - INDEX \`FK_55333901817dd09d5906537e088\` (\`communicationId\`), - INDEX \`FK_5554d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`post\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`type\` varchar(255) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`commentsId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_c52470717008d58ec6d76b12ff\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_c4fb636888fc391cf1d7406e89\` (\`commentsId\`), - UNIQUE INDEX \`REL_c4fb636888fc391cf1d7406e89\` (\`commentsId\`), - UNIQUE INDEX \`IDX_67663901817dd09d5906537e088\` (\`profileId\`), - INDEX \`FK_67663901817dd09d5906537e088\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`post_template\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`type\` text NOT NULL, - \`defaultDescription\` text NOT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_44447ccdda9ba57d8e3a634cd8\` (\`authorizationId\`), - INDEX \`FK_66666450cf75dc486700ca034c6\` (\`templatesSetId\`), - INDEX \`FK_59991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`preference\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`value\` varchar(16) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`preferenceDefinitionId\` char(36) DEFAULT NULL, - \`preferenceSetId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_49030bc57aa0f319cee7996fca\` (\`authorizationId\`), - INDEX \`FK_650fb4e564a8b4b4ac344270744\` (\`preferenceDefinitionId\`), - INDEX \`FK_88881fbd1fef95a0540f7e7d1e2\` (\`preferenceSetId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`preference_definition\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`groupName\` varchar(128) NOT NULL, - \`displayName\` varchar(128) NOT NULL, - \`description\` varchar(255) NOT NULL, - \`valueType\` varchar(16) NOT NULL, - \`type\` varchar(128) NOT NULL, - \`definitionSet\` varchar(128) NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`preference_set\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_8888dccdda9ba57d8e3a634cd8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`profile\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`description\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`locationId\` char(36) DEFAULT NULL, - \`displayName\` text NOT NULL, - \`tagline\` varchar(255) DEFAULT NULL, - \`storageBucketId\` char(36) DEFAULT NULL, - \`type\` text NOT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_a96475631aba7dce41db03cc8b\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_77777ca8ac212b8357637794d6\` (\`locationId\`), - UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`), - UNIQUE INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`project\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`spaceID\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - \`opportunityId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_fac8673f44e6b295e30d1c1739\` (\`authorizationId\`), - UNIQUE INDEX \`REL_f425931bb61a95ef6f6d89c9a8\` (\`lifecycleId\`), - INDEX \`FK_35e34564793a27bb3c209a15245\` (\`opportunityId\`), - INDEX \`FK_49991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`query-result-cache\` ( - \`id\` int(11) NOT NULL AUTO_INCREMENT, - \`identifier\` varchar(255) DEFAULT NULL, - \`time\` bigint(20) NOT NULL, - \`duration\` int(11) NOT NULL, - \`query\` text NOT NULL, - \`result\` text NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`reference\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`uri\` text NOT NULL, - \`description\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_73e8ae665a49366ca7e2866a45\` (\`authorizationId\`), - INDEX \`FK_2f46c698fc4c19a8cc233c5f255\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`relation\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`type\` varchar(255) NOT NULL, - \`actorName\` varchar(255) NOT NULL, - \`actorType\` varchar(255) NOT NULL, - \`actorRole\` varchar(255) NOT NULL, - \`description\` text DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`collaborationId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_53fccd56207915b969b91834e0\` (\`authorizationId\`), - INDEX \`FK_701a6f8e3e1da76354571767c3f\` (\`collaborationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`room\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`displayName\` varchar(255) NOT NULL, - \`externalRoomID\` varchar(255) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`messagesCount\` int(11) NOT NULL, - \`type\` varchar(255) NOT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_7777dccdda9ba57d8e3a634cd8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`space\` ( - \`rowId\` int(11) NOT NULL AUTO_INCREMENT, - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`contextId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - \`agentId\` char(36) DEFAULT NULL, - \`preferenceSetId\` char(36) DEFAULT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`collaborationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - \`licenseId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_0f03c61020ea0dfa0198c60304\` (\`rowId\`), - UNIQUE INDEX \`REL_17a161eef37c9f07186532ab75\` (\`authorizationId\`), - UNIQUE INDEX \`REL_6db8627abbf00b1b986e359054\` (\`contextId\`), - UNIQUE INDEX \`REL_f5ad15bcb06a95c2a109fbcce2\` (\`communityId\`), - UNIQUE INDEX \`REL_b0c3f360534db92017e36a00bb\` (\`agentId\`), - UNIQUE INDEX \`IDX_99990355b4e9bd6b02c66507aa\` (\`preferenceSetId\`), - UNIQUE INDEX \`IDX_6325f4ef25c4e07e723a96ed37\` (\`collaborationId\`), - INDEX \`FK_33336901817dd09d5906537e088\` (\`templatesSetId\`), - INDEX \`FK_71231450cf75dc486700ca034c6\` (\`profileId\`), - INDEX \`FK_1114d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`), - INDEX \`FK_3ef80ef55ba1a1d45e625ea8389\` (\`licenseId\`) - ) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`storage_aggregator\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`parentStorageAggregatorId\` char(36) DEFAULT NULL, - \`directStorageId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` (\`authorizationId\`), - UNIQUE INDEX \`REL_0647707288c243e60091c8d862\` (\`directStorageId\`), - INDEX \`FK_b80c28f5335ab5442f63c644d94\` (\`parentStorageAggregatorId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`storage_bucket\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`allowedMimeTypes\` text DEFAULT NULL, - \`maxFileSize\` int(11) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_77994efc5eb5936ed70f2c55903\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`tagset\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL DEFAULT 'default', - \`tags\` text NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`tagsetTemplateId\` char(36) DEFAULT NULL, - \`type\` varchar(255) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` (\`authorizationId\`), - INDEX \`FK_81fc213b2d9ad0cddeab1a9ce64\` (\`profileId\`), - INDEX \`FK_7ab35130cde781b69259eec7d85\` (\`tagsetTemplateId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`tagset_template\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) DEFAULT NULL, - \`type\` varchar(255) DEFAULT NULL, - \`allowedValues\` text DEFAULT NULL, - \`defaultSelectedValue\` varchar(255) DEFAULT NULL, - \`tagsetTemplateSetId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - INDEX \`FK_9ad35130cde781b69259eec7d85\` (\`tagsetTemplateSetId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`tagset_template_set\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - PRIMARY KEY (\`id\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`templates_set\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`policy\` text DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_66666ccdda9ba57d8e3a634cd8\` (\`authorizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`timeline\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`calendarId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_e6203bc09ec8b93debeb3a44cb9\` (\`authorizationId\`), - UNIQUE INDEX \`REL_10ed346b16ca044cd84fb1c4034\` (\`calendarId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`user\` ( - \`rowId\` int(11) NOT NULL AUTO_INCREMENT, - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`accountUpn\` varchar(255) NOT NULL, - \`firstName\` varchar(255) NOT NULL, - \`lastName\` varchar(255) NOT NULL, - \`email\` varchar(255) NOT NULL, - \`phone\` varchar(255) NOT NULL, - \`gender\` varchar(255) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`agentId\` char(36) DEFAULT NULL, - \`communicationID\` varchar(255) NOT NULL, - \`serviceProfile\` tinyint(4) NOT NULL, - \`preferenceSetId\` char(36) DEFAULT NULL, - \`storageAggregatorId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_266bc44a18601f893566962df6\` (\`rowId\`), - UNIQUE INDEX \`REL_09f909622aa177a097256b7cc2\` (\`authorizationId\`), - UNIQUE INDEX \`REL_9466682df91534dd95e4dbaa61\` (\`profileId\`), - UNIQUE INDEX \`REL_b61c694cacfab25533bd23d9ad\` (\`agentId\`), - UNIQUE INDEX \`IDX_88880355b4e9bd6b02c66507aa\` (\`preferenceSetId\`), - INDEX \`FK_4444d59c0b805c9c1ecb0070e16\` (\`storageAggregatorId\`) - ) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`user_group\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`spaceID\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`organizationId\` char(36) DEFAULT NULL, - \`communityId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_e8e32f1e59c349b406a4752e54\` (\`authorizationId\`), - UNIQUE INDEX \`REL_9912e4cfc1e09848a392a65151\` (\`profileId\`), - INDEX \`FK_9fcc131f256e969d773327f07cb\` (\`communityId\`), - INDEX \`FK_2b8381df8c3a1680f50e4bc2351\` (\`organizationId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`visual\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`uri\` text NOT NULL, - \`minWidth\` int(11) NOT NULL, - \`maxWidth\` int(11) NOT NULL, - \`minHeight\` int(11) NOT NULL, - \`maxHeight\` int(11) NOT NULL, - \`aspectRatio\` float DEFAULT NULL, - \`allowedTypes\` text NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`alternativeText\` varchar(120) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_439d0b187986492b58178a82c3\` (\`authorizationId\`), - INDEX \`FK_77771450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`whiteboard\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`content\` longtext NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`checkoutId\` char(36) DEFAULT NULL, - \`nameID\` varchar(36) NOT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_1dc9521a013c92854e92e09933\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_08d1ccc94b008dbda894a3cfa2\` (\`checkoutId\`), - UNIQUE INDEX \`REL_1dc9521a013c92854e92e09933\` (\`authorizationId\`), - UNIQUE INDEX \`REL_08d1ccc94b008dbda894a3cfa2\` (\`checkoutId\`), - INDEX \`FK_29991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`whiteboard_checkout\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`whiteboardId\` char(36) NOT NULL, - \`lockedBy\` char(36) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_353b042af56f01ce222f08abf4\` (\`authorizationId\`), - UNIQUE INDEX \`REL_bd3c7c6c2dbc2a8daf4b1500a6\` (\`lifecycleId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`whiteboard_rt\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(255) NOT NULL, - \`content\` longtext NOT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - \`contentUpdatePolicy\` varchar(255) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_60e34af57347a7d391bc598568\` (\`authorizationId\`), - UNIQUE INDEX \`REL_9dd2273a4105bd6ed536fe4913\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query(`CREATE TABLE \`whiteboard_template\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`templatesSetId\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`content\` longtext NOT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_88888ccdda9ba57d8e3a634cd8\` (\`authorizationId\`), - INDEX \`FK_65556450cf75dc486700ca034c6\` (\`templatesSetId\`), - INDEX \`FK_69991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - - await queryRunner.query( - 'ALTER TABLE `actor` ADD CONSTRAINT `FK_a2afa3851ea733de932251b3a1f` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `actor` ADD CONSTRAINT `FK_0f9d41ee193d631a5439bb4f404` FOREIGN KEY (`actorGroupId`) REFERENCES `actor_group`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `actor_group` ADD CONSTRAINT `FK_cbb1d7afa052a184471723d3297` FOREIGN KEY (`ecosystemModelId`) REFERENCES `ecosystem_model`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `actor_group` ADD CONSTRAINT `FK_bde98d59e8984e7d17034c3b937` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `agent` ADD CONSTRAINT `FK_8ed9d1af584fa62f1ad3405b33b` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `agreement` ADD CONSTRAINT `FK_8785b5a8510cabcc25d0f196783` FOREIGN KEY (`projectId`) REFERENCES `project`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `agreement` ADD CONSTRAINT `FK_22348b89c2f802a3d75d52fbd57` FOREIGN KEY (`tagsetId`) REFERENCES `tagset`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application` ADD CONSTRAINT `FK_b4ae3fea4a24b4be1a86dacf8a2` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application` ADD CONSTRAINT `FK_7ec2857c7d8d16432ffca1cb3d9` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application` ADD CONSTRAINT `FK_56f5614fff0028d403704995822` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application` ADD CONSTRAINT `FK_500cee6f635849f50e19c7e2b76` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application_questions` ADD CONSTRAINT `FK_fe50118fd82e7fe2f74f986a195` FOREIGN KEY (`nvpId`) REFERENCES `nvp`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `application_questions` ADD CONSTRAINT `FK_8495fae86f13836b0745642baa8` FOREIGN KEY (`applicationId`) REFERENCES `application`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD CONSTRAINT \`FK_33355901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_77755450cf75dc486700ca034c6\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_6a30f26ca267009fcf514e0e726\` FOREIGN KEY (\`createdBy\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_22255901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_157de0ce487e25bb69437e80b13\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_111838434c7198a323ea6f475fb\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_9b1c5ee044611ac78249194ec35\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_62ed316cda7b75735b20307b47e\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_6289dee12effb51320051c6f1fc\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_36b0da55acff774d0845aeb55f2\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_1e740008a7e1512966e3b084148\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_dfa86c46f509a61c6510536cd9a\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_97fefc97fb254c30577696e1c0a\` FOREIGN KEY (\`postId\`) REFERENCES \`post\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`reference\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_7370de8eb79ed00b0d403f2299a\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_c9d7c2c4eb8a1d012ddc6605da9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_f53e2d266432e58e538a366705d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD INDEX \`IDX_62712f63939a6d56fd5c334ee3\` (\`whiteboardRtId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_62712f63939a6d56fd5c334ee3f\` FOREIGN KEY (\`whiteboardRtId\`) REFERENCES \`whiteboard_rt\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_6c90723f8f1424e2dd08dddb393\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_75d5ced6c2e92cbbb5d8d0a913e\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_7c434491e8e9ee8af12caff7db3\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_b94beb9cefe0a8814dceddd10f6\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_83bbc10ba2ddee4502bf327f1f5\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_bffd07760b73be1aad13b6d00c3\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_d4551f18fed106ae2e20c70f7cb\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - ` ALTER TABLE \`challenge\` ADD CONSTRAINT FK_c890de5a08d363719a41703a638 FOREIGN KEY (preferenceSetId) REFERENCES preference_set(id) ON DELETE SET NULL;` - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_b025a2720e5ee0e5b38774f7a8c` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_aa9668dd2340c2d794b414577b6` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_81231450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_7d2b222d54b900071b0959f03ef` FOREIGN KEY (`parentChallengeId`) REFERENCES `challenge`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_4c435130cde781b69259eec7d85` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_494b27cb13b59128fb24b365ca6` FOREIGN KEY (`parentSpaceId`) REFERENCES `space`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_2224d59c0b805c9c1ecb0070e16` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_1deebaabfc620e881858333b0d0` FOREIGN KEY (`contextId`) REFERENCES `context`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `challenge` ADD CONSTRAINT `FK_178fa41e46fd331f3501a62f6bf` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_3005ed9ce3f57c250c59d6d5065` FOREIGN KEY (`timelineId`) REFERENCES `timeline`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_262ecf3f5d70b82a48336184251\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_1a135130cde781b69259eec7d85` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_a20c5901817dd09d5906537e087\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_777750fa78a37776ad962cb7643\` FOREIGN KEY (\`updatesId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `community` ADD CONSTRAINT `FK_8e8283bdacc9e770918fe689333` FOREIGN KEY (`parentCommunityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_7fbe50fa78a37776ad962cb7643\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `community` ADD CONSTRAINT `FK_6e7584bfb417bd0f8e8696ab585` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_35533901817dd09d5906537e088\` FOREIGN KEY (\`policyId\`) REFERENCES \`community_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_25543901817dd09d5906537e088\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `context` ADD CONSTRAINT `FK_a03169c3f86480ba3863924f4d7` FOREIGN KEY (`ecosystemModelId`) REFERENCES `ecosystem_model`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `context` ADD CONSTRAINT `FK_5f0dbc3b097ef297bd5f4ddb1a9` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `credential` ADD CONSTRAINT `FK_dbe0929355f82e5995f0b7fd5e2` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_c6a084fe80d01c41d9f142d51aa\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_4555dccdda9ba57d8e3a634cd0d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_345655450cf75dc486700ca034c6\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_2d8a3ca181c3f0346817685d21d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_3337f26ca267009fcf514e0e726\` FOREIGN KEY (\`createdBy\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_222838434c7198a323ea6f475fb\` FOREIGN KEY (\`tagsetId\`) REFERENCES \`tagset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_11155901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_11155450cf75dc486700ca034c6\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `ecosystem_model` ADD CONSTRAINT `FK_658580aea4e1a892227e27db902` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`feature_flag\` ADD CONSTRAINT \`FK_7e3e0a8b6d3e9b4a3a0d6e3a3e3\` FOREIGN KEY (\`licenseId\`) REFERENCES \`license\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_da1a68698d32f610a5fc1880c7f` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_da7368698d32f610a5fc1880c7f` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_4b4a68698d32f610a5fc1880c7f` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_76546901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_79991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_76546450cf75dc486700ca034c6\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_b411e4f27d77a96eccdabbf4b45\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_36c8905c2c6c59467c60d94fd8a\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_77777450cf75dc486700ca034c6\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_55555901817dd09d5906537e088\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_39991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_22222901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b132226941570cb650a4023d493\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b0c80ccf319a1c7a7af12b39987\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_339c1fe2a9c5caef5b982303fb0\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation_external\` ADD CONSTRAINT \`FK_42a7abc9f297ffcacb53087da88\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation_external\` ADD CONSTRAINT \`FK_2a985f774bd4de2a9aead6bd5b1\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_6664d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_33333901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license\` ADD CONSTRAINT \`FK_bfd01743815f0dd68ac1c5c45c0\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_0e2c355dbb2950851dbc17a4490` FOREIGN KEY (`challengeId`) REFERENCES `challenge`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD CONSTRAINT \`FK_fa617e79d6b2926edc7b4a3878f\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_1c7744df92f39ab567084fd8c09` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_4840f1e3ae5509245bdb5c401f3` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD CONSTRAINT \`FK_89894d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD CONSTRAINT \`FK_91231450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_9c169eb500e2d3823154c7b603d` FOREIGN KEY (`contextId`) REFERENCES `context`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_a344b754f33792cbbc58e41e898` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `opportunity` ADD CONSTRAINT `FK_c814aa7dc8a68f27d96d5d1782c` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_037ba4b170844c039e74aa22ecd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_3334d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_7671a7e33f6665764f4534a5967` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_95bbac07221e98072beafa61732` FOREIGN KEY (`verificationId`) REFERENCES `organization_verification`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_badc07674ce4e44801e5a5f36ce` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT FK_c07b5b4c96fa89cb80215827668 FOREIGN KEY (preferenceSetId) REFERENCES preference_set(id) ON DELETE SET NULL;` - ); - await queryRunner.query( - 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_3795f9dd15ef3ef2dd1d27e309c` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_22be0d440df7972d9b3a94aa6d5` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_5554d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_55333901817dd09d5906537e088\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_44333901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_c4fb636888fc391cf1d7406e891\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_67663901817dd09d5906537e088\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT FK_00a8c330495ef844bfc6975ec89 FOREIGN KEY (authorizationId) REFERENCES authorization_policy(id) ON DELETE SET NULL;` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_66666450cf75dc486700ca034c6\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_59991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_44446901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_88881fbd1fef95a0540f7e7d1e2\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_650fb4e564a8b4b4ac344270744\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_49030bc57aa0f319cee7996fca1\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD CONSTRAINT \`FK_88885901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `profile` ADD CONSTRAINT `FK_a96475631aba7dce41db03cc8b2` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_77777ca8ac212b8357637794d6f\` FOREIGN KEY (\`locationId\`) REFERENCES \`location\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_4a1c74fd2a61b32d9d9500e0650\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_35e34564793a27bb3c209a15245` FOREIGN KEY (`opportunityId`) REFERENCES `opportunity`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`project\` ADD CONSTRAINT \`FK_49991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_f425931bb61a95ef6f6d89c9a85` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_fac8673f44e6b295e30d1c1739a` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `reference` ADD CONSTRAINT `FK_73e8ae665a49366ca7e2866a45d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `reference` ADD CONSTRAINT `FK_2f46c698fc4c19a8cc233c5f255` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`relation\` ADD CONSTRAINT \`FK_701a6f8e3e1da76354571767c3f\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `relation` ADD CONSTRAINT `FK_53fccd56207915b969b91834e04` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`room\` ADD CONSTRAINT \`FK_77775901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_f5ad15bcb06a95c2a109fbcce2a` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_b0c3f360534db92017e36a00bb2` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_71231450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_6db8627abbf00b1b986e359054f` FOREIGN KEY (`contextId`) REFERENCES `context`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT FK_6bf7adf4308991457fdb04624e2 FOREIGN KEY (preferenceSetId) REFERENCES preference_set(id) ON DELETE SET NULL;` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6325f4ef25c4e07e723a96ed37c\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_3ef80ef55ba1a1d45e625ea8389\` FOREIGN KEY (\`licenseId\`) REFERENCES \`license\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_33336901817dd09d5906537e088\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_17a161eef37c9f07186532ab758` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_1114d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_f3b4d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_b80c28f5335ab5442f63c644d94\` FOREIGN KEY (\`parentStorageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_0647707288c243e60091c8d8620\` FOREIGN KEY (\`directStorageId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_77755901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_7ab35130cde781b69259eec7d85` FOREIGN KEY (`tagsetTemplateId`) REFERENCES `tagset_template`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_81fc213b2d9ad0cddeab1a9ce64` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_eb59b98ee6ef26c993d0d75c83c` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `tagset_template` ADD CONSTRAINT `FK_9ad35130cde781b69259eec7d85` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD CONSTRAINT \`FK_66666901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_66355901817dd09d5906537e088\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_22443901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `user` ADD CONSTRAINT `FK_b61c694cacfab25533bd23d9add` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user` ADD CONSTRAINT `FK_9466682df91534dd95e4dbaa616` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT FK_5ea996d22fbd9d522a59a39b74e FOREIGN KEY (preferenceSetId) REFERENCES preference_set(id) ON DELETE SET NULL;` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_4444d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `user` ADD CONSTRAINT `FK_09f909622aa177a097256b7cc22` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_e8e32f1e59c349b406a4752e545` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_9fcc131f256e969d773327f07cb` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_9912e4cfc1e09848a392a651514` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_2b8381df8c3a1680f50e4bc2351` FOREIGN KEY (`organizationId`) REFERENCES `organization`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_77771450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_439d0b187986492b58178a82c3f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_29991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_1dc9521a013c92854e92e099335\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_08d1ccc94b008dbda894a3cfa20\` FOREIGN KEY (\`checkoutId\`) REFERENCES \`whiteboard_checkout\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_checkout\` ADD CONSTRAINT \`FK_353b042af56f01ce222f08abf49\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_checkout\` ADD CONSTRAINT \`FK_bd3c7c6c2dbc2a8daf4b1500a69\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard_rt` ADD CONSTRAINT `FK_60e34af57347a7d391bc5985681` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard_rt` ADD CONSTRAINT `FK_9dd2273a4105bd6ed536fe49138` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_45556901817dd09d5906537e088\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_69991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_65556450cf75dc486700ca034c6\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - // create library instance with authorization - const libraryAuthID = randomUUID(); - const libraryID = randomUUID(); - const libraryAuthPolicy = `[{"type":"global-admin","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true},{"type":"global-admin-hubs","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true}]`; - const libraryStorageAggregatorID = await this.createStorageAggregator( - queryRunner - ); - - await queryRunner.query( - `INSERT INTO authorization_policy VALUES ('${libraryAuthID}', NOW(), NOW(), 1, '${libraryAuthPolicy}', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO library (id, createdDate, updatedDate, version, authorizationId, storageAggregatorId) VALUES ('${libraryID}', NOW(), NOW(), 1, '${libraryAuthID}', '${libraryStorageAggregatorID}')` - ); - - // create platform instance with authorization - const platformAuthID = randomUUID(); - const platformID = randomUUID(); - const platformStorageAggregatorID = await this.createStorageAggregator( - queryRunner - ); - - await queryRunner.query( - `INSERT INTO authorization_policy VALUES ('${platformAuthID}', NOW(), NOW(), 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO platform (id, createdDate, updatedDate, version, authorizationId, libraryId, storageAggregatorId) VALUES ('${platformID}', NOW(), NOW(), 1, '${platformAuthID}', '${libraryID}', '${platformStorageAggregatorID}')` - ); - - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - var preferenceDefinitionIds = [...Array(42)].map(id => randomUUID()); - - await queryRunner.query( - `INSERT INTO preference_definition (id, version, groupName, displayName, description, valueType, type, definitionSet) - VALUES - ('${preferenceDefinitionIds[0]}',1,'NotificationGlobalAdmin','[Admin] User profile deleted','Receive a notification when a user profile is removed','boolean','NotificationUserRemoved','user'), - ('${preferenceDefinitionIds[1]}',1,'Notification','Community Application','Receive notification when I apply to join a community','boolean','NotificationApplicationSubmitted','user'), - ('${preferenceDefinitionIds[2]}',1,'Notification','Community Updates','Receive notification when a new update is shared with a community I am a member of','boolean','NotificationCommunityUpdates','user'), - ('${preferenceDefinitionIds[3]}',1,'Notification','Community Discussion created','Receive notification when a new discussion is created on a community I am a member of','boolean','NotificationCommunityDiscussionCreated','user'), - ('${preferenceDefinitionIds[4]}',1,'NotificationForum','Receive a notification when a new comment is added to a Discussion I created in the Forum','Receive a notification when a new comment is added to a Discussion I created in the Forum','boolean','NotificationForumDiscussionComment','user'), - ('${preferenceDefinitionIds[5]}',1,'NotificationCommunityAdmin','[Admin] Community Applications','Receive notification when a new application is received for a community for which I am an administrator','boolean','NotificationApplicationReceived','user'), - ('${preferenceDefinitionIds[6]}',1,'NotificationGlobalAdmin','[Admin] New user sign up','Receive notification when a new user signs up','boolean','NotificationUserSignUp','user'), - ('${preferenceDefinitionIds[7]}',1,'NotificationCommunityAdmin','[Admin] Community Discussion Created','Receive notification when a new discussion is created for a community for which I am an administrator','boolean','NotificationCommunityDiscussionCreatedAdmin','user'), - ('${preferenceDefinitionIds[8]}',1,'NotificationCommunityAdmin','[Admin] Community Updates','Receive notification when a new update is shared with a community for which I am an administrator','boolean','NotificationCommunityUpdateSentAdmin','user'), - ('${preferenceDefinitionIds[9]}',1,'MembershipSpace','Applications allowed','Allow applications to this Space','boolean','MembershipApplicationsFromAnyone','space'), - ('${preferenceDefinitionIds[10]}',1,'MembershipSpace','Anyone can join','Allow any registered user to join this Space','boolean','MembershipJoinSpaceFromAnyone','space'), - ('${preferenceDefinitionIds[11]}',1,'MembershipSpace','Host Organization Join','Allow members of the host organization to join','boolean','MembershipJoinSpaceFromHostOrganizationMembers','space'), - ('${preferenceDefinitionIds[12]}',1,'Authorization','Anonymous read access','Allow non-members to read the contents of this Space','boolean','AuthorizationAnonymousReadAccess','space'), - ('${preferenceDefinitionIds[13]}',1,'AuthorizationOrganization','Domain based membership','Automatically add new users with emails matching the domain of the Organization','boolean','AuthorizationOrganizationMatchDomain','organization'), - ('${preferenceDefinitionIds[14]}',1,'Notification','Invitations to a community','Receive a notification when someone invites you to join a community','boolean','NotificationCommunityInvitationUser','user'), - ('${preferenceDefinitionIds[15]}',1,'NotificationCommunityAdmin','[Admin] Community review submitted','Receive notification when a new community review is submitted by a member','boolean','NotificationCommunityReviewSubmittedAdmin','user'), - ('${preferenceDefinitionIds[16]}',1,'NotificationCommunication','Mentions or tags of you in posts or comments','Receive a notification when a user tags you in a post or a comment','boolean','NotificationCommunicationMention','user'), - ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), - ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), - ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), - ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when an Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), - ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), - ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), - ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), - ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), - ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when an Post is created in community i am a member of','boolean','NotificationPostCreated','user'), - ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), - ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), - ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), - ('${preferenceDefinitionIds[29]}',1,'Privileges','Allow members to create Callouts.','Allow members to create Callouts.','boolean','AllowMembersToCreateCallouts','space'), - ('${preferenceDefinitionIds[30]}',1,'MembershipChallenge','Allow Space members to apply','Allow members of the parent Space to apply to this Challenge','boolean','MembershipApplyChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[31]}',1,'MembershipChallenge','Allow Space members to provide feedback on Context','Allow members of the parent Space to give feedback on the Challenge Context','boolean','MembershipFeedbackOnChallengeContext','challenge'), - ('${preferenceDefinitionIds[32]}',1,'Privileges','Allow Space members to create Challenges','Allow members of the Space to create Challenges.','boolean','AllowMembersToCreateChallenges','space'), - ('${preferenceDefinitionIds[33]}',1,'NotificationCommunication','Allow direct messages from other users','Receive a notification when a user wants to directly send you a message or shares with you','boolean','NotificationCommunicationMessage','user'), - ('${preferenceDefinitionIds[34]}',1,'Notification','Community review submitted','Receive notification when you submit a new community review','boolean','NotificationCommunityReviewSubmitted','user'), - ('${preferenceDefinitionIds[35]}',1,'Notification','Comment replies','Receive a notification when someone replies to your comment','boolean','NotificationCommentReply','user'), - ('${preferenceDefinitionIds[36]}',1,'Notification','New comment on Discssion','Receive a notification when a new comment is added to a Discussion in a community I am a member of','boolean','NotificationDiscussionCommentCreated','user'), - ('${preferenceDefinitionIds[37]}',1,'NotificationOrganizationAdmin','Mentions or tags of an organization you manage','Receive a notification when the organization you are admin of is mentioned','boolean','NotificationOrganizationMention','user'), - ('${preferenceDefinitionIds[38]}',1,'MembershipChallenge','Allow Space members to join','Allow members of the parent Space to join this Challenge','boolean','MembershipJoinChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[39]}',1,'Notification','Community new member','Receiver notification when I join a community','boolean','NotificationCommunityNewMember','user'), - ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), - ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async addMissingConstraints(queryRunner: QueryRunner) { - const storageBuckets = await queryRunner.query( - `SELECT id FROM storage_bucket where storageAggregatorId NOT IN (select id from storage_aggregator);` - ); - for (const storageBucket of storageBuckets) { - await queryRunner.query( - `UPDATE storage_bucket - SET storageAggregatorId = NULL - WHERE id = '${storageBucket.id}'` - ); - } - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - private async createStorageAggregator( - queryRunner: QueryRunner - ): Promise { - const storageAggregatorID = randomUUID(); - const storageAggregatorAuthID = randomUUID(); - const directStorageID = randomUUID(); - const directStorageAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageAggregatorAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${directStorageAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId) - VALUES ('${directStorageID}', - '1', - '${directStorageAuthID}', - '${allowedTypes}', - ${maxAllowedFileSize}, - '${storageAggregatorID}')` - ); - - await queryRunner.query( - `INSERT INTO storage_aggregator (id, version, authorizationId, directStorageId) - VALUES ('${storageAggregatorID}', - '1', - '${storageAggregatorAuthID}', - '${directStorageID}')` - ); - - return storageAggregatorID; - } -} diff --git a/src/migrations/1705843901852-addConstraints.ts b/src/migrations/1705843901852-addConstraints.ts deleted file mode 100644 index 0c40219aca..0000000000 --- a/src/migrations/1705843901852-addConstraints.ts +++ /dev/null @@ -1,302 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class addConstraints1705843901852 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`visual\` ADD UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` (\`tagsetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` (\`locationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD UNIQUE INDEX \`IDX_b4cf0f96bf08cf396f68355522\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD UNIQUE INDEX \`IDX_8e76dcf171c45875c44febb1d8\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_9fdd8f0bfe04a676822c7265e1\` (\`rowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_d2cb77c14644156ec8e865608e\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_5a72d5b37312bac2e0a0115718\` (\`verificationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_395aa74996a1f978b4969d114b\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_028322b763dc94242dc9f638f9\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_10458c50c10436b6d589b40e5c\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`room\` ADD UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_2d8a3ca181c3f0346817685d21\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_5337074c9b818bb63e6f314c80\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD UNIQUE INDEX \`IDX_eb99e588873c788a68a035478a\` (\`updatesId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b132226941570cb650a4023d49\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_c7d74dd6b92d4202c705cd3676\` (\`applicationFormId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_3823de95920943655430125fa9\` (\`policyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_checkout\` ADD UNIQUE INDEX \`IDX_e85c3329a73901499b08268da7\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_checkout\` ADD UNIQUE INDEX \`IDX_740508d60c7a6de2c2a706f202\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_4db6290f461fa726e86cf3d634\` (\`checkoutId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` (\`framingId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_b5069b11030e9608ee4468f850\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD UNIQUE INDEX \`IDX_6e74d59afda096b68d12a69969\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_5fe58ece01b48496aebc04733d\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` (\`calendarId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` (\`tagsetTemplateSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_f67a2d25c945269d602c182fbc\` (\`timelineId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`project\` ADD UNIQUE INDEX \`IDX_6814b5d57d931283b1a2a1908c\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_0af5c8e5c0a2f7858ae0a40c04\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD UNIQUE INDEX \`IDX_e3b287bbffe59aba827d97d5fa\` (\`rowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD UNIQUE INDEX \`IDX_28129cec24e65cc8340ecd1284\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD UNIQUE INDEX \`IDX_a37ebd95962285f8339bffb157\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD UNIQUE INDEX \`IDX_8488dda5c509a57e6070e8c3b0\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD UNIQUE INDEX \`IDX_313c12afe69143a9ee3779b4f6\` (\`rowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD UNIQUE INDEX \`IDX_eedbe52ec6041ac337528d3dd0\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD UNIQUE INDEX \`IDX_0ec10c5ca99e2b7bbdeeaf6ff0\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD UNIQUE INDEX \`IDX_e62d620c2e7ea854d8832db720\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD UNIQUE INDEX \`IDX_c3bdb693adb031b6613edcef4f\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD UNIQUE INDEX \`IDX_4a9c8cefc6c7e33aa728d22a90\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD UNIQUE INDEX \`IDX_cc2faf30ce52648db9299d7072\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD UNIQUE INDEX \`IDX_5b4948db27c348e65055187d5e\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD UNIQUE INDEX \`IDX_3aec561629db1d65a9b2b3a788\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD UNIQUE INDEX \`IDX_bd591d7403dabe091f6a116975\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_479f799f0d86e43c9d8623e827\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_29ff764dc6de1a9dc289cbfb01\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD UNIQUE INDEX \`IDX_eb0176ef4b98c143322aa6f809\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_b4250035291aac1329d59224a9\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_ea06eb8894469a0f262d929bf0\` (\`collaborationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` (\`contextId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` (\`communityId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_9c664d684f987a735678b0ba82\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_85e1d68e22378dc2e81bce8d3a\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_3ef80ef55ba1a1d45e625ea838\` (\`licenseId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_ef077d5cc64cd388217db42ea9\` (\`templatesSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_980c4643d7d9de1b97bc39f518\` (\`storageAggregatorId\`)` - ); - // // ======================================== FIXING ONE-TO-ONE RELATIONSHIPS ======================================== - // // PLATFORM - // communicationId - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_55333901817dd09d5906537e088\`` - ); - await queryRunner.query( - `DROP INDEX \`FK_55333901817dd09d5906537e088\` ON \`platform\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`REL_3eb4c1d5063176a184485399f1\` (\`communicationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_55333901817dd09d5906537e088\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // storageAggregatorId - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_5554d59c0b805c9c1ecb0070e16\`` - ); - await queryRunner.query( - `DROP INDEX \`FK_5554d59c0b805c9c1ecb0070e16\` ON \`platform\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`REL_f516dd9a46616999c7e9a6adc1\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_5554d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // this one was missing in the first place - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_ca469f5ec53a7719d155d60aca1\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`REL_ca469f5ec53a7719d155d60aca\` (\`libraryId\`)` - ); - // // LIBRARY - // storageAggregatorId - await queryRunner.query( - `ALTER TABLE \`library\` DROP FOREIGN KEY \`FK_6664d59c0b805c9c1ecb0070e16\`` - ); - await queryRunner.query( - `DROP INDEX \`FK_6664d59c0b805c9c1ecb0070e16\` ON \`library\`` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD UNIQUE INDEX \`REL_112e1c016f3cdbcea1d45118ee\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_6664d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // // CALLOUT FRAMING - // whiteboardId - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // INNOVATION PACK - // profileId - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` (\`profileId\`)` - ); - // templatesSetId - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`REL_a1441e46c8d36090e1f6477cea\` (\`templatesSetId\`)` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1707155838075-linkProfile.ts b/src/migrations/1707155838075-linkProfile.ts deleted file mode 100644 index 4b2c571da5..0000000000 --- a/src/migrations/1707155838075-linkProfile.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class linkProfile1707155838075 implements MigrationInterface { - name = 'linkProfile1707155838075'; - - public async up(queryRunner: QueryRunner): Promise { - const contributions: { - id: string; - linkId: string; - }[] = await queryRunner.query( - `SELECT id, linkId FROM callout_contribution` - ); - for (const contribution of contributions) { - if (contribution.linkId) { - await queryRunner.query( - `UPDATE \`reference\` SET profileId = NULL WHERE (id = '${contribution.linkId}')` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1707304590364-linkEntity.ts b/src/migrations/1707304590364-linkEntity.ts deleted file mode 100644 index bed539c7c4..0000000000 --- a/src/migrations/1707304590364-linkEntity.ts +++ /dev/null @@ -1,272 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import replaceSpecialCharacters from 'replace-special-characters'; -import { escapeString } from './utils/escape-string'; - -export class linkEntity1707304590364 implements MigrationInterface { - name = 'linkEntity1707304590364'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`link\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`uri\` text NOT NULL, - \`authorizationId\` char(36) NULL, - \`profileId\` char(36) NULL, - UNIQUE INDEX \`REL_07f249ac87502495710a62c5c0\` (\`authorizationId\`), - UNIQUE INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` (\`profileId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_07f249ac87502495710a62c5c01\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_3bfc8c1aaec1395cc148268d3cd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` - ); - - const contributions: { - id: string; - linkId: string; - calloutId: string; - }[] = await queryRunner.query( - `SELECT id, linkId, calloutId FROM callout_contribution WHERE linkId IS NOT NULL` - ); - for (const contribution of contributions) { - // Get the relevant information - const [reference]: { - id: string; - name: string; - description: string; - uri: string; - }[] = await queryRunner.query( - `SELECT id, name, description, uri FROM reference WHERE id = '${contribution.linkId}'` - ); - - if (contribution.calloutId === null) { - console.log(`Contribution ${contribution.id} has no calloutId`); - continue; - } - const storageAggregatorID = await this.getStorageAggregatorID( - queryRunner, - contribution.calloutId - ); - - if (storageAggregatorID === null) { - console.log( - `Callout ${contribution.calloutId} has no storageAggregatorID` - ); - continue; - } - - // Create and link the Profile - const linkID = randomUUID(); - const linkAuthID = randomUUID(); - - const profileID = randomUUID(); - const profileAuthID = randomUUID(); - - const locationID = randomUUID(); - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${linkAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${profileAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO location VALUES - ('${locationID}', DEFAULT, DEFAULT, 1, '', '', '' ,'', '', '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${storageAggregatorID}', - '${storageBucketAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO profile (id, version, displayName, description, type, authorizationId) VALUES - ('${profileID}', - 1, - '${escapeString(replaceSpecialCharacters(reference.name))}', - '${escapeString( - replaceSpecialCharacters(reference.description) - )}', - 'contribution-link', - '${profileAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO link (id, version, uri, authorizationId, profileId) VALUES - ('${linkID}', - 1, '${escapeString( - replaceSpecialCharacters(reference.uri) - )}', '${linkAuthID}', '${profileID}')` - ); - - await queryRunner.query( - `UPDATE callout_contribution SET linkId = '${linkID}' WHERE id = '${contribution.id}'` - ); - - // Delete the old reference table entry - await queryRunner.query( - `DELETE FROM reference WHERE id = '${contribution.linkId}'` - ); - } - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`link\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_3bfc8c1aaec1395cc148268d3cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_07f249ac87502495710a62c5c01\`` - ); - - await queryRunner.query( - `DROP INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` - ); - - const contributions: { - id: string; - linkId: string; - calloutId: string; - }[] = await queryRunner.query( - `SELECT id, linkId, calloutId FROM callout_contribution WHERE linkId IS NOT NULL` - ); - for (const contribution of contributions) { - // Get the relevant information - const [link]: { - id: string; - uri: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, uri, profileId FROM link WHERE id = '${contribution.linkId}'` - ); - - const [linkProfile]: { - id: string; - displayName: string; - description: string; - }[] = await queryRunner.query( - `SELECT id, displayName, description FROM profile WHERE id = '${link.profileId}'` - ); - - const referenceID = randomUUID(); - const referenceAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${referenceAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO reference (id, version, name, uri, description, authorizationId) VALUES - ('${referenceID}', - 1, - '${escapeString( - replaceSpecialCharacters(linkProfile.displayName) - )}', - '${escapeString(replaceSpecialCharacters(link.uri))}', - '${escapeString( - replaceSpecialCharacters(linkProfile.description) - )}', - '${referenceAuthID}')` - ); - await queryRunner.query( - `UPDATE callout_contribution SET linkId = '${referenceID}' WHERE id = '${contribution.id}'` - ); - await queryRunner.query( - `DELETE FROM profile WHERE id = '${link.profileId}'` - ); - } - await queryRunner.query(`DROP TABLE \`link\``); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`reference\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - private async getStorageAggregatorID( - queryRunner: QueryRunner, - calloutID: string - ) { - const [callout]: { - id: string; - framingId: string; - }[] = await queryRunner.query( - `SELECT id, framingId FROM callout WHERE id = '${calloutID}'` - ); - - const [framing]: { - id: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, profileId FROM callout_framing WHERE id = '${callout.framingId}'` - ); - - const [profile]: { - id: string; - storageBucketId: string; - }[] = await queryRunner.query( - `SELECT id, storageBucketId FROM profile WHERE id = '${framing.profileId}'` - ); - - const [storageBucket]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM storage_bucket WHERE id = '${profile.storageBucketId}'` - ); - return storageBucket.storageAggregatorId; - } - - private async getCalloutFramingProfileID( - queryRunner: QueryRunner, - calloutID: string - ) { - const [callout]: { - id: string; - framingId: string; - }[] = await queryRunner.query( - `SELECT id, framingId FROM callout WHERE id = '${calloutID}'` - ); - - const [framing]: { - id: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, profileId FROM callout_framing WHERE id = '${callout.framingId}'` - ); - - return framing.profileId; - } -} diff --git a/src/migrations/1708354354175-whiteboardToRt.ts b/src/migrations/1708354354175-whiteboardToRt.ts deleted file mode 100644 index 2ac0049cb3..0000000000 --- a/src/migrations/1708354354175-whiteboardToRt.ts +++ /dev/null @@ -1,225 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -type Whiteboard = { - id: string; - createdDate: Date; - updatedDate: Date; - version: number; - content: string; - authorizationId: string; - checkoutId: string; - nameID: string; - createdBy: string; - profileId: string; -}; - -export class whiteboardToRt1708354354175 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - // move whiteboards to whiteboard_rt AND decompress the content - const whiteboards: Whiteboard[] = await queryRunner.query(` - SELECT * FROM whiteboard - `); - for (const whiteboard of whiteboards) { - const debugValue = generateInsertValues(whiteboard); - await queryRunner.query( - ` - INSERT INTO whiteboard_rt (id, createdDate, updatedDate, version, nameID, content, createdBy, authorizationId, profileId, contentUpdatePolicy) - VALUES - ${debugValue} - `, - [whiteboard.content] - ); - } - // delete checkout entity - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_08d1ccc94b008dbda894a3cfa20\`` // whiteboard_checkout.id - ); - await queryRunner.query( - `DROP INDEX \`REL_08d1ccc94b008dbda894a3cfa2\` ON \`whiteboard\`` // whiteboard_checkout.id - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_08d1ccc94b008dbda894a3cfa2\`` // whiteboard_checkout.id - ); - await queryRunner.query(`DROP TABLE whiteboard_checkout`); - // migrate framing whiteboardRtId to whiteboardId and drop whiteboardRtId - // this way no rename is needed and FK conflicts are avoided - // drop fk constraint and add it later - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` // whiteboardId - ); - await queryRunner.query(` - UPDATE callout_framing SET whiteboardId = whiteboardRtId - WHERE whiteboardRtId IS NOT NULL - `); - // drop framing.whiteboardRtId - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_62712f63939a6d56fd5c334ee3f\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_62712f63939a6d56fd5c334ee3\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP COLUMN \`whiteboardRtId\`` - ); - // drop callout_contribution references to whiteboard table - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` - ); - // drop whiteboard table - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_29991450cf75dc486700ca034c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_1dc9521a013c92854e92e099335\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_1dc9521a013c92854e92e09933\` ON \`whiteboard\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_1dc9521a013c92854e92e09933\`` - ); - await queryRunner.query(`DROP TABLE whiteboard`); - // rename whiteboard_rt to whiteboard - await queryRunner.query(`ALTER TABLE whiteboard_rt RENAME TO whiteboard`); - // reinsert callout_contribution references to the newly renamed whiteboard table - await queryRunner.query(` - ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` - FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`) - `); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // enforce the contribution policy to OWNER for all whiteboards that are responses to a callout - await queryRunner.query( - `UPDATE whiteboard SET contentUpdatePolicy = 'admins'` - ); - // update all the callouts with whiteboardRT type - await queryRunner.query( - `UPDATE \`callout\` SET type = 'whiteboard' WHERE type = 'whiteboard-real-time'` - ); - // update all callout templates - await queryRunner.query( - `UPDATE \`callout_template\` SET type = 'whiteboard' WHERE type = 'whiteboard-real-time'` - ); - // rename feature flag - await queryRunner.query( - `UPDATE \`feature_flag\` SET name = 'whiteboard-multi-user' WHERE name = 'whiteboard-rt'` - ); - // rename privilege rules - await queryRunner.query(` - UPDATE authorization_policy - SET privilegeRules = REPLACE(privilegeRules, 'whiteboardRtContentUpdate', 'whiteboardContentUpdate'); - `); - await queryRunner.query(` - UPDATE authorization_policy - SET privilegeRules = REPLACE(privilegeRules, 'collaborationWhiteboardRtCreate', 'collaborationWhiteboardCreate'); - `); - await queryRunner.query(` - UPDATE authorization_policy - SET privilegeRules = REPLACE(privilegeRules, 'collaborationWhiteboardRtContributorsCreate', 'collaborationWhiteboardContributorsCreate'); - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` - ); - await queryRunner.query(`ALTER TABLE whiteboard RENAME TO whiteboard_rt`); - await queryRunner.query(`CREATE TABLE \`whiteboard\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`content\` longtext NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`checkoutId\` char(36) DEFAULT NULL, - \`nameID\` varchar(36) NOT NULL, - \`createdBy\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`IDX_1dc9521a013c92854e92e09933\` (\`authorizationId\`), - UNIQUE INDEX \`IDX_08d1ccc94b008dbda894a3cfa2\` (\`checkoutId\`), - UNIQUE INDEX \`REL_1dc9521a013c92854e92e09933\` (\`authorizationId\`), - UNIQUE INDEX \`REL_08d1ccc94b008dbda894a3cfa2\` (\`checkoutId\`), - INDEX \`FK_29991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_1dc9521a013c92854e92e099335\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_29991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query(` - ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`) - `); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD \`whiteboardRtId\` char(36) DEFAULT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD INDEX \`IDX_62712f63939a6d56fd5c334ee3\` (\`whiteboardRtId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_62712f63939a6d56fd5c334ee3f\` FOREIGN KEY (\`whiteboardRtId\`) REFERENCES \`whiteboard_rt\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_08d1ccc94b008dbda894a3cfa20\` FOREIGN KEY (\`checkoutId\`) REFERENCES \`whiteboard_checkout\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query(`CREATE TABLE \`whiteboard_checkout\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`whiteboardId\` char(36) NOT NULL, - \`lockedBy\` char(36) NOT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_353b042af56f01ce222f08abf4\` (\`authorizationId\`), - UNIQUE INDEX \`REL_bd3c7c6c2dbc2a8daf4b1500a6\` (\`lifecycleId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - } -} - -const generateInsertValues = (whiteboard: Whiteboard) => { - return `( - '${whiteboard.id}', - '${dateToMysqlDatetime(correctDate(whiteboard.createdDate))}', - '${dateToMysqlDatetime(correctDate(whiteboard.updatedDate))}', - ${whiteboard.version}, - '${whiteboard.nameID}', - ?, - '${whiteboard.createdBy}', - '${whiteboard.authorizationId}', - '${whiteboard.profileId}', - 'admins' - )`; -}; -// corrects the date object, changed after parsing the date from the database by typeorm -// the date in db looks like '2023-12-01 10:10:39.725124', but is parsed as '2023-12-01T08:10:39' -// this function parses it to '2023-12-01T10:10:39.725Z' -const correctDate = (date: Date) => { - date.setTime(date.getTime() - date.getTimezoneOffset() * 60 * 1000); - return date; -}; - -const dateToMysqlDatetime = (date: Date) => { - return date.toISOString().slice(0, 19).replace('T', ' '); -}; diff --git a/src/migrations/1708769388221-flowStates.ts b/src/migrations/1708769388221-flowStates.ts deleted file mode 100644 index 774635106d..0000000000 --- a/src/migrations/1708769388221-flowStates.ts +++ /dev/null @@ -1,449 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import replaceSpecialCharacters from 'replace-special-characters'; -import { escapeString } from './utils/escape-string'; -import { createMachine } from 'xstate'; - -export class flowStates1708769388221 implements MigrationInterface { - name = 'flowStates1708769388221'; - - public async up(queryRunner: QueryRunner): Promise { - // create new schema entries - - await queryRunner.query( - `CREATE TABLE \`space_defaults\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`innovationFlowTemplateId\` char(36) NULL, - \`authorizationId\` char(36) NULL, - UNIQUE INDEX \`REL_413ba75964e5a534e4bfa54846\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD \`states\` text NOT NULL DEFAULT ('[]')` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD \`states\` text NOT NULL DEFAULT ('[]')` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`defaultsId\` char(36) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD \`innovationFlowId\` char(36) DEFAULT NULL` - ); - - // disable old constraints - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_4b4a68698d32f610a5fc1880c7f\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_0af5c8e5c0a2f7858ae0a40c04\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP COLUMN \`spaceID\`` - ); - // TODO: drop constraints challenge - innovation flow, opportunit - innovation flow - - //////////////////////////////////////// - // migrate data to new setup - // a. Create new space defaults for all spaces, including default flows for challenges + opportunities. TODO: what about the old flows? - const spaces: { - id: string; - templatesSetId: string; - }[] = await queryRunner.query(`SELECT id, templatesSetId FROM space`); - for (const space of spaces) { - // Get the default innovation flow template to use - const innovation_flow_templates: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM innovation_flow_template WHERE templatesSetId = '${space.templatesSetId}'` - ); - // Pick up the first one if there is an innovation flow template; otherwise, use the default - let innovationTemplateID: string | null = null; - if (innovation_flow_templates.length > 0) { - innovationTemplateID = innovation_flow_templates[0].id; - } - - // Create and link the Profile - const defaultsID = randomUUID(); - const defaultsAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${defaultsAuthID}', - 1, '', '', 0, '')` - ); - - // todo: Valentin: please check what I am doing re stringify... - await queryRunner.query( - `INSERT INTO space_defaults (id, version, innovationFlowTemplateId, authorizationId) VALUES - ('${defaultsID}', - 1, - '${innovationTemplateID}', - '${defaultsAuthID}')` - ); - await queryRunner.query( - `UPDATE space SET defaultsId = '${defaultsID}' WHERE id = '${space.id}'` - ); - } - - // b. Iterate over all the innovation flow entries and also all the innovation flow templates to convert the states to the new format - const innovationFlows: { - id: string; - lifecycleId: string; - }[] = await queryRunner.query( - `SELECT id, lifecycleId FROM innovation_flow` - ); - for (const innovationFlow of innovationFlows) { - const [lifecycle]: { - id: string; - machineDef: string; - }[] = await queryRunner.query( - `SELECT id, machineDef FROM lifecycle WHERE id = '${innovationFlow.lifecycleId}'` - ); - - // Convert the states to the new format - const states = this.convertMachineDefinitionToStates( - lifecycle.machineDef - ); - - // - await queryRunner.query( - `UPDATE innovation_flow SET states = '${this.convertStatesToText( - states - )}' WHERE id = '${innovationFlow.id}'` - ); - await queryRunner.query( - `DELETE FROM lifecycle WHERE id = '${lifecycle.id}'` - ); - } - - // c. Iterate over all the innovation flow entries and also all the innovation flow templates to convert the states to the new format - const innovationFlowTemplates: { - id: string; - definition: string; - }[] = await queryRunner.query( - `SELECT id, definition FROM innovation_flow_template` - ); - for (const innovationFlowTemplate of innovationFlowTemplates) { - // Convert the states to the new format - const states = this.convertMachineDefinitionToStates( - innovationFlowTemplate.definition - ); - - // - await queryRunner.query( - `UPDATE innovation_flow_template SET states = '${this.convertStatesToText( - states - )}' WHERE id = '${innovationFlowTemplate.id}'` - ); - } - // d. Move the InnovationFlows to be on Collaboration for Challenges + Opportunities - const challenges: { - id: string; - innovationFlowId: string; - collaborationId: string; - }[] = await queryRunner.query( - `SELECT id, innovationFlowId, collaborationId FROM challenge` - ); - for (const challenge of challenges) { - // - await queryRunner.query( - `UPDATE collaboration SET innovationFlowId = '${challenge.innovationFlowId}' WHERE id = '${challenge.collaborationId}'` - ); - } - const opportunities: { - id: string; - innovationFlowId: string; - collaborationId: string; - }[] = await queryRunner.query( - `SELECT id, innovationFlowId, collaborationId FROM opportunity` - ); - for (const opportunity of opportunities) { - // - await queryRunner.query( - `UPDATE collaboration SET innovationFlowId = '${opportunity.innovationFlowId}' WHERE id = '${opportunity.collaborationId}'` - ); - } - const spaces2: { - id: string; - collaborationId: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, collaborationId, storageAggregatorId FROM space` - ); - for (const space of spaces2) { - const newInnovationFlowId = await this.createInnovationFlow( - queryRunner, - space.storageAggregatorId - ); - await queryRunner.query( - `UPDATE collaboration SET innovationFlowId = '${newInnovationFlowId}' WHERE id = '${space.collaborationId}'` - ); - } - - // Add new constraints - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD UNIQUE INDEX \`IDX_413ba75964e5a534e4bfa54846\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_413ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // TBD: also need a REL? - await queryRunner.query( - // Shouldn't this be a non-unique index if we are allowing nulls here? - `ALTER TABLE \`space_defaults\` ADD INDEX \`IDX_666ba75964e5a534e4bfa54846\` (\`innovationFlowTemplateId\`)` - ); - // This one didn't work - // await queryRunner.query( - // `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_666ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`innovationFlowTemplateId\`) REFERENCES \`innovation_flow_template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - // ); - - // TODO: add constraints collaboration - innovation flow - - // remove old data - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP COLUMN \`definition\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP COLUMN \`type\`` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP COLUMN \`lifecycleId\`` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP COLUMN \`type\`` - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_4c435130cde781b69259eec7d85\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP COLUMN \`innovationFlowId\`` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_4840f1e3ae5509245bdb5c401f3\`` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP COLUMN \`innovationFlowId\`` - ); - - await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP COLUMN \`policy\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - // create new schema entries - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD \`policy\` text NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD \`lifecycleId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD \`spaceID\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD \`type\` varchar(128) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`innovationFlowId\` char(36) DEFAULTNULL` - ); - - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`innovationFlowId\` char(36) DEFAULTNULL` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD \`definition\` text NULL` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD \`type\` varchar(128) NULL` - ); - - // disable old constraints - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_413ba75964e5a534e4bfa54846e\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\`` - ); - - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_666ba75964e5a534e4bfa54846e\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_666ba75964e5a534e4bfa54846\`` - ); - - // migrate data to new setup - - // Add new constraints - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_0af5c8e5c0a2f7858ae0a40c04\` ON \`innovation_flow\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_4b4a68698d32f610a5fc1880c7f\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - // remove old data - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`defaultsId\``); - await queryRunner.query(`DROP TABLE \`space_defaults\``); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP COLUMN \`states\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP COLUMN \`states\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP COLUMN \`innovationFlowId\`` - ); - } - - innovationFlowStatesDefault: FlowState[] = [ - { - displayName: 'prepare', - description: 'The innovation is being prepared.', - }, - { - displayName: 'in progress', - description: 'The innovation is in progress.', - }, - { - displayName: 'summary', - description: 'The summary of the flow results.', - }, - { - displayName: 'done', - description: 'The flow is completed.', - }, - ]; - - private convertStatesToText(states: FlowState[]) { - return `${escapeString(replaceSpecialCharacters(JSON.stringify(states)))}`; - } - - private convertMachineDefinitionToStates(machineDefStr: string): FlowState[] { - if (machineDefStr === '') { - // if no definition, just return the default - return this.innovationFlowStatesDefault; - } - const result: FlowState[] = []; - const machineDef = JSON.parse(machineDefStr); - const machine = createMachine(machineDef); - const states = machine.states; - const stateNames = Object.keys(states); - for (const stateName of stateNames) { - result.push({ - displayName: stateName, - description: '', - }); - } - return result; - } - - private async createInnovationFlow( - queryRunner: QueryRunner, - storageAggregatorID: String - ): Promise { - // Create and link the Profile - const innovationFlowID = randomUUID(); - const innovationFlowAuthID = randomUUID(); - - const profileID = randomUUID(); - const profileAuthID = randomUUID(); - - const locationID = randomUUID(); - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${innovationFlowAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${profileAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO location VALUES - ('${locationID}', DEFAULT, DEFAULT, 1, '', '', '' ,'', '', '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${storageAggregatorID}', - '${storageBucketAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO profile (id, version, displayName, description, type, authorizationId) VALUES - ('${profileID}', - 1, - 'innovationFlow', - '', - 'innovation-flow', - '${profileAuthID}')` - ); - - const statesStr = this.convertStatesToText( - this.innovationFlowStatesDefault - ); - await queryRunner.query( - `INSERT INTO innovation_flow (id, version, authorizationId, profileId, states) VALUES - ('${innovationFlowID}', - 1, - '${innovationFlowAuthID}', - '${profileID}', - '${statesStr}')` - ); - - return innovationFlowID; - } -} - -export type FlowState = { - displayName: string; - description: string; -}; diff --git a/src/migrations/1709970166009-account.ts b/src/migrations/1709970166009-account.ts deleted file mode 100644 index f87ee704ae..0000000000 --- a/src/migrations/1709970166009-account.ts +++ /dev/null @@ -1,475 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class account1709970166009 implements MigrationInterface { - name = 'account1709970166009'; - - public async up(queryRunner: QueryRunner): Promise { - // Add new structure - await this.projectAgreementUp(queryRunner); - await this.challengeHierarchyUp(queryRunner); - - await this.accountUpBeforeData(queryRunner); - - // migrate data - const spaces: { - id: string; - licenseId: string; - defaultsId: string; - templatesSetId: string; - }[] = await queryRunner.query( - `SELECT id, licenseId, defaultsId, templatesSetId FROM space` - ); - for (const space of spaces) { - // - const accountAuthorizationID = await this.createAuthorization( - queryRunner - ); - const accountID = randomUUID(); - - await queryRunner.query( - `INSERT INTO account (id, version, authorizationId, spaceID, licenseId, defaultsId, libraryId) VALUES - ('${accountID}', 1, '${accountAuthorizationID}', '${space.id}', '${space.licenseId}', '${space.defaultsId}', '${space.templatesSetId}')` - ); - await queryRunner.query( - `UPDATE space SET accountId = '${accountID}' WHERE id = '${space.id}'` - ); - } - const challenges: { - id: string; - spaceId: string; - }[] = await queryRunner.query(`SELECT id, spaceId FROM challenge`); - for (const challenge of challenges) { - const [space]: { - id: string; - accountId: string; - }[] = await queryRunner.query( - `SELECT id, accountId FROM space WHERE id = '${challenge.spaceId}'` - ); - if (!space || !space.accountId) { - continue; - } - await queryRunner.query( - `UPDATE challenge SET accountId = '${space.accountId}' WHERE id = '${challenge.id}'` - ); - } - const opportunities: { - id: string; - spaceID: string; - }[] = await queryRunner.query(`SELECT id, spaceID FROM opportunity`); - for (const opportunity of opportunities) { - const [space]: { - id: string; - accountId: string; - }[] = await queryRunner.query( - `SELECT id, accountId FROM space WHERE id = '${opportunity.spaceID}'` - ); - await queryRunner.query( - `UPDATE opportunity SET accountId = '${space.accountId}' WHERE id = '${opportunity.id}'` - ); - } - - // add new constraints - await this.accountUpAfterData(queryRunner); - } - - public async down(queryRunner: QueryRunner): Promise { - // await this.projectAgreementDown(queryRunner); - await this.challengeHierarchyDown(queryRunner); - - await this.accountDownBeforeData(queryRunner); - - // Migrate data - const spaces: { - id: string; - accountId: string; - }[] = await queryRunner.query(`SELECT id, accountId FROM space`); - for (const space of spaces) { - const [account]: { - id: string; - defaultsId: string; - libraryId: string; - licenseId: string; - }[] = await queryRunner.query( - `SELECT id, defaultsId, libraryId, licenseId FROM account WHERE id = '${space.accountId}'` - ); - await queryRunner.query( - `UPDATE space SET defaultsId = '${account.defaultsId}', templatesSetId = '${account.libraryId}', licenseId = '${account.licenseId}' WHERE id = '${space.id}'` - ); - } - - const challenges: { - id: string; - accountId: string; - }[] = await queryRunner.query(`SELECT id, accountId FROM challenge`); - for (const challenge of challenges) { - const [account]: { - id: string; - spaceID: string; - }[] = await queryRunner.query( - `SELECT id, spaceID FROM account WHERE id = '${challenge.accountId}'` - ); - if (!account || !account.spaceID) { - continue; - } - await queryRunner.query( - `UPDATE challenge SET spaceId = '${account.spaceID}' WHERE id = '${challenge.id}'` - ); - } - const opportunities: { - id: string; - accountId: string; - }[] = await queryRunner.query(`SELECT id, accountId FROM opportunity`); - for (const opportunity of opportunities) { - const [account]: { - id: string; - spaceID: string; - }[] = await queryRunner.query( - `SELECT id, spaceID FROM account WHERE id = '${opportunity.accountId}'` - ); - if (!account || !account.spaceID) { - continue; - } - await queryRunner.query( - `UPDATE challenge SET spaceID = '${account.spaceID}' WHERE id = '${opportunity.id}'` - ); - } - - await this.accountDownAfterData(queryRunner); - } - - private async accountUpBeforeData(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`account\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`spaceID\` char(36) NOT NULL, - \`authorizationId\` char(36) NULL, - \`licenseId\` char(36) NULL, - \`libraryId\` char(36) NULL, - \`defaultsId\` char(36) NULL, - UNIQUE INDEX \`REL_91a165c1091a6959cc19d52239\` (\`authorizationId\`), - UNIQUE INDEX \`REL_8339e62882f239dc00ff5866f8\` (\`licenseId\`), - UNIQUE INDEX \`REL_bea623a346d2e3f88dd0aeef57\` (\`libraryId\`), - UNIQUE INDEX \`REL_9542f2ad51464f961e5b5b5b58\` (\`defaultsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`accountId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_6bdeffaf6ea6159b4672a2aed7\` (\`accountId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6bdeffaf6ea6159b4672a2aed7\` ON \`space\` (\`accountId\`)` - ); - - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`accountId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`accountId\` char(36) NULL` - ); - } - - private async accountUpAfterData(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_91a165c1091a6959cc19d522399\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_8339e62882f239dc00ff5866f8c\` FOREIGN KEY (\`licenseId\`) REFERENCES \`license\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_bea623a346d2e3f88dd0aeef576\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_9542f2ad51464f961e5b5b5b582\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6bdeffaf6ea6159b4672a2aed70\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD CONSTRAINT \`FK_69e32f4f4652f654dc8641ae2b8\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_78017461e03bd2a6cd47044bf6a\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_3ef80ef55ba1a1d45e625ea8389\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_33336901817dd09d5906537e088\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3ef80ef55ba1a1d45e625ea838\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_ef077d5cc64cd388217db42ea9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`licenseId\``); - await queryRunner.query( - `ALTER TABLE \`space\` DROP COLUMN \`templatesSetId\`` - ); - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`defaultsId\``); - - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP COLUMN \`spaceID2\`` - ); - - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP COLUMN \`spaceID\`` - ); - } - - private async accountDownBeforeData(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`templatesSetId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`licenseId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`defaultsId\` char(36) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_9542f2ad51464f961e5b5b5b582\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_bea623a346d2e3f88dd0aeef576\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_8339e62882f239dc00ff5866f8c\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_91a165c1091a6959cc19d522399\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_78017461e03bd2a6cd47044bf6a\`` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_69e32f4f4652f654dc8641ae2b8\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6bdeffaf6ea6159b4672a2aed7\` ON \`space\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_6bdeffaf6ea6159b4672a2aed7\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9542f2ad51464f961e5b5b5b58\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_bea623a346d2e3f88dd0aeef57\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8339e62882f239dc00ff5866f8\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\`` - ); - } - - private async accountDownAfterData(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3ef80ef55ba1a1d45e625ea838\` ON \`space\` (\`licenseId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_ef077d5cc64cd388217db42ea9\` ON \`space\` (\`templatesSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_3ef80ef55ba1a1d45e625ea8389\` FOREIGN KEY (\`licenseId\`) REFERENCES \`license\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_33336901817dd09d5906537e088\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP COLUMN \`accountId\`` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP COLUMN \`accountId\`` - ); - - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`accountId\``); - - await queryRunner.query(`DROP TABLE \`account\``); - } - - private async challengeHierarchyUp(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_494b27cb13b59128fb24b365ca6\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` RENAME COLUMN \`spaceId\` TO \`spaceID2\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` RENAME COLUMN \`parentSpaceId\` TO \`spaceId\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_494b27cb13b59128fb24b365ca6\` FOREIGN KEY (\`spaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_7d2b222d54b900071b0959f03ef\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP COLUMN \`parentChallengeId\`` - ); - } - - private async challengeHierarchyDown( - queryRunner: QueryRunner - ): Promise { - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_494b27cb13b59128fb24b365ca6\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` RENAME COLUMN \`spaceId\` TO \`parentSpaceId\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`spaceId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_494b27cb13b59128fb24b365ca6\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`spaceID\` char(36) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`parentChallengeId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD CONSTRAINT \`FK_7d2b222d54b900071b0959f03ef\` FOREIGN KEY (\`parentChallengeId\`) REFERENCES \`challenge\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - private async projectAgreementUp(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`agreement\` DROP FOREIGN KEY \`FK_8785b5a8510cabcc25d0f196783\`` - ); - await queryRunner.query( - `ALTER TABLE \`agreement\` DROP FOREIGN KEY \`FK_22348b89c2f802a3d75d52fbd57\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP FOREIGN KEY \`FK_35e34564793a27bb3c209a15245\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP FOREIGN KEY \`FK_49991450cf75dc486700ca034c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP FOREIGN KEY \`FK_f425931bb61a95ef6f6d89c9a85\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP FOREIGN KEY \`FK_fac8673f44e6b295e30d1c1739a\`` - ); - - await queryRunner.query( - `DROP INDEX \`REL_22348b89c2f802a3d75d52fbd5\` ON \`agreement\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_fac8673f44e6b295e30d1c1739\` ON \`project\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f425931bb61a95ef6f6d89c9a8\` ON \`project\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP INDEX \`FK_35e34564793a27bb3c209a15245\`` - ); - await queryRunner.query( - `ALTER TABLE \`project\` DROP INDEX \`FK_49991450cf75dc486700ca034c6\`` - ); - - await queryRunner.query(`DROP TABLE \`agreement\``); - await queryRunner.query(`DROP TABLE \`project\``); - } - - private async projectAgreementDown(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`agreement\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`name\` varchar(255) NOT NULL, - \`description\` text DEFAULT NULL, - \`projectId\` char(36) DEFAULT NULL, - \`tagsetId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_22348b89c2f802a3d75d52fbd5\` (\`tagsetId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - - await queryRunner.query(`CREATE TABLE \`project\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), - \`version\` int(11) NOT NULL, - \`nameID\` varchar(36) NOT NULL, - \`spaceID\` char(36) DEFAULT NULL, - \`authorizationId\` char(36) DEFAULT NULL, - \`lifecycleId\` char(36) DEFAULT NULL, - \`opportunityId\` char(36) DEFAULT NULL, - \`profileId\` char(36) DEFAULT NULL, - PRIMARY KEY (\`id\`), - UNIQUE INDEX \`REL_fac8673f44e6b295e30d1c1739\` (\`authorizationId\`), - UNIQUE INDEX \`REL_f425931bb61a95ef6f6d89c9a8\` (\`lifecycleId\`), - INDEX \`FK_35e34564793a27bb3c209a15245\` (\`opportunityId\`), - INDEX \`FK_49991450cf75dc486700ca034c6\` (\`profileId\`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); - - await queryRunner.query( - 'ALTER TABLE `agreement` ADD CONSTRAINT `FK_8785b5a8510cabcc25d0f196783` FOREIGN KEY (`projectId`) REFERENCES `project`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `agreement` ADD CONSTRAINT `FK_22348b89c2f802a3d75d52fbd57` FOREIGN KEY (`tagsetId`) REFERENCES `tagset`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_35e34564793a27bb3c209a15245` FOREIGN KEY (`opportunityId`) REFERENCES `opportunity`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - `ALTER TABLE \`project\` ADD CONSTRAINT \`FK_49991450cf75dc486700ca034c6\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_f425931bb61a95ef6f6d89c9a85` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `project` ADD CONSTRAINT `FK_fac8673f44e6b295e30d1c1739a` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - } - - private async createAuthorization(queryRunner: QueryRunner): Promise { - // Create and link the Profile - const authorizationID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${authorizationID}', - 1, '', '', 0, '')` - ); - return authorizationID; - } -} diff --git a/src/migrations/1710272553085-calloutGroups.ts b/src/migrations/1710272553085-calloutGroups.ts deleted file mode 100644 index 78de74e2b6..0000000000 --- a/src/migrations/1710272553085-calloutGroups.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { escapeString } from './utils/escape-string'; -import replaceSpecialCharacters from 'replace-special-characters'; - -export class calloutGroups1710272553085 implements MigrationInterface { - name = 'calloutGroups1710272553085'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD \`groupsStr\` text NOT NULL DEFAULT ('[]')` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`type\` varchar(32) NOT NULL DEFAULT ('space')` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`type\` varchar(32) NOT NULL DEFAULT ('challenge')` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`type\` varchar(32) NOT NULL DEFAULT ('opportunity')` - ); - - await this.addCalloutGroupsAndType( - queryRunner, - 'space', - this.spaceCalloutGroups - ); - await this.addCalloutGroupsAndType( - queryRunner, - 'challenge', - this.subspaceCalloutGroups - ); - await this.addCalloutGroupsAndType( - queryRunner, - 'opportunity', - this.subspaceCalloutGroups - ); - - const tagsets: { - id: string; - name: string; - tags: string; - }[] = await queryRunner.query(`SELECT id, name, tags FROM tagset`); - for (const tagset of tagsets) { - if (tagset.name === 'callout-display-location') { - await queryRunner.query( - `UPDATE tagset SET name = 'callout-group' WHERE id = '${tagset.id}'` - ); - - await queryRunner.query( - `UPDATE tagset SET tags = '${this.updateTags( - tagset.tags - )}' WHERE id = '${tagset.id}'` - ); - } - } - - const tagset_templates: { - id: string; - name: string; - allowedValues: string; - }[] = await queryRunner.query( - `SELECT id, name, allowedValues FROM tagset_template` - ); - for (const tagset_template of tagset_templates) { - if (tagset_template.name === 'callout-display-location') { - await queryRunner.query( - `UPDATE tagset_template SET name = 'callout-group' WHERE id = '${tagset_template.id}'` - ); - - await queryRunner.query( - `UPDATE tagset_template SET allowedValues = '${this.updateTags( - tagset_template.allowedValues - )}' WHERE id = '${tagset_template.id}'` - ); - } - } - } - private updateTags(tagsStr: string): string { - let tags = tagsStr; - tags = tags.replace('CHALLENGES_1', 'SUBSPACES_1'); - tags = tags.replace('OPPORTUNITIES_1', 'SUBSPACES_1'); - tags = tags.replace('CHALLENGES_2', 'SUBSPACES_2'); - tags = tags.replace('OPPORTUNITIES_2', 'SUBSPACES_2'); - return tags; - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP COLUMN \`groupsStr\`` - ); - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`type\``); - await queryRunner.query(`ALTER TABLE \`challenge\` DROP COLUMN \`type\``); - await queryRunner.query(`ALTER TABLE \`opportunity\` DROP COLUMN \`type\``); - } - - private async addCalloutGroupsAndType( - queryRunner: QueryRunner, - journeyType: string, - calloutGroups: CalloutGroup[] - ) { - const journeys: { - id: string; - collaborationId: string; - }[] = await queryRunner.query( - `SELECT id, collaborationId FROM ${journeyType}` - ); - for (const journey of journeys) { - await queryRunner.query( - `UPDATE ${journeyType} SET type = '${journeyType}' WHERE id = '${journey.id}'` - ); - const groupsStr = escapeString( - replaceSpecialCharacters(JSON.stringify(calloutGroups)) - ); - await queryRunner.query( - `UPDATE collaboration SET groupsStr = '${groupsStr}' WHERE id = '${journey.collaborationId}'` - ); - } - } - - spaceCalloutGroups: CalloutGroup[] = [ - { - displayName: 'HOME_1', - description: 'The left column on the Home page.', - }, - { - displayName: 'HOME_2', - description: 'The right column on the Home page.', - }, - { - displayName: 'COMMUNITY_1', - description: 'The left column on the Community page.', - }, - { - displayName: 'COMMUNITY_2', - description: 'The right column on the Community page.', - }, - { - displayName: 'SUBSPACES_1', - description: 'The left column on the Subspaces page.', - }, - { - displayName: 'SUBSPACES_2', - description: 'The right column on the Subspaces page.', - }, - { - displayName: 'KNOWLEDGE', - description: 'The knowledge page.', - }, - ]; - - subspaceCalloutGroups: CalloutGroup[] = [ - { - displayName: 'HOME_1', - description: 'The left column on the Home page.', - }, - { - displayName: 'HOME_2', - description: 'The right column on the Home page.', - }, - { - displayName: 'CONTRIBUTE_1', - description: 'The left column on the Contribute page.', - }, - { - displayName: 'CONTRIBUTE_2', - description: 'The right column on the Contribute page.', - }, - { - displayName: 'SUBSPACES_1', - description: 'The left column on the Subspaces page.', - }, - { - displayName: 'SUBSPACES_2', - description: 'The right column on the Subspaces page.', - }, - ]; -} - -export type CalloutGroup = { - displayName: string; - description: string; -}; diff --git a/src/migrations/1710305801060-AddMissingRelationOnCallout.ts b/src/migrations/1710305801060-AddMissingRelationOnCallout.ts deleted file mode 100644 index 980da9d850..0000000000 --- a/src/migrations/1710305801060-AddMissingRelationOnCallout.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AddMissingRelationOnCallout1710305801060 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_cf776244b01436d8ca5cc762848\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1710670020390-communityGuidelines.ts b/src/migrations/1710670020390-communityGuidelines.ts deleted file mode 100644 index 7744df399b..0000000000 --- a/src/migrations/1710670020390-communityGuidelines.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import replaceSpecialCharacters from 'replace-special-characters'; -import { escapeString } from './utils/escape-string'; - -export class communityGuidelines1710670020390 implements MigrationInterface { - name = 'communityGuidelines1710670020390'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`community_guidelines\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`authorizationId\` char(36) NULL, - \`profileId\` char(36) NULL, - UNIQUE INDEX \`REL_684b272e6f7459439d41d2879e\` (\`authorizationId\`), - UNIQUE INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` (\`profileId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query( - `ALTER TABLE \`community\` ADD \`guidelinesId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` (\`guidelinesId\`)` - ); - - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_684b272e6f7459439d41d2879ee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_2e7dd2fa8c829352cfbecb2cc93\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - const communities: { - id: string; - type: string; - }[] = await queryRunner.query(`SELECT id, type FROM community`); - for (const community of communities) { - // Only process spaces - if (community.type === 'space') { - const [space]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM space WHERE communityId = '${community.id}'` - ); - const storageAggregatorID = space.storageAggregatorId; - - // Create and link the Profile - const guidelinesID = randomUUID(); - const guidelinesAuthID = randomUUID(); - - const profileID = randomUUID(); - const profileAuthID = randomUUID(); - - const locationID = randomUUID(); - - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - const defaultTagsetID = randomUUID(); - const defaultTagsetAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${guidelinesAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${profileAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO location VALUES - ('${locationID}', DEFAULT, DEFAULT, 1, '', '', '' ,'', '', '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${storageAggregatorID}', - '${storageBucketAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO profile (id, version, displayName, description, storageBucketId, type, authorizationId) VALUES - ('${profileID}', - 1, - 'Default Community Guidelines', - '', - '${storageBucketID}', - 'community-guidelines', - '${profileAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${defaultTagsetAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO tagset (id, version, name, tags, authorizationId, profileId, type) VALUES - ('${defaultTagsetID}', 1, 'default', '', '${defaultTagsetAuthID}', '${profileID}', 'freeform')` - ); - - await queryRunner.query( - `INSERT INTO community_guidelines (id, version, authorizationId, profileId) VALUES - ('${guidelinesID}', - 1, - '${guidelinesAuthID}', - '${profileID}')` - ); - - await queryRunner.query( - `UPDATE community SET guidelinesId = '${guidelinesID}' WHERE id = '${community.id}'` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1710843986344-AddReleaseForumCategory.ts b/src/migrations/1710843986344-AddReleaseForumCategory.ts deleted file mode 100644 index 030c42c83f..0000000000 --- a/src/migrations/1710843986344-AddReleaseForumCategory.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AddReleaseForumCategory1710843986344 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const [platform]: { communicationId: string }[] = await queryRunner.query(` - SELECT communicationId FROM platform - `); - - await queryRunner.query(` - UPDATE communication SET discussionCategories = 'releases,platform-functionalities,community-building,challenge-centric,help,other' - WHERE id = '${platform.communicationId}' - `); - } - - public async down(queryRunner: QueryRunner): Promise { - const [platform]: { communicationId: string }[] = await queryRunner.query(` - SELECT communicationId FROM platform - `); - - await queryRunner.query(` - UPDATE communication SET discussionCategories = 'platform-functionalities,community-building,challenge-centric,help,other' - WHERE id = '${platform.communicationId}' - `); - } -} diff --git a/src/migrations/1710843986354-spaceSettings.ts b/src/migrations/1710843986354-spaceSettings.ts deleted file mode 100644 index c20bb39841..0000000000 --- a/src/migrations/1710843986354-spaceSettings.ts +++ /dev/null @@ -1,293 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class spaceSettings1710843986354 implements MigrationInterface { - name = 'spaceSettings1710843986354'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`settingsStr\` text NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`settingsStr\` text NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`settingsStr\` text NOT NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bf7adf4308991457fdb04624e2\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_c890de5a08d363719a41703a638\`` - ); - - // Temporary remove foreign key constraint, we'll add it back in the end - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_650fb4e564a8b4b4ac344270744\`` - ); - - const spaces: { - id: string; - preferenceSetId: string; - }[] = await queryRunner.query(`SELECT id, preferenceSetId FROM space`); - for (const space of spaces) { - const preferences: { - id: string; - value: string; - preferenceDefinitionId: string; - }[] = await queryRunner.query( - `SELECT id, value, preferenceDefinitionId FROM preference WHERE preferenceSetId = '${space.preferenceSetId}'` - ); - const settings = this.getClonedSpaceSettings(); - for (const preference of preferences) { - const [preferenceDeinition]: { - id: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, type FROM preference_definition WHERE id = '${preference.preferenceDefinitionId}'` - ); - switch (preferenceDeinition.type) { - case SpacePreferenceType.MEMBERSHIP_JOIN_SPACE_FROM_ANYONE: - if (preference.value === 'true') { - settings.membership.policy = 'open'; - } - break; - case SpacePreferenceType.MEMBERSHIP_APPLICATIONS_FROM_ANYONE: - if (preference.value === 'true') { - settings.membership.policy = 'applications'; - } - break; - case SpacePreferenceType.AUTHORIZATION_ANONYMOUS_READ_ACCESS: - if (preference.value === 'true') { - settings.privacy.mode = 'public'; - } else { - settings.privacy.mode = 'private'; - } - break; - case SpacePreferenceType.ALLOW_MEMBERS_TO_CREATE_CHALLENGES: - if (preference.value === 'true') { - settings.collaboration.allowMembersToCreateSubspaces = true; - } - break; - case SpacePreferenceType.ALLOW_MEMBERS_TO_CREATE_CALLOUTS: - if (preference.value === 'true') { - settings.collaboration.allowMembersToCreateCallouts = true; - } - break; - case SpacePreferenceType.MEMBERSHIP_JOIN_SPACE_FROM_HOST_ORGANIZATION_MEMBERS: - const hostOrganizationId = await this.getHostOrganizationId( - queryRunner, - space.id - ); - if (hostOrganizationId) { - settings.membership.trustedOrganizations = [hostOrganizationId]; - } - break; - } - await queryRunner.query( - `UPDATE space SET settingsStr = '${JSON.stringify( - settings - )}' WHERE id = '${space.id}'` - ); - } - // drop preferences that match the preferenceSetId - - await queryRunner.query( - `DELETE FROM preference WHERE preferenceSetId = '${space.preferenceSetId}'` - ); - await queryRunner.query( - `DELETE FROM preference_set WHERE id = '${space.preferenceSetId}'` - ); - } - - const challenges: { - id: string; - preferenceSetId: string; - }[] = await queryRunner.query(`SELECT id, preferenceSetId FROM challenge`); - for (const challenge of challenges) { - const preferences: { - id: string; - value: string; - preferenceDefinitionId: string; - }[] = await queryRunner.query( - `SELECT id, value, preferenceDefinitionId FROM preference WHERE preferenceSetId = '${challenge.preferenceSetId}'` - ); - const settings: SpaceSettings = this.getClonedSpaceSettings(); - for (const preference of preferences) { - const [preferenceDeinition]: { - id: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, type FROM preference_definition WHERE id = '${preference.preferenceDefinitionId}'` - ); - switch (preferenceDeinition.type) { - case ChallengePreferenceType.MEMBERSHIP_APPLY_CHALLENGE_FROM_SPACE_MEMBERS: - if (preference.value === 'true') { - settings.membership.policy = 'applications'; - } - break; - case ChallengePreferenceType.MEMBERSHIP_JOIN_CHALLENGE_FROM_SPACE_MEMBERS: - if (preference.value === 'true') { - settings.membership.policy = 'open'; - } - break; - case ChallengePreferenceType.ALLOW_NON_MEMBERS_READ_ACCESS: - if (preference.value === 'true') { - settings.privacy.mode = 'public'; - } else { - settings.privacy.mode = 'private'; - } - break; - case ChallengePreferenceType.ALLOW_CONTRIBUTORS_TO_CREATE_OPPORTUNITIES: - if (preference.value === 'true') { - settings.collaboration.allowMembersToCreateSubspaces = true; - } - break; - case ChallengePreferenceType.ALLOW_CONTRIBUTORS_TO_CREATE_CALLOUTS: - if (preference.value === 'true') { - settings.collaboration.allowMembersToCreateCallouts = true; - } - break; - } - await queryRunner.query( - `UPDATE challenge SET settingsStr = '${JSON.stringify( - settings - )}' WHERE id = '${challenge.id}'` - ); - } - // drop preferences that match the preferenceSetId - await queryRunner.query( - `DELETE FROM preference WHERE preferenceSetId = '${challenge.preferenceSetId}'` - ); - await queryRunner.query( - `DELETE FROM preference_set WHERE id = '${challenge.preferenceSetId}'` - ); - } - - const opportunities: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM opportunity`); - for (const opportunity of opportunities) { - const settings = this.getClonedSpaceSettings(); - settings.privacy.mode = 'public'; - settings.collaboration.allowMembersToCreateSubspaces = false; - settings.collaboration.allowMembersToCreateCallouts = true; - settings.collaboration.inheritMembershipRights = true; - settings.membership.policy = 'open'; - await queryRunner.query( - `UPDATE opportunity SET settingsStr = '${JSON.stringify( - settings - )}' WHERE id = '${opportunity.id}'` - ); - } - - // Remove preferenceSet from space + challenge. Note: no constraints? - await queryRunner.query( - `ALTER TABLE \`space\` DROP COLUMN \`preferenceSetId\`` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP COLUMN \`preferenceSetId\`` - ); - - // Todo: delete preference definitions that are no longer needed - const spacePreferenceDefinitions: string[] = - Object.values(SpacePreferenceType); - const challengePreferenceDefinitions: string[] = Object.values( - ChallengePreferenceType - ); - const preferenceDefinitionsToRemove = spacePreferenceDefinitions.concat( - challengePreferenceDefinitions - ); - for (const preferenceDefinition of preferenceDefinitionsToRemove) { - await queryRunner.query( - `DELETE FROM preference_definition WHERE type = '${preferenceDefinition}'` - ); - } - - await queryRunner.query( - `DELETE FROM preference WHERE preferenceDefinitionId NOT IN (SELECT id FROM preference_definition);` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_650fb4e564a8b4b4ac344270744\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private getClonedSpaceSettings(): SpaceSettings { - return JSON.parse(JSON.stringify(spaceSettingsDefaults)); - } - - private async getHostOrganizationId( - queryRunner: QueryRunner, - spaceID: string - ): Promise { - const [credential]: { - id: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT id, agentId FROM credential WHERE type = 'space-host' AND resourceID = '${spaceID}'` - ); - if (!credential) { - return undefined; - } - const [organization]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM organization WHERE agentId = '${credential.agentId}'` - ); - if (!organization) { - return undefined; - } - return organization.id; - } -} - -export const spaceSettingsDefaults: SpaceSettings = { - privacy: { - mode: 'public', - }, - membership: { - policy: 'invitations', - trustedOrganizations: [], - }, - collaboration: { - inheritMembershipRights: true, - allowMembersToCreateSubspaces: false, - allowMembersToCreateCallouts: false, - }, -}; - -export enum ChallengePreferenceType { - MEMBERSHIP_JOIN_CHALLENGE_FROM_SPACE_MEMBERS = 'MembershipJoinChallengeFromSpaceMembers', - MEMBERSHIP_APPLY_CHALLENGE_FROM_SPACE_MEMBERS = 'MembershipApplyChallengeFromSpaceMembers', - MEMBERSHIP_FEEDBACK_ON_CHALLENGE_CONTEXT = 'MembershipFeedbackOnChallengeContext', - ALLOW_CONTRIBUTORS_TO_CREATE_OPPORTUNITIES = 'AllowContributorsToCreateOpportunities', - ALLOW_CONTRIBUTORS_TO_CREATE_CALLOUTS = 'AllowContributorsToCreateCallouts', - ALLOW_SPACE_MEMBERS_TO_CONTRIBUTE = 'AllowSpaceMembersToContribute', - ALLOW_NON_MEMBERS_READ_ACCESS = 'AllowNonMembersReadAccess', -} - -export enum SpacePreferenceType { - MEMBERSHIP_JOIN_SPACE_FROM_ANYONE = 'MembershipJoinSpaceFromAnyone', - MEMBERSHIP_JOIN_SPACE_FROM_HOST_ORGANIZATION_MEMBERS = 'MembershipJoinSpaceFromHostOrganizationMembers', - MEMBERSHIP_APPLICATIONS_FROM_ANYONE = 'MembershipApplicationsFromAnyone', - AUTHORIZATION_ANONYMOUS_READ_ACCESS = 'AuthorizationAnonymousReadAccess', - ALLOW_MEMBERS_TO_CREATE_CHALLENGES = 'AllowMembersToCreateChallenges', - ALLOW_MEMBERS_TO_CREATE_CALLOUTS = 'AllowMembersToCreateCallouts', -} - -export type SpaceSettings = { - privacy: { - mode: 'public' | 'private'; - }; - membership: { - policy: 'open' | 'applications' | 'invitations'; - trustedOrganizations: string[]; - }; - collaboration: { - inheritMembershipRights: boolean; - allowMembersToCreateSubspaces: boolean; - allowMembersToCreateCallouts: boolean; - }; -}; diff --git a/src/migrations/1711017129997-AddMissingStorageBuckets.ts b/src/migrations/1711017129997-AddMissingStorageBuckets.ts deleted file mode 100644 index 367127b1fe..0000000000 --- a/src/migrations/1711017129997-AddMissingStorageBuckets.ts +++ /dev/null @@ -1,201 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -const localhostDocumentUriPrefix = - 'http://localhost:3000/api/private/rest/storage/document'; -const productionDocumentUriPrefix = - 'https://alkem.io/api/private/rest/storage/document'; -export class AddMissingStorageBuckets1711017129997 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const linkProfiles: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM profile WHERE storageBucketId IS NULL AND type = 'contribution-link'` - ); - - for (const linkProfile of linkProfiles) { - const storageAggregatorID = await this.getStorageAggregatorID( - queryRunner, - linkProfile.id - ); - - if (storageAggregatorID === null) { - console.log( - `Parent Callout of link with profileId ${linkProfile.id} has no storageAggregatorId.` - ); - continue; - } - - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${storageAggregatorID}', - '${storageBucketAuthID}')` - ); - - await queryRunner.query( - `UPDATE profile SET storageBucketId = '${storageBucketID}' WHERE id = '${linkProfile.id}'` - ); - // We are not sure if someone has pasted an alkemio url of a document or directly uploaded on this link. Commenting out until we are sure. - // Update document storageBucketId - const [link] = await queryRunner.query( - `SELECT id, uri FROM link WHERE profileId = '${linkProfile.id}'` - ); - const isAlkemioDocumentUri = this.isAlkemioDocumentUri(link.uri); - if (isAlkemioDocumentUri) { - const links: { - id: string; - uri: string; - createdDate: string; - }[] = await queryRunner.query( - `SELECT id, uri, createdDate FROM link WHERE uri = '${link.uri}'` - ); - if (links.length > 1) { - const dates = links.map(link => new Date(link.createdDate)); - const oldestDate = Math.min(...dates.map(date => date.getTime())); - const oldestLink = links.find( - link => new Date(link.createdDate).getTime() === oldestDate - ); - console.log( - `Multiple links with same uri found. Skipping storage bucket update. Oldest link id: ${oldestLink?.id}` - ); - continue; - } - const documentId = this.getDocumentId(link.uri); - console.log( - `Updating document storageBucketId for document with id: ${documentId}` - ); - await queryRunner.query( - `UPDATE document SET storageBucketId = '${storageBucketID}' WHERE id = '${documentId}'` - ); - } - } - - const spaces: { - id: string; - collaborationId: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, collaborationId, storageAggregatorId FROM space` - ); - - for (const space of spaces) { - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${space.storageAggregatorId}', - '${storageBucketAuthID}')` - ); - - const [collaboration]: { - id: string; - innovationFlowId: string; - }[] = await queryRunner.query( - `SELECT id, innovationFlowId FROM collaboration WHERE id = '${space.collaborationId}'` - ); - - const [innovationFlow]: { - id: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, profileId FROM innovation_flow WHERE id = '${collaboration.innovationFlowId}'` - ); - - const [innovationFlowProfile]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM profile WHERE id = '${innovationFlow.profileId}'` - ); - - await queryRunner.query( - `UPDATE profile SET storageBucketId = '${storageBucketID}' WHERE id = '${innovationFlowProfile.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async getStorageAggregatorID( - queryRunner: QueryRunner, - linkProfileId: string - ) { - const [link]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM link WHERE profileId = '${linkProfileId}'` - ); - - const [contribution]: { - id: string; - calloutId: string; - }[] = await queryRunner.query( - `SELECT id, calloutId FROM callout_contribution WHERE linkId = '${link.id}'` - ); - - const [callout]: { - id: string; - framingId: string; - }[] = await queryRunner.query( - `SELECT id, framingId FROM callout WHERE id = '${contribution.calloutId}'` - ); - - const [framing]: { - id: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, profileId FROM callout_framing WHERE id = '${callout.framingId}'` - ); - - const [profile]: { - id: string; - storageBucketId: string; - }[] = await queryRunner.query( - `SELECT id, storageBucketId FROM profile WHERE id = '${framing.profileId}'` - ); - - const [storageBucket]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM storage_bucket WHERE id = '${profile.storageBucketId}'` - ); - return storageBucket.storageAggregatorId; - } - - private isAlkemioDocumentUri(uri: string) { - const lastSlashIndex = uri.lastIndexOf('/'); - const prefix = uri.slice(0, lastSlashIndex); - // we can maybe use condition: if (prefix === productionDocumentUriPrefix || prefix === localhostDocumentUriPrefix) - if (prefix === productionDocumentUriPrefix) { - return true; - } - return false; - } - - private getDocumentId(uri: string) { - const lastSlashIndex = uri.lastIndexOf('/'); - return uri.slice(lastSlashIndex + 1); - } -} diff --git a/src/migrations/1711636518883-UpdateCommunityGuidelinesProfileRelationOptions.ts b/src/migrations/1711636518883-UpdateCommunityGuidelinesProfileRelationOptions.ts deleted file mode 100644 index eefe2750df..0000000000 --- a/src/migrations/1711636518883-UpdateCommunityGuidelinesProfileRelationOptions.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class UpdateCommunityGuidelinesProfileRelationOptions1711636518883 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - } -} diff --git a/src/migrations/1711636518886-communityGuidelines2.ts b/src/migrations/1711636518886-communityGuidelines2.ts deleted file mode 100644 index 7ff1d84815..0000000000 --- a/src/migrations/1711636518886-communityGuidelines2.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import replaceSpecialCharacters from 'replace-special-characters'; -import { escapeString } from './utils/escape-string'; - -export class communityGuideliness1711636518886 implements MigrationInterface { - name = 'communityGuideliness1711636518886'; - - public async up(queryRunner: QueryRunner): Promise { - const communities: { - id: string; - type: string; - guidelinesId: string; - }[] = await queryRunner.query( - `SELECT id, type, guidelinesId FROM community` - ); - for (const community of communities) { - // Add to all communities that don't have guidelines - if (community.guidelinesId === null) { - let storageAggregatorID: string | undefined = undefined; - if (community.type === 'space') { - const [space]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM space WHERE communityId = '${community.id}'` - ); - if (space === undefined) { - console.log( - `Community with id: ${community.id} of type ${community.type} does not have a parent ${community.type}` - ); - continue; - } - storageAggregatorID = space.storageAggregatorId; - } else if (community.type === 'challenge') { - const [challenge]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM challenge WHERE communityId = '${community.id}'` - ); - if (challenge === undefined) { - console.log( - `Community with id: ${community.id} of type ${community.type} does not have a parent ${community.type}` - ); - continue; - } - storageAggregatorID = challenge.storageAggregatorId; - } else if (community.type === 'opportunity') { - const [opportunity]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM opportunity WHERE communityId = '${community.id}'` - ); - if (opportunity === undefined) { - console.log( - `Community with id: ${community.id} of type ${community.type} does not have a parent ${community.type}` - ); - continue; - } - storageAggregatorID = opportunity.storageAggregatorId; - } else { - console.log(`Unknown community type: ${community.type}`); - break; - } - - // Create and link the Profile - const guidelinesID = randomUUID(); - const guidelinesAuthID = randomUUID(); - - const profileID = randomUUID(); - const profileAuthID = randomUUID(); - - const locationID = randomUUID(); - - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - const defaultTagsetID = randomUUID(); - const defaultTagsetAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${guidelinesAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${profileAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO location VALUES - ('${locationID}', DEFAULT, DEFAULT, 1, '', '', '' ,'', '', '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, storageAggregatorId, authorizationId) VALUES - ('${storageBucketID}', - 1, - '${storageAggregatorID}', - '${storageBucketAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO profile (id, version, displayName, description, storageBucketId, type, authorizationId) VALUES - ('${profileID}', - 1, - 'Default Community Guidelines', - '', - '${storageBucketID}', - 'community-guidelines', - '${profileAuthID}')` - ); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${defaultTagsetAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO tagset (id, version, name, tags, authorizationId, profileId, type) VALUES - ('${defaultTagsetID}', 1, 'default', '', '${defaultTagsetAuthID}', '${profileID}', 'freeform')` - ); - - await queryRunner.query( - `INSERT INTO community_guidelines (id, version, authorizationId, profileId) VALUES - ('${guidelinesID}', - 1, - '${guidelinesAuthID}', - '${profileID}')` - ); - - await queryRunner.query( - `UPDATE community SET guidelinesId = '${guidelinesID}' WHERE id = '${community.id}'` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1711636518888-subspaces.ts b/src/migrations/1711636518888-subspaces.ts deleted file mode 100644 index 74d525e4c4..0000000000 --- a/src/migrations/1711636518888-subspaces.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class subspaces1711636518888 implements MigrationInterface { - name = 'subspaces1711636518888'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`account\` RENAME COLUMN \`spaceID\` TO \`spaceId2\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD \`spaceId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` ADD \`level\` int NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` ADD \`level\` int NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`space\` ADD \`level\` int NOT NULL`); - - // User group had some legacy fields that are no longer needed - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP COLUMN \`spaceID\`` - ); - await queryRunner.query(`ALTER TABLE \`user_group\` DROP COLUMN \`name\``); // TODO: check user group data on production. This might need to be a migration script as well as a schema change - - // User group had some legacy fields that are no longer needed - await queryRunner.query( - `ALTER TABLE \`community\` DROP COLUMN \`spaceID\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP COLUMN \`spaceID\`` - ); - - const accounts: { - id: string; - spaceId2: string; - }[] = await queryRunner.query(`SELECT id, spaceId2 FROM account`); - for (const account of accounts) { - await queryRunner.query( - `UPDATE account SET spaceId = '${account.spaceId2}' WHERE id = '${account.id}'` - ); - } - - // Update the type for all credentials - const credentials: { - id: string; - type: string; - }[] = await queryRunner.query(`SELECT id, type FROM credential`); - for (const credential of credentials) { - await queryRunner.query( - `UPDATE credential SET type = '${this.updateCredentialType( - credential.type - )}' WHERE id = '${credential.id}'` - ); - } - // Update all community policies - const communityPolicies: { - id: string; - member: string; - lead: string; - admin: string; - }[] = await queryRunner.query( - `SELECT id, community_policy.member, community_policy.lead, admin FROM community_policy` - ); - for (const policy of communityPolicies) { - await queryRunner.query( - `UPDATE community_policy SET member = '${this.updateCredentialType( - policy.member - )}' WHERE id = '${policy.id}'` - ); - await queryRunner.query( - `UPDATE community_policy SET community_policy.lead = '${this.updateCredentialType( - policy.lead - )}' WHERE id = '${policy.id}'` - ); - await queryRunner.query( - `UPDATE community_policy SET admin = '${this.updateCredentialType( - policy.admin - )}' WHERE id = '${policy.id}'` - ); - } - - await queryRunner.query( - `ALTER TABLE \`community_policy\` DROP COLUMN \`host\`` - ); - await queryRunner.query(`ALTER TABLE \`account\` DROP COLUMN \`spaceId2\``); - - const authorizationPolicies: { - id: string; - credentialRules: string; - privilegeRules: string; - admin: string; - }[] = await queryRunner.query( - `SELECT id, authorization_policy.credentialRules, authorization_policy.privilegeRules FROM authorization_policy` - ); - for (const policy of authorizationPolicies) { - await queryRunner.query( - `UPDATE authorization_policy SET credentialRules = '${this.updateAuthorizationPoliciesType( - policy.credentialRules - )}' WHERE id = '${policy.id}'` - ); - await queryRunner.query( - `UPDATE authorization_policy SET privilegeRules = '${this.updateAuthorizationPoliciesType( - policy.privilegeRules - )}' WHERE id = '${policy.id}'` - ); - } - - const challenges: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM challenge`); - for (const challenge of challenges) { - await queryRunner.query( - `UPDATE challenge SET level = 1 WHERE id = '${challenge.id}'` - ); - } - - const opportunities: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM opportunity`); - for (const opportunity of opportunities) { - await queryRunner.query( - `UPDATE opportunity SET level = 2 WHERE id = '${opportunity.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} - - private updateCredentialType(type: string): string { - let result = type; - result = result.replace('space-host', 'account-host'); - result = result.replace('challenge-', 'subspace-'); - result = result.replace('opportunity-', 'subspace-'); - return result; - } - - private updateAuthorizationPoliciesType(type: string): string { - let result = type; - result = result.replace('create-challenge', 'create-subspace'); - result = result.replace('create-opportunity', 'create-subspace'); - return result; - } -} diff --git a/src/migrations/1712213355890-virtualContributor.ts b/src/migrations/1712213355890-virtualContributor.ts deleted file mode 100644 index fbd7c1b299..0000000000 --- a/src/migrations/1712213355890-virtualContributor.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class virtual1712213355890 implements MigrationInterface { - name = 'virtual1712213355890'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`virtual_persona\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`nameID\` varchar(255) NOT NULL, - \`engine\` text NOT NULL, - \`prompt\` text NOT NULL, - \`authorizationId\` char(36) NULL, - \`profileId\` char(36) NULL, - \`storageAggregatorId\` char(36) NULL, - UNIQUE INDEX \`REL_e5b04476330916a9dac3d87e52\` (\`authorizationId\`), - UNIQUE INDEX \`REL_f5b93c5a204483c3563c7c434a\` (\`profileId\`), - UNIQUE INDEX \`REL_a6a9c0a62d17b6737eeb90b790\` (\`storageAggregatorId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query(`CREATE TABLE \`virtual_contributor\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, \`nameID\` varchar(255) NOT NULL, - \`authorizationId\` char(36) NULL, - \`profileId\` char(36) NULL, - \`agentId\` char(36) NULL, - \`storageAggregatorId\` char(36) NULL, - \`virtualPersonaId\` char(36) NULL, - UNIQUE INDEX \`REL_a1a11662383fefcb81416116a6\` (\`authorizationId\`), - UNIQUE INDEX \`REL_7b8b29a41564c268b864bc85ff\` (\`profileId\`), - UNIQUE INDEX \`REL_c947646f184a6f7aeee68be999\` (\`agentId\`), - UNIQUE INDEX \`REL_29a529635a2b2db9f37ca6d352\` (\`storageAggregatorId\`), - UNIQUE INDEX \`REL_5c6f158a128406aafb9808b3a8\` (\`virtualPersonaId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a1a11662383fefcb81416116a6c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7b8b29a41564c268b864bc85ff2\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_c947646f184a6f7aeee68be9998\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_29a529635a2b2db9f37ca6d3521\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_5c6f158a128406aafb9808b3a82\` FOREIGN KEY (\`virtualPersonaId\`) REFERENCES \`virtual_persona\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD CONSTRAINT \`FK_e5b04476330916a9dac3d87e529\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD CONSTRAINT \`FK_f5b93c5a204483c3563c7c434a4\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD CONSTRAINT \`FK_a6a9c0a62d17b6737eeb90b7903\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - // Update all the licenses to add a feature flag for the usage of virtual contributors in a space - const licenses: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM license`); - - for (const license of licenses) { - const featureFlagUUID = randomUUID(); - await queryRunner.query( - `INSERT INTO feature_flag (id, version, licenseId, name, enabled) VALUES - ('${featureFlagUUID}', - 1, - '${license.id}', - 'virtual-contributors', - 0)` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1712596874894-addCommunicationIDToVirtualContributor.ts b/src/migrations/1712596874894-addCommunicationIDToVirtualContributor.ts deleted file mode 100644 index 322be4e8f3..0000000000 --- a/src/migrations/1712596874894-addCommunicationIDToVirtualContributor.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class addCommunicationIDToVirtualContributor1712596874894 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`communicationID\` varchar(255) NOT NULL` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`communicationID\`` - ); - } -} diff --git a/src/migrations/1712597102891-makePersonaIdNonUniqueVirtualContributor.ts b/src/migrations/1712597102891-makePersonaIdNonUniqueVirtualContributor.ts deleted file mode 100644 index ae7458bd97..0000000000 --- a/src/migrations/1712597102891-makePersonaIdNonUniqueVirtualContributor.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class makePersonaIdNonUniqueVirtualContributor1712597102891 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE virtual_contributor DROP CONSTRAINT FK_5c6f158a128406aafb9808b3a82` - ); - await queryRunner.query( - `ALTER TABLE virtual_contributor DROP INDEX REL_5c6f158a128406aafb9808b3a8` - ); - await queryRunner.query( - `ALTER TABLE virtual_contributor ADD INDEX REL_5c6f158a128406aafb9808b3a8 (virtualPersonaId)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_5c6f158a128406aafb9808b3a82\` FOREIGN KEY (\`virtualPersonaId\`) REFERENCES \`virtual_persona\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE virtual_contributor DROP CONSTRAINT FK_5c6f158a128406aafb9808b3a82` - ); - await queryRunner.query( - `ALTER TABLE virtual_contributor DROP INDEX REL_5c6f158a128406aafb9808b3a8` - ); - await queryRunner.query( - `ALTER TABLE virtual_contributor ADD UNIQUE INDEX REL_5c6f158a128406aafb9808b3a8 (virtualPersonaId)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_5c6f158a128406aafb9808b3a82\` FOREIGN KEY (\`virtualPersonaId\`) REFERENCES \`virtual_persona\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } -} diff --git a/src/migrations/1712649061199-journeyMerge.ts b/src/migrations/1712649061199-journeyMerge.ts deleted file mode 100644 index b31da0dfcc..0000000000 --- a/src/migrations/1712649061199-journeyMerge.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class journeyMerge1712649061199 implements MigrationInterface { - name = 'journeyMerge1712649061199'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`parentSpaceId\` char(36) NULL` - ); - - // There should not be a unique constraint from space to account; yes the other way around - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_6bdeffaf6ea6159b4672a2aed7\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`REL_6bdeffaf6ea6159b4672a2aed7\`` - ); - - // // Challenge constraints - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_178fa41e46fd331f3501a62f6bf\`` // authorizationId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_d4551f18fed106ae2e20c70f7cb\`` // collaborationId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_b025a2720e5ee0e5b38774f7a8c\`` // agentId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_aa9668dd2340c2d794b414577b6\`` // communityId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_81231450cf75dc486700ca034c6\`` // profileId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_494b27cb13b59128fb24b365ca6\`` // parentSpaceId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_2224d59c0b805c9c1ecb0070e16\`` // storageAggregator FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_1deebaabfc620e881858333b0d0\`` // contextId FK - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP FOREIGN KEY \`FK_78017461e03bd2a6cd47044bf6a\`` // account FK - ); - - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`REL_178fa41e46fd331f3501a62f6b\`` // authorizationId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`REL_1deebaabfc620e881858333b0d\`` // contextId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`REL_aa9668dd2340c2d794b414577b\`` // communityId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`REL_b025a2720e5ee0e5b38774f7a8\`` // agentId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`IDX_d4551f18fed106ae2e20c70f7c\`` // collaborationId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`IDX_eedbe52ec6041ac337528d3dd0\`` // profileId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`IDX_0ec10c5ca99e2b7bbdeeaf6ff0\`` // storageAggregatorId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`FK_494b27cb13b59128fb24b365ca6\`` // spaceId - ); - await queryRunner.query( - `ALTER TABLE \`challenge\` DROP INDEX \`FK_78017461e03bd2a6cd47044bf6a\`` // accountId - ); - - // Opportunity constraints - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_a344b754f33792cbbc58e41e898\`` // authorizationId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_fa617e79d6b2926edc7b4a3878f\`` // collaborationId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_c814aa7dc8a68f27d96d5d1782c\`` // agentId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_1c7744df92f39ab567084fd8c09\`` // communityId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_91231450cf75dc486700ca034c6\`` // profileId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_0e2c355dbb2950851dbc17a4490\`` // parentChallenge FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_89894d59c0b805c9c1ecb0070e16\`` // storageAggregator FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_9c169eb500e2d3823154c7b603d\`` // contextId FK - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP FOREIGN KEY \`FK_69e32f4f4652f654dc8641ae2b8\`` // account FK - ); - - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`IDX_313c12afe69143a9ee3779b4f6\`` // rowId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`REL_a344b754f33792cbbc58e41e89\`` // authorizationId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`REL_9c169eb500e2d3823154c7b603\`` // contextId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`REL_1c7744df92f39ab567084fd8c0\`` // communityId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`REL_c814aa7dc8a68f27d96d5d1782\`` // agentId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`IDX_fa617e79d6b2926edc7b4a3878\`` // collaborationId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`FK_0e2c355dbb2950851dbc17a4490\`` // challengeId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`FK_91231450cf75dc486700ca034c6\`` // profileId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`IDX_28129cec24e65cc8340ecd1284\`` // profileId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`IDX_8488dda5c509a57e6070e8c3b0\`` // storageAggregatorId - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`FK_89894d59c0b805c9c1ecb0070e16\`` // FK_89894d59c0b805c9c1ecb0070e16 - ); - await queryRunner.query( - `ALTER TABLE \`opportunity\` DROP INDEX \`FK_69e32f4f4652f654dc8641ae2b8\`` // accountId - ); - - // TBD: rowID + issues with pagination? - const challenges: any[] = await queryRunner.query(`SELECT id, - version, nameID, authorizationID, - contextId, communityId, agentId, - spaceId, collaborationId, profileId, - storageAggregatorId, accountId, type, - settingsStr, level - FROM challenge`); - for (const challenge of challenges) { - await queryRunner.query(`INSERT INTO space (id, - version, nameID, authorizationID, - contextId, communityId, agentId, - parentSpaceId, collaborationId, profileId, - storageAggregatorId, accountId, type, - settingsStr, level) - VALUES ( - '${challenge.id}', - '${challenge.version}', '${challenge.nameID}', '${challenge.authorizationID}', - '${challenge.contextId}', '${challenge.communityId}', '${challenge.agentId}', - '${challenge.spaceId}', '${challenge.collaborationId}', '${challenge.profileId}', - '${challenge.storageAggregatorId}', '${challenge.accountId}', '${challenge.type}', - '${challenge.settingsStr}', '${challenge.level}' - )`); - - // Set the created / updated date based on old values; strings gave an issue so needs to be done at the db level - await queryRunner.query( - `UPDATE space SET createdDate = (SELECT createdDate FROM challenge WHERE challenge.id = '${challenge.id}') WHERE (space.id = '${challenge.id}');` - ); - await queryRunner.query( - `UPDATE space SET updatedDate = (SELECT updatedDate FROM challenge WHERE challenge.id = '${challenge.id}') WHERE (space.id = '${challenge.id}');` - ); - } - - const opportunities: any[] = await queryRunner.query(`SELECT id, - version, nameID, authorizationID, - contextId, communityId, agentId, - challengeId, collaborationId, profileId, - storageAggregatorId, accountId, type, - settingsStr, level - FROM opportunity`); - for (const opportunity of opportunities) { - await queryRunner.query(`INSERT INTO space (id, - version, nameID, authorizationID, - contextId, communityId, agentId, - parentSpaceId, collaborationId, profileId, - storageAggregatorId, accountId, type, - settingsStr, level) - VALUES ( - '${opportunity.id}', - '${opportunity.version}', '${opportunity.nameID}', '${opportunity.authorizationID}', - '${opportunity.contextId}', '${opportunity.communityId}', '${opportunity.agentId}', - '${opportunity.challengeId}', '${opportunity.collaborationId}', '${opportunity.profileId}', - '${opportunity.storageAggregatorId}', '${opportunity.accountId}', '${opportunity.type}', - '${opportunity.settingsStr}', '${opportunity.level}' - )`); - // Set the created / updated date based on old values; strings gave an issue so needs to be done at the db level - await queryRunner.query( - `UPDATE space SET createdDate = (SELECT createdDate FROM opportunity WHERE opportunity.id = '${opportunity.id}') WHERE (space.id = '${opportunity.id}');` - ); - await queryRunner.query( - `UPDATE space SET updatedDate = (SELECT updatedDate FROM opportunity WHERE opportunity.id = '${opportunity.id}') WHERE (space.id = '${opportunity.id}');` - ); - } - - // Setting foreign key from one column to the primary key in the same table is not allowed in MySQL - // await queryRunner.query( - // `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - // ); - // TODO: subspaces relationship FK to be added - // TODO: check constraints account to space + space to account - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1713255211876-fixVcFeatureFlags.ts b/src/migrations/1713255211876-fixVcFeatureFlags.ts deleted file mode 100644 index 7b0fef8252..0000000000 --- a/src/migrations/1713255211876-fixVcFeatureFlags.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class fixVcFeatureFlags1713255211876 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - const licenses: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM license`); - - for (const license of licenses) { - const existingFeatureFlag = await queryRunner.query( - `SELECT * FROM feature_flag WHERE licenseId = '${license.id}' AND name = 'virtual-contributors'` - ); - - if (!existingFeatureFlag.length) { - const featureFlagUUID = randomUUID(); - await queryRunner.query( - `INSERT INTO feature_flag (id, version, licenseId, name, enabled) VALUES - ('${featureFlagUUID}', - 1, - '${license.id}', - 'virtual-contributors', - 0)` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1713264430226-allCalloutsInRightColumn.ts b/src/migrations/1713264430226-allCalloutsInRightColumn.ts deleted file mode 100644 index 55c7c56a1f..0000000000 --- a/src/migrations/1713264430226-allCalloutsInRightColumn.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { isEqual, uniq, uniqWith } from 'lodash'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -const replacements: { [key: string]: string } = { - HOME_0: 'HOME', - HOME_1: 'HOME', - HOME_2: 'HOME', - HOME_LEFT: 'HOME', - HOME_RIGHT: 'HOME', - CONTRIBUTE_0: 'CONTRIBUTE', - CONTRIBUTE_1: 'CONTRIBUTE', - CONTRIBUTE_2: 'CONTRIBUTE', - CONTRIBUTE_LEFT: 'CONTRIBUTE', - CONTRIBUTE_RIGHT: 'CONTRIBUTE', - COMMUNITY_0: 'COMMUNITY', - COMMUNITY_1: 'COMMUNITY', - COMMUNITY_2: 'COMMUNITY', - COMMUNITY_LEFT: 'COMMUNITY', - COMMUNITY_RIGHT: 'COMMUNITY', - SUBSPACES_0: 'SUBSPACES', - SUBSPACES_1: 'SUBSPACES', - SUBSPACES_2: 'SUBSPACES', - SUBSPACES_LEFT: 'SUBSPACES', - SUBSPACES_RIGHT: 'SUBSPACES', -}; - -interface TagsetTemplate { - id: string; - allowedValues: string; - defaultSelectedValue: string; -} - -const replaceAllowedValues = (allowedValues: string): string => { - const currentAllowedValues = allowedValues.split(','); - const newAllowedValues = currentAllowedValues.map(value => { - if (replacements[value]) { - return replacements[value]; - } - return value; - }); - return uniq(newAllowedValues).join(','); -}; - -const replaceDefaultSelectedValue = (defaultSelectedValue: string): string => { - if (replacements[defaultSelectedValue]) { - return replacements[defaultSelectedValue]; - } - return defaultSelectedValue; -}; - -interface Collaboration { - id: string; - groupsStr: string; -} - -interface CalloutGroup { - displayName: string; - description: string; -} - -const replaceGroupsStr = (groupsStr: string): string => { - const elements: CalloutGroup[] = JSON.parse(groupsStr); - const newElements = uniqWith( - elements.map(element => { - const newElement = { ...element }; - if (replacements[element.displayName]) { - newElement.displayName = replacements[element.displayName]; - newElement.description = element.description.replace( - /(left|right) column on the /, - '' - ); - } - return newElement; - }), - (a, b) => a.displayName === b.displayName - ); - return JSON.stringify(newElements); -}; - -export class allCalloutsInRightColumn1713264430226 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - // Tagset: - for (let key in replacements) { - let value = replacements[key]; - await queryRunner.query( - `UPDATE tagset SET tags = '${value}' WHERE name = 'callout-group' AND tags = '${key}';` - ); - } - - // TagsetTemplate: - const tagsetTemplates: TagsetTemplate[] = await queryRunner.query( - `SELECT id, allowedValues, defaultSelectedValue FROM tagset_template WHERE name = 'callout-group';` - ); - for (let tagsetTemplate of tagsetTemplates) { - const newAllowedValues = replaceAllowedValues( - tagsetTemplate.allowedValues - ); - const newDefaultSelectedValue = replaceDefaultSelectedValue( - tagsetTemplate.defaultSelectedValue - ); - - if ( - newAllowedValues !== tagsetTemplate.allowedValues || - newDefaultSelectedValue !== tagsetTemplate.defaultSelectedValue - ) { - await queryRunner.query( - `UPDATE tagset_template SET allowedValues = '${newAllowedValues}', defaultSelectedValue='${newDefaultSelectedValue}' WHERE id = '${tagsetTemplate.id}';` - ); - } - } - - // Collaboration: - const collaborations: Collaboration[] = await queryRunner.query( - `SELECT id, groupsStr FROM collaboration;` - ); - for (let collaboration of collaborations) { - const newGroupsStr = replaceGroupsStr(collaboration.groupsStr); - - if (newGroupsStr !== collaboration.groupsStr) { - await queryRunner.query( - `UPDATE collaboration SET groupsStr = '${newGroupsStr}' WHERE id = '${collaboration.id}';` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1713526131435-SetDefaultAllowedMimeTypesAndMaxFileSize.ts b/src/migrations/1713526131435-SetDefaultAllowedMimeTypesAndMaxFileSize.ts deleted file mode 100644 index 0add11fccf..0000000000 --- a/src/migrations/1713526131435-SetDefaultAllowedMimeTypesAndMaxFileSize.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { MimeFileType } from '@common/enums/mime.file.type'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -const DEFAULT_MAX_ALLOWED_FILE_SIZE = 5242880; - -const DEFAULT_VISUAL_ALLOWED_MIME_TYPES: MimeFileType[] = [ - MimeFileType.JPG, - MimeFileType.JPEG, - MimeFileType.XPNG, - MimeFileType.PNG, - MimeFileType.GIF, - MimeFileType.WEBP, - MimeFileType.SVG, - MimeFileType.AVIF, - MimeFileType.PDF, -]; - -export class SetDefaultAllowedMimeTypesAndMaxFileSize1713526131435 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const storageBuckets: { - id: string; - maxFileSize: number | null; - allowedMimeTypes: string[] | null; - }[] = await queryRunner.query(`SELECT * FROM storage_bucket`); - - for (const storageBucket of storageBuckets) { - if (storageBucket.allowedMimeTypes === null) { - await queryRunner.query( - `UPDATE storage_bucket SET allowedMimeTypes = ? WHERE id = ?`, - [DEFAULT_VISUAL_ALLOWED_MIME_TYPES.join(','), storageBucket.id] - ); - } - if (storageBucket.maxFileSize === null) { - await queryRunner.query( - `UPDATE storage_bucket SET maxFileSize = ? WHERE id = ?`, - [DEFAULT_MAX_ALLOWED_FILE_SIZE, storageBucket.id] - ); - } - } - - await queryRunner.query( - `ALTER TABLE storage_bucket ALTER COLUMN maxFileSize SET DEFAULT ${DEFAULT_MAX_ALLOWED_FILE_SIZE};` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1714040354734-moveCalloutsHome.ts b/src/migrations/1714040354734-moveCalloutsHome.ts deleted file mode 100644 index 99abe3b28d..0000000000 --- a/src/migrations/1714040354734-moveCalloutsHome.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -// move all the Callouts of all Subspaces ONLY, to HOME group -// Space Callouts are not moved; only Subspaces -export class moveCalloutsHome1714040354734 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - // update the value of TAGSET related ONLY to Subspaces - await queryRunner.query(` - UPDATE tagset - LEFT JOIN profile ON profile.id = tagset.profileId - LEFT JOIN callout_framing ON callout_framing.profileId = profile.id - LEFT JOIN callout ON callout.framingId = callout_framing.id - LEFT JOIN collaboration ON collaboration.id = callout.collaborationId - LEFT JOIN space ON space.collaborationId = collaboration.id - SET tagset.tags = 'HOME' - WHERE space.parentSpaceId IS NOT NULL AND tagset.name = 'callout-group'; - `); - // update the value of TAGSET_TEMPLATE related ONLY to Subspaces - await queryRunner.query(` - UPDATE tagset_template - LEFT JOIN tagset_template_set on tagset_template.tagsetTemplateSetId = tagset_template_set.id - LEFT JOIN collaboration ON collaboration.tagsetTemplateSetId = tagset_template_set.id - LEFT JOIN space ON space.collaborationId = collaboration.id - SET tagset_template.allowedValues = 'HOME' - WHERE space.parentSpaceId IS NOT NULL AND tagset_template.name = 'callout-group'; - `); - // update the value of COLLABORATION related ONLY to Subspaces - const newGroupStr = JSON.stringify([ - { displayName: 'HOME', description: 'The Home page.' }, - ]); - await queryRunner.query(` - UPDATE collaboration - LEFT JOIN space ON space.collaborationId = collaboration.id - SET collaboration.groupsStr = '${newGroupStr}' - WHERE space.parentSpaceId IS NOT NULL; - `); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1714401683721-accountHost.ts b/src/migrations/1714401683721-accountHost.ts deleted file mode 100644 index 72773cc7fe..0000000000 --- a/src/migrations/1714401683721-accountHost.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class accountHost1714401683721 implements MigrationInterface { - name = 'accountHost1714401683721'; - - public async up(queryRunner: QueryRunner): Promise { - const accountHostCredentials: { - id: string; - resourceID: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, resourceID, type FROM credential where type = 'account-host'` - ); - for (const accountHostCredential of accountHostCredentials) { - // try to look up the account - const [account]: any[] = await queryRunner.query( - `SELECT id FROM account WHERE id = '${accountHostCredential.resourceID}'` - ); - if (account) break; // all ok - - // Move from spaceID to accountID - const [space]: { - id: string; - accountId: string; - }[] = await queryRunner.query( - `SELECT id, accountId FROM space WHERE id = '${accountHostCredential.resourceID}'` - ); - if (space) { - await queryRunner.query( - `UPDATE credential SET resourceID = '${space.accountId}' WHERE id = '${accountHostCredential.id}'` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1714410262128-licensePolicy.ts b/src/migrations/1714410262128-licensePolicy.ts deleted file mode 100644 index 91729dcaa1..0000000000 --- a/src/migrations/1714410262128-licensePolicy.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class licensePolicy1714410262128 implements MigrationInterface { - name = 'licensePolicy1714410262128'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`license_policy\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`featureFlagRules\` text NOT NULL, - \`authorizationId\` char(36) NULL, - UNIQUE INDEX \`REL_23d4d78ea8db637df031f86f03\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD CONSTRAINT \`FK_23d4d78ea8db637df031f86f030\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`platform\` ADD \`licensePolicyId\` char(36) NULL` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bde2e6ff4a8d800388bcee8057\` ON \`platform\` (\`licensePolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_bde2e6ff4a8d800388bcee8057\` (\`licensePolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_bde2e6ff4a8d800388bcee8057e\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - const licensePolicyID = randomUUID(); - const licensePolicyAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${licensePolicyAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO license_policy (id, version, authorizationId, featureFlagRules) VALUES - ('${licensePolicyID}', - 1, - '${licensePolicyAuthID}', - '${JSON.stringify(licenseRules)}')` - ); - await queryRunner.query( - `UPDATE platform SET licensePolicyId = '${licensePolicyID}'` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_bde2e6ff4a8d800388bcee8057e\`` - ); - - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP FOREIGN KEY \`FK_23d4d78ea8db637df031f86f030\`` - ); - - await queryRunner.query( - `DROP INDEX \`REL_bde2e6ff4a8d800388bcee8057\` ON \`platform\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_bde2e6ff4a8d800388bcee8057\`` - ); - - await queryRunner.query( - `DROP INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` - ); - await queryRunner.query(`DROP TABLE \`license_policy\``); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP COLUMN \`licensePolicyId\`` - ); - } -} - -export type FeatureFlagRule = { - featureFlagName: LicenseFeatureFlagName; - grantedPrivileges: LicensePrivilege[]; - name: string; -}; - -export enum LicensePrivilege { - VIRTUAL_CONTRIBUTOR_ACCESS = 'virtual-contributor-access', - WHITEBOARD_MULTI_USER = 'whiteboard-multi-user', - CALLOUT_SAVE_AS_TEMPLATE = 'callout-save-as-template', -} - -export enum LicenseFeatureFlagName { - WHITEBOARD_MULTI_USER = 'whiteboard-multi-user', - CALLOUT_TO_CALLOUT_TEMPLATE = 'callout-to-callout-template', - VIRTUAL_CONTRIBUTORS = 'virtual-contributors', -} - -export const licenseRules: FeatureFlagRule[] = [ - { - featureFlagName: LicenseFeatureFlagName.VIRTUAL_CONTRIBUTORS, - grantedPrivileges: [LicensePrivilege.VIRTUAL_CONTRIBUTOR_ACCESS], - name: 'Virtual Contributors', - }, - { - featureFlagName: LicenseFeatureFlagName.WHITEBOARD_MULTI_USER, - grantedPrivileges: [LicensePrivilege.WHITEBOARD_MULTI_USER], - name: 'Multi-user whiteboards', - }, - { - featureFlagName: LicenseFeatureFlagName.CALLOUT_TO_CALLOUT_TEMPLATE, - grantedPrivileges: [LicensePrivilege.CALLOUT_SAVE_AS_TEMPLATE], - name: 'Callout templates', - }, -]; diff --git a/src/migrations/1715169195439-fixSubspaceCalloutsGroupName.ts b/src/migrations/1715169195439-fixSubspaceCalloutsGroupName.ts deleted file mode 100644 index a0862ecb8a..0000000000 --- a/src/migrations/1715169195439-fixSubspaceCalloutsGroupName.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -interface Tagset { - id: string; - tagsetTemplateId: string; -} - -export class fixSubspaceCalloutsGroupName1715169195439 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - // 'callout-group' Tagsets from callouts in subspaces - const tagsets: Tagset[] = await queryRunner.query(` - SELECT tagset.id, tagset.tagsetTemplateId FROM space - INNER JOIN callout ON callout.collaborationId = space.collaborationId - INNER JOIN callout_framing ON callout.framingId = callout_framing.id - INNER JOIN tagset ON tagset.profileId = callout_framing.profileId - INNER JOIN tagset_template ON tagset.tagsetTemplateId = tagset_template.id - WHERE - space.parentSpaceId IS NOT NULL -- only subspaces - AND tagset.name = 'callout-group' -- callout-group tagsets - AND (tagset.tags !='HOME' OR tagset_template.allowedValues != 'HOME' OR tagset_template.defaultSelectedValue != 'HOME') - `); - - const tagsetIds = tagsets.map(tagset => `'${tagset.id}'`).join(','); - const tagsetTemplateIds = tagsets - .map(tagset => `'${tagset.tagsetTemplateId}'`) - .join(','); - - if (tagsets.length > 0) { - await queryRunner.query( - `UPDATE tagset SET tags = 'HOME' WHERE id IN (${tagsetIds});` - ); - await queryRunner.query( - `UPDATE tagset_template SET defaultSelectedValue = 'HOME', allowedValues = 'HOME' WHERE id IN (${tagsetTemplateIds});` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1715169195500-globalRoles.ts b/src/migrations/1715169195500-globalRoles.ts deleted file mode 100644 index d2ce4553e0..0000000000 --- a/src/migrations/1715169195500-globalRoles.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class globalRoles1715169195500 implements MigrationInterface { - name = 'globalRoles1715169195500'; - - public async up(queryRunner: QueryRunner): Promise { - const credentials: { - id: string; - resourceID: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, resourceID, type FROM credential` - ); - for (const credential of credentials) { - const updatedType = this.updateType(credential.type); - if (updatedType !== credential.type) { - await queryRunner.query( - `UPDATE credential SET type = '${updatedType}' WHERE id = '${credential.id}'` - ); - } - } - - // Add the extra space setting - const spaces: { - id: string; - settingsStr: string; - }[] = await queryRunner.query(`SELECT id, settingsStr FROM space`); - for (const space of spaces) { - const settings: SpaceSettingsOld = JSON.parse(space.settingsStr); - const updatedSettings: SpaceSettingsNew = { - privacy: { - mode: settings.privacy.mode, - allowPlatformSupportAsAdmin: true, - }, - membership: { - policy: settings.membership.policy, - trustedOrganizations: settings.membership.trustedOrganizations, - allowSubspaceAdminsToInviteMembers: true, - }, - collaboration: { - inheritMembershipRights: - settings.collaboration.inheritMembershipRights, - allowMembersToCreateSubspaces: - settings.collaboration.allowMembersToCreateSubspaces, - allowMembersToCreateCallouts: - settings.collaboration.allowMembersToCreateCallouts, - }, - }; - await queryRunner.query( - `UPDATE space SET settingsStr = '${JSON.stringify( - updatedSettings - )}' WHERE id = '${space.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} - - private updateType(type: string): string { - let updatedType = type; - updatedType = updatedType.replace( - 'global-admin-community', - 'global-community-read' - ); - updatedType = updatedType.replace('global-admin-spaces', 'global-support'); - return updatedType; - } -} - -export type SpaceSettingsOld = { - privacy: { - mode: 'public' | 'private'; - }; - membership: { - policy: 'open' | 'applications' | 'invitations'; - trustedOrganizations: string[]; - }; - collaboration: { - inheritMembershipRights: boolean; - allowMembersToCreateSubspaces: boolean; - allowMembersToCreateCallouts: boolean; - }; -}; - -export type SpaceSettingsNew = { - privacy: { - mode: 'public' | 'private'; - allowPlatformSupportAsAdmin: boolean; - }; - membership: { - policy: 'open' | 'applications' | 'invitations'; - trustedOrganizations: string[]; - allowSubspaceAdminsToInviteMembers: boolean; - }; - collaboration: { - inheritMembershipRights: boolean; - allowMembersToCreateSubspaces: boolean; - allowMembersToCreateCallouts: boolean; - }; -}; diff --git a/src/migrations/1715575211966-subspaceCredentials.ts b/src/migrations/1715575211966-subspaceCredentials.ts deleted file mode 100644 index 95a288a977..0000000000 --- a/src/migrations/1715575211966-subspaceCredentials.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class subspaceCredentials1715575211966 implements MigrationInterface { - name = 'subspaceCredentials1715575211966'; - - public async up(queryRunner: QueryRunner): Promise { - // All credentials need to be updated to reflect the new type - await queryRunner.query(` - UPDATE credential - SET type = REPLACE(type, 'subspace-', 'space-') - WHERE type LIKE '%subspace-%'; - `); - - // And the community policies - await queryRunner.query(` - UPDATE community_policy - SET member = REPLACE(member, 'subspace-', 'space-') - WHERE member LIKE '%subspace-%' - `); - - await queryRunner.query(` - UPDATE community_policy - SET \`lead\` = REPLACE(\`lead\`, 'subspace-', 'space-') - WHERE \`lead\` LIKE '%subspace-%' - `); - - await queryRunner.query(` - UPDATE community_policy - SET admin = REPLACE(admin, 'subspace-', 'space-') - WHERE admin LIKE '%subspace-%' - `); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1715618480443-communityGuidelinesTemplate.ts b/src/migrations/1715618480443-communityGuidelinesTemplate.ts deleted file mode 100644 index e04e268078..0000000000 --- a/src/migrations/1715618480443-communityGuidelinesTemplate.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class communityGuidelinesTemplate1715618480443 - implements MigrationInterface -{ - name = 'communityGuidelinesTemplate1715618480443'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'CREATE TABLE `community_guidelines_template` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `templatesSetId` char(36) NULL, `guidelinesId` char(36) NULL, UNIQUE INDEX `REL_eb3f02cf18df8943da1673a25b` (`authorizationId`), UNIQUE INDEX `REL_25dbe2675edea7b3c4f4aec430` (`profileId`), UNIQUE INDEX `REL_e1817f55e97bba03a57b928725` (`guidelinesId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` ADD CONSTRAINT `FK_eb3f02cf18df8943da1673a25b8` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` ADD CONSTRAINT `FK_25dbe2675edea7b3c4f4aec4300` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` ADD CONSTRAINT `FK_8b2d7f497cccf9cac312dac8b46` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` ADD CONSTRAINT `FK_e1817f55e97bba03a57b9287251` FOREIGN KEY (`guidelinesId`) REFERENCES `community_guidelines`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` DROP FOREIGN KEY `FK_e1817f55e97bba03a57b9287251`' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` DROP FOREIGN KEY `FK_8b2d7f497cccf9cac312dac8b46`' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` DROP FOREIGN KEY `FK_25dbe2675edea7b3c4f4aec4300`' - ); - await queryRunner.query( - 'ALTER TABLE `community_guidelines_template` DROP FOREIGN KEY `FK_eb3f02cf18df8943da1673a25b8`' - ); - await queryRunner.query( - 'DROP INDEX `REL_e1817f55e97bba03a57b928725` ON `community_guidelines_template`' - ); - await queryRunner.query( - 'DROP INDEX `REL_25dbe2675edea7b3c4f4aec430` ON `community_guidelines_template`' - ); - await queryRunner.query( - 'DROP INDEX `REL_eb3f02cf18df8943da1673a25b` ON `community_guidelines_template`' - ); - await queryRunner.query('DROP TABLE `community_guidelines_template`'); - } -} diff --git a/src/migrations/1715661558908-subspaceAdmin.ts b/src/migrations/1715661558908-subspaceAdmin.ts deleted file mode 100644 index 8fd1c2e21a..0000000000 --- a/src/migrations/1715661558908-subspaceAdmin.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class subspaceAdmin1715661558908 implements MigrationInterface { - name = 'subspaceAdmin1715661558908'; - - public async up(queryRunner: QueryRunner): Promise { - const spaceAdminCredentials: { - id: string; - resourceID: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, resourceID, type FROM credential where type = 'space-admin'` - ); - for (const spaceAdminCredential of spaceAdminCredentials) { - // try to look up the account - const [space]: { id: string; level: number; parentSpaceId: string }[] = - await queryRunner.query( - `SELECT id, level, parentSpaceId FROM space WHERE id = '${spaceAdminCredential.resourceID}'` - ); - if (!space) { - console.log( - `Unable to find space for space admin credential ${spaceAdminCredential.id}` - ); - } - if (!space || !space.level || space.level === 0) { - continue; - } - const subspaceAdminCredID = randomUUID(); - const resourceID = space.parentSpaceId; // assigning the credential to the parent space - await queryRunner.query( - `INSERT INTO credential (id, version, resourceID, type) VALUES ('${subspaceAdminCredID}', 1, '${resourceID}', 'subspace-admin')` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1715780931509-fixPersonaEngines.ts b/src/migrations/1715780931509-fixPersonaEngines.ts deleted file mode 100644 index a06c0e1f45..0000000000 --- a/src/migrations/1715780931509-fixPersonaEngines.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class fixPersonaEngines1715780931509 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - // All credentials need to be updated to reflect the new type - await queryRunner.query(` - UPDATE virtual_persona - SET engine = 'expert' - WHERE engine = 'alkemio-digileefomgeving'; - `); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1715874015062-subspaceInvitations.ts b/src/migrations/1715874015062-subspaceInvitations.ts deleted file mode 100644 index d8bf965625..0000000000 --- a/src/migrations/1715874015062-subspaceInvitations.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class subspaceInvitations1715874015062 implements MigrationInterface { - name = 'subspaceInvitations1715874015062'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD \`invitedToParent\` tinyint NOT NULL DEFAULT 0` - ); - await queryRunner.query( - `ALTER TABLE \`invitation_external\` ADD \`invitedToParent\` tinyint NOT NULL DEFAULT 0` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`invitation_external\` DROP COLUMN \`invitedToParent\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP COLUMN \`invitedToParent\`` - ); - } -} diff --git a/src/migrations/1715936821326-accountInnovationHub.ts b/src/migrations/1715936821326-accountInnovationHub.ts deleted file mode 100644 index fbbc5ba590..0000000000 --- a/src/migrations/1715936821326-accountInnovationHub.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class accountInnovationHub1715936821326 implements MigrationInterface { - name = 'accountInnovationHub1715936821326'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD `accountId` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD UNIQUE INDEX `IDX_156fd30246eb151b9d17716abf` (`accountId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_156fd30246eb151b9d17716abf` ON `innovation_hub` (`accountId`)' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_156fd30246eb151b9d17716abf5` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP FOREIGN KEY `FK_156fd30246eb151b9d17716abf5`' - ); - await queryRunner.query( - 'DROP INDEX `REL_156fd30246eb151b9d17716abf` ON `innovation_hub`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP INDEX `IDX_156fd30246eb151b9d17716abf`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP COLUMN `accountId`' - ); - } -} diff --git a/src/migrations/1715957704292-agentAccount.ts b/src/migrations/1715957704292-agentAccount.ts deleted file mode 100644 index 68bb301320..0000000000 --- a/src/migrations/1715957704292-agentAccount.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class agentAccount1715957704292 implements MigrationInterface { - name = 'agentAccount1715957704292'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`account\` ADD \`agentId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_833582df0c439ab8c9adc5240d\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_833582df0c439ab8c9adc5240d1\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`credential\` ADD \`issuer\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` ADD \`expires\` datetime(6) DEFAULT NULL` - ); - - // Create the agent on each account - const accounts: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM account`); - for (const account of accounts) { - const accountAgentID = randomUUID(); - const accountAgentAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${accountAgentAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO agent (id, version, authorizationId) VALUES - ('${accountAgentID}', - 1, - '${accountAgentAuthID}')` - ); - await queryRunner.query( - `UPDATE account SET agentId = '${accountAgentID}' WHERE id = '${account.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1716108478921-licensing.ts b/src/migrations/1716108478921-licensing.ts deleted file mode 100644 index 02862c0742..0000000000 --- a/src/migrations/1716108478921-licensing.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class licensing1716108478921 implements MigrationInterface { - name = 'licensing1716108478921'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`licensing\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`authorizationId\` char(36) NULL, - \`licensePolicyId\` char(36) NULL, - UNIQUE INDEX \`REL_1ddac8984c93ca18a23edb30fc\` (\`authorizationId\`), - UNIQUE INDEX \`REL_65ca04c85acdd5dad63f557609\` (\`licensePolicyId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`CREATE TABLE \`license_plan\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`name\` text NOT NULL, - \`enabled\` tinyint NOT NULL DEFAULT '1', - \`licensingId\` char(36) NULL, - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - // Drop constraints platform ==> license policy - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_bde2e6ff4a8d800388bcee8057e\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_bde2e6ff4a8d800388bcee8057\` ON \`platform\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_bde2e6ff4a8d800388bcee8057\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD \`licensingId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_1282e7fa19848d4b4bc3a4829d\` (\`licensingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_1282e7fa19848d4b4bc3a4829d\` ON \`platform\` (\`licensingId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_1ddac8984c93ca18a23edb30fc9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_65ca04c85acdd5dad63f5576094\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD CONSTRAINT \`FK_42becb5fd6dc563f51ecb71abcc\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_1282e7fa19848d4b4bc3a4829db\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - // Create the agent on each account - const [platform]: { id: string; licensePolicyId: string }[] = - await queryRunner.query(`SELECT id, licensePolicyId FROM platform `); - const licensingID = randomUUID(); - const licensingAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${licensingAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO licensing (id, version, authorizationId, licensePolicyId) VALUES - ('${licensingID}', - 1, - '${licensingAuthID}', - '${platform.licensePolicyId}')` - ); - await queryRunner.query( - `UPDATE platform SET licensingId = '${licensingID}' WHERE id = '${platform.id}'` - ); - - await queryRunner.query( - `ALTER TABLE \`platform\` DROP COLUMN \`licensePolicyId\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1716199897459-updateVirtualPersona.ts b/src/migrations/1716199897459-updateVirtualPersona.ts deleted file mode 100644 index 363f71da9c..0000000000 --- a/src/migrations/1716199897459-updateVirtualPersona.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class updateVirtualPersona11716199897459 implements MigrationInterface { - name = 'updateVirtualPersona11716199897459'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP FOREIGN KEY \`FK_a6a9c0a62d17b6737eeb90b7903\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a6a9c0a62d17b6737eeb90b790\` ON \`virtual_persona\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP COLUMN \`storageAggregatorId\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD \`dataAccessMode\` varchar(64) NOT NULL DEFAULT 'space_profile'` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD \`platformId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD CONSTRAINT \`FK_0e5ff0df260179127b43731bb68\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP FOREIGN KEY \`FK_0e5ff0df260179127b43731bb68\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP COLUMN \`platformId\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP COLUMN \`dataAccessMode\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD \`storageAggregatorId\` char(36) NULL` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a6a9c0a62d17b6737eeb90b790\` ON \`virtual_persona\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD CONSTRAINT \`FK_a6a9c0a62d17b6737eeb90b7903\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } -} diff --git a/src/migrations/1716202782049-updateVirtualContributor.ts b/src/migrations/1716202782049-updateVirtualContributor.ts deleted file mode 100644 index e3e9959b9e..0000000000 --- a/src/migrations/1716202782049-updateVirtualContributor.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class updateVirtualContributor1716202782049 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_5c6f158a128406aafb9808b3a82\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5c6f158a128406aafb9808b3a8\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7b8b29a41564c268b864bc85ff2\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7b8b29a41564c268b864bc85ff\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a1a11662383fefcb81416116a6c\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a1a11662383fefcb81416116a6\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_c947646f184a6f7aeee68be9998\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c947646f184a6f7aeee68be999\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`bodyOfKnowledgeType\` varchar(64) NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`bodyOfKnowledgeID\` varchar(256) NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`accountId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_4504c37764f6962ccbd165a21d\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_ce68cea88d194e0240b737c3f0\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_ce68cea88d194e0240b737c3f0\` ON \`virtual_contributor\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_e2eaa2213ac4454039cd8abc07d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_4504c37764f6962ccbd165a21de\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a8890dcd65b8c3ee6e160d33f3a\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_ce68cea88d194e0240b737c3f0c\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_5c6f158a128406aafb9808b3a82\` FOREIGN KEY (\`virtualPersonaId\`) REFERENCES \`virtual_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7a962c9b04b0d197bc3c93262a7\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7a962c9b04b0d197bc3c93262a7\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_5c6f158a128406aafb9808b3a82\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_ce68cea88d194e0240b737c3f0c\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a8890dcd65b8c3ee6e160d33f3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_4504c37764f6962ccbd165a21de\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_e2eaa2213ac4454039cd8abc07d\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_ce68cea88d194e0240b737c3f0\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_ce68cea88d194e0240b737c3f0\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`accountId\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`bodyOfKnowledgeID\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`bodyOfKnowledgeType\`` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c947646f184a6f7aeee68be999\` ON \`virtual_contributor\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a1a11662383fefcb81416116a6\` ON \`virtual_contributor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7b8b29a41564c268b864bc85ff\` ON \`virtual_contributor\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`REL_5c6f158a128406aafb9808b3a8\` ON \`virtual_contributor\` (\`virtualPersonaId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_5c6f158a128406aafb9808b3a82\` FOREIGN KEY (\`virtualPersonaId\`) REFERENCES \`virtual_persona\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } -} diff --git a/src/migrations/1716209492183-updateVirtualPersonaEngineAndPlatform.ts b/src/migrations/1716209492183-updateVirtualPersonaEngineAndPlatform.ts deleted file mode 100644 index 08b876d600..0000000000 --- a/src/migrations/1716209492183-updateVirtualPersonaEngineAndPlatform.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class updateVirtualPersonaEngineAndPlatform1716209492183 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE virtual_persona SET platformId = (SELECT id FROM platform LIMIT 0, 1)` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1716293512214-plansTableColumns.ts b/src/migrations/1716293512214-plansTableColumns.ts deleted file mode 100644 index dfa56ddff9..0000000000 --- a/src/migrations/1716293512214-plansTableColumns.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class plansTableColumns1716293512214 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - const { licensingId } = ( - await queryRunner.query(` - SELECT \`licensingId\` FROM \`platform\`; - `) - )[0]; - - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`sortOrder\` int NOT NULL DEFAULT (0)` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`pricePerMonth\` DECIMAL(10,2) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`isFree\` TINYINT NOT NULL DEFAULT(0)` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`trialEnabled\` TINYINT NOT NULL DEFAULT(0)` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`requiresPaymentMethod\` TINYINT NOT NULL DEFAULT(0)` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`requiresContactSupport\` TINYINT NOT NULL DEFAULT(0)` - ); - - const plans = [ - { - name: 'FREE', - enabled: true, - licensingId, - sortOrder: 10, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: false, - }, - { - name: 'PLUS', - enabled: true, - licensingId, - sortOrder: 20, - pricePerMonth: 249, - isFree: false, - trialEnabled: true, - requiresPaymentMethod: false, - requiresContactSupport: false, - }, - { - name: 'PREMIUM', - enabled: true, - licensingId, - sortOrder: 30, - pricePerMonth: 749, - isFree: false, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - }, - { - name: 'ENTERPRISE', - enabled: true, - licensingId, - sortOrder: 40, - pricePerMonth: null, - isFree: false, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - }, - ]; - - for (const plan of plans) { - await queryRunner.query( - `INSERT INTO \`license_plan\` - ( \`id\`, \`createdDate\`, \`updatedDate\`, \`version\`, \`name\`, \`enabled\`, \`licensingId\`, \`sortOrder\`, \`pricePerMonth\`, \`isFree\`, \`trialEnabled\`, \`requiresPaymentMethod\`, \`requiresContactSupport\`) - VALUES - (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - `, - [ - randomUUID(), // id - new Date(), // createdDate - new Date(), // updatedDate - 1, // version - plan.name, // name - plan.enabled, // enabled - plan.licensingId, // licensingId - plan.sortOrder, // sortOrder - plan.pricePerMonth, // pricePerMonth - plan.isFree, // isFree - plan.trialEnabled, // trialEnabled - plan.requiresPaymentMethod, // requiresPaymentMethod - plan.requiresContactSupport, // requiresContactSupport - ] - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`sortOrder\`;` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`pricePerMonth\`;` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`isFree\`;` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`trialEnabled\`;` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`requiresPaymentMethod\`;` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`requiresContactSupport\`;` - ); - } -} diff --git a/src/migrations/1716805934325-communitPolicyParentCred.ts b/src/migrations/1716805934325-communitPolicyParentCred.ts deleted file mode 100644 index 538127cee8..0000000000 --- a/src/migrations/1716805934325-communitPolicyParentCred.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class communitPolicyParentCred1716805934325 - implements MigrationInterface -{ - name = 'communitPolicyParentCred1716805934325'; - - public async up(queryRunner: QueryRunner): Promise { - // Create the agent on each account - const communityPolicies: { - id: string; - lead: string; - }[] = await queryRunner.query( - `SELECT \`id\`, \`lead\` FROM \`community_policy\`` - ); - for (const policy of communityPolicies) { - const policyLead: CommunityPolicyRole = JSON.parse(policy.lead); - const newParentCredentials: CredentialDefinition[] = []; - for (const parentCredential of policyLead.parentCredentials) { - if (parentCredential.type === 'account-host') { - const [space]: { id: string }[] = await queryRunner.query( - `SELECT id FROM space where id = '${parentCredential.resourceID}'` - ); - if (space) { - parentCredential.type = 'space-lead'; - newParentCredentials.push(parentCredential); - policyLead.parentCredentials = newParentCredentials; - - await queryRunner.query( - `UPDATE \`community_policy\` SET \`lead\` = '${JSON.stringify( - policyLead - )}' WHERE id = '${policy.id}'` - ); - } - } - } - } - } - - public async down(queryRunner: QueryRunner): Promise { - console.log( - 'No down migration possible for communitPolicyParentCred1716805934325 migration!' - ); - } -} - -export type CredentialDefinition = { - type: string; - resourceID: string; -}; - -export type CommunityPolicyRole = { - enabled: boolean; - - credential: CredentialDefinition; - - parentCredentials: CredentialDefinition[]; - - minUser: number; - - maxUser: number; - - minOrg: number; - - maxOrg: number; -}; diff --git a/src/migrations/1716810317354-removeUserAccountHost.ts b/src/migrations/1716810317354-removeUserAccountHost.ts deleted file mode 100644 index 3374ad0b90..0000000000 --- a/src/migrations/1716810317354-removeUserAccountHost.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class removeUserAccountHost1716810317354 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - const credentialsToDelete: { - id: string; - }[] = await queryRunner.query( - `SELECT credential.id FROM alkemio.credential - JOIN agent on credential.agentId = agent.id - JOIN user on user.agentId = agent.id - JOIN account on resourceID = account.id - WHERE credential.type = 'account-host';` - ); - - if (credentialsToDelete.length === 0) { - console.log('No credentials to delete'); - return; - } - await queryRunner.query( - `DELETE FROM alkemio.credential WHERE id IN (${credentialsToDelete - .map(c => `'${c.id}'`) - .join(',')});` - ); - } - - public async down(_queryRunner: QueryRunner): Promise { - console.log('No down migration for removeUserAccountHost1716810317354'); - } -} diff --git a/src/migrations/1716831433146-licensePlanAssignment.ts b/src/migrations/1716831433146-licensePlanAssignment.ts deleted file mode 100644 index 472338ee9b..0000000000 --- a/src/migrations/1716831433146-licensePlanAssignment.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { Credential } from '@domain/agent'; -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class licensePlanAssignment1716831433146 implements MigrationInterface { - name = 'licensePlanAssignment1716831433146'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`licenseCredential\` varchar(255) NOT NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD \`basePlanId\` char(36) NULL` - ); - const plans: { - id: string; - name: string; - }[] = await queryRunner.query(`SELECT id, name FROM license_plan`); - for (const plan of plans) { - const planDefinition = planDefinitions.find(p => p.name === plan.name); - if (!planDefinition) { - throw new Error(`Plan ${plan.name} not found`); - } - await queryRunner.query( - `UPDATE license_plan SET licenseCredential = '${planDefinition.credential}' WHERE id = '${plan.id}'` - ); - } - const basePlan = plans.find(p => p.name === 'FREE'); - if (!basePlan) { - throw new Error(`Base plan not found`); - } - await queryRunner.query( - `UPDATE licensing SET basePlanId = '${basePlan.id}'` - ); - - // Create a free plan credential for every existing space - const accounts: { - id: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT \`id\`, \`agentId\` FROM \`account\`` - ); - - for (const { id: accountId, agentId } of accounts) { - await queryRunner.query( - `INSERT INTO \`credential\` - (\`id\`, \`createdDate\`, \`updatedDate\`, \`version\`, \`resourceID\`, \`type\`, \`agentId\`, \`issuer\`, \`expires\`) - VALUES - (?, ?, ?, ?, ?, ?, ?, ?, ?); - `, - [ - randomUUID(), // id - new Date(), // createdDate - new Date(), // updatedDate - 1, // version - accountId, // resourceID - LicenseCredential.SPACE_FREE, // type - agentId, // agentId - null, // issuer - null, // expires - ] - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} - -export enum LicenseCredential { - SPACE_FREE = 'license-space-free', - SPACE_PLUS = 'license-space-plus', - SPACE_PREMIUM = 'license-space-premium', - SPACE_ENTERPRISE = 'license-space-enterprise', -} - -export const planDefinitions = [ - { - name: 'FREE', - credential: LicenseCredential.SPACE_FREE, - }, - { - name: 'PLUS', - credential: LicenseCredential.SPACE_PLUS, - }, - { - name: 'PREMIUM', - credential: LicenseCredential.SPACE_PREMIUM, - }, - { - name: 'ENTERPRISE', - credential: LicenseCredential.SPACE_ENTERPRISE, - }, -]; diff --git a/src/migrations/1717058223813-revertVirtualPersonaPrompt.ts b/src/migrations/1717058223813-revertVirtualPersonaPrompt.ts deleted file mode 100644 index 7a999549e6..0000000000 --- a/src/migrations/1717058223813-revertVirtualPersonaPrompt.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class revertVirtualPersonaPrompt1717058223813 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const table = await queryRunner.getTable('virtual_persona'); - const isPromptColumnExist = table?.findColumnByName('prompt'); - - if (!isPromptColumnExist) { - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` ADD \`prompt\` text NOT NULL` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - const table = await queryRunner.getTable('virtual_persona'); - const isPromptColumnExist = table?.findColumnByName('prompt'); - - if (isPromptColumnExist) { - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP COLUMN \`prompt\`` - ); - } - } -} diff --git a/src/migrations/1717079559696-optionalBodyOfKnowledge.ts b/src/migrations/1717079559696-optionalBodyOfKnowledge.ts deleted file mode 100644 index 8b3105308b..0000000000 --- a/src/migrations/1717079559696-optionalBodyOfKnowledge.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class optionalBodyOfKnowledge1717079559696 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const table = await queryRunner.getTable('virtual_contributor'); - const bokColumn = table?.findColumnByName('bodyOfKnowledgeID'); - if (bokColumn && !bokColumn.isNullable) { - await queryRunner.changeColumn( - 'virtual_contributor', - 'bodyOfKnowledgeID', - new TableColumn({ - name: 'bodyOfKnowledgeID', - type: bokColumn.type, - isNullable: true, - }) - ); - } - const bokTypeColum = table?.findColumnByName('bodyOfKnowledgeType'); - if (bokTypeColum && !bokTypeColum.isNullable) { - await queryRunner.changeColumn( - 'virtual_contributor', - 'bodyOfKnowledgeType', - new TableColumn({ - name: 'bodyOfKnowledgeType', - type: bokTypeColum.type, - isNullable: true, - length: '64', - }) - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - const table = await queryRunner.getTable('virtual_contributor'); - const bokColumn = table?.findColumnByName('bodyOfKnowledgeID'); - if (bokColumn && bokColumn.isNullable) { - await queryRunner.changeColumn( - 'virtual_contributor', - 'bodyOfKnowledgeID', - new TableColumn({ - name: 'bodyOfKnowledgeID', - type: bokColumn.type, - isNullable: false, - }) - ); - } - const bokTypeColum = table?.findColumnByName('bodyOfKnowledgeType'); - if (bokTypeColum && bokTypeColum.isNullable) { - await queryRunner.changeColumn( - 'virtual_contributor', - 'bodyOfKnowledgeType', - new TableColumn({ - name: 'bodyOfKnowledgeType', - type: bokTypeColum.type, - isNullable: false, - length: '255', - }) - ); - } - } -} diff --git a/src/migrations/1717573360692-increasePdfSize.ts b/src/migrations/1717573360692-increasePdfSize.ts deleted file mode 100644 index ddfefd9b79..0000000000 --- a/src/migrations/1717573360692-increasePdfSize.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class increasePdfSize1717573360692 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`storage_bucket\` SET \`maxFileSize\` = 15728640 WHERE \`maxFileSize\` = 5242880;` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`storage_bucket\` SET \`maxFileSize\` = 5242880 WHERE \`maxFileSize\` = 15728640;` - ); - } -} diff --git a/src/migrations/1717750717135-extendMimeTypes.ts b/src/migrations/1717750717135-extendMimeTypes.ts deleted file mode 100644 index 44e7121438..0000000000 --- a/src/migrations/1717750717135-extendMimeTypes.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -const DEFAULT_ALLOWED_MIME_TYPES = [ - 'application/pdf', - 'application/vnd.ms-excel', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/vnd.oasis.opendocument.spreadsheet', - 'application/msword', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/vnd.oasis.opendocument.text', - 'image/bmp', - 'image/jpg', - 'image/jpeg', - 'image/x-png', - 'image/png', - 'image/gif', - 'image/webp', - 'image/svg+xml', - 'image/avif', -]; - -export class extendMimeTypes1717750717135 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query('UPDATE storage_bucket SET allowedMimeTypes = ?', [ - DEFAULT_ALLOWED_MIME_TYPES.join(','), - ]); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query('UPDATE storage_bucket SET allowedMimeTypes = ?', [ - 'image/jpg,image/jpeg,image/x-png,image/png,image/gif,image/webp,image/svg+xml,image/avif,application/pdf', - ]); - } -} diff --git a/src/migrations/1717751497484-updateDocumentMimeTypeLength.ts b/src/migrations/1717751497484-updateDocumentMimeTypeLength.ts deleted file mode 100644 index 8dc3882661..0000000000 --- a/src/migrations/1717751497484-updateDocumentMimeTypeLength.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class updateDocumentMimeTypeLength1717751497484 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE document MODIFY COLUMN mimeType VARCHAR(128) NULL` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE document MODIFY COLUMN mimeType VARCHAR(36) NULL` - ); - } -} diff --git a/src/migrations/1718174556242-invitationContributor.ts b/src/migrations/1718174556242-invitationContributor.ts deleted file mode 100644 index 300efaab3a..0000000000 --- a/src/migrations/1718174556242-invitationContributor.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class invitationContributor1718174556242 implements MigrationInterface { - name = 'invitationContributor1718174556242'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`invitation\` RENAME COLUMN \`invitedUser\` TO \`invitedContributor\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD \`contributorType\` char(36) NOT NULL` - ); - const invitations: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM invitation`); - for (const invitation of invitations) { - await queryRunner.query( - `UPDATE invitation SET contributorType = 'user' WHERE id = '${invitation.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1718174556250-discussionPrivacy.ts b/src/migrations/1718174556250-discussionPrivacy.ts deleted file mode 100644 index 5955590e4a..0000000000 --- a/src/migrations/1718174556250-discussionPrivacy.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class discussionPrivacy1718174556250 implements MigrationInterface { - name = 'discussionPrivacy1718174556250'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD \`privacy\` varchar(255) NOT NULL DEFAULT 'authenticated'` - ); - - const discussions: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM discussion`); - for (const discussion of discussions) { - await queryRunner.query( - `UPDATE discussion SET privacy = 'authenticated' WHERE id = '${discussion.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP COLUMN \`privacy\`` - ); - } -} diff --git a/src/migrations/1718860939735-aiServerSetup.ts b/src/migrations/1718860939735-aiServerSetup.ts deleted file mode 100644 index f0ec7dc26a..0000000000 --- a/src/migrations/1718860939735-aiServerSetup.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class aiServerSetup1718860939735 implements MigrationInterface { - name = 'aiServerSetup1718860939735'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE IF NOT EXISTS \`ai_persona\` ( - \`id\` char(36) NOT NULL, - \`aiPersonaServiceID\` varchar(128) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`description\` text DEFAULT NULL, - \`authorizationId\` char(36) NULL, - \`interactionModes\` text DEFAULT NULL, - \`dataAccessMode\` varchar(64) DEFAULT NULL, - \`bodyOfKnowledgeType\` varchar(64) DEFAULT NULL, - UNIQUE INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query(`CREATE TABLE IF NOT EXISTS \`ai_server\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`authorizationId\` char(36) NULL, - UNIQUE INDEX \`REL_9d520fa5fed56042918e48fc4b\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query(`CREATE TABLE IF NOT EXISTS \`ai_persona_service\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`engine\` varchar(128) NOT NULL, - \`dataAccessMode\` varchar(64) NOT NULL DEFAULT 'space_profile', - \`prompt\` text NOT NULL, - \`bodyOfKnowledgeType\` varchar(64) NULL, - \`bodyOfKnowledgeID\` varchar(255) NULL, - \`authorizationId\` char(36) NULL, - \`aiServerId\` char(36) NULL, - UNIQUE INDEX \`REL_79206feb0038b1c5597668dc4b\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`listedInStore\` tinyint NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`searchVisibility\` varchar(36) NOT NULL DEFAULT 'account'` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD \`aiPersonaId\` char(36) NOT NULL` - ); - - // Drop the existing FK constraints related to Virtual Persona - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP FOREIGN KEY \`FK_0e5ff0df260179127b43731bb68\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_persona\` DROP FOREIGN KEY \`FK_f5b93c5a204483c3563c7c434a4\` ` - ); - - ////////////////////////////////////// - // Migrate the data - - // The approach being taken is to create a new AI Persona and AI Persona Service for each Virtual Contributor - // This may result in maybe too many AI Persona and AI Persona Service records, but it is the most straight forward way to do it, and also guarantees that we get the account setup right - - // Create the AI Server entity - const aiServerID = randomUUID(); - const aiServerAuthID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${aiServerAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO ai_server (id, version, authorizationId) VALUES - ('${aiServerID}', - 1, - '${aiServerAuthID}')` - ); - - // Loop over all VCs - const virtualContributors: { - id: string; - virtualPersonaId: string; - bodyOfKnowledgeType: string; - bodyOfKnowledgeID: string; - }[] = await queryRunner.query( - `SELECT id, virtualPersonaId, bodyOfKnowledgeType, bodyOfKnowledgeID FROM virtual_contributor` - ); - - let aiPersonaServiceID; - for (const vc of virtualContributors) { - const [virtualPersona]: { - id: string; - engine: string; - prompt: string; - dataAccessMode: string; - }[] = await queryRunner.query( - `SELECT id, engine, prompt, dataAccessMode FROM virtual_persona WHERE id = '${vc.virtualPersonaId}'` - ); - if (!virtualPersona) { - console.log( - `unable to identify virtual persona for virtual contributor ${vc.id}` - ); - continue; - } - - // Create + populate the AI Persona Service - aiPersonaServiceID = randomUUID(); - const aiPersonaServiceAuthID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${aiPersonaServiceAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO ai_persona_service (\ - id,\ - version,\ - authorizationId,\ - aiServerId,\ - engine,\ - dataAccessMode,\ - prompt,\ - bodyOfKnowledgeType,\ - bodyOfKnowledgeID\ - )\ - VALUES (\ - '${aiPersonaServiceID}',\ - 1,\ - '${aiPersonaServiceAuthID}',\ - '${aiServerID}',\ - '${virtualPersona.engine}',\ - '${virtualPersona.dataAccessMode}',\ - '${virtualPersona.prompt}',\ - '${vc.bodyOfKnowledgeType}',\ - ${vc.bodyOfKnowledgeID ? `'${vc.bodyOfKnowledgeID}'` : 'NULL'}\ - )` - ); - - // Create + populate the AI Persona - const aiPersonaID = randomUUID(); - const aiPersonaAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${aiPersonaAuthID}', - 1, '', '', 0, '')` - ); - await queryRunner.query( - `INSERT INTO ai_persona (\ - id, \ - version, \ - aiPersonaServiceID, \ - authorizationId,\ - bodyOfKnowledgeType,\ - dataAccessMode,\ - interactionModes,\ - description\ - )\ - VALUES (\ - '${aiPersonaID}',\ - 1,\ - '${aiPersonaServiceID}',\ - '${aiPersonaAuthID}',\ - '${vc.bodyOfKnowledgeType}',\ - '${virtualPersona.dataAccessMode}',\ - '[${['discussion-tagging']}]',\ - ''\ - )` - ); - await queryRunner.query( - `UPDATE virtual_contributor SET aiPersonaId = '${aiPersonaID}' WHERE id = '${vc.id}'` - ); - } - - // update persona indicies after data is populated - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_55b8101bdf4f566645e928c26e\` (\`aiPersonaId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\` (\`aiPersonaId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_55b8101bdf4f566645e928c26e3\` FOREIGN KEY (\`aiPersonaId\`) REFERENCES \`ai_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD CONSTRAINT \`FK_293f0d3ef60cb0ca0006044ecfd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD CONSTRAINT \`FK_9d520fa5fed56042918e48fc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_79206feb0038b1c5597668dc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_b9f20da98058d7bd474152ed6ce\` FOREIGN KEY (\`aiServerId\`) REFERENCES \`ai_server\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - - //////////////////////////////////////// - // Clean up the old structure / data - - // And clean up data as last... - await queryRunner.query( - `ALTER TABLE virtual_contributor DROP CONSTRAINT FK_5c6f158a128406aafb9808b3a82` - ); - - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`bodyOfKnowledgeID\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`bodyOfKnowledgeType\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`virtualPersonaId\`` - ); - await queryRunner.query(`DROP TABLE \`virtual_persona\``); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719032308707-forum.ts b/src/migrations/1719032308707-forum.ts deleted file mode 100644 index 6262cee3da..0000000000 --- a/src/migrations/1719032308707-forum.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class forum1719032308707 implements MigrationInterface { - name = 'forum1719032308707'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`forum\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`discussionCategories\` text NOT NULL, - \`authorizationId\` char(36) NULL, - UNIQUE INDEX \`REL_3b0c92945f36d06f37de80285d\` (\`authorizationId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD \`forumId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD \`forumId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_dd88d373c64b04e24705d575c9\` (\`forumId\`)` - ); - - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\` (\`forumId\`)` - ); - - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_0de78853c1ee793f61bda7eff79\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` ADD CONSTRAINT \`FK_3b0c92945f36d06f37de80285dd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_dd88d373c64b04e24705d575c99\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_c6a084fe80d01c41d9f142d51aa\` ` - ); - - // communicationId - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_55333901817dd09d5906537e088\`` - ); - - await queryRunner.query( - `DROP INDEX \`REL_3eb4c1d5063176a184485399f1\` ON \`platform\`` - ); - - const [platform]: { - id: string; - communicationId: string; - }[] = await queryRunner.query(`SELECT id, communicationId FROM platform`); - if (platform) { - const [communication]: { - id: string; - authorizationId: string; - discussionCategories: string; - }[] = await queryRunner.query( - `SELECT id, authorizationId, discussionCategories FROM communication where id = '${platform.communicationId}'` - ); - if (communication) { - const forumID = randomUUID(); - await queryRunner.query( - `INSERT INTO forum (id, version, discussionCategories, authorizationId) VALUES (?, ?, ?, ?)`, - [ - forumID, - 1, // version - communication.discussionCategories, // discussionCategories - communication.authorizationId, // authorizationId - ] - ); - // Move over all the Discussions - await queryRunner.query( - `UPDATE discussion SET forumId = '${forumID}' WHERE communicationId = '${platform.communicationId}'` - ); - - await queryRunner.query( - `UPDATE platform SET forumId = '${forumID}' WHERE id = '${platform.id}'` - ); - - // delete the communication - await queryRunner.query( - `DELETE FROM communication WHERE id = '${platform.communicationId}'` - ); - } - } - - await queryRunner.query( - `ALTER TABLE \`communication\` DROP COLUMN \`discussionCategories\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP COLUMN \`communicationId\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP COLUMN \`communicationId\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719038314268-featureFlagsCredentials.ts b/src/migrations/1719038314268-featureFlagsCredentials.ts deleted file mode 100644 index fabcad0581..0000000000 --- a/src/migrations/1719038314268-featureFlagsCredentials.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class featureFlagsCredentials1719038314268 - implements MigrationInterface -{ - name = 'featureFlagsCredentials1719038314268'; - - public async up(queryRunner: QueryRunner): Promise { - // Add the new flags on license_plan - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`assignToNewOrganizationAccounts\` tinyint NOT NULL DEFAULT '0'` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`assignToNewUserAccounts\` tinyint NOT NULL DEFAULT '0'` - ); - - // Update existing plans to have new flags - const existingPlans: { - id: string; - name: string; - }[] = await queryRunner.query(`SELECT id, name FROM \`license_plan\``); - for (const existingPlan of existingPlans) { - let assignToNewOrganizationAccounts = false; - let assignToNewUserAccounts = false; - if (existingPlan.name === 'FREE') { - assignToNewOrganizationAccounts = true; - assignToNewUserAccounts = true; - } - await queryRunner.query( - `UPDATE \`license_plan\` - SET \`assignToNewOrganizationAccounts\` = ?, - \`assignToNewUserAccounts\` = ? - WHERE id = ?; - `, - [ - assignToNewOrganizationAccounts, - assignToNewUserAccounts, - existingPlan.id, - ] - ); - } - - // Create a new plan for each of the planDefinitions - const [platform]: { - id: string; - licensingId: string; - }[] = await queryRunner.query(`SELECT id, licensingId FROM platform`); - - for (const plan of plans) { - const planID = randomUUID(); - await queryRunner.query( - `INSERT INTO \`license_plan\` - ( \`id\`, - \`version\`, - \`name\`, - \`enabled\`, - \`licensingId\`, - \`sortOrder\`, - \`pricePerMonth\`, - \`isFree\`, - \`trialEnabled\`, - \`requiresPaymentMethod\`, - \`requiresContactSupport\`, - \`licenseCredential\`, - \`assignToNewOrganizationAccounts\`, - \`assignToNewUserAccounts\`) - VALUES - (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - `, - [ - planID, // id - 1, // version - plan.name, // name - plan.enabled, // enabled - platform.licensingId, // licensingId - plan.sortOrder, // sortOrder - plan.pricePerMonth, // pricePerMonth - plan.isFree, // isFree - plan.trialEnabled, // trialEnabled - plan.requiresPaymentMethod, // requiresPaymentMethod - plan.requiresContactSupport, // requiresContactSupport - plan.credential, - plan.assignToNewOrganizationAccounts, - plan.assignToNewUserAccounts, - ] - ); - } - - const accounts: { - id: string; - agentId: string; - licenseId: string; - }[] = await queryRunner.query( - `SELECT \`id\`, agentId, licenseId FROM \`account\`` - ); - for (const account of accounts) { - const featureFlags: { - id: string; - name: string; - enabled: string; - }[] = await queryRunner.query( - `SELECT id, name, enabled FROM feature_flag where licenseId = '${account.id}'` - ); - for (const flag of featureFlags) { - // Assign a credential to the agent under account if enabled - if (flag.enabled) { - const plan = plans.find(p => p.name === flag.name); - if (plan) { - const credentialID = randomUUID(); - let credentialType: string = ''; - switch (flag.name) { - case LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER: - credentialType = - LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER; - break; - case LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE: - credentialType = - LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE; - break; - case LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS: - credentialType = LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS; - break; - } - - await queryRunner.query( - `INSERT INTO \`credential\` - ( \`id\`, \`version\`, \`agentId\`, \`type\`, \`resourceID\`) - VALUES - (?, ?, ?, ?, ?); - `, - [ - `${credentialID}`, - 1, // version - account.agentId, - credentialType, - account.id, - ] - ); - } - } - } - } - - // Update the license policy to include the new credential rules - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD \`credentialRulesStr\` text NOT NULL` - ); - const [license_policy]: { - id: string; - }[] = await queryRunner.query(`SELECT id FROM license_policy`); - await queryRunner.query( - `UPDATE license_policy SET credentialRulesStr = '${JSON.stringify( - licenseCredentialRules - )}' WHERE id = '${license_policy.id}'` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP COLUMN \`featureFlagRules\` ` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} - -export enum LicenseCredential { - FEATURE_WHITEBOARD_MULTI_USER = 'feature-whiteboard-multi-user', - FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE = 'feature-callout-to-callout-template', - FEATURE_VIRTUAL_CONTRIBUTORS = 'feature-virtual-contributors', -} - -const plans = [ - { - name: 'FEATURE_WHITEBOARD_MULTI_USER', - credential: LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER, - enabled: true, - sortOrder: 50, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: false, - assignToNewUserAccounts: false, - }, - { - name: 'FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE', - credential: LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE, - enabled: true, - sortOrder: 60, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: true, - assignToNewUserAccounts: true, - }, - { - name: 'FEATURE_VIRTUAL_CONTRIBUTORS', - credential: LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS, - enabled: true, - sortOrder: 70, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: false, - assignToNewUserAccounts: true, - }, -]; - -export type CredentialRule = { - credentialType: LicenseCredential; - grantedPrivileges: LicensePrivilege[]; - name: string; -}; - -export enum LicensePrivilege { - VIRTUAL_CONTRIBUTOR_ACCESS = 'virtual-contributor-access', - WHITEBOARD_MULTI_USER = 'whiteboard-multi-user', - CALLOUT_SAVE_AS_TEMPLATE = 'callout-save-as-template', -} - -export const licenseCredentialRules: CredentialRule[] = [ - { - credentialType: LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS, - grantedPrivileges: [LicensePrivilege.VIRTUAL_CONTRIBUTOR_ACCESS], - name: 'Virtual Contributors', - }, - { - credentialType: LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER, - grantedPrivileges: [LicensePrivilege.WHITEBOARD_MULTI_USER], - name: 'Multi-user whiteboards', - }, - { - credentialType: LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE, - grantedPrivileges: [LicensePrivilege.CALLOUT_SAVE_AS_TEMPLATE], - name: 'Callout templates', - }, -]; diff --git a/src/migrations/1719225622768-licensePlanType.ts b/src/migrations/1719225622768-licensePlanType.ts deleted file mode 100644 index 8d13fb4e27..0000000000 --- a/src/migrations/1719225622768-licensePlanType.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class licensePlanType1719225622768 implements MigrationInterface { - name = 'licensePlanType1719225622768'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD \`type\` varchar(255) NULL` - ); - - const licensePlans: { - id: string; - name: string; - }[] = await queryRunner.query(`SELECT id, name FROM license_plan`); - - for (const licensePlan of licensePlans) { - const type = licensePlan.name.toLowerCase().startsWith('feature_') - ? LicensePlanType.SPACE_FEATURE_FLAG - : LicensePlanType.SPACE_PLAN; - await queryRunner.query( - `UPDATE license_plan SET type = '${type}' WHERE id = '${licensePlan.id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP COLUMN \`type\`` - ); - } -} - -export enum LicensePlanType { - SPACE_PLAN = 'space-plan', - SPACE_FEATURE_FLAG = 'space-feature-flag', -} diff --git a/src/migrations/1719225623900-spaceTypeKnowledge.ts b/src/migrations/1719225623900-spaceTypeKnowledge.ts deleted file mode 100644 index 981a2f9215..0000000000 --- a/src/migrations/1719225623900-spaceTypeKnowledge.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class spaceTypeKnowledgeType1719225623900 implements MigrationInterface { - name = 'spaceTypeKnowledgeType1719225623900'; - - public async up(queryRunner: QueryRunner): Promise { - const spaces: { - id: string; - type: string; - }[] = await queryRunner.query(`SELECT id, type FROM space`); - - for (const space of spaces) { - if (space.type === 'vc') { - await queryRunner.query( - `UPDATE space SET type = 'knowledge' WHERE id = '${space.id}'` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719225624444-aiPersonaFields.ts b/src/migrations/1719225624444-aiPersonaFields.ts deleted file mode 100644 index 3a74dd92b5..0000000000 --- a/src/migrations/1719225624444-aiPersonaFields.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class aiPersonaFields1719225624444 implements MigrationInterface { - name = 'aiPersonaFields1719225624444'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD \`bodyOfKnowledge\` text DEFAULT NULL` - ); - - const aiPersonas: { - id: string; - aiPersonaServiceID: string; - }[] = await queryRunner.query( - `SELECT id, aiPersonaServiceID FROM ai_persona` - ); - for (const aiPersona of aiPersonas) { - const [aiPersonaService]: { - id: string; - bodyOfKnowledgeType: string; - bodyOfKnowledgeID: string; - }[] = await queryRunner.query( - `SELECT id, bodyOfKnowledgeType, bodyOfKnowledgeID FROM ai_persona_service where id = '${aiPersona.aiPersonaServiceID}'` - ); - const bodyOfKnowledge = `Body of knowledge: based on the AI persona service ID: ${aiPersona.aiPersonaServiceID}`; - await queryRunner.query( - `UPDATE ai_persona SET bodyOfKnowledge = '${bodyOfKnowledge}' WHERE id = '${aiPersona.id}'` - ); - } - - await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP COLUMN \`bodyOfKnowledgeType\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719410254726-generateFeatureFlagCredentials.ts b/src/migrations/1719410254726-generateFeatureFlagCredentials.ts deleted file mode 100644 index a6d2ed23db..0000000000 --- a/src/migrations/1719410254726-generateFeatureFlagCredentials.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class generateFeatureFlagCredentials1719410254726 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const accounts: { - id: string; - agentId: string; - licenseId: string; - }[] = await queryRunner.query( - `SELECT \`id\`, agentId, licenseId FROM \`account\`` - ); - for (const account of accounts) { - const featureFlags: { - id: string; - name: string; - enabled: boolean; - }[] = await queryRunner.query( - `SELECT id, name, enabled FROM feature_flag where licenseId = '${account.licenseId}'` - ); - for (const flag of featureFlags) { - // Assign a credential to the agent under account if enabled - if (flag.enabled) { - const plan = plans.find(p => p.name === flag.name); - if (plan) { - const credentialID = randomUUID(); - let credentialType: string = ''; - switch ('feature-' + flag.name) { - case LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER: - credentialType = - LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER; - break; - case LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE: - credentialType = - LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE; - break; - case LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS: - credentialType = LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS; - break; - } - - await queryRunner.query( - `INSERT INTO \`credential\` - ( \`id\`, \`version\`, \`agentId\`, \`type\`, \`resourceID\`) - VALUES - (?, ?, ?, ?, ?); - `, - [ - `${credentialID}`, - 1, // version - account.agentId, - credentialType, - account.id, - ] - ); - } - } - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} - -enum LicenseCredential { - FEATURE_WHITEBOARD_MULTI_USER = 'feature-whiteboard-multi-user', - FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE = 'feature-callout-to-callout-template', - FEATURE_VIRTUAL_CONTRIBUTORS = 'feature-virtual-contributors', -} - -const plans = [ - { - name: 'whiteboard-multi-user', - credential: LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER, - enabled: true, - sortOrder: 50, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: false, - assignToNewUserAccounts: false, - }, - { - name: 'callout-to-callout-template', - credential: LicenseCredential.FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE, - enabled: true, - sortOrder: 60, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: true, - assignToNewUserAccounts: true, - }, - { - name: 'virtual-contributors', - credential: LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS, - enabled: true, - sortOrder: 70, - pricePerMonth: 0, - isFree: true, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: false, - assignToNewUserAccounts: true, - }, -]; diff --git a/src/migrations/1719431685862-platformInvitations.ts b/src/migrations/1719431685862-platformInvitations.ts deleted file mode 100644 index ec0b7f710f..0000000000 --- a/src/migrations/1719431685862-platformInvitations.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class platformInvitations1719431685862 implements MigrationInterface { - name = 'platformInvitations1719431685862'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE invitation_external RENAME TO platform_invitation` - ); - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD \`platformId\` char(36) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_809c1e6cf3ef6be03a0a1db3f70\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD \`platformRole\` varchar(255) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` RENAME COLUMN \`invitedToParent\` TO \`communityInvitedToParent\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719487568442-contributorCommunicationID.ts b/src/migrations/1719487568442-contributorCommunicationID.ts deleted file mode 100644 index 8be7838045..0000000000 --- a/src/migrations/1719487568442-contributorCommunicationID.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class contributorCommunicationID1719487568442 - implements MigrationInterface -{ - name = 'contributorCommunicationID1719487568442'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `organization` ADD `communicationID` varchar(255) NOT NULL' - ); - await queryRunner.query(`UPDATE organization SET communicationID = ''`); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1719550326418-accountStorage.ts b/src/migrations/1719550326418-accountStorage.ts deleted file mode 100644 index 367c5e2e6c..0000000000 --- a/src/migrations/1719550326418-accountStorage.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class accountStorage1719550326418 implements MigrationInterface { - name = 'accountStorage1719550326418'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `account` ADD `storageAggregatorId` char(36) NULL' - ); - - const accounts: { - id: string; - spaceId: string; - }[] = await queryRunner.query(`SELECT id, spaceId FROM \`account\``); - for (const account of accounts) { - const accountStorageAggregatorID = - await this.createStorageAggregatorOnAccount(queryRunner, account.id); - const [rootSpace]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM space WHERE id = '${account.spaceId}'` - ); - if (rootSpace) { - await queryRunner.query( - `UPDATE storage_aggregator SET parentStorageAggregatorId = '${accountStorageAggregatorID}' WHERE id = '${rootSpace.storageAggregatorId}'` - ); - } else { - console.log(`No root space found for account ${account.id}`); - } - } - - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_99998853c1ee793f61bda7eff79\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async createStorageAggregatorOnAccount( - queryRunner: QueryRunner, - accountID: string - ): Promise { - const storageAggregatorID = randomUUID(); - const storageAggregatorAuthID = randomUUID(); - - const directStorageId = await this.createStorageBucket(queryRunner); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageAggregatorAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO storage_aggregator (id, version, authorizationId, directStorageId) - VALUES ('${storageAggregatorID}', - '1', - '${storageAggregatorAuthID}', - '${directStorageId}')` - ); - - await queryRunner.query( - `UPDATE \`account\` SET storageAggregatorId = '${storageAggregatorID}' WHERE (id = '${accountID}')` - ); - - return storageAggregatorID; - } - - private async createStorageBucket(queryRunner: QueryRunner): Promise { - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId) - VALUES ('${storageBucketID}', - '1', - '${storageBucketAuthID}', - '${allowedTypes}', - ${maxAllowedFileSize}, - null)` - ); - - return storageBucketID; - } -} - -export const allowedTypes = [ - 'application/pdf', - 'application/vnd.ms-excel', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/vnd.oasis.opendocument.spreadsheet', - 'application/msword', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/vnd.oasis.opendocument.text', - 'image/bmp', - 'image/jpg', - 'image/jpeg', - 'image/x-png', - 'image/png', - 'image/gif', - 'image/webp', - 'image/svg+xml', - 'image/avif', -]; - -export const maxAllowedFileSize = 15728640; diff --git a/src/migrations/1719859107990-communityType.ts b/src/migrations/1719859107990-communityType.ts deleted file mode 100644 index 2d86a9444e..0000000000 --- a/src/migrations/1719859107990-communityType.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class communityType1719859107990 implements MigrationInterface { - name = 'communityType1719859107990'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`community\` DROP COLUMN \`type\``); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1720510767439-createInteraction.ts b/src/migrations/1720510767439-createInteraction.ts deleted file mode 100644 index 572de1b896..0000000000 --- a/src/migrations/1720510767439-createInteraction.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class createInteraction1720510767439 implements MigrationInterface { - name = 'createInteraction1720510767439'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE TABLE \`vc_interaction\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`threadID\` varchar(128) NOT NULL, \`virtualContributorID\` char(36) NOT NULL, \`roomId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` ADD CONSTRAINT \`FK_1ba25e7d3dc29fa02b88e17fca0\` FOREIGN KEY (\`roomId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` DROP FOREIGN KEY \`FK_1ba25e7d3dc29fa02b88e17fca0\`` - ); - await queryRunner.query(`DROP TABLE \`vc_interaction\``); - } -} diff --git a/src/migrations/1721140750386-aiPersonaFields.ts b/src/migrations/1721140750386-aiPersonaFields.ts deleted file mode 100644 index e2d016bbc4..0000000000 --- a/src/migrations/1721140750386-aiPersonaFields.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class aiPersonaFields1721140750386 implements MigrationInterface { - name = 'aiPersonaFields1721140750386'; - - public async up(queryRunner: QueryRunner): Promise { - const aiPersonaServices: { - id: string; - bodyOfKnowledgeType: string; - }[] = await queryRunner.query( - `SELECT id, bodyOfKnowledgeType FROM \`ai_persona_service\`` - ); - for (const aiPersonaService of aiPersonaServices) { - if (aiPersonaService.bodyOfKnowledgeType === '') { - await queryRunner.query( - `UPDATE ai_persona_service SET bodyOfKnowledgeType = 'none' WHERE id = '${aiPersonaService.id}'` - ); - } else if (aiPersonaService.bodyOfKnowledgeType === 'space') { - await queryRunner.query( - `UPDATE ai_persona_service SET bodyOfKnowledgeType = 'alkemio-space' WHERE id = '${aiPersonaService.id}'` - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1721373372024-genderUser.ts b/src/migrations/1721373372024-genderUser.ts deleted file mode 100644 index 93c2c409cb..0000000000 --- a/src/migrations/1721373372024-genderUser.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class genderUser1721373372024 implements MigrationInterface { - name = 'genderUser1721373372024'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`user\` DROP COLUMN \`gender\``); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1721649196399-innovationPacksAccount.ts b/src/migrations/1721649196399-innovationPacksAccount.ts deleted file mode 100644 index f81f193dd4..0000000000 --- a/src/migrations/1721649196399-innovationPacksAccount.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { safelyDropFK } from './utils/safely-drop-foreignKey'; - -export class InnovationPacksAccount1721649196399 implements MigrationInterface { - name = 'InnovationPacksAccount1721649196399'; - - public async up(queryRunner: QueryRunner): Promise { - await safelyDropFK( - queryRunner, - 'innovation_pack', - 'FK_77777450cf75dc486700ca034c6' - ); - await safelyDropFK( - queryRunner, - 'library', - 'FK_6664d59c0b805c9c1ecb0070e16' - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP COLUMN \`libraryId\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD \`listedInStore\` tinyint NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD \`searchVisibility\` varchar(36) NOT NULL DEFAULT 'account'` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD \`accountId\` char(36) NULL` - ); - - const innovationPacks = await queryRunner.query( - `SELECT id FROM \`innovation_pack\`` - ); - if (innovationPacks.length > 0) { - const defaultHostAccount = await this.getDefaultHostAccount(queryRunner); - console.log(`Default host account: ${defaultHostAccount}`); - - const libraryStorageAggregatorID = - await this.getLibraryStorageAggregatorID(queryRunner); - - for (const innovationPack of innovationPacks) { - let accountID = defaultHostAccount; - - const providerCredential = await this.getProviderCredential( - queryRunner, - innovationPack.id - ); - if (providerCredential) { - const organization = await this.getOrganization( - queryRunner, - providerCredential.agentId - ); - if (organization) { - const accountHostCredential = await this.getAccountHostCredential( - queryRunner, - organization.agentId - ); - if (accountHostCredential) { - accountID = accountHostCredential.resourceID; - } - } - } - - if (!accountID) { - throw new Error( - `Account ID not found for innovation pack: ${innovationPack.id}` - ); - } - - const account = await this.getAccount(queryRunner, accountID); - if (!account) { - console.log( - `Account ${accountID} does not have a storage aggregator` - ); - continue; - } - const listedInStore = true; - const searchVisibility = 'public'; - await queryRunner.query( - `UPDATE innovation_pack SET accountId = '${accountID}', listedInStore = ${listedInStore}, searchVisibility='${searchVisibility}' WHERE id = '${innovationPack.id}'` - ); - - await this.updateStorageBuckets( - queryRunner, - libraryStorageAggregatorID, - account.storageAggregatorId - ); - } - } - - await queryRunner.query( - `ALTER TABLE \`library\` DROP COLUMN \`storageAggregatorId\`` - ); - await queryRunner.query( - `DELETE FROM credential WHERE type = 'innovation-pack-provider'` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_77777450cf75dc486700ca034c6\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async getDefaultHostAccount( - queryRunner: QueryRunner - ): Promise { - const orgNamePattern = '%Alkemio%'; - let result = await queryRunner.query( - `SELECT account.id as id FROM credential - JOIN account ON credential.resourceID = account.id - JOIN organization ON credential.agentId = organization.agentId - JOIN profile ON organization.profileId = profile.id - WHERE credential.type = 'account-host' AND profile.displayName LIKE ?`, - [orgNamePattern] - ); - - if (!result || result.length === 0) { - result = await queryRunner.query( - `SELECT account.id as id FROM credential - JOIN account ON credential.resourceID = account.id - JOIN organization ON credential.agentId = organization.agentId - WHERE credential.type = 'account-host' LIMIT 1` - ); - - if (!result || result.length === 0) { - throw new Error(`No account-host credentials found.`); - } - } - - return result[0].id; - } - - private async getLibraryStorageAggregatorID( - queryRunner: QueryRunner - ): Promise { - const library = await queryRunner.query( - `SELECT id, storageAggregatorId FROM library` - ); - if (!library || library.length !== 1) { - throw new Error(`Unable to retrieve storage aggregator on library`); - } - return library[0].storageAggregatorId; - } - - private async getProviderCredential( - queryRunner: QueryRunner, - resourceId: string - ): Promise { - const result = await queryRunner.query( - `SELECT id, agentId FROM credential WHERE resourceID = ? and type = 'innovation-pack-provider'`, - [resourceId] - ); - return result[0]; - } - - private async getOrganization( - queryRunner: QueryRunner, - agentId: string - ): Promise { - const result = await queryRunner.query( - `SELECT id, agentId FROM organization WHERE agentId = ?`, - [agentId] - ); - return result[0]; - } - - private async getAccountHostCredential( - queryRunner: QueryRunner, - agentId: string - ): Promise { - const result = await queryRunner.query( - `SELECT id, agentId, resourceID FROM credential WHERE agentId = ? and type = 'account-host'`, - [agentId] - ); - return result[0]; - } - - private async getAccount( - queryRunner: QueryRunner, - accountId: string - ): Promise { - const result = await queryRunner.query( - `SELECT id, storageAggregatorId FROM account WHERE id = ?`, - [accountId] - ); - return result[0]; - } - - private async updateStorageBuckets( - queryRunner: QueryRunner, - oldStorageAggregatorId: string, - newStorageAggregatorId: string - ): Promise { - const storageBuckets = await queryRunner.query( - `SELECT id FROM \`storage_bucket\` WHERE storageAggregatorId = ?`, - [oldStorageAggregatorId] - ); - - for (const storageBucket of storageBuckets) { - await queryRunner.query( - `UPDATE storage_bucket SET storageAggregatorId = ? WHERE id = ?`, - [newStorageAggregatorId, storageBucket.id] - ); - } - } -} diff --git a/src/migrations/1721737522043-innovationHubAccount.ts b/src/migrations/1721737522043-innovationHubAccount.ts deleted file mode 100644 index 4060dc77a4..0000000000 --- a/src/migrations/1721737522043-innovationHubAccount.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class InnovationHubAccount1721737522043 implements MigrationInterface { - name = 'InnovationHubAccount1721737522043'; - - public async up(queryRunner: QueryRunner): Promise { - // Temporarily remove the constraint - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP CONSTRAINT `FK_156fd30246eb151b9d17716abf5`' - ); - - // Remove uniqueness of accountId index: Just copied from accountInnovationHub1715936821326 - await queryRunner.query( - 'DROP INDEX `REL_156fd30246eb151b9d17716abf` ON `innovation_hub`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP INDEX `IDX_156fd30246eb151b9d17716abf`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD INDEX `IDX_156fd30246eb151b9d17716abf` (`accountId`)' - ); - await queryRunner.query( - 'CREATE INDEX `REL_156fd30246eb151b9d17716abf` ON `innovation_hub` (`accountId`)' - ); - - // Add the two new columns - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD \`listedInStore\` tinyint NOT NULL DEFAULT(1)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD \`searchVisibility\` varchar(36) NOT NULL DEFAULT 'account'` - ); - - // All existing innovation hubs to default to be public + listed - await queryRunner.query( - `UPDATE innovation_hub SET listedInStore = '1', searchVisibility = 'public';` - ); - - // Find the account that will host all innovation hubs that don't have an account already - const innovationHubs = await queryRunner.query( - `SELECT id FROM \`innovation_hub\`` - ); - if (innovationHubs.length > 0) { - const defaultHostAccount = await this.getDefaultHostAccount(queryRunner); - console.log(`Default host account: ${defaultHostAccount}`); - await queryRunner.query( - `UPDATE innovation_hub SET accountId = '${defaultHostAccount}' WHERE accountId IS NULL;` - ); - } - - // Make accountId not nullable - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` MODIFY \`accountId\` varchar(36) NOT NULL;` - ); - - // Add the constraint back - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_156fd30246eb151b9d17716abf5` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE CASCADE ON UPDATE CASCADE' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP COLUMN \`listedInStore\`` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP COLUMN \`searchVisibility\`` - ); - - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` MODIFY \`accountId\` varchar(36) NOT NULL;` - ); - } - - private async getDefaultHostAccount( - queryRunner: QueryRunner - ): Promise { - const orgNamePattern = '%Alkemio%'; - let result = await queryRunner.query( - `SELECT account.id as id FROM credential - JOIN account ON credential.resourceID = account.id - JOIN organization ON credential.agentId = organization.agentId - JOIN profile ON organization.profileId = profile.id - WHERE credential.type = 'account-host' AND profile.displayName LIKE ?`, - [orgNamePattern] - ); - - if (!result || result.length === 0) { - result = await queryRunner.query( - `SELECT account.id as id FROM credential - JOIN account ON credential.resourceID = account.id - JOIN organization ON credential.agentId = organization.agentId - WHERE credential.type = 'account-host' LIMIT 1` - ); - - if (!result || result.length === 0) { - throw new Error(`No account-host credentials found.`); - } - } - - return result[0].id; - } -} diff --git a/src/migrations/1721767553604-vcStorage.ts b/src/migrations/1721767553604-vcStorage.ts deleted file mode 100644 index 0d97d665cf..0000000000 --- a/src/migrations/1721767553604-vcStorage.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class VcStorage1721767553604 implements MigrationInterface { - name = 'VcStorage1721767553604'; - - public async up(queryRunner: QueryRunner): Promise { - // Check and drop FK constraints if they exist - await queryRunner - .query( - ` - SELECT CONSTRAINT_NAME - FROM information_schema.KEY_COLUMN_USAGE - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = 'virtual_contributor' - AND CONSTRAINT_NAME = 'FK_29a529635a2b2db9f37ca6d3521' -` - ) - .then(async result => { - if (result.length > 0) { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_29a529635a2b2db9f37ca6d3521\`` - ); - } - }); - - await queryRunner - .query( - ` - SELECT CONSTRAINT_NAME - FROM information_schema.KEY_COLUMN_USAGE - WHERE TABLE_SCHEMA = DATABASE() - AND TABLE_NAME = 'virtual_contributor' - AND CONSTRAINT_NAME = 'FK_ce68cea88d194e0240b737c3f0c' -` - ) - .then(async result => { - if (result.length > 0) { - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_ce68cea88d194e0240b737c3f0c\`` - ); - } - }); - - // Logic is a) iterate over all VCs b) find the account storage bucket for each c) find all storage buckets - // using the storage aggregator of the VC and update them to use the storage aggregator of the account - const vcs: { - id: string; - accountId: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, accountId, storageAggregatorId FROM \`virtual_contributor\`` - ); - for (const vc of vcs) { - const [account]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM account WHERE id = '${vc.accountId}'` - ); - if (account) { - const storageBuckets: { - id: string; - accountId: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id FROM \`storage_bucket\` where storageAggregatorId = '${vc.storageAggregatorId}'` - ); - for (const storageBucket of storageBuckets) { - await queryRunner.query( - `UPDATE storage_bucket SET storageAggregatorId = '${account.storageAggregatorId}' WHERE id = '${storageBucket.id}'` - ); - } - } else { - throw new Error(`No account found for virtual contributor ${vc.id}`); - } - // Delete the referred to storage aggregator - await queryRunner.query( - `DELETE FROM storage_aggregator WHERE id = '${vc.storageAggregatorId}'` - ); - } - // drop storageBucketId on virtual_contributor - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP COLUMN \`storageAggregatorId\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1721803817721-levelZeroSpaceID.ts b/src/migrations/1721803817721-levelZeroSpaceID.ts deleted file mode 100644 index 5478bb3585..0000000000 --- a/src/migrations/1721803817721-levelZeroSpaceID.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class LevelZeroSpaceID1721803817721 implements MigrationInterface { - name = 'LevelZeroSpaceID1721803817721'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `space` ADD `levelZeroSpaceID` char(36) NULL' - ); - const spaces: { - id: string; - accountId: string; - level: number; - }[] = await queryRunner.query(`SELECT id, accountId, level FROM \`space\``); - for (const space of spaces) { - const [account]: { - id: string; - spaceId: string; - }[] = await queryRunner.query( - `SELECT id, spaceId FROM account WHERE id = '${space.accountId}'` - ); - if (account) { - await queryRunner.query( - `UPDATE space SET levelZeroSpaceID = '${account.spaceId}' WHERE id = '${space.id}'` - ); - } else { - console.log(`No root space found for account ${space.id}`); - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1721830892863-spaceVisibility.ts b/src/migrations/1721830892863-spaceVisibility.ts deleted file mode 100644 index 1b5d28d799..0000000000 --- a/src/migrations/1721830892863-spaceVisibility.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class SpaceVisibility1721830892863 implements MigrationInterface { - name = 'SpaceVisibility1721830892863'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `space` ADD `visibility` varchar(36) NULL' - ); - - // Drop the foreign key constraint on License - await queryRunner.query( - `ALTER TABLE \`license\` DROP FOREIGN KEY \`FK_bfd01743815f0dd68ac1c5c45c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_8339e62882f239dc00ff5866f8c\`` - ); - await queryRunner.query( - `ALTER TABLE \`feature_flag\` DROP FOREIGN KEY \`FK_7e3e0a8b6d3e9b4a3a0d6e3a3e3\`` - ); - - const spaces: { - id: string; - accountId: string; - level: number; - }[] = await queryRunner.query(`SELECT id, accountId, level FROM \`space\``); - for (const space of spaces) { - const [account]: { - id: string; - licenseId: string; - }[] = await queryRunner.query( - `SELECT id, licenseId FROM account WHERE id = '${space.accountId}'` - ); - if (account) { - const [license]: { - id: string; - visibility: string; - }[] = await queryRunner.query( - `SELECT id, visibility FROM license WHERE id = '${account.licenseId}'` - ); - if (license) { - await queryRunner.query( - `UPDATE \`space\` SET visibility = '${license.visibility}' WHERE id = '${space.id}'` - ); - } else { - console.log(`No license found for account ${account.id}`); - } - } else { - console.log(`No root space found for account ${space.id}`); - } - } - - const licenses: { - id: string; - authorizationId: string; - }[] = await queryRunner.query( - `SELECT id, authorizationId FROM \`license\`` - ); - for (const license of licenses) { - // delete the authorization associated with the license - await queryRunner.query( - `DELETE FROM authorization_policy WHERE id = '${license.authorizationId}'` - ); - } - // Drop License table + column on Account - await queryRunner.query('ALTER TABLE `account` DROP COLUMN `licenseId`'); - await queryRunner.query('DROP TABLE `license`'); - await queryRunner.query('DROP TABLE `feature_flag`'); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1721897303394-fixPhantomVCInvitations.ts b/src/migrations/1721897303394-fixPhantomVCInvitations.ts deleted file mode 100644 index d4b5ac0f8e..0000000000 --- a/src/migrations/1721897303394-fixPhantomVCInvitations.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixPhantomVCInvitations1721897303394 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - DELETE FROM invitation - WHERE invitedContributor NOT IN ( - SELECT id FROM virtual_contributor - ); - `); - } - - public async down(queryRunner: QueryRunner): Promise { - console.log( - 'Reversing the deletion of invitations is not feasible. Restore from a backup.' - ); - } -} diff --git a/src/migrations/1722591262858-innovationHubs-storageAggregators.ts b/src/migrations/1722591262858-innovationHubs-storageAggregators.ts deleted file mode 100644 index dab8d50e50..0000000000 --- a/src/migrations/1722591262858-innovationHubs-storageAggregators.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class InnovationHubsStorageAggregators1722591262858 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const innovationHubs: { - innovationHubId: string; - storageBucketId: string; - currentStorageAggregatorId: string; - accountStorageAggregator: string; - }[] = await queryRunner.query( - `SELECT - innovation_hub.id AS innovationHubId, - profile.storageBucketId AS storageBucketId, - storage_bucket.storageAggregatorId AS currentStorageAggregatorId, - account.storageAggregatorId AS accountStorageAggregator - FROM innovation_hub - JOIN profile ON innovation_hub.profileId = profile.Id - JOIN storage_bucket ON profile.storageBucketId = storage_bucket.id - JOIN account ON innovation_hub.accountId = account.id;` - ); - if (innovationHubs.length > 0) { - for (const innovationHub of innovationHubs) { - if ( - innovationHub.currentStorageAggregatorId !== - innovationHub.accountStorageAggregator - ) { - await queryRunner.query( - `UPDATE storage_bucket SET storageAggregatorId = ? WHERE id = ?`, - [ - innovationHub.accountStorageAggregator, - innovationHub.storageBucketId, - ] - ); - } - } - } - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1723121607785-deleteAccountsWithoutSpaces.ts b/src/migrations/1723121607785-deleteAccountsWithoutSpaces.ts deleted file mode 100644 index 0dd7d1eed3..0000000000 --- a/src/migrations/1723121607785-deleteAccountsWithoutSpaces.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class DeleteAccountsWithoutSpaces1723121607785 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const credentialsToDelete: { - id: string; - }[] = await queryRunner.query( - `SELECT credential.id FROM alkemio.credential - JOIN agent on credential.agentId = agent.id - JOIN account on account.agentId = agent.id - WHERE account.spaceId IS NULL;` - ); - - if (credentialsToDelete.length === 0) { - console.log('No credentials to delete'); - return; - } - await queryRunner.query( - `DELETE FROM credential WHERE id IN (${credentialsToDelete - .map(c => `'${c.id}'`) - .join(',')});` - ); - await queryRunner.query(`DELETE FROM account WHERE spaceId IS NULL;`); - } - - public async down(_queryRunner: QueryRunner): Promise { - console.log( - 'No down migration for deleteAccountsWithoutSpaces1723121607785' - ); - } -} diff --git a/src/migrations/1723121607799-agentType.ts b/src/migrations/1723121607799-agentType.ts deleted file mode 100644 index 5efabe0022..0000000000 --- a/src/migrations/1723121607799-agentType.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AgentType1723121607799 implements MigrationInterface { - name = 'AgentType1723121607799'; - - public async up(queryRunner: QueryRunner): Promise { - // Add the type column to the agent table - await queryRunner.query('ALTER TABLE `agent` ADD `type` varchar(128) NULL'); - await this.updateAgentTypeForEntity(queryRunner, 'account', 'account'); - await this.updateAgentTypeForEntity(queryRunner, 'space', 'space'); - await this.updateAgentTypeForEntity(queryRunner, 'user', 'user'); - await this.updateAgentTypeForEntity( - queryRunner, - 'organization', - 'organization' - ); - await this.updateAgentTypeForEntity( - queryRunner, - 'virtual_contributor', - 'virtual-contributor' - ); - - // Drop the parentDisplayID column from the agent table - await queryRunner.query( - 'ALTER TABLE `agent` DROP COLUMN `parentDisplayID`' - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async updateAgentTypeForEntity( - queryRunner: QueryRunner, - entityType: string, - agentType: string - ) { - const entities: { - id: string; - agentId: string; - }[] = await queryRunner.query(`SELECT id, agentId FROM \`${entityType}\``); - for (const entity of entities) { - const [agent]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM agent WHERE id = '${entity.agentId}'` - ); - if (agent) { - await queryRunner.query( - `UPDATE \`agent\` SET type = '${agentType}' WHERE id = '${agent.id}'` - ); - } else { - console.log(`No agent found for ${entityType}: ${entity.id}`); - } - } - } -} diff --git a/src/migrations/1723121607999-storageAggregatorType.ts b/src/migrations/1723121607999-storageAggregatorType.ts deleted file mode 100644 index 3c3d208033..0000000000 --- a/src/migrations/1723121607999-storageAggregatorType.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class StorageAggregatorType1723121607999 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - // Add the type column to the storage aggregator table - await queryRunner.query( - 'ALTER TABLE `storage_aggregator` ADD `type` varchar(128) NULL' - ); - await this.updateStorageAggregatorTypeForEntity( - queryRunner, - 'account', - 'account' - ); - await this.updateStorageAggregatorTypeForEntity( - queryRunner, - 'space', - 'space' - ); - await this.updateStorageAggregatorTypeForEntity( - queryRunner, - 'user', - 'user' - ); - await this.updateStorageAggregatorTypeForEntity( - queryRunner, - 'organization', - 'organization' - ); - await this.updateStorageAggregatorTypeForEntity( - queryRunner, - 'platform', - 'platform' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - console.log('No down migration for storageAggregatorType1723121607999'); - } - - private async updateStorageAggregatorTypeForEntity( - queryRunner: QueryRunner, - entityType: string, - storageAggregatorType: string - ) { - const entities: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM \`${entityType}\`` - ); - for (const entity of entities) { - const [storageAggregator]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM storage_aggregator WHERE id = '${entity.storageAggregatorId}'` - ); - if (storageAggregator) { - await queryRunner.query( - `UPDATE \`storage_aggregator\` SET type = '${storageAggregatorType}' WHERE id = '${storageAggregator.id}'` - ); - } else { - console.log( - `No storage_aggregator found for ${entityType}: ${entity.id}` - ); - } - } - } -} diff --git a/src/migrations/1723390789346-orphanedStorageAggregator.ts b/src/migrations/1723390789346-orphanedStorageAggregator.ts deleted file mode 100644 index 032ae13daf..0000000000 --- a/src/migrations/1723390789346-orphanedStorageAggregator.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class OrphanedStorageAggregator1723390789346 - implements MigrationInterface -{ - name = 'OrphanedStorageAggregator1723390789346'; - - public async up(queryRunner: QueryRunner): Promise { - const aggregators: { - id: string; - directStorageId: string; - authorizationId: string; - }[] = await queryRunner.query( - `SELECT id, directStorageId, authorizationId FROM \`storage_aggregator\` where type is null` - ); - for (const aggregator of aggregators) { - const [storageBucket]: { - id: string; - authorizationId: string; - }[] = await queryRunner.query( - `SELECT id, authorizationId FROM storage_bucket WHERE id = '${aggregator.directStorageId}'` - ); - if (storageBucket) { - // Delete the orphaned direct storage bucket authorization - await queryRunner.query( - `DELETE FROM \`authorization_policy\` WHERE id = '${storageBucket.authorizationId}'` - ); - await queryRunner.query( - `DELETE FROM \`storage_bucket\` WHERE id = '${storageBucket.id}'` - ); - } else { - console.log( - `No storage_aggregator found for null storage aggregator: ${aggregator.id}` - ); - } - - await queryRunner.query( - `DELETE FROM \`authorization_policy\` WHERE id = '${aggregator.authorizationId}'` - ); - await queryRunner.query( - `DELETE FROM \`storage_aggregator\` WHERE id = '${aggregator.id}'` - ); - } - } - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1723391280682-removeRelation.ts b/src/migrations/1723391280682-removeRelation.ts deleted file mode 100644 index c1ad45a18f..0000000000 --- a/src/migrations/1723391280682-removeRelation.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class RemoveRelation1723391280682 implements MigrationInterface { - name = 'RemoveRelation1723391280682'; - - public async up(queryRunner: QueryRunner): Promise { - const relations: { - id: string; - authorizationId: string; - }[] = await queryRunner.query( - `SELECT id, authorizationId FROM \`relation\`` - ); - for (const relation of relations) { - await queryRunner.query( - `DELETE FROM \`authorization_policy\` WHERE id = '${relation.authorizationId}'` - ); - - await queryRunner.query( - `DELETE FROM \`relation\` WHERE id = '${relation.id}'` - ); - } - // delete the relation table - await queryRunner.query(`DROP TABLE \`relation\``); - } - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1723391280999-authorizationPolicyType.ts b/src/migrations/1723391280999-authorizationPolicyType.ts deleted file mode 100644 index de9f740498..0000000000 --- a/src/migrations/1723391280999-authorizationPolicyType.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { chunkArray } from './utils/chunk.array'; - -export class AuthorizationPolicyType1723121607999 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - // Add the type column to the storage aggregator table - await queryRunner.query( - 'ALTER TABLE `authorization_policy` ADD `type` varchar(128) NOT NULL' - ); - for (const key in AuthorizationPolicyType) { - if (AuthorizationPolicyType.hasOwnProperty(key)) { - const type = - AuthorizationPolicyType[key as keyof typeof AuthorizationPolicyType]; - await this.updateAuthorizationPolicyTypeForEntity( - queryRunner, - key.toLowerCase(), - type - ); - } - } - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`authorization_policy\` DROP COLUMN \`type\`` - ); - } - - private async updateAuthorizationPolicyTypeForEntity( - queryRunner: QueryRunner, - entityName: string, - authorizationPolicyType: string - ) { - // get all the policies for this entity - const entities: { - authorizationId: string; - }[] = await queryRunner.query( - `SELECT authorizationId FROM \`${entityName}\`` - ); - // extract only the auth ids - const authIds = entities.map(entity => entity.authorizationId); - // convert the ids to strings with quotes - const authIdsStr = authIds.map(id => `'${id}'`); - // chunk the big array since the IN operator may have some limitations for the amount of values used with it - const idChunks = chunkArray(authIdsStr, 500); - // for every chunk, do an UPDATE with WHERE IN - for (const idChunk of idChunks) { - // join the ids in a string - const idChunkStr = idChunk.join(','); - // update - await queryRunner.query( - `UPDATE \`authorization_policy\` SET type = '${authorizationPolicyType}' WHERE id IN (${idChunkStr})` - ); - } - } -} - -enum AuthorizationPolicyType { - AGENT = 'agent', - CALLOUT = 'callout', - CALLOUT_CONTRIBUTION = 'callout-contribution', - CALLOUT_FRAMING = 'callout-framing', - COLLABORATION = 'collaboration', - INNOVATION_FLOW = 'innovation-flow', - INNOVATION_HUB = 'innovation-hub', - INNOVATION_PACK = 'innovation-pack', - LINK = 'link', - POST = 'post', - WHITEBOARD = 'whiteboard', - PREFERENCE = 'preference', - PREFERENCE_SET = 'preference-set', - PROFILE = 'profile', - REFERENCE = 'reference', - TAGSET = 'tagset', - VISUAL = 'visual', - COMMUNICATION = 'communication', - ROOM = 'room', - AI_PERSONA = 'ai-persona', - APPLICATION = 'application', - COMMUNITY = 'community', - COMMUNITY_GUIDELINES = 'community-guidelines', - INVITATION = 'invitation', - FORUM = 'forum', - PLATFORM = 'platform', - DISCUSSION = 'discussion', - USER = 'user', - USER_GROUP = 'user-group', - ACTOR = 'actor', - ACTOR_GROUP = 'actor-group', - ORGANIZATION = 'organization', - ORGANIZATION_VERIFICATION = 'organization-verification', - CONTEXT = 'context', - ECOSYSTEM_MODEL = 'ecosystem-model', - VIRTUAL_CONTRIBUTOR = 'virtual-contributor', - SPACE = 'space', - SPACE_DEFAULTS = 'space-defaults', - ACCOUNT = 'account', - DOCUMENT = 'document', - STORAGE_AGGREGATOR = 'storage-aggregator', - STORAGE_BUCKET = 'storage-bucket', - TEMPLATES_SET = 'templates-set', - CALENDAR = 'calendar', - CALENDAR_EVENT = 'calendar-event', - TIMELINE = 'timeline', - WHITEBOARD_TEMPLATE = 'whiteboard-template', - POST_TEMPLATE = 'template', - CALLOUT_TEMPLATE = 'template', - INNOVATION_FLOW_TEMPLATE = 'template', - COMMUNITY_GUIDELINES_TEMPLATE = 'template', - LICENSING = 'licensing', - - AI_PERSONA_SERVICE = 'ai-persona-service', -} diff --git a/src/migrations/1723391281999-spaceLibraryDefaults.ts b/src/migrations/1723391281999-spaceLibraryDefaults.ts deleted file mode 100644 index 752441ec7c..0000000000 --- a/src/migrations/1723391281999-spaceLibraryDefaults.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class SpaceLibraryDefaults1723391281999 implements MigrationInterface { - name = 'SpaceLibraryDefaults1723391281999'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`libraryId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` (\`libraryId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`defaultsId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`)` - ); - - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_9542f2ad51464f961e5b5b5b582\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_bea623a346d2e3f88dd0aeef576\`` - ); - - const templateTableNames = [ - 'whiteboard_template', - 'callout_template', - 'post_template', - 'community_guidelines_template', - 'innovation_flow_template', - ]; - - const accounts: { - id: string; - spaceId: string; - defaultsId: string; - libraryId: string; - }[] = await queryRunner.query( - `SELECT account.id, account.spaceId, account.defaultsId, account.libraryId FROM \`account\` - JOIN \`space\` ON \`account\`.spaceId = \`space\`.id` // fixes a problem with acceptance database, there were some accounts with a wrong spaceId which is just bad data and only load accounts that really have a space. - ); - for (const account of accounts) { - if (account.spaceId) { - await queryRunner.query( - `UPDATE \`space\` SET defaultsId = '${account.defaultsId}', libraryId = '${account.libraryId}' WHERE id = '${account.spaceId}'` - ); - const storageAggregatorID = await this.getStorageAggregatorForSpace( - queryRunner, - account.spaceId - ); - // Update the storage aggregator hierarchy for the TemplatesSet? - for (const templateTableName of templateTableNames) { - await this.updateStorageAggregatorForTemplates( - queryRunner, - account.libraryId, - templateTableName, - storageAggregatorID - ); - } - } - } - - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_9542f2ad51464f961e5b5b5b582\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_bea623a346d2e3f88dd0aeef576\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`account\` DROP COLUMN \`defaultsId\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP COLUMN \`libraryId\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async getStorageAggregatorForSpace( - queryRunner: QueryRunner, - spaceID: string - ): Promise { - const [space]: { - id: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, storageAggregatorId FROM space WHERE id = '${spaceID}'` - ); - if (space) { - return space.storageAggregatorId; - } - throw new Error( - `Unable to retrieve storage aggregator for spaceID: ${spaceID}` - ); - } - - private async updateStorageAggregatorForTemplates( - queryRunner: QueryRunner, - templatesSetID: string, - templateTableName: string, - storageAggregatorId: string - ): Promise { - const templates: { - id: string; - profileId: string; - }[] = await queryRunner.query( - `SELECT id, profileId FROM \`${templateTableName}\` where templatesSetId = '${templatesSetID}'` - ); - for (const template of templates) { - const [profile]: { - id: string; - storageBucketId: string; - }[] = await queryRunner.query( - `SELECT id, storageBucketId FROM profile WHERE id = '${template.profileId}'` - ); - if (profile) { - await queryRunner.query( - `UPDATE \`storage_bucket\` SET storageAggregatorId = '${storageAggregatorId}' WHERE id = '${profile.storageBucketId}'` - ); - } - } - } -} diff --git a/src/migrations/1723391282999-accountsUserOrg.ts b/src/migrations/1723391282999-accountsUserOrg.ts deleted file mode 100644 index e8aa589e0d..0000000000 --- a/src/migrations/1723391282999-accountsUserOrg.ts +++ /dev/null @@ -1,370 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import { query } from 'express'; - -export class AccountsUserOrg1723391282999 implements MigrationInterface { - name = 'AccountsUserOrg1723391282999'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`space\` SET accountId = null WHERE level = '1'` - ); - await queryRunner.query( - `UPDATE \`space\` SET accountId = null WHERE level = '2'` - ); - await this.accountsMigrationContributor(queryRunner, 'user'); - await this.accountsMigrationContributor(queryRunner, 'organization'); - - // remove spaceId from account - await queryRunner.query('ALTER TABLE `account` DROP COLUMN `spaceId`'); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async moveAccountResources( - queryRunner: QueryRunner, - tableName: string, - masterAccountID: string, - slaveAccountID: string - ): Promise { - const accountResources: { - id: string; - accountId: string; - }[] = await queryRunner.query( - `SELECT id, accountId FROM \`${tableName}\` WHERE accountId = '${slaveAccountID}'` - ); - for (const accountResource of accountResources) { - await queryRunner.query( - `UPDATE \`${tableName}\` SET accountId = '${masterAccountID}' WHERE id = '${accountResource.id}'` - ); - } - } - - private async accountsMigrationContributor( - queryRunner: QueryRunner, - contributorType: string - ) { - // Clean up bad data: - const wrongCredentials: { - id: string; - resourceID: string; - agentId: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, resourceID, type, agentId FROM credential WHERE type = 'account-host' AND resourceID NOT IN (SELECT id FROM account)` - ); - if (wrongCredentials.length > 0) { - console.log( - 'BAD DATA: Credentials found with invalid account-host resourceID. Deleting...', - wrongCredentials - ); - await queryRunner.query( - `DELETE FROM credential WHERE id IN (${wrongCredentials.map(credential => `'${credential.id}'`).join(',')})` - ); - } - - const contributors: { - id: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT id, agentId FROM \`${contributorType}\`` - ); - for (const contributor of contributors) { - // select all ACCOUNT_HOST credentials associated with the user - let accountHostCredentials: { - id: string; - resourceID: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, resourceID, type FROM \`credential\` WHERE agentId = '${contributor.agentId}' AND type = 'account-host'` - ); - if (accountHostCredentials.length === 0) { - // create a new and associated credential for the contributor - const accountID = await this.createAccount(queryRunner); - await this.assignAccountHostCredential( - queryRunner, - contributor.agentId, - accountID - ); - } else if (accountHostCredentials.length === 1) { - // Move the account licensing credentials to the space agent - await this.moveAccountCredentialsToSpace( - queryRunner, - accountHostCredentials[0].resourceID - ); - } else if (accountHostCredentials.length > 1) { - // Pick the first one, and merge them all into it - const masterAccountID = accountHostCredentials[0].resourceID; - await this.moveAccountCredentialsToSpace( - queryRunner, - accountHostCredentials[0].resourceID - ); - for (let i = 1; i < accountHostCredentials.length; i++) { - const slaveAccountID = accountHostCredentials[i].resourceID; - await this.moveAccountCredentialsToSpace(queryRunner, slaveAccountID); - - await this.moveAccountResources( - queryRunner, - 'virtual_contributor', - masterAccountID, - slaveAccountID - ); - await this.moveAccountResources( - queryRunner, - 'innovation_hub', - masterAccountID, - slaveAccountID - ); - await this.moveAccountResources( - queryRunner, - 'innovation_pack', - masterAccountID, - slaveAccountID - ); - await this.moveAccountResources( - queryRunner, - 'space', - masterAccountID, - slaveAccountID - ); - // Delete the old accounts + associated credential - await this.deleteAccount(queryRunner, slaveAccountID); - await queryRunner.query( - `DELETE FROM credential WHERE resourceId = '${slaveAccountID}' AND type = 'account-host'` - ); - } - } - } - } - - private async moveAccountCredentialsToSpace( - queryRunner: QueryRunner, - accountID: string - ) { - const [account]: { - id: string; - spaceId: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT id, spaceId, agentId FROM account WHERE id = '${accountID}'` - ); - if (!account) { - console.log(`ACCOUNT for credential does not exist? ${accountID}`); - return; - } - const spaceID = account.spaceId; - const [space]: { - id: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT id, agentId FROM space WHERE id = '${spaceID}'` - ); - if (!space) { - console.log(`Space for account? ${accountID}`); - return; - } - const accountAgentID = account.agentId; - const spaceAgentID = space.agentId; - // Move all credentials from account agent to space agent - await queryRunner.query( - `UPDATE credential SET agentId = '${spaceAgentID}', resourceId = '${spaceID}' WHERE agentId = '${accountAgentID}' AND resourceId = '${accountID}'` - ); - } - - private async deleteAccount( - queryRunner: QueryRunner, - accountID: string - ): Promise { - const [account]: { - id: string; - authorizationId: string; - agentId: string; - storageAggregatorId: string; - }[] = await queryRunner.query( - `SELECT id, authorizationId, agentId, storageAggregatorId FROM account WHERE id = '${accountID}'` - ); - if (!account) { - console.log(`ACCOUNT WAS ALREADY DELETED? ${accountID}`); - return; - } - await queryRunner.query( - `DELETE FROM authorization_policy WHERE id = '${account.authorizationId}'` - ); - await queryRunner.query( - `DELETE FROM credential WHERE agentId = '${account.agentId}'` - ); - await queryRunner.query( - `DELETE FROM agent WHERE id = '${account.agentId}'` - ); - await queryRunner.query( - `DELETE FROM storage_aggregator WHERE id = '${account.storageAggregatorId}'` - ); - await queryRunner.query(`DELETE FROM account WHERE id = '${accountID}'`); - } - - private async assignAccountHostCredential( - queryRunner: QueryRunner, - agentID: string, - accountID: string - ): Promise { - const credentialID = randomUUID(); - await queryRunner.query( - `INSERT INTO credential (id, version, agentId, type, resourceID) - VALUES ('${credentialID}', - '1', - '${agentID}', - 'account-host', - '${accountID}')` - ); - } - - private async createAccount(queryRunner: QueryRunner): Promise { - const accountID = randomUUID(); - const accountAuthID = randomUUID(); - - const agentID = await this.createAgentForAccount(queryRunner); - const storageAggregatorID = await this.createStorageAggregator(queryRunner); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${accountAuthID}', - 1, '', '', 0, '', 'account')` - ); - - await queryRunner.query( - `INSERT INTO account (id, version, authorizationId, agentId, storageAggregatorId) - VALUES ('${accountID}', - '1', - '${accountAuthID}', - '${agentID}', - '${storageAggregatorID}')` - ); - - return accountID; - } - - private async createAgentForAccount( - queryRunner: QueryRunner - ): Promise { - const agentID = randomUUID(); - const agentAuthID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${agentAuthID}', - 1, '', '', 0, '', 'agent')` - ); - - await queryRunner.query( - `INSERT INTO agent (id, version, authorizationId, did, password, type) - VALUES ('${agentID}', - '1', - '${agentAuthID}', - '', - '', - 'account')` - ); - return agentID; - } - - private async createStorageAggregator( - queryRunner: QueryRunner - ): Promise { - const storageAggregatorID = randomUUID(); - const storageAggregatorAuthID = randomUUID(); - - const directStorageId = await this.createStorageBucket(queryRunner); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${storageAggregatorAuthID}', - 1, '', '', 0, '', 'storage-aggregator')` - ); - - await queryRunner.query( - `INSERT INTO storage_aggregator (id, version, authorizationId, directStorageId) - VALUES ('${storageAggregatorID}', - '1', - '${storageAggregatorAuthID}', - '${directStorageId}')` - ); - - return storageAggregatorID; - } - - private async createStorageBucket(queryRunner: QueryRunner): Promise { - const storageBucketID = randomUUID(); - const storageBucketAuthID = randomUUID(); - - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${storageBucketAuthID}', - 1, '', '', 0, '', 'storage-bucket')` - ); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId) - VALUES ('${storageBucketID}', - '1', - '${storageBucketAuthID}', - '${allowedTypes}', - ${maxAllowedFileSize}, - null)` - ); - - return storageBucketID; - } - - private async assignLicensePlansToAgent( - queryRunner: QueryRunner, - agentID: string - ): Promise { - for (const licensePlanType of licensePlanTypes) { - const credentialID = randomUUID(); - await queryRunner.query( - `INSERT INTO credential (id, version, agentId, type, resourceID) - VALUES ('${credentialID}', - '1', - '${agentID}', - '${licensePlanType}', - '')` - ); - } - } -} - -export const licensePlanTypes = [ - 'feature-virtual-contributors', - 'feature-callout-to-callout-template', - 'license-space-free', -]; - -export const allowedTypes = [ - 'application/pdf', - 'application/vnd.ms-excel', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/vnd.oasis.opendocument.spreadsheet', - 'application/msword', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/vnd.oasis.opendocument.text', - 'image/bmp', - 'image/jpg', - 'image/jpeg', - 'image/x-png', - 'image/png', - 'image/gif', - 'image/webp', - 'image/svg+xml', - 'image/avif', -]; - -export const maxAllowedFileSize = 15728640; - -export enum LicenseCredential { - LICENSE_SPACE_FREE = 'license-space-free', - LICENSE_SPACE_PLUS = 'license-space-plus', - LICENSE_SPACE_PREMIUM = 'license-space-premium', - LICENSE_SPACE_ENTERPRISE = 'license-space-enterprise', - FEATURE_CALLOUT_TO_CALLOUT_TEMPLATE = 'feature-callout-to-callout-template', - FEATURE_VIRTUAL_CONTRIBUTORS = 'feature-virtual-contributors', - FEATURE_WHITEBOARD_MULTI_USER = 'feature-whiteboard-multi-user', -} diff --git a/src/migrations/1723391283999-accountHostCredential.ts b/src/migrations/1723391283999-accountHostCredential.ts deleted file mode 100644 index 4bbe4b06b3..0000000000 --- a/src/migrations/1723391283999-accountHostCredential.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AccountHostCredential1723391283999 implements MigrationInterface { - name = 'AccountHostCredential1723391283999'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`user\` ADD \`accountID\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD \`accountID\` char(36) NULL` - ); - - await this.updateContributorAccount(queryRunner, 'user'); - await this.updateContributorAccount(queryRunner, 'organization'); - } - public async down(queryRunner: QueryRunner): Promise {} - - private async updateContributorAccount( - queryRunner: QueryRunner, - tableName: string - ): Promise { - const contributors: { - id: string; - agentId: string; - }[] = await queryRunner.query(`SELECT id, agentId FROM \`${tableName}\``); - for (const contributor of contributors) { - // select all ACCOUNT_HOST credentials associated with the user - const accountHostCredentials: { - id: string; - resourceID: string; - }[] = await queryRunner.query( - `SELECT id, resourceID FROM credential WHERE agentId = '${contributor.agentId}' AND type = 'account-host'` - ); - if (accountHostCredentials.length !== 1) { - throw new Error( - `contributor found of type ${tableName} with id ${contributor.id} has ${accountHostCredentials.length} account-host credentials` - ); - } - const hostCredential = accountHostCredentials[0]; - await queryRunner.query( - `UPDATE \`${tableName}\` SET accountID = '${hostCredential.resourceID}' WHERE id = '${contributor.id}'` - ); - // delete the credential - await queryRunner.query( - `DELETE FROM credential WHERE id = '${hostCredential.id}'` - ); - } - } -} diff --git a/src/migrations/1724255463216-whiteboardTemplatesAuthType.ts b/src/migrations/1724255463216-whiteboardTemplatesAuthType.ts deleted file mode 100644 index 84a5e9b0a3..0000000000 --- a/src/migrations/1724255463216-whiteboardTemplatesAuthType.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class WhiteboardTemplatesAuthType1724255463216 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`authorization_policy\` SET \`type\` = 'template' WHERE \`type\` = 'whiteboard-template'` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1724319295054-ContributionSortOrder.ts b/src/migrations/1724319295054-ContributionSortOrder.ts deleted file mode 100644 index 2e5cb2955c..0000000000 --- a/src/migrations/1724319295054-ContributionSortOrder.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class ContributionSortOrder1724319295054 implements MigrationInterface { - name = 'ContributionSortOrder1724319295054'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD \`sortOrder\` int NOT NULL` - ); - // Add a default sort order to all existing contributions: - const contributions: { - id: string; - calloutId: string; - }[] = await queryRunner.query( - `SELECT \`id\`, \`calloutId\` FROM \`callout_contribution\` ORDER BY \`calloutId\`, \`createdDate\` DESC` - ); - - let lastCalloutId = ''; - let sortOrder = 1; - for (const { id, calloutId } of contributions) { - if (lastCalloutId !== calloutId) { - sortOrder = 1; - lastCalloutId = calloutId; - } else { - sortOrder++; - } - await queryRunner.query( - `UPDATE \`callout_contribution\` SET \`sortOrder\` = ${sortOrder} WHERE \`id\` = '${id}'` - ); - } - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP COLUMN \`sortOrder\`` - ); - } -} diff --git a/src/migrations/1724333243087-addBoKLastUpdateToAiPersonaService.ts b/src/migrations/1724333243087-addBoKLastUpdateToAiPersonaService.ts deleted file mode 100644 index dcd19fe33d..0000000000 --- a/src/migrations/1724333243087-addBoKLastUpdateToAiPersonaService.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AddBoKLastUpdateToAiPersonaService1724333243087 - implements MigrationInterface -{ - name = 'AddBoKLastUpdateToAiPersonaService1724333243087'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD \`bodyOfKnowledgeLastUpdated\` datetime DEFAULT NULL` - ); - - await queryRunner.query( - `UPDATE \`ai_persona_service\` SET \`bodyOfKnowledgeLastUpdated\`= NOW()` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP COLUMN \`bodyOfKnowledgeLastUpdated\`` - ); - } -} diff --git a/src/migrations/1724417095448-convergance.ts b/src/migrations/1724417095448-convergance.ts deleted file mode 100644 index 666dd0a28d..0000000000 --- a/src/migrations/1724417095448-convergance.ts +++ /dev/null @@ -1,955 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class Convergance1724417095448 implements MigrationInterface { - name = 'Convergance1724417095448'; - - public async up(queryRunner: QueryRunner): Promise { - // was missing - await queryRunner.query('ALTER TABLE `licensing` DROP COLUMN `basePlanId`'); - await queryRunner.query( - 'ALTER TABLE `tagset_template` CHANGE `name` `name` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `tagset_template` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `tagset_template` CHANGE `allowedValues` `allowedValues` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `tagset` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `visual` CHANGE `uri` `uri` varchar(2048) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `visual` CHANGE `aspectRatio` `aspectRatio` decimal(3,1) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `city` `city` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `country` `country` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `addressLine1` `addressLine1` varchar(512) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `addressLine2` `addressLine2` varchar(512) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `stateOrProvince` `stateOrProvince` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `location` CHANGE `postalCode` `postalCode` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `document` CHANGE `displayName` `displayName` varchar(512) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `document` CHANGE `mimeType` `mimeType` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `document` CHANGE `size` `size` int NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `document` CHANGE `externalID` `externalID` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `storage_bucket` CHANGE `allowedMimeTypes` `allowedMimeTypes` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `storage_bucket` CHANGE `maxFileSize` `maxFileSize` int NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `profile` CHANGE `tagline` `tagline` text NULL' - ); - await queryRunner.query( - 'ALTER TABLE `profile` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `vc_interaction` CHANGE `threadID` `threadID` varchar(44) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `room` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` CHANGE `contentUpdatePolicy` `contentUpdatePolicy` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` ADD UNIQUE INDEX `IDX_d3b86160bb7d704212382b0ca4` (`authorizationId`)' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` ADD UNIQUE INDEX `IDX_3f9e9e2798d2a4d84b16ee8477` (`profileId`)' - ); - await queryRunner.query( - 'ALTER TABLE `callout_contribution_policy` CHANGE `state` `state` varchar(128) NOT NULL' - ); - // was 255 before - await queryRunner.query( - 'ALTER TABLE `post` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `post` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `post` CHANGE `createdBy` `createdBy` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `callout_contribution` CHANGE `createdBy` `createdBy` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `callout` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `callout` CHANGE `visibility` `visibility` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `callout` CHANGE `publishedDate` `publishedDate` datetime NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `createdBy` `createdBy` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `startDate` `startDate` datetime NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `wholeDay` `wholeDay` tinyint NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `multipleDays` `multipleDays` tinyint NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` CHANGE `durationMinutes` `durationMinutes` int NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` CHANGE `states` `states` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `collaboration` CHANGE `groupsStr` `groupsStr` text NOT NULL' - ); - // was missing - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD UNIQUE INDEX `IDX_35c6b1de6d4d89dfe8e9c85d77` (`innovationFlowId`)' - ); - await queryRunner.query( - 'ALTER TABLE `organization_verification` CHANGE `organizationID` `organizationID` varchar(36) NOT NULL' - ); - await queryRunner.query( - "ALTER TABLE `organization_verification` CHANGE `status` `status` varchar(128) NOT NULL DEFAULT 'not-verified'" - ); - await queryRunner.query( - 'ALTER TABLE `credential` CHANGE `resourceID` `resourceID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `credential` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `agent` CHANGE `type` `type` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `organization` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `organization` CHANGE `accountID` `accountID` char(36) NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `nvp` CHANGE `name` `name` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `nvp` CHANGE `value` `value` varchar(512) NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `accountID` `accountID` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `accountUpn` `accountUpn` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `firstName` `firstName` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `lastName` `lastName` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `email` `email` varchar(512) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `user` CHANGE `phone` `phone` varchar(128) NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `communication` CHANGE `spaceID` `spaceID` varchar(36) NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `community_policy` CHANGE `member` `member` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `community_policy` CHANGE `lead` `lead` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `community_policy` CHANGE `admin` `admin` text NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `form` CHANGE `questions` `questions` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `form` CHANGE `description` `description` text NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_b132226941570cb650a4023d493`' - ); // authorizationId - await queryRunner.query( - 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_b0c80ccf319a1c7a7af12b39987`' - ); // authorizationId - await queryRunner.query('ALTER TABLE `invitation` DROP PRIMARY KEY'); - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `id` `id` char(36) NOT NULL PRIMARY KEY' - ); - - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `invitedContributor` `invitedContributor` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `createdBy` `createdBy` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `contributorType` `contributorType` varchar(128) NOT NULL' - ); - - await queryRunner.query( - 'DROP INDEX `REL_b132226941570cb650a4023d49` ON `invitation`' - ); // authorizationId - await queryRunner.query( - 'DROP INDEX `IDX_b132226941570cb650a4023d49` ON `invitation`' - ); // authorizationId - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `authorizationId` `authorizationId` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` ADD UNIQUE INDEX `IDX_b132226941570cb650a4023d49` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b132226941570cb650a4023d49` ON `invitation` (`authorizationId`)' - ); - - await queryRunner.query( - 'DROP INDEX `REL_b0c80ccf319a1c7a7af12b3998` ON `invitation`' - ); //lifecycleId - await queryRunner.query( - 'ALTER TABLE `invitation` DROP INDEX `IDX_b0c80ccf319a1c7a7af12b3998`' - ); //lifecycleId - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `lifecycleId` `lifecycleId` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` ADD UNIQUE INDEX `IDX_b0c80ccf319a1c7a7af12b3998` (`lifecycleId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b0c80ccf319a1c7a7af12b3998` ON `invitation` (`lifecycleId`)' - ); - - await queryRunner.query( - 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_339c1fe2a9c5caef5b982303fb0`' - ); // invitation.communityId - await queryRunner.query( - 'ALTER TABLE `invitation` CHANGE `communityId` `communityId` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_339c1fe2a9c5caef5b982303fb0` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - - await queryRunner.query( - 'ALTER TABLE `library` ADD UNIQUE INDEX `IDX_3879db652f2421337691219ace` (`authorizationId`)' - ); - - await queryRunner.query( - 'ALTER TABLE `license_plan` CHANGE `sortOrder` `sortOrder` int NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `license_plan` CHANGE `licenseCredential` `licenseCredential` text NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `license_plan` CHANGE `type` `type` varchar(128) NOT NULL' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `licensing` ADD UNIQUE INDEX `IDX_0c6a4d0a6c13a3f5df6ac01509` (`authorizationId`)' - ); - await queryRunner.query( - 'ALTER TABLE `licensing` ADD UNIQUE INDEX `IDX_a5dae5a376dd49c7c076893d40` (`licensePolicyId`)' - ); - - await queryRunner.query( - 'ALTER TABLE `discussion` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `discussion` CHANGE `createdBy` `createdBy` char(36) NOT NULL' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `platform` ADD UNIQUE INDEX `IDX_9f621c51dd854634d8766a9cfa` (`authorizationId`)' - ); - await queryRunner.query( - 'ALTER TABLE `platform` ADD UNIQUE INDEX `IDX_425bbb4b951f7f4629710763fc` (`licensingId`)' - ); - - await queryRunner.query( - 'ALTER TABLE `platform_invitation` CHANGE `platformRole` `platformRole` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` CHANGE `email` `email` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` CHANGE `firstName` `firstName` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` CHANGE `lastName` `lastName` varchar(128) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` CHANGE `createdBy` `createdBy` char(36) NOT NULL' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `platform_invitation` ADD UNIQUE INDEX `IDX_c0448d2c992a62c9c11bd0f142` (`authorizationId`)' - ); - - await queryRunner.query( - 'ALTER TABLE `innovation_flow_template` CHANGE `states` `states` text NOT NULL' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `space_defaults` ADD UNIQUE INDEX `IDX_592a23e68922853bae6ebecd85` (`innovationFlowTemplateId`)' - ); - await queryRunner.query( - 'ALTER TABLE `space` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `space` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `space` CHANGE `levelZeroSpaceID` `levelZeroSpaceID` char(36) NULL' - ); - // gives WARN_DATA_TRUNCATED when there is a null value - // await queryRunner.query( - // 'ALTER TABLE `space` CHANGE `visibility` `visibility` varchar(128) NOT NULL' - // ); - - await queryRunner.query( - 'ALTER TABLE `ai_persona` CHANGE `dataAccessMode` `dataAccessMode` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `ai_persona` CHANGE `interactionModes` `interactionModes` text NOT NULL' - ); - - await queryRunner.query( - 'ALTER TABLE `virtual_contributor` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `virtual_contributor` CHANGE `searchVisibility` `searchVisibility` varchar(128) NOT NULL' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `innovation_pack` ADD UNIQUE INDEX `IDX_8af8122897b05315e7eb892525` (`authorizationId`)' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `account` ADD UNIQUE INDEX `IDX_950221e932175dc7cf7c006488` (`storageAggregatorId`)' - ); - - await queryRunner.query( - 'DROP INDEX `IDX_1d39dac2c6d2f17286d90c306b` ON `innovation_hub`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` CHANGE `nameID` `nameID` varchar(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD UNIQUE INDEX `IDX_1d39dac2c6d2f17286d90c306b` (`nameID`)' - ); - - await queryRunner.query( - 'DROP INDEX `IDX_8f35d04d098bb6c7c57a9a83ac` ON `innovation_hub`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` CHANGE `subdomain` `subdomain` varchar(63) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD UNIQUE INDEX `IDX_8f35d04d098bb6c7c57a9a83ac` (`subdomain`)' - ); - - await queryRunner.query( - 'ALTER TABLE `innovation_hub` CHANGE `listedInStore` `listedInStore` tinyint NOT NULL' - ); - await queryRunner.query( - "ALTER TABLE `innovation_hub` CHANGE `searchVisibility` `searchVisibility` varchar(128) NOT NULL DEFAULT 'account'" - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` DROP FOREIGN KEY `FK_156fd30246eb151b9d17716abf5`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` CHANGE `accountId` `accountId` char(36) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_156fd30246eb151b9d17716abf5` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - // missing - await queryRunner.query( - 'ALTER TABLE `activity` ADD UNIQUE INDEX `IDX_07a39cea9426b689be25fd61de` (`rowId`)' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `triggeredBy` `triggeredBy` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `resourceID` `resourceID` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `collaborationID` `collaborationID` char(36) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `visibility` `visibility` tinyint NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `description` `description` varchar(512) NULL' - ); - await queryRunner.query( - 'ALTER TABLE `activity` CHANGE `type` `type` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `ai_persona_service` CHANGE `dataAccessMode` `dataAccessMode` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `ai_persona_service` CHANGE `bodyOfKnowledgeType` `bodyOfKnowledgeType` varchar(128) NOT NULL' - ); - await queryRunner.query( - 'ALTER TABLE `ai_persona_service` CHANGE `bodyOfKnowledgeID` `bodyOfKnowledgeID` varchar(128) NULL' - ); - // - // - // - // - // - // probably some are not needed - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_d9e2dfcccf59233c17cc6bc641` ON `document` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_9fb9257b14ec21daf5bc9aa4c8` ON `document` (`tagsetId`)' - ); - // await queryRunner.query(`CREATE UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)`); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_432056041df0e4337b17ff7b09` ON `profile` (`locationId`)' - ); - // there are two unique indexes; the last one needs to go - await queryRunner.query( - 'ALTER TABLE `profile` DROP INDEX `IDX_432056041df0e4337b17ff7b09`' - ); // profile.locationId - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_d1d94dd8e0c417b4188a05ccbc` ON `room` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_d3b86160bb7d704212382b0ca4` ON `whiteboard` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_3f9e9e2798d2a4d84b16ee8477` ON `whiteboard` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_390343b22abec869bf80041933` ON `post` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_970844fcd10c2b6df7c1b49eac` ON `post` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_042b9825d770d6b3009ae206c2` ON `post` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_cf776244b01436d8ca5cc76284` ON `callout` (`framingId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_1e740008a7e1512966e3b08414` ON `callout` (`contributionPolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_36b0da55acff774d0845aeb55f` ON `callout` (`contributionDefaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_62ed316cda7b75735b20307b47` ON `callout` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_8ee86afa2808a4ab523b9ee6c5` ON `calendar_event` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_9349e137959f3ca5818c2e62b3` ON `calendar_event` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b5069b11030e9608ee4468f850` ON `calendar_event` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_6e74d59afda096b68d12a69969` ON `calendar` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_5fe58ece01b48496aebc04733d` ON `timeline` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_56aae15a664b2889a1a11c2cf8` ON `timeline` (`calendarId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_a6e050daa4c7a3ab1e411c3651` ON `innovation_flow` (`authorizationId`)' - ); - // await queryRunner.query( - // 'CREATE UNIQUE INDEX `REL_96a8cbe1706f459fd7d883be9b` ON `innovation_flow` (`profileId`)' - // ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b7ece56376ac7ca0b9a56c33b3` ON `collaboration` (`tagsetTemplateSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_f67a2d25c945269d602c182fbc` ON `collaboration` (`timelineId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_35c6b1de6d4d89dfe8e9c85d77` ON `collaboration` (`innovationFlowId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_c66eddab0caacb1ef8d46bcafd` ON `organization_verification` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_1cc3b275fc2a9d9d9b0ae33b31` ON `organization_verification` (`lifecycleId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b4cf0f96bf08cf396f68355522` ON `preference` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_8e76dcf171c45875c44febb1d8` ON `preference_set` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_e0e150e4f11d906b931b46a2d8` ON `organization` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_d2cb77c14644156ec8e865608e` ON `organization` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_7f1bec8979b57ed7ebd392a2ca` ON `organization` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_5a72d5b37312bac2e0a0115718` ON `organization` (`verificationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_58fd47c4a6ac8df9fe2bcaed87` ON `organization` (`preferenceSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_395aa74996a1f978b4969d114b` ON `organization` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_028322b763dc94242dc9f638f9` ON `user` (`preferenceSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_10458c50c10436b6d589b40e5c` ON `user` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_eb99e588873c788a68a035478a` ON `communication` (`updatesId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_3879db652f2421337691219ace` ON `library` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_0c6a4d0a6c13a3f5df6ac01509` ON `licensing` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_a5dae5a376dd49c7c076893d40` ON `licensing` (`licensePolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_2d8a3ca181c3f0346817685d21` ON `discussion` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_5337074c9b818bb63e6f314c80` ON `discussion` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_9f621c51dd854634d8766a9cfa` ON `platform` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_425bbb4b951f7f4629710763fc` ON `platform` (`licensingId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_c0448d2c992a62c9c11bd0f142` ON `platform_invitation` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_7fbe50fa78a37776ad962cb764` ON `community` (`communicationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_c7d74dd6b92d4202c705cd3676` ON `community` (`applicationFormId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_3823de95920943655430125fa9` ON `community` (`policyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_c3bdb693adb031b6613edcef4f` ON `post_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_4a9c8cefc6c7e33aa728d22a90` ON `post_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_cc2faf30ce52648db9299d7072` ON `whiteboard_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_5b4948db27c348e65055187d5e` ON `whiteboard_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_3aec561629db1d65a9b2b3a788` ON `innovation_flow_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_bd591d7403dabe091f6a116975` ON `innovation_flow_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_479f799f0d86e43c9d8623e827` ON `callout_template` (`contributionDefaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_29ff764dc6de1a9dc289cbfb01` ON `callout_template` (`contributionPolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_eb0176ef4b98c143322aa6f809` ON `templates_set` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_592a23e68922853bae6ebecd85` ON `space_defaults` (`innovationFlowTemplateId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_8d03fd2c8e8411ec9192c79cd9` ON `space` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_b4250035291aac1329d59224a9` ON `space` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_ea06eb8894469a0f262d929bf0` ON `space` (`collaborationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_cc0b08eb9679d3daa95153c2af` ON `space` (`contextId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_68fa2c2b00cc1ed77e7c225e8b` ON `space` (`communityId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_9c664d684f987a735678b0ba82` ON `space` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_980c4643d7d9de1b97bc39f518` ON `space` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_43559aeadc1a5169d17e81b3d4` ON `space` (`libraryId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_6b1efee39d076d9f7ecb8fef4c` ON `space` (`defaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_8af8122897b05315e7eb892525` ON `innovation_pack` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_950221e932175dc7cf7c006488` ON `account` (`storageAggregatorId`)' - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` - ); - await queryRunner.query( - 'ALTER TABLE `tagset_template` ADD CONSTRAINT `FK_96f23f044acf305c1699e0319d2` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_644155610ddc40dc4e19781c8f0` FOREIGN KEY (`tagsetTemplateId`) REFERENCES `tagset_template`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `visual` ADD CONSTRAINT `FK_4fbd109f9bb84f58b7a3c60649c` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `visual` ADD CONSTRAINT `FK_1104f3ef8497ca40d99b9f46b87` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `document` ADD CONSTRAINT `FK_d9e2dfcccf59233c17cc6bc6418` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `document` ADD CONSTRAINT `FK_851e50ec4be7c62a1f9b9a430bf` FOREIGN KEY (`storageBucketId`) REFERENCES `storage_bucket`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `document` ADD CONSTRAINT `FK_9fb9257b14ec21daf5bc9aa4c8e` FOREIGN KEY (`tagsetId`) REFERENCES `tagset`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `storage_bucket` ADD CONSTRAINT `FK_f2f48b57269987b13b415a00587` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `profile` ADD CONSTRAINT `FK_432056041df0e4337b17ff7b09d` FOREIGN KEY (`locationId`) REFERENCES `location`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `vc_interaction` ADD CONSTRAINT `FK_d6f78c95ff41cdd30e505a4ebbb` FOREIGN KEY (`roomId`) REFERENCES `room`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `room` ADD CONSTRAINT `FK_d1d94dd8e0c417b4188a05ccbca` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` ADD CONSTRAINT `FK_d3b86160bb7d704212382b0ca44` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard` ADD CONSTRAINT `FK_3f9e9e2798d2a4d84b16ee8477c` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post` ADD CONSTRAINT `FK_390343b22abec869bf800419333` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post` ADD CONSTRAINT `FK_970844fcd10c2b6df7c1b49eacf` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post` ADD CONSTRAINT `FK_042b9825d770d6b3009ae206c2f` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - /// - /// - // these are very questionable - only the update and cascade are changed; - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_fe50118fd82e7fe2f74f986a195\`` - ); - // nvpId is NOT NULL, meaning on delete you cannot set it to null - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_fe50118fd82e7fe2f74f986a195\` FOREIGN KEY (\`nvpId\`) REFERENCES \`nvp\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - // applicationId is NOT NULL, meaning on delete you cannot set it to null - // these are very questionable - only the update and cascade are changed; - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_8495fae86f13836b0745642baa8\`` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_8495fae86f13836b0745642baa8\` FOREIGN KEY (\`applicationId\`) REFERENCES \`application\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - ///// some constraints and keys are probably not needed - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - - await queryRunner.query( - 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_8ee86afa2808a4ab523b9ee6c5e` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_9349e137959f3ca5818c2e62b3f` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_b5069b11030e9608ee4468f850d` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_80ab7835e1749581a27462eb87f` FOREIGN KEY (`calendarId`) REFERENCES `calendar`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `calendar` ADD CONSTRAINT `FK_6e74d59afda096b68d12a699691` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `timeline` ADD CONSTRAINT `FK_5fe58ece01b48496aebc04733da` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `timeline` ADD CONSTRAINT `FK_56aae15a664b2889a1a11c2cf82` FOREIGN KEY (`calendarId`) REFERENCES `calendar`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_a6e050daa4c7a3ab1e411c36517` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - // await queryRunner.query( - // 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_96a8cbe1706f459fd7d883be9bd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - // ); - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_b7ece56376ac7ca0b9a56c33b3a` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_f67a2d25c945269d602c182fbc0` FOREIGN KEY (`timelineId`) REFERENCES `timeline`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_35c6b1de6d4d89dfe8e9c85d771` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_c66eddab0caacb1ef8d46bcafdb` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_1cc3b275fc2a9d9d9b0ae33b310` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `preference` ADD CONSTRAINT `FK_b4cf0f96bf08cf396f683555229` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `preference` ADD CONSTRAINT `FK_46d60bf133073f749b8f07e534c` FOREIGN KEY (`preferenceDefinitionId`) REFERENCES `preference_definition`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `preference` ADD CONSTRAINT `FK_f4b5742f589e2ac8bfe48b708c0` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `preference_set` ADD CONSTRAINT `FK_8e76dcf171c45875c44febb1d8d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_e0e150e4f11d906b931b46a2d89` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_d2cb77c14644156ec8e865608e0` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_7f1bec8979b57ed7ebd392a2ca9` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_5a72d5b37312bac2e0a01157185` FOREIGN KEY (`verificationId`) REFERENCES `organization_verification`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_58fd47c4a6ac8df9fe2bcaed874` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `organization` ADD CONSTRAINT `FK_395aa74996a1f978b4969d114b1` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_694ebec955a90e999d9926b7da8` FOREIGN KEY (`organizationId`) REFERENCES `organization`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user` ADD CONSTRAINT `FK_028322b763dc94242dc9f638f9b` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `user` ADD CONSTRAINT `FK_10458c50c10436b6d589b40e5ca` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `communication` ADD CONSTRAINT `FK_eb99e588873c788a68a035478ab` FOREIGN KEY (`updatesId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_b132226941570cb650a4023d493` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_b0c80ccf319a1c7a7af12b39987` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `library` ADD CONSTRAINT `FK_3879db652f2421337691219ace8` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `license_plan` ADD CONSTRAINT `FK_3030904030f5d30f483b49905d1` FOREIGN KEY (`licensingId`) REFERENCES `licensing`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `licensing` ADD CONSTRAINT `FK_0c6a4d0a6c13a3f5df6ac015096` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `licensing` ADD CONSTRAINT `FK_a5dae5a376dd49c7c076893d40b` FOREIGN KEY (`licensePolicyId`) REFERENCES `license_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `discussion` ADD CONSTRAINT `FK_5337074c9b818bb63e6f314c808` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `platform` ADD CONSTRAINT `FK_9f621c51dd854634d8766a9cfaf` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `platform` ADD CONSTRAINT `FK_f516dd9a46616999c7e9a6adc15` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `platform` ADD CONSTRAINT `FK_425bbb4b951f7f4629710763fc0` FOREIGN KEY (`licensingId`) REFERENCES `licensing`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` ADD CONSTRAINT `FK_c0448d2c992a62c9c11bd0f1422` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `platform_invitation` ADD CONSTRAINT `FK_b3d3f3c2ce851d1059c4ed26ba2` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `community` ADD CONSTRAINT `FK_c7d74dd6b92d4202c705cd36769` FOREIGN KEY (`applicationFormId`) REFERENCES `form`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `community` ADD CONSTRAINT `FK_3823de95920943655430125fa93` FOREIGN KEY (`policyId`) REFERENCES `community_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post_template` ADD CONSTRAINT `FK_c3bdb693adb031b6613edcef4f4` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post_template` ADD CONSTRAINT `FK_4a9c8cefc6c7e33aa728d22a905` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `post_template` ADD CONSTRAINT `FK_34b22da74bc9e821a99fbe78a19` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard_template` ADD CONSTRAINT `FK_cc2faf30ce52648db9299d7072b` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard_template` ADD CONSTRAINT `FK_5b4948db27c348e65055187d5ea` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `whiteboard_template` ADD CONSTRAINT `FK_6776ee550271ece75b3b2a5ba18` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow_template` ADD CONSTRAINT `FK_3aec561629db1d65a9b2b3a788f` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow_template` ADD CONSTRAINT `FK_bd591d7403dabe091f6a116975d` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow_template` ADD CONSTRAINT `FK_4b7450c0baad85f4afee2ce25e6` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `callout_template` ADD CONSTRAINT `FK_479f799f0d86e43c9d8623e8277` FOREIGN KEY (`contributionDefaultsId`) REFERENCES `callout_contribution_defaults`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `callout_template` ADD CONSTRAINT `FK_29ff764dc6de1a9dc289cbfb01b` FOREIGN KEY (`contributionPolicyId`) REFERENCES `callout_contribution_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `templates_set` ADD CONSTRAINT `FK_eb0176ef4b98c143322aa6f8090` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space_defaults` ADD CONSTRAINT `FK_592a23e68922853bae6ebecd85e` FOREIGN KEY (`innovationFlowTemplateId`) REFERENCES `innovation_flow_template`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_8d03fd2c8e8411ec9192c79cd99` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_b4250035291aac1329d59224a96` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - // gives error - // await queryRunner.query( - // 'ALTER TABLE `space` ADD CONSTRAINT `FK_ef1ff4ac7f613cc0677e2295b30` FOREIGN KEY (`parentSpaceId`) REFERENCES `space`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - // ); - - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_6bdeffaf6ea6159b4672a2aed70` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_ea06eb8894469a0f262d929bf06` FOREIGN KEY (`collaborationId`) REFERENCES `collaboration`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_cc0b08eb9679d3daa95153c2af5` FOREIGN KEY (`contextId`) REFERENCES `context`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_68fa2c2b00cc1ed77e7c225e8ba` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_9c664d684f987a735678b0ba825` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_980c4643d7d9de1b97bc39f5185` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_43559aeadc1a5169d17e81b3d45` FOREIGN KEY (`libraryId`) REFERENCES `templates_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `space` ADD CONSTRAINT `FK_6b1efee39d076d9f7ecb8fef4cd` FOREIGN KEY (`defaultsId`) REFERENCES `space_defaults`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_8af8122897b05315e7eb8925253` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_5facd6d188068a5a1c5b6f07fc3` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_51014590f9644e6ff9e0536f40f` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_a1441e46c8d36090e1f6477cea5` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `account` ADD CONSTRAINT `FK_950221e932175dc7cf7c0064887` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1724751579592-accountType.ts b/src/migrations/1724751579592-accountType.ts deleted file mode 100644 index 150836ba6f..0000000000 --- a/src/migrations/1724751579592-accountType.ts +++ /dev/null @@ -1,284 +0,0 @@ -import { randomUUID } from 'crypto'; -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class AccountType1724751579592 implements MigrationInterface { - name = 'AccountType1724751579592'; - - public async up(queryRunner: QueryRunner): Promise { - // Add the type column to the storage aggregator table - await queryRunner.query( - 'ALTER TABLE `account` ADD `type` varchar(128) NULL' - ); - - await this.updateAccountTypeForEntity(queryRunner, 'user', 'user'); - await this.updateAccountTypeForEntity( - queryRunner, - 'organization', - 'organization' - ); - - // Update all license related credentials and plans - for (const credentialUpdate of credentialUpdates) { - await queryRunner.query( - `UPDATE \`credential\` SET type = '${credentialUpdate.newCredentialName}' WHERE type = '${credentialUpdate.oldCredentialName}'` - ); - await queryRunner.query( - `UPDATE \`license_plan\` SET licenseCredential = '${credentialUpdate.newCredentialName}', name='${credentialUpdate.newPlanName}' WHERE licenseCredential = '${credentialUpdate.oldCredentialName}'` - ); - } - - // Create new license plans for accounts - const [platform]: { - id: string; - licensingId: string; - }[] = await queryRunner.query(`SELECT id, licensingId FROM platform`); - const licensingId = platform.licensingId; - - const [licensing]: { - id: string; - licensePolicyId: string; - }[] = await queryRunner.query( - `SELECT id, licensePolicyId FROM licensing WHERE id = '${licensingId}'` - ); - - for (const plan of plans) { - const planID = randomUUID(); - await queryRunner.query( - `INSERT INTO \`license_plan\` - ( \`id\`, - \`version\`, - \`name\`, - \`enabled\`, - \`licensingId\`, - \`sortOrder\`, - \`pricePerMonth\`, - \`isFree\`, - \`trialEnabled\`, - \`requiresPaymentMethod\`, - \`requiresContactSupport\`, - \`licenseCredential\`, - \`assignToNewOrganizationAccounts\`, - \`assignToNewUserAccounts\`, - \`type\`) - VALUES - (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - `, - [ - planID, // id - 1, // version - plan.name, // name - plan.enabled, // enabled - platform.licensingId, // licensingId - plan.sortOrder, // sortOrder - plan.pricePerMonth, // pricePerMonth - plan.isFree, // isFree - plan.trialEnabled, // trialEnabled - plan.requiresPaymentMethod, // requiresPaymentMethod - plan.requiresContactSupport, // requiresContactSupport - plan.credential, - plan.assignToNewOrganizationAccounts, - plan.assignToNewUserAccounts, - plan.type, - ] - ); - } - - // Update the credential rules in the license policy - await queryRunner.query( - `UPDATE \`license_policy\` SET credentialRulesStr = '${JSON.stringify(licenseCredentialRules)}' WHERE id = '${licensing.licensePolicyId}'` - ); - - // Update all accounts associated with users that are a) beta testers or b) part of the VC campaign and assign the appropriate license plan - await this.assignUserBetaTestersAccountLicense(queryRunner); - } - public async down(queryRunner: QueryRunner): Promise {} - - private async updateAccountTypeForEntity( - queryRunner: QueryRunner, - entityType: string, - accountType: string - ) { - const entities: { - id: string; - accountID: string; - }[] = await queryRunner.query( - `SELECT id, accountID FROM \`${entityType}\`` - ); - for (const entity of entities) { - const [account]: { - id: string; - }[] = await queryRunner.query( - `SELECT id FROM account WHERE id = '${entity.accountID}'` - ); - if (account) { - await queryRunner.query( - `UPDATE \`account\` SET type = '${accountType}' WHERE id = '${account.id}'` - ); - } else { - console.log(`No account found for ${entityType}: ${entity.id}`); - } - } - } - - private async assignUserBetaTestersAccountLicense(queryRunner: QueryRunner) { - const users: { - id: string; - agentId: string; - accountID: string; - }[] = await queryRunner.query( - `SELECT id, agentId, accountID FROM \`user\`` - ); - for (const user of users) { - const credentials: { - id: string; - type: string; - }[] = await queryRunner.query( - `SELECT id, type FROM \`credential\` where agentId = '${user.agentId}'` - ); - const matchingCredential = credentials.find( - credential => - credential.type === 'beta-tester' || credential.type === 'vc-campaign' - ); - if (matchingCredential) { - const [account]: { - id: string; - agentId: string; - }[] = await queryRunner.query( - `SELECT id, agentId FROM account WHERE id = '${user.accountID}'` - ); - if (account) { - /// Create a new credential for the agent - const credentialID = randomUUID(); - await queryRunner.query( - `INSERT INTO \`credential\` - ( \`id\`, - \`version\`, - \`type\`, - \`resourceID\`, - \`agentId\`) - VALUES - (?, ?, ?, ?, ?); - `, - [ - credentialID, // id - 1, // version - 'account-license-plus', // type - account.id, // resource - account.agentId, // agentId - ] - ); - } else { - console.log(`No account found for user: ${user.id}`); - } - } - } - } -} - -const credentialUpdates: CredentialUpdate[] = [ - { - oldCredentialName: 'license-space-free', - newCredentialName: 'space-license-free', - newPlanName: 'SPACE_LICENSE_FREE', - }, - { - oldCredentialName: 'license-space-plus', - newCredentialName: 'space-license-plus', - newPlanName: 'SPACE_LICENSE_PLUS', - }, - { - oldCredentialName: 'license-space-enterprise', - newCredentialName: 'space-license-enterprise', - newPlanName: 'SPACE_LICENSE_ENTERPRISE', - }, - { - oldCredentialName: 'license-space-premium', - newCredentialName: 'space-license-premium', - newPlanName: 'SPACE_LICENSE_PREMIUM', - }, - { - oldCredentialName: 'feature-callout-to-callout-template', - newCredentialName: 'space-feature-save-as-template', - newPlanName: 'SPACE_FEATURE_SAVE_AS_TEMPLATE', - }, - { - oldCredentialName: 'feature-whiteboard-multi-user', - newCredentialName: 'space-feature-whiteboard-multi-user', - newPlanName: 'SPACE_FEATURE_WHITEBOARD_MULTI_USER', - }, - { - oldCredentialName: 'feature-virtual-contributors', - newCredentialName: 'space-feature-virtual-contributors', - newPlanName: 'SPACE_FEATURE_VIRTUAL_CONTIBUTORS', - }, -]; - -export enum LicenseCredential { - ACCOUNT_LICENSE_PLUS = 'account-license-plus', -} - -const plans = [ - { - name: 'ACCOUNT_LICENSE_PLUS', - credential: LicenseCredential.ACCOUNT_LICENSE_PLUS, - enabled: true, - sortOrder: 50, - pricePerMonth: 0, - isFree: false, - trialEnabled: false, - requiresPaymentMethod: false, - requiresContactSupport: true, - assignToNewOrganizationAccounts: false, - assignToNewUserAccounts: false, - type: 'account-plan', - }, -]; - -export type CredentialUpdate = { - oldCredentialName: string; - newCredentialName: string; - newPlanName: string; -}; - -const licenseCredentialRules = [ - { - credentialType: 'space-feature-virtual-contributors', - grantedPrivileges: ['space-virtual-contributor-access'], - name: 'Space Virtual Contributors', - }, - { - credentialType: 'space-feature-whiteboard-multi-user', - grantedPrivileges: ['space-whiteboard-multi-user'], - name: 'Space Multi-user whiteboards', - }, - { - credentialType: 'space-feature-save-as-template', - grantedPrivileges: ['space-save-as-template'], - name: 'Space Save As Templatet', - }, - { - credentialType: 'space-license-plus', - grantedPrivileges: [ - 'space-whiteboard-multi-user', - 'space-save-as-template', - ], - name: 'Space License Plus', - }, - { - credentialType: 'space-license-premium', - grantedPrivileges: [ - 'space-whiteboard-multi-user', - 'space-save-as-template', - ], - name: 'Space License Premium', - }, - { - credentialType: 'account-license-plus', - grantedPrivileges: [ - 'account-create-space', - 'account-create-virtual-contributor', - 'account-create-innovation-pack', - ], - name: 'Account License Plus', - }, -]; diff --git a/src/migrations/1724832530050-OrgSpaceVClicense.ts b/src/migrations/1724832530050-OrgSpaceVClicense.ts deleted file mode 100644 index 20bc6473ba..0000000000 --- a/src/migrations/1724832530050-OrgSpaceVClicense.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class OrgSpaceVClicense1724832530050 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`license_plan\` SET \`assignToNewOrganizationAccounts\` = 1 WHERE \`licenseCredential\` = 'feature-virtual-contributors'` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`license_plan\` SET \`assignToNewOrganizationAccounts\` = 0 WHERE \`licenseCredential\` = 'feature-virtual-contributors'` - ); - } -} diff --git a/src/migrations/1726060322894-indexConvergence.ts b/src/migrations/1726060322894-indexConvergence.ts deleted file mode 100644 index aebdbccf42..0000000000 --- a/src/migrations/1726060322894-indexConvergence.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { safelyDropIndex } from './utils/safely-drop-index'; -import { safelyAddFK } from './utils/safely-add-foreignKey'; - -export class IndexConvergence1726060322894 implements MigrationInterface { - name = 'IndexConvergence1726060322894'; - - public async up(queryRunner: QueryRunner): Promise { - await safelyDropIndex( - queryRunner, - 'document', - 'FK_3337f26ca267009fcf514e0e726' - ); - await safelyDropIndex( - queryRunner, - 'calendar_event', - 'FK_6a30f26ca267009fcf514e0e726' - ); - await safelyDropIndex( - queryRunner, - 'calendar_event', - 'FK_6a30f26ca267009fcf514e0e726' - ); - await safelyDropIndex( - queryRunner, - 'activity', - 'IDX_0f03c61020ea0dfa0198c60304' - ); - await queryRunner.query( - 'CREATE INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `activity` (`rowId`)' - ); - await queryRunner.query(` - UPDATE \`space\` - SET \`visibility\` = 'demo' - WHERE \`visibility\` IS NULL - `); - await queryRunner.query(` - ALTER TABLE \`space\` - MODIFY \`visibility\` varchar(128) NOT NULL - `); - await queryRunner.query( - 'CREATE UNIQUE INDEX `REL_96a8cbe1706f459fd7d883be9b` ON `innovation_flow` (`profileId`)' - ); - - await safelyAddFK( - queryRunner, - 'innovation_flow', // Table name - 'FK_96a8cbe1706f459fd7d883be9bd', // Foreign key name - 'profileId', // Column in this table - 'profile', // Referenced table - 'id' // Referenced column - ); - - await safelyAddFK( - queryRunner, - 'application_questions', // Table name - 'FK_8495fae86f13836b0745642baa8', // Foreign key name - 'applicationId', // Column in this table - 'application', // Referenced table - 'id', // Referenced column - 'CASCADE', // ON DELETE - 'CASCADE' // ON UPDATE - ); - - await safelyAddFK( - queryRunner, - 'application_questions', // Table name - 'FK_fe50118fd82e7fe2f74f986a195', // Foreign key name - 'nvpId', // Column in this table - 'nvp', // Referenced table - 'id', // Referenced column - 'CASCADE', // ON DELETE - 'CASCADE' // ON UPDATE - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `application_questions` DROP FOREIGN KEY `FK_fe50118fd82e7fe2f74f986a195`' - ); - await queryRunner.query( - 'ALTER TABLE `application_questions` DROP FOREIGN KEY `FK_8495fae86f13836b0745642baa8`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` DROP FOREIGN KEY `FK_96a8cbe1706f459fd7d883be9bd`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `activity`' - ); - await queryRunner.query( - 'DROP INDEX `REL_96a8cbe1706f459fd7d883be9b` ON `innovation_flow`' - ); - await queryRunner.query(` - ALTER TABLE \`space\` - MODIFY \`visibility\` varchar(36) NULL - `); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` DROP INDEX `IDX_96a8cbe1706f459fd7d883be9b`' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `activity` (`rowId`)' - ); - await queryRunner.query( - 'CREATE INDEX `FK_6a30f26ca267009fcf514e0e726` ON `calendar_event` (`createdBy`)' - ); - await queryRunner.query( - 'CREATE INDEX `FK_3337f26ca267009fcf514e0e726` ON `document` (`createdBy`)' - ); - } -} diff --git a/src/migrations/1726062072715-fixSpaceFK.ts b/src/migrations/1726062072715-fixSpaceFK.ts deleted file mode 100644 index 014103b54d..0000000000 --- a/src/migrations/1726062072715-fixSpaceFK.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixSpaceFK1726062072715 implements MigrationInterface { - name = 'FixSpaceFK1726062072715'; - - public async up(queryRunner: QueryRunner): Promise { - // Step 1: Log the IDs of rows with invalid `parentSpaceId` - const invalidRows = await queryRunner.query(` - SELECT s.\`id\` - FROM \`space\` s - LEFT JOIN \`space\` parent ON s.\`parentSpaceId\` = parent.\`id\` - WHERE s.\`parentSpaceId\` IS NOT NULL - AND parent.\`id\` IS NULL; - `); - - if (invalidRows.length > 0) { - // Log the IDs of rows with invalid `parentSpaceId` - const invalidRowIds = invalidRows.map((row: any) => row.id); - console.log( - 'Updating invalid parentSpaceId for rows with IDs:', - invalidRowIds - ); - - // Step 2: Update the invalid `parentSpaceId` rows and set to NULL - await queryRunner.query(` - UPDATE \`space\` s - LEFT JOIN \`space\` parent ON s.\`parentSpaceId\` = parent.\`id\` - SET s.\`parentSpaceId\` = NULL - WHERE s.\`parentSpaceId\` IS NOT NULL - AND parent.\`id\` IS NULL; - `); - } - - // Step 3: Add the foreign key constraint - await queryRunner.query(` - ALTER TABLE \`space\` - ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` - FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) - ON DELETE NO ACTION ON UPDATE NO ACTION; - `); - } - - public async down(queryRunner: QueryRunner): Promise { - // Drop the foreign key constraint if migration is rolled back - await queryRunner.query(` - ALTER TABLE \`space\` - DROP FOREIGN KEY \`FK_ef1ff4ac7f613cc0677e2295b30\`; - `); - } -} diff --git a/src/migrations/1726150255887-dropAllIndexesFKsRelations.ts b/src/migrations/1726150255887-dropAllIndexesFKsRelations.ts deleted file mode 100644 index 208fb1a583..0000000000 --- a/src/migrations/1726150255887-dropAllIndexesFKsRelations.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class DropAllIndexesFKsRelations1726150255887 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - const dbName = 'alkemio'; // Your database name - - // 1. Drop all foreign keys that can be deleted - const foreignKeysResult = await queryRunner.query(` - SELECT TABLE_NAME, CONSTRAINT_NAME - FROM information_schema.KEY_COLUMN_USAGE - WHERE CONSTRAINT_SCHEMA = '${dbName}' - AND REFERENCED_TABLE_NAME IS NOT NULL; - `); - - for (const fk of foreignKeysResult) { - try { - await queryRunner.query( - `ALTER TABLE \`${fk.TABLE_NAME}\` DROP FOREIGN KEY \`${fk.CONSTRAINT_NAME}\`` - ); - console.log( - `Dropped foreign key ${fk.CONSTRAINT_NAME} on table ${fk.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop foreign key ${fk.CONSTRAINT_NAME} on table ${fk.TABLE_NAME}:`, - error - ); - continue; - } - } - - // 2. Drop all unique constraints that can be deleted - const uniqueConstraintsResult = await queryRunner.query(` - SELECT TABLE_NAME, CONSTRAINT_NAME - FROM information_schema.TABLE_CONSTRAINTS - WHERE CONSTRAINT_SCHEMA = '${dbName}' - AND CONSTRAINT_TYPE = 'UNIQUE'; - `); - - for (const unique of uniqueConstraintsResult) { - try { - await queryRunner.query( - `ALTER TABLE \`${unique.TABLE_NAME}\` DROP INDEX \`${unique.CONSTRAINT_NAME}\`` - ); - console.log( - `Dropped unique constraint ${unique.CONSTRAINT_NAME} on table ${unique.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop unique constraint ${unique.CONSTRAINT_NAME} on table ${unique.TABLE_NAME}:`, - error - ); - continue; - } - } - - // 3. Drop all regular indexes (except primary keys and indexes on AUTO_INCREMENT columns) - const indexesResult = await queryRunner.query(` - SELECT s.TABLE_NAME, s.INDEX_NAME, c.COLUMN_NAME, MAX(c.EXTRA) AS EXTRA - FROM information_schema.STATISTICS s - JOIN information_schema.COLUMNS c - ON s.TABLE_NAME = c.TABLE_NAME - AND s.TABLE_SCHEMA = c.TABLE_SCHEMA - AND s.COLUMN_NAME = c.COLUMN_NAME - WHERE s.TABLE_SCHEMA = '${dbName}' - AND s.INDEX_NAME != 'PRIMARY' - GROUP BY s.TABLE_NAME, s.INDEX_NAME, c.COLUMN_NAME - `); - - for (const index of indexesResult) { - if (index.EXTRA && index.EXTRA.includes('auto_increment')) { - console.log( - `Skipping index ${index.INDEX_NAME} on table ${index.TABLE_NAME} (AUTO_INCREMENT column)` - ); - continue; - } - - // Try to drop the index - try { - await queryRunner.query( - `DROP INDEX \`${index.INDEX_NAME}\` ON \`${index.TABLE_NAME}\`` - ); - console.log( - `Dropped index ${index.INDEX_NAME} on table ${index.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`, - error - ); - continue; - } - } - } - - public async down(queryRunner: QueryRunner): Promise { - // Logic for down migration can be added here if needed - } -} diff --git a/src/migrations/1726153799415-fixIndexesFKsRelations-1.ts b/src/migrations/1726153799415-fixIndexesFKsRelations-1.ts deleted file mode 100644 index 5accc9ba94..0000000000 --- a/src/migrations/1726153799415-fixIndexesFKsRelations-1.ts +++ /dev/null @@ -1,2693 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixIndexesFKsRelations1726153799415 implements MigrationInterface { - name = 'FixIndexesFKsRelations1726153799415'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD UNIQUE INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` (\`tagsetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD UNIQUE INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD UNIQUE INDEX \`IDX_0647707288c243e60091c8d862\` (\`directStorageId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_a96475631aba7dce41db03cc8b\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` (\`locationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` ADD UNIQUE INDEX \`IDX_73e8ae665a49366ca7e2866a45\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`room\` ADD UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_f53e2d266432e58e538a366705\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD UNIQUE INDEX \`IDX_07f249ac87502495710a62c5c0\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD UNIQUE INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_dfa86c46f509a61c6510536cd9\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_97fefc97fb254c30577696e1c0\` (\`postId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` (\`linkId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_6289dee12effb51320051c6f1f\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` (\`framingId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_b5069b11030e9608ee4468f850\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD UNIQUE INDEX \`IDX_6e74d59afda096b68d12a69969\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_5fe58ece01b48496aebc04733d\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` (\`calendarId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_262ecf3f5d70b82a4833618425\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` (\`tagsetTemplateSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_f67a2d25c945269d602c182fbc\` (\`timelineId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD UNIQUE INDEX \`IDX_b4cf0f96bf08cf396f68355522\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD UNIQUE INDEX \`IDX_8e76dcf171c45875c44febb1d8\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` ADD UNIQUE INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_d2cb77c14644156ec8e865608e\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_5a72d5b37312bac2e0a0115718\` (\`verificationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_395aa74996a1f978b4969d114b\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD UNIQUE INDEX \`IDX_e8e32f1e59c349b406a4752e54\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD UNIQUE INDEX \`IDX_9912e4cfc1e09848a392a65151\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_09f909622aa177a097256b7cc2\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_9466682df91534dd95e4dbaa61\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_b61c694cacfab25533bd23d9ad\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_028322b763dc94242dc9f638f9\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_10458c50c10436b6d589b40e5c\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD UNIQUE INDEX \`IDX_56f5614fff0028d40370499582\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD UNIQUE INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD UNIQUE INDEX \`IDX_a20c5901817dd09d5906537e08\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD UNIQUE INDEX \`IDX_eb99e588873c788a68a035478a\` (\`updatesId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b132226941570cb650a4023d49\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD UNIQUE INDEX \`IDX_684b272e6f7459439d41d2879e\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD UNIQUE INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD UNIQUE INDEX \`IDX_3879db652f2421337691219ace\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD UNIQUE INDEX \`IDX_23d4d78ea8db637df031f86f03\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD UNIQUE INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD UNIQUE INDEX \`IDX_a5dae5a376dd49c7c076893d40\` (\`licensePolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_2d8a3ca181c3f0346817685d21\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_5337074c9b818bb63e6f314c80\` (\`commentsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` ADD UNIQUE INDEX \`IDX_3b0c92945f36d06f37de80285d\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_9f621c51dd854634d8766a9cfa\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_dd88d373c64b04e24705d575c9\` (\`forumId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_ca469f5ec53a7719d155d60aca\` (\`libraryId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_425bbb4b951f7f4629710763fc\` (\`licensingId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD UNIQUE INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_7fbe50fa78a37776ad962cb764\` (\`communicationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_c7d74dd6b92d4202c705cd3676\` (\`applicationFormId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_3823de95920943655430125fa9\` (\`policyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD UNIQUE INDEX \`IDX_a2afa3851ea733de932251b3a1\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD UNIQUE INDEX \`IDX_bde98d59e8984e7d17034c3b93\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` ADD UNIQUE INDEX \`IDX_658580aea4e1a892227e27db90\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD UNIQUE INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD UNIQUE INDEX \`IDX_a03169c3f86480ba3863924f4d\` (\`ecosystemModelId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD UNIQUE INDEX \`IDX_c3bdb693adb031b6613edcef4f\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD UNIQUE INDEX \`IDX_4a9c8cefc6c7e33aa728d22a90\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD UNIQUE INDEX \`IDX_cc2faf30ce52648db9299d7072\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD UNIQUE INDEX \`IDX_5b4948db27c348e65055187d5e\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD UNIQUE INDEX \`IDX_3aec561629db1d65a9b2b3a788\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD UNIQUE INDEX \`IDX_bd591d7403dabe091f6a116975\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_6c90723f8f1424e2dd08dddb39\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_75d5ced6c2e92cbbb5d8d0a913\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_b94beb9cefe0a8814dceddd10f\` (\`framingId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_479f799f0d86e43c9d8623e827\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD UNIQUE INDEX \`IDX_29ff764dc6de1a9dc289cbfb01\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD UNIQUE INDEX \`IDX_eb3f02cf18df8943da1673a25b\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD UNIQUE INDEX \`IDX_25dbe2675edea7b3c4f4aec430\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD UNIQUE INDEX \`IDX_e1817f55e97bba03a57b928725\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD UNIQUE INDEX \`IDX_eb0176ef4b98c143322aa6f809\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD UNIQUE INDEX \`IDX_413ba75964e5a534e4bfa54846\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD UNIQUE INDEX \`IDX_592a23e68922853bae6ebecd85\` (\`innovationFlowTemplateId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_b4250035291aac1329d59224a9\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_ea06eb8894469a0f262d929bf0\` (\`collaborationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` (\`contextId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` (\`communityId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_9c664d684f987a735678b0ba82\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_980c4643d7d9de1b97bc39f518\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` (\`libraryId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD UNIQUE INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_4504c37764f6962ccbd165a21d\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_55b8101bdf4f566645e928c26e\` (\`aiPersonaId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_8af8122897b05315e7eb892525\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_a1441e46c8d36090e1f6477cea\` (\`templatesSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_91a165c1091a6959cc19d52239\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_833582df0c439ab8c9adc5240d\` (\`agentId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_950221e932175dc7cf7c006488\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` (\`nameID\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` (\`subdomain\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` (\`profileId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`activity\` ADD UNIQUE INDEX \`IDX_07a39cea9426b689be25fd61de\` (\`rowId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD UNIQUE INDEX \`IDX_9d520fa5fed56042918e48fc4b\` (\`authorizationId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD UNIQUE INDEX \`IDX_79206feb0038b1c5597668dc4b\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\` (\`tagsetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\` (\`directStorageId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\` (\`locationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\` (\`storageBucketId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_390343b22abec869bf80041933\` ON \`post\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\` (\`postId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\` (\`linkId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\` (\`framingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\` (\`calendarId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\` (\`tagsetTemplateSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\` (\`timelineId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\` (\`verificationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\` (\`updatesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3879db652f2421337691219ace\` ON \`library\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\` (\`licensePolicyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\` (\`forumId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\` (\`libraryId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\` (\`licensingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\` (\`communicationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c7d74dd6b92d4202c705cd3676\` ON \`community\` (\`applicationFormId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3823de95920943655430125fa9\` ON \`community\` (\`policyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\` (\`ecosystemModelId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c3bdb693adb031b6613edcef4f\` ON \`post_template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4a9c8cefc6c7e33aa728d22a90\` ON \`post_template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_cc2faf30ce52648db9299d7072\` ON \`whiteboard_template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5b4948db27c348e65055187d5e\` ON \`whiteboard_template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3aec561629db1d65a9b2b3a788\` ON \`innovation_flow_template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bd591d7403dabe091f6a116975\` ON \`innovation_flow_template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6c90723f8f1424e2dd08dddb39\` ON \`callout_template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_75d5ced6c2e92cbbb5d8d0a913\` ON \`callout_template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b94beb9cefe0a8814dceddd10f\` ON \`callout_template\` (\`framingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_479f799f0d86e43c9d8623e827\` ON \`callout_template\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_29ff764dc6de1a9dc289cbfb01\` ON \`callout_template\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb3f02cf18df8943da1673a25b\` ON \`community_guidelines_template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_25dbe2675edea7b3c4f4aec430\` ON \`community_guidelines_template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e1817f55e97bba03a57b928725\` ON \`community_guidelines_template\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\` (\`innovationFlowTemplateId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\` (\`collaborationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\` (\`contextId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\` (\`communityId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\` (\`libraryId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\` (\`aiPersonaId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\` (\`templatesSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\` (\`applicationId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\` (\`nvpId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`tagset_template\` ADD CONSTRAINT \`FK_96f23f044acf305c1699e0319d2\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_eb59b98ee6ef26c993d0d75c83c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_81fc213b2d9ad0cddeab1a9ce64\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_644155610ddc40dc4e19781c8f0\` FOREIGN KEY (\`tagsetTemplateId\`) REFERENCES \`tagset_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_4fbd109f9bb84f58b7a3c60649c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_1104f3ef8497ca40d99b9f46b87\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_d9e2dfcccf59233c17cc6bc6418\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_851e50ec4be7c62a1f9b9a430bf\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_9fb9257b14ec21daf5bc9aa4c8e\` FOREIGN KEY (\`tagsetId\`) REFERENCES \`tagset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_f3b4d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_b80c28f5335ab5442f63c644d94\` FOREIGN KEY (\`parentStorageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_0647707288c243e60091c8d8620\` FOREIGN KEY (\`directStorageId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_f2f48b57269987b13b415a00587\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_a96475631aba7dce41db03cc8b2\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_432056041df0e4337b17ff7b09d\` FOREIGN KEY (\`locationId\`) REFERENCES \`location\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_4a1c74fd2a61b32d9d9500e0650\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_73e8ae665a49366ca7e2866a45d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_2f46c698fc4c19a8cc233c5f255\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` ADD CONSTRAINT \`FK_d6f78c95ff41cdd30e505a4ebbb\` FOREIGN KEY (\`roomId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`room\` ADD CONSTRAINT \`FK_d1d94dd8e0c417b4188a05ccbca\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_d3b86160bb7d704212382b0ca44\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_3f9e9e2798d2a4d84b16ee8477c\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_c9d7c2c4eb8a1d012ddc6605da9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_f53e2d266432e58e538a366705d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_390343b22abec869bf800419333\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_970844fcd10c2b6df7c1b49eacf\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_042b9825d770d6b3009ae206c2f\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_07f249ac87502495710a62c5c01\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_3bfc8c1aaec1395cc148268d3cd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_dfa86c46f509a61c6510536cd9a\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_97fefc97fb254c30577696e1c0a\` FOREIGN KEY (\`postId\`) REFERENCES \`post\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`link\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_7370de8eb79ed00b0d403f2299a\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_6289dee12effb51320051c6f1fc\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_cf776244b01436d8ca5cc762848\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_1e740008a7e1512966e3b084148\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_36b0da55acff774d0845aeb55f2\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_62ed316cda7b75735b20307b47e\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_9b1c5ee044611ac78249194ec35\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_8ee86afa2808a4ab523b9ee6c5e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_9349e137959f3ca5818c2e62b3f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_b5069b11030e9608ee4468f850d\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_80ab7835e1749581a27462eb87f\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD CONSTRAINT \`FK_6e74d59afda096b68d12a699691\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_5fe58ece01b48496aebc04733da\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_56aae15a664b2889a1a11c2cf82\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_a6e050daa4c7a3ab1e411c36517\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_96a8cbe1706f459fd7d883be9bd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_262ecf3f5d70b82a48336184251\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_b7ece56376ac7ca0b9a56c33b3a\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_f67a2d25c945269d602c182fbc0\` FOREIGN KEY (\`timelineId\`) REFERENCES \`timeline\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_35c6b1de6d4d89dfe8e9c85d771\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_c66eddab0caacb1ef8d46bcafdb\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_1cc3b275fc2a9d9d9b0ae33b310\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_b4cf0f96bf08cf396f683555229\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_46d60bf133073f749b8f07e534c\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_f4b5742f589e2ac8bfe48b708c0\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD CONSTRAINT \`FK_8e76dcf171c45875c44febb1d8d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` ADD CONSTRAINT \`FK_dbe0929355f82e5995f0b7fd5e2\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` ADD CONSTRAINT \`FK_8ed9d1af584fa62f1ad3405b33b\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_e0e150e4f11d906b931b46a2d89\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_d2cb77c14644156ec8e865608e0\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7f1bec8979b57ed7ebd392a2ca9\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_5a72d5b37312bac2e0a01157185\` FOREIGN KEY (\`verificationId\`) REFERENCES \`organization_verification\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_58fd47c4a6ac8df9fe2bcaed874\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_395aa74996a1f978b4969d114b1\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_e8e32f1e59c349b406a4752e545\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9912e4cfc1e09848a392a651514\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_694ebec955a90e999d9926b7da8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9fcc131f256e969d773327f07cb\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_09f909622aa177a097256b7cc22\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_9466682df91534dd95e4dbaa616\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_b61c694cacfab25533bd23d9add\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_028322b763dc94242dc9f638f9b\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_10458c50c10436b6d589b40e5ca\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_56f5614fff0028d403704995822\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_7ec2857c7d8d16432ffca1cb3d9\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_b4ae3fea4a24b4be1a86dacf8a2\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_500cee6f635849f50e19c7e2b76\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_a20c5901817dd09d5906537e087\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_eb99e588873c788a68a035478ab\` FOREIGN KEY (\`updatesId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b132226941570cb650a4023d493\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b0c80ccf319a1c7a7af12b39987\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_339c1fe2a9c5caef5b982303fb0\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_684b272e6f7459439d41d2879ee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_3879db652f2421337691219ace8\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD CONSTRAINT \`FK_23d4d78ea8db637df031f86f030\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD CONSTRAINT \`FK_3030904030f5d30f483b49905d1\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_0c6a4d0a6c13a3f5df6ac015096\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_a5dae5a376dd49c7c076893d40b\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_4555dccdda9ba57d8e3a634cd0d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_2d8a3ca181c3f0346817685d21d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_5337074c9b818bb63e6f314c808\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_0de78853c1ee793f61bda7eff79\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` ADD CONSTRAINT \`FK_3b0c92945f36d06f37de80285dd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_9f621c51dd854634d8766a9cfaf\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_dd88d373c64b04e24705d575c99\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_ca469f5ec53a7719d155d60aca1\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_f516dd9a46616999c7e9a6adc15\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_425bbb4b951f7f4629710763fc0\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_c0448d2c992a62c9c11bd0f1422\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_b3d3f3c2ce851d1059c4ed26ba2\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_809c1e6cf3ef6be03a0a1db3f70\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_6e7584bfb417bd0f8e8696ab585\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_7fbe50fa78a37776ad962cb7643\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_2e7dd2fa8c829352cfbecb2cc93\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_c7d74dd6b92d4202c705cd36769\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3823de95920943655430125fa93\` FOREIGN KEY (\`policyId\`) REFERENCES \`community_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_8e8283bdacc9e770918fe689333\` FOREIGN KEY (\`parentCommunityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_a2afa3851ea733de932251b3a1f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_0f9d41ee193d631a5439bb4f404\` FOREIGN KEY (\`actorGroupId\`) REFERENCES \`actor_group\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_bde98d59e8984e7d17034c3b937\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_cbb1d7afa052a184471723d3297\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` ADD CONSTRAINT \`FK_658580aea4e1a892227e27db902\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_5f0dbc3b097ef297bd5f4ddb1a9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_a03169c3f86480ba3863924f4d7\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_c3bdb693adb031b6613edcef4f4\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_4a9c8cefc6c7e33aa728d22a905\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` ADD CONSTRAINT \`FK_34b22da74bc9e821a99fbe78a19\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_cc2faf30ce52648db9299d7072b\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_5b4948db27c348e65055187d5ea\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` ADD CONSTRAINT \`FK_6776ee550271ece75b3b2a5ba18\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_3aec561629db1d65a9b2b3a788f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_bd591d7403dabe091f6a116975d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` ADD CONSTRAINT \`FK_4b7450c0baad85f4afee2ce25e6\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_6c90723f8f1424e2dd08dddb393\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_75d5ced6c2e92cbbb5d8d0a913e\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_7c434491e8e9ee8af12caff7db3\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_b94beb9cefe0a8814dceddd10f6\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_479f799f0d86e43c9d8623e8277\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` ADD CONSTRAINT \`FK_29ff764dc6de1a9dc289cbfb01b\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD CONSTRAINT \`FK_eb3f02cf18df8943da1673a25b8\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD CONSTRAINT \`FK_25dbe2675edea7b3c4f4aec4300\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD CONSTRAINT \`FK_8b2d7f497cccf9cac312dac8b46\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` ADD CONSTRAINT \`FK_e1817f55e97bba03a57b9287251\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD CONSTRAINT \`FK_eb0176ef4b98c143322aa6f8090\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_413ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_592a23e68922853bae6ebecd85e\` FOREIGN KEY (\`innovationFlowTemplateId\`) REFERENCES \`innovation_flow_template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_8d03fd2c8e8411ec9192c79cd99\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_b4250035291aac1329d59224a96\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6bdeffaf6ea6159b4672a2aed70\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ea06eb8894469a0f262d929bf06\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_cc0b08eb9679d3daa95153c2af5\` FOREIGN KEY (\`contextId\`) REFERENCES \`context\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_68fa2c2b00cc1ed77e7c225e8ba\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_9c664d684f987a735678b0ba825\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_980c4643d7d9de1b97bc39f5185\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_43559aeadc1a5169d17e81b3d45\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD CONSTRAINT \`FK_293f0d3ef60cb0ca0006044ecfd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_e2eaa2213ac4454039cd8abc07d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_4504c37764f6962ccbd165a21de\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a8890dcd65b8c3ee6e160d33f3a\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7a962c9b04b0d197bc3c93262a7\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_55b8101bdf4f566645e928c26e3\` FOREIGN KEY (\`aiPersonaId\`) REFERENCES \`ai_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_8af8122897b05315e7eb8925253\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_5facd6d188068a5a1c5b6f07fc3\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_51014590f9644e6ff9e0536f40f\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_a1441e46c8d36090e1f6477cea5\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_91a165c1091a6959cc19d522399\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_833582df0c439ab8c9adc5240d1\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_950221e932175dc7cf7c0064887\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_b411e4f27d77a96eccdabbf4b45\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_36c8905c2c6c59467c60d94fd8a\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_156fd30246eb151b9d17716abf5\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD CONSTRAINT \`FK_9d520fa5fed56042918e48fc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_79206feb0038b1c5597668dc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_b9f20da98058d7bd474152ed6ce\` FOREIGN KEY (\`aiServerId\`) REFERENCES \`ai_server\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_8495fae86f13836b0745642baa8\` FOREIGN KEY (\`applicationId\`) REFERENCES \`application\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_fe50118fd82e7fe2f74f986a195\` FOREIGN KEY (\`nvpId\`) REFERENCES \`nvp\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_fe50118fd82e7fe2f74f986a195\`` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_8495fae86f13836b0745642baa8\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_b9f20da98058d7bd474152ed6ce\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_79206feb0038b1c5597668dc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` DROP FOREIGN KEY \`FK_9d520fa5fed56042918e48fc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_156fd30246eb151b9d17716abf5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_36c8905c2c6c59467c60d94fd8a\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_b411e4f27d77a96eccdabbf4b45\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_950221e932175dc7cf7c0064887\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_833582df0c439ab8c9adc5240d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_91a165c1091a6959cc19d522399\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_a1441e46c8d36090e1f6477cea5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_51014590f9644e6ff9e0536f40f\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_5facd6d188068a5a1c5b6f07fc3\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_8af8122897b05315e7eb8925253\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_55b8101bdf4f566645e928c26e3\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7a962c9b04b0d197bc3c93262a7\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a8890dcd65b8c3ee6e160d33f3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_4504c37764f6962ccbd165a21de\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_e2eaa2213ac4454039cd8abc07d\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP FOREIGN KEY \`FK_293f0d3ef60cb0ca0006044ecfd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_43559aeadc1a5169d17e81b3d45\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_980c4643d7d9de1b97bc39f5185\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_9c664d684f987a735678b0ba825\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_68fa2c2b00cc1ed77e7c225e8ba\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_cc0b08eb9679d3daa95153c2af5\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ea06eb8894469a0f262d929bf06\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ef1ff4ac7f613cc0677e2295b30\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_b4250035291aac1329d59224a96\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_8d03fd2c8e8411ec9192c79cd99\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_592a23e68922853bae6ebecd85e\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_413ba75964e5a534e4bfa54846e\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP FOREIGN KEY \`FK_eb0176ef4b98c143322aa6f8090\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP FOREIGN KEY \`FK_e1817f55e97bba03a57b9287251\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP FOREIGN KEY \`FK_8b2d7f497cccf9cac312dac8b46\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP FOREIGN KEY \`FK_25dbe2675edea7b3c4f4aec4300\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP FOREIGN KEY \`FK_eb3f02cf18df8943da1673a25b8\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_29ff764dc6de1a9dc289cbfb01b\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_479f799f0d86e43c9d8623e8277\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_b94beb9cefe0a8814dceddd10f6\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_7c434491e8e9ee8af12caff7db3\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_75d5ced6c2e92cbbb5d8d0a913e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP FOREIGN KEY \`FK_6c90723f8f1424e2dd08dddb393\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP FOREIGN KEY \`FK_4b7450c0baad85f4afee2ce25e6\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP FOREIGN KEY \`FK_bd591d7403dabe091f6a116975d\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP FOREIGN KEY \`FK_3aec561629db1d65a9b2b3a788f\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` DROP FOREIGN KEY \`FK_6776ee550271ece75b3b2a5ba18\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` DROP FOREIGN KEY \`FK_5b4948db27c348e65055187d5ea\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` DROP FOREIGN KEY \`FK_cc2faf30ce52648db9299d7072b\`` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` DROP FOREIGN KEY \`FK_34b22da74bc9e821a99fbe78a19\`` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` DROP FOREIGN KEY \`FK_4a9c8cefc6c7e33aa728d22a905\`` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` DROP FOREIGN KEY \`FK_c3bdb693adb031b6613edcef4f4\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_a03169c3f86480ba3863924f4d7\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_5f0dbc3b097ef297bd5f4ddb1a9\`` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` DROP FOREIGN KEY \`FK_658580aea4e1a892227e27db902\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_cbb1d7afa052a184471723d3297\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_bde98d59e8984e7d17034c3b937\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_0f9d41ee193d631a5439bb4f404\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_a2afa3851ea733de932251b3a1f\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_8e8283bdacc9e770918fe689333\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3823de95920943655430125fa93\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_c7d74dd6b92d4202c705cd36769\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_2e7dd2fa8c829352cfbecb2cc93\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_7fbe50fa78a37776ad962cb7643\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_6e7584bfb417bd0f8e8696ab585\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_809c1e6cf3ef6be03a0a1db3f70\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_b3d3f3c2ce851d1059c4ed26ba2\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_c0448d2c992a62c9c11bd0f1422\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_425bbb4b951f7f4629710763fc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_f516dd9a46616999c7e9a6adc15\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_ca469f5ec53a7719d155d60aca1\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_dd88d373c64b04e24705d575c99\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_9f621c51dd854634d8766a9cfaf\`` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` DROP FOREIGN KEY \`FK_3b0c92945f36d06f37de80285dd\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_0de78853c1ee793f61bda7eff79\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_5337074c9b818bb63e6f314c808\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_2d8a3ca181c3f0346817685d21d\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_4555dccdda9ba57d8e3a634cd0d\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_a5dae5a376dd49c7c076893d40b\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_0c6a4d0a6c13a3f5df6ac015096\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP FOREIGN KEY \`FK_3030904030f5d30f483b49905d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP FOREIGN KEY \`FK_23d4d78ea8db637df031f86f030\`` - ); - await queryRunner.query( - `ALTER TABLE \`library\` DROP FOREIGN KEY \`FK_3879db652f2421337691219ace8\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_684b272e6f7459439d41d2879ee\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_339c1fe2a9c5caef5b982303fb0\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b0c80ccf319a1c7a7af12b39987\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b132226941570cb650a4023d493\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_eb99e588873c788a68a035478ab\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_a20c5901817dd09d5906537e087\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_500cee6f635849f50e19c7e2b76\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_b4ae3fea4a24b4be1a86dacf8a2\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_7ec2857c7d8d16432ffca1cb3d9\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_56f5614fff0028d403704995822\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_10458c50c10436b6d589b40e5ca\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_028322b763dc94242dc9f638f9b\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_b61c694cacfab25533bd23d9add\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_9466682df91534dd95e4dbaa616\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_09f909622aa177a097256b7cc22\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9fcc131f256e969d773327f07cb\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_694ebec955a90e999d9926b7da8\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9912e4cfc1e09848a392a651514\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_e8e32f1e59c349b406a4752e545\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_395aa74996a1f978b4969d114b1\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_58fd47c4a6ac8df9fe2bcaed874\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_5a72d5b37312bac2e0a01157185\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7f1bec8979b57ed7ebd392a2ca9\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_d2cb77c14644156ec8e865608e0\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_e0e150e4f11d906b931b46a2d89\`` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` DROP FOREIGN KEY \`FK_8ed9d1af584fa62f1ad3405b33b\`` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` DROP FOREIGN KEY \`FK_dbe0929355f82e5995f0b7fd5e2\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` DROP FOREIGN KEY \`FK_8e76dcf171c45875c44febb1d8d\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_f4b5742f589e2ac8bfe48b708c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_46d60bf133073f749b8f07e534c\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_b4cf0f96bf08cf396f683555229\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_1cc3b275fc2a9d9d9b0ae33b310\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_c66eddab0caacb1ef8d46bcafdb\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_35c6b1de6d4d89dfe8e9c85d771\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_f67a2d25c945269d602c182fbc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_b7ece56376ac7ca0b9a56c33b3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_262ecf3f5d70b82a48336184251\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_96a8cbe1706f459fd7d883be9bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_a6e050daa4c7a3ab1e411c36517\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_56aae15a664b2889a1a11c2cf82\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_5fe58ece01b48496aebc04733da\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` DROP FOREIGN KEY \`FK_6e74d59afda096b68d12a699691\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_80ab7835e1749581a27462eb87f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_b5069b11030e9608ee4468f850d\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_9349e137959f3ca5818c2e62b3f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_8ee86afa2808a4ab523b9ee6c5e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_9b1c5ee044611ac78249194ec35\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_62ed316cda7b75735b20307b47e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_36b0da55acff774d0845aeb55f2\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_1e740008a7e1512966e3b084148\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_cf776244b01436d8ca5cc762848\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_6289dee12effb51320051c6f1fc\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_7370de8eb79ed00b0d403f2299a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_97fefc97fb254c30577696e1c0a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_dfa86c46f509a61c6510536cd9a\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_3bfc8c1aaec1395cc148268d3cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_07f249ac87502495710a62c5c01\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_042b9825d770d6b3009ae206c2f\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_970844fcd10c2b6df7c1b49eacf\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_390343b22abec869bf800419333\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_f53e2d266432e58e538a366705d\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_c9d7c2c4eb8a1d012ddc6605da9\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_3f9e9e2798d2a4d84b16ee8477c\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_d3b86160bb7d704212382b0ca44\`` - ); - await queryRunner.query( - `ALTER TABLE \`room\` DROP FOREIGN KEY \`FK_d1d94dd8e0c417b4188a05ccbca\`` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` DROP FOREIGN KEY \`FK_d6f78c95ff41cdd30e505a4ebbb\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_2f46c698fc4c19a8cc233c5f255\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_73e8ae665a49366ca7e2866a45d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_4a1c74fd2a61b32d9d9500e0650\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_432056041df0e4337b17ff7b09d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_a96475631aba7dce41db03cc8b2\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_11d0ed50a26da5513f7e4347847\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_f2f48b57269987b13b415a00587\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_0647707288c243e60091c8d8620\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_b80c28f5335ab5442f63c644d94\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_f3b4d59c0b805c9c1ecb0070e16\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_9fb9257b14ec21daf5bc9aa4c8e\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_851e50ec4be7c62a1f9b9a430bf\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_d9e2dfcccf59233c17cc6bc6418\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_1104f3ef8497ca40d99b9f46b87\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_4fbd109f9bb84f58b7a3c60649c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_644155610ddc40dc4e19781c8f0\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_81fc213b2d9ad0cddeab1a9ce64\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_eb59b98ee6ef26c993d0d75c83c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset_template\` DROP FOREIGN KEY \`FK_96f23f044acf305c1699e0319d2\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e1817f55e97bba03a57b928725\` ON \`community_guidelines_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_25dbe2675edea7b3c4f4aec430\` ON \`community_guidelines_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_eb3f02cf18df8943da1673a25b\` ON \`community_guidelines_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_29ff764dc6de1a9dc289cbfb01\` ON \`callout_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_479f799f0d86e43c9d8623e827\` ON \`callout_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b94beb9cefe0a8814dceddd10f\` ON \`callout_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_75d5ced6c2e92cbbb5d8d0a913\` ON \`callout_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6c90723f8f1424e2dd08dddb39\` ON \`callout_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_bd591d7403dabe091f6a116975\` ON \`innovation_flow_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3aec561629db1d65a9b2b3a788\` ON \`innovation_flow_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5b4948db27c348e65055187d5e\` ON \`whiteboard_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_cc2faf30ce52648db9299d7072\` ON \`whiteboard_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4a9c8cefc6c7e33aa728d22a90\` ON \`post_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c3bdb693adb031b6613edcef4f\` ON \`post_template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3823de95920943655430125fa9\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c7d74dd6b92d4202c705cd3676\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3879db652f2421337691219ace\` ON \`library\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_390343b22abec869bf80041933\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP INDEX \`IDX_79206feb0038b1c5597668dc4b\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` DROP INDEX \`IDX_9d520fa5fed56042918e48fc4b\`` - ); - await queryRunner.query( - `ALTER TABLE \`activity\` DROP INDEX \`IDX_07a39cea9426b689be25fd61de\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_36c8905c2c6c59467c60d94fd8\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_1d39dac2c6d2f17286d90c306b\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_950221e932175dc7cf7c006488\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_833582df0c439ab8c9adc5240d\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_91a165c1091a6959cc19d52239\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_a1441e46c8d36090e1f6477cea\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_8af8122897b05315e7eb892525\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_55b8101bdf4f566645e928c26e\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_43559aeadc1a5169d17e81b3d4\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_980c4643d7d9de1b97bc39f518\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_9c664d684f987a735678b0ba82\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_cc0b08eb9679d3daa95153c2af\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_ea06eb8894469a0f262d929bf0\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_b4250035291aac1329d59224a9\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_592a23e68922853bae6ebecd85\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP INDEX \`IDX_eb0176ef4b98c143322aa6f809\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP INDEX \`IDX_e1817f55e97bba03a57b928725\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP INDEX \`IDX_25dbe2675edea7b3c4f4aec430\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines_template\` DROP INDEX \`IDX_eb3f02cf18df8943da1673a25b\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP INDEX \`IDX_29ff764dc6de1a9dc289cbfb01\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP INDEX \`IDX_479f799f0d86e43c9d8623e827\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP INDEX \`IDX_b94beb9cefe0a8814dceddd10f\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP INDEX \`IDX_75d5ced6c2e92cbbb5d8d0a913\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_template\` DROP INDEX \`IDX_6c90723f8f1424e2dd08dddb39\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP INDEX \`IDX_bd591d7403dabe091f6a116975\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow_template\` DROP INDEX \`IDX_3aec561629db1d65a9b2b3a788\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` DROP INDEX \`IDX_5b4948db27c348e65055187d5e\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard_template\` DROP INDEX \`IDX_cc2faf30ce52648db9299d7072\`` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` DROP INDEX \`IDX_4a9c8cefc6c7e33aa728d22a90\`` - ); - await queryRunner.query( - `ALTER TABLE \`post_template\` DROP INDEX \`IDX_c3bdb693adb031b6613edcef4f\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP INDEX \`IDX_a03169c3f86480ba3863924f4d\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\`` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` DROP INDEX \`IDX_658580aea4e1a892227e27db90\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP INDEX \`IDX_bde98d59e8984e7d17034c3b93\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP INDEX \`IDX_a2afa3851ea733de932251b3a1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_3823de95920943655430125fa9\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_c7d74dd6b92d4202c705cd3676\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_7fbe50fa78a37776ad962cb764\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP INDEX \`IDX_c0448d2c992a62c9c11bd0f142\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_425bbb4b951f7f4629710763fc\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_f516dd9a46616999c7e9a6adc1\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_ca469f5ec53a7719d155d60aca\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_dd88d373c64b04e24705d575c9\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_9f621c51dd854634d8766a9cfa\`` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` DROP INDEX \`IDX_3b0c92945f36d06f37de80285d\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_5337074c9b818bb63e6f314c80\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_2d8a3ca181c3f0346817685d21\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP INDEX \`IDX_a5dae5a376dd49c7c076893d40\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP INDEX \`IDX_23d4d78ea8db637df031f86f03\`` - ); - await queryRunner.query( - `ALTER TABLE \`library\` DROP INDEX \`IDX_3879db652f2421337691219ace\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP INDEX \`IDX_684b272e6f7459439d41d2879e\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP INDEX \`IDX_b132226941570cb650a4023d49\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP INDEX \`IDX_eb99e588873c788a68a035478a\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP INDEX \`IDX_a20c5901817dd09d5906537e08\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP INDEX \`IDX_56f5614fff0028d40370499582\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_10458c50c10436b6d589b40e5c\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_028322b763dc94242dc9f638f9\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_b61c694cacfab25533bd23d9ad\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_9466682df91534dd95e4dbaa61\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_09f909622aa177a097256b7cc2\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP INDEX \`IDX_9912e4cfc1e09848a392a65151\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP INDEX \`IDX_e8e32f1e59c349b406a4752e54\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_395aa74996a1f978b4969d114b\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_5a72d5b37312bac2e0a0115718\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_d2cb77c14644156ec8e865608e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_e0e150e4f11d906b931b46a2d8\`` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` DROP INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` DROP INDEX \`IDX_8e76dcf171c45875c44febb1d8\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP INDEX \`IDX_b4cf0f96bf08cf396f68355522\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_f67a2d25c945269d602c182fbc\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_262ecf3f5d70b82a4833618425\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP INDEX \`IDX_96a8cbe1706f459fd7d883be9b\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP INDEX \`IDX_56aae15a664b2889a1a11c2cf8\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP INDEX \`IDX_5fe58ece01b48496aebc04733d\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` DROP INDEX \`IDX_6e74d59afda096b68d12a69969\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_b5069b11030e9608ee4468f850\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_9349e137959f3ca5818c2e62b3\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_62ed316cda7b75735b20307b47\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_36b0da55acff774d0845aeb55f\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_1e740008a7e1512966e3b08414\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_cf776244b01436d8ca5cc76284\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_6289dee12effb51320051c6f1f\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_bdf2d0eced5c95968a85caaaae\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_97fefc97fb254c30577696e1c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_5e34f9a356f6254b8da24f8947\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_dfa86c46f509a61c6510536cd9\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP INDEX \`IDX_07f249ac87502495710a62c5c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_042b9825d770d6b3009ae206c2\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_970844fcd10c2b6df7c1b49eac\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_390343b22abec869bf80041933\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_f53e2d266432e58e538a366705\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_d3b86160bb7d704212382b0ca4\`` - ); - await queryRunner.query( - `ALTER TABLE \`room\` DROP INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP INDEX \`IDX_73e8ae665a49366ca7e2866a45\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_432056041df0e4337b17ff7b09\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_a96475631aba7dce41db03cc8b\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP INDEX \`IDX_f2f48b57269987b13b415a0058\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP INDEX \`IDX_0647707288c243e60091c8d862\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\`` - ); - } -} diff --git a/src/migrations/1726153912745-fixIndexesFKsRelations-2.ts b/src/migrations/1726153912745-fixIndexesFKsRelations-2.ts deleted file mode 100644 index 7fff2b1c18..0000000000 --- a/src/migrations/1726153912745-fixIndexesFKsRelations-2.ts +++ /dev/null @@ -1,823 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixIndexesFKsRelations21726153912745 - implements MigrationInterface -{ - name = 'FixIndexesFKsRelations21726153912745'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'DROP INDEX `IDX_eb59b98ee6ef26c993d0d75c83` ON `tagset`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_4fbd109f9bb84f58b7a3c60649` ON `visual`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9fb9257b14ec21daf5bc9aa4c8` ON `document`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_d9e2dfcccf59233c17cc6bc641` ON `document`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_0647707288c243e60091c8d862` ON `storage_aggregator`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_f3b4d59c0b805c9c1ecb0070e1` ON `storage_aggregator`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_f2f48b57269987b13b415a0058` ON `storage_bucket`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_432056041df0e4337b17ff7b09` ON `profile`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_4a1c74fd2a61b32d9d9500e065` ON `profile`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a96475631aba7dce41db03cc8b` ON `profile`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_73e8ae665a49366ca7e2866a45` ON `reference`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_d1d94dd8e0c417b4188a05ccbc` ON `room`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3f9e9e2798d2a4d84b16ee8477` ON `whiteboard`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_d3b86160bb7d704212382b0ca4` ON `whiteboard`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8bc0e1f40be5816d3a593cbf7f` ON `callout_framing`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_c9d7c2c4eb8a1d012ddc6605da` ON `callout_framing`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_f53e2d266432e58e538a366705` ON `callout_framing`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_042b9825d770d6b3009ae206c2` ON `post`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_390343b22abec869bf80041933` ON `post`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_970844fcd10c2b6df7c1b49eac` ON `post`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_07f249ac87502495710a62c5c0` ON `link`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3bfc8c1aaec1395cc148268d3c` ON `link`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5e34f9a356f6254b8da24f8947` ON `callout_contribution`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_97fefc97fb254c30577696e1c0` ON `callout_contribution`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_bdf2d0eced5c95968a85caaaae` ON `callout_contribution`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_dfa86c46f509a61c6510536cd9` ON `callout_contribution`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_1e740008a7e1512966e3b08414` ON `callout`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_36b0da55acff774d0845aeb55f` ON `callout`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_6289dee12effb51320051c6f1f` ON `callout`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_62ed316cda7b75735b20307b47` ON `callout`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_cf776244b01436d8ca5cc76284` ON `callout`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8ee86afa2808a4ab523b9ee6c5` ON `calendar_event`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9349e137959f3ca5818c2e62b3` ON `calendar_event`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b5069b11030e9608ee4468f850` ON `calendar_event`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_6e74d59afda096b68d12a69969` ON `calendar`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_56aae15a664b2889a1a11c2cf8` ON `timeline`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5fe58ece01b48496aebc04733d` ON `timeline`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_96a8cbe1706f459fd7d883be9b` ON `innovation_flow`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a6e050daa4c7a3ab1e411c3651` ON `innovation_flow`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_262ecf3f5d70b82a4833618425` ON `collaboration`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_35c6b1de6d4d89dfe8e9c85d77` ON `collaboration`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b7ece56376ac7ca0b9a56c33b3` ON `collaboration`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_f67a2d25c945269d602c182fbc` ON `collaboration`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_1cc3b275fc2a9d9d9b0ae33b31` ON `organization_verification`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_c66eddab0caacb1ef8d46bcafd` ON `organization_verification`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b4cf0f96bf08cf396f68355522` ON `preference`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8e76dcf171c45875c44febb1d8` ON `preference_set`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8ed9d1af584fa62f1ad3405b33` ON `agent`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_395aa74996a1f978b4969d114b` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_58fd47c4a6ac8df9fe2bcaed87` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5a72d5b37312bac2e0a0115718` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_7f1bec8979b57ed7ebd392a2ca` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_d2cb77c14644156ec8e865608e` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_e0e150e4f11d906b931b46a2d8` ON `organization`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9912e4cfc1e09848a392a65151` ON `user_group`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_e8e32f1e59c349b406a4752e54` ON `user_group`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_028322b763dc94242dc9f638f9` ON `user`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_09f909622aa177a097256b7cc2` ON `user`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_10458c50c10436b6d589b40e5c` ON `user`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9466682df91534dd95e4dbaa61` ON `user`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b61c694cacfab25533bd23d9ad` ON `user`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_56f5614fff0028d40370499582` ON `application`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_7ec2857c7d8d16432ffca1cb3d` ON `application`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a20c5901817dd09d5906537e08` ON `communication`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_eb99e588873c788a68a035478a` ON `communication`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b0c80ccf319a1c7a7af12b3998` ON `invitation`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b132226941570cb650a4023d49` ON `invitation`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3d60fe4fa40d54bad7d51bb4bd` ON `community_guidelines`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_684b272e6f7459439d41d2879e` ON `community_guidelines`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3879db652f2421337691219ace` ON `library`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_23d4d78ea8db637df031f86f03` ON `license_policy`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_0c6a4d0a6c13a3f5df6ac01509` ON `licensing`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a5dae5a376dd49c7c076893d40` ON `licensing`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_2d8a3ca181c3f0346817685d21` ON `discussion`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_4555dccdda9ba57d8e3a634cd0` ON `discussion`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5337074c9b818bb63e6f314c80` ON `discussion`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3b0c92945f36d06f37de80285d` ON `forum`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_425bbb4b951f7f4629710763fc` ON `platform`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9f621c51dd854634d8766a9cfa` ON `platform`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_ca469f5ec53a7719d155d60aca` ON `platform`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_dd88d373c64b04e24705d575c9` ON `platform`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_f516dd9a46616999c7e9a6adc1` ON `platform`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_c0448d2c992a62c9c11bd0f142` ON `platform_invitation`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_2e7dd2fa8c829352cfbecb2cc9` ON `community`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3823de95920943655430125fa9` ON `community`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_6e7584bfb417bd0f8e8696ab58` ON `community`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_7fbe50fa78a37776ad962cb764` ON `community`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_c7d74dd6b92d4202c705cd3676` ON `community`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a2afa3851ea733de932251b3a1` ON `actor`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_bde98d59e8984e7d17034c3b93` ON `actor_group`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_658580aea4e1a892227e27db90` ON `ecosystem_model`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5f0dbc3b097ef297bd5f4ddb1a` ON `context`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a03169c3f86480ba3863924f4d` ON `context`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_4a9c8cefc6c7e33aa728d22a90` ON `post_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_c3bdb693adb031b6613edcef4f` ON `post_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5b4948db27c348e65055187d5e` ON `whiteboard_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_cc2faf30ce52648db9299d7072` ON `whiteboard_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_3aec561629db1d65a9b2b3a788` ON `innovation_flow_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_bd591d7403dabe091f6a116975` ON `innovation_flow_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_29ff764dc6de1a9dc289cbfb01` ON `callout_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_479f799f0d86e43c9d8623e827` ON `callout_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_6c90723f8f1424e2dd08dddb39` ON `callout_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_75d5ced6c2e92cbbb5d8d0a913` ON `callout_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b94beb9cefe0a8814dceddd10f` ON `callout_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_25dbe2675edea7b3c4f4aec430` ON `community_guidelines_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_e1817f55e97bba03a57b928725` ON `community_guidelines_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_eb3f02cf18df8943da1673a25b` ON `community_guidelines_template`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_eb0176ef4b98c143322aa6f809` ON `templates_set`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_413ba75964e5a534e4bfa54846` ON `space_defaults`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_592a23e68922853bae6ebecd85` ON `space_defaults`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_43559aeadc1a5169d17e81b3d4` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_68fa2c2b00cc1ed77e7c225e8b` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_6b1efee39d076d9f7ecb8fef4c` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8d03fd2c8e8411ec9192c79cd9` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_980c4643d7d9de1b97bc39f518` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9c664d684f987a735678b0ba82` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b4250035291aac1329d59224a9` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_cc0b08eb9679d3daa95153c2af` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_ea06eb8894469a0f262d929bf0` ON `space`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_293f0d3ef60cb0ca0006044ecf` ON `ai_persona`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_4504c37764f6962ccbd165a21d` ON `virtual_contributor`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_55b8101bdf4f566645e928c26e` ON `virtual_contributor`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a8890dcd65b8c3ee6e160d33f3` ON `virtual_contributor`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_e2eaa2213ac4454039cd8abc07` ON `virtual_contributor`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_5facd6d188068a5a1c5b6f07fc` ON `innovation_pack`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_8af8122897b05315e7eb892525` ON `innovation_pack`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_a1441e46c8d36090e1f6477cea` ON `innovation_pack`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_833582df0c439ab8c9adc5240d` ON `account`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_91a165c1091a6959cc19d52239` ON `account`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_950221e932175dc7cf7c006488` ON `account`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_36c8905c2c6c59467c60d94fd8` ON `innovation_hub`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_b411e4f27d77a96eccdabbf4b4` ON `innovation_hub`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `activity`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_79206feb0038b1c5597668dc4b` ON `ai_persona_service`' - ); - await queryRunner.query( - 'DROP INDEX `IDX_9d520fa5fed56042918e48fc4b` ON `ai_server`' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9d520fa5fed56042918e48fc4b` ON `ai_server` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_79206feb0038b1c5597668dc4b` ON `ai_persona_service` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `activity` (`rowId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b411e4f27d77a96eccdabbf4b4` ON `innovation_hub` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_36c8905c2c6c59467c60d94fd8` ON `innovation_hub` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_950221e932175dc7cf7c006488` ON `account` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_91a165c1091a6959cc19d52239` ON `account` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_833582df0c439ab8c9adc5240d` ON `account` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a1441e46c8d36090e1f6477cea` ON `innovation_pack` (`templatesSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8af8122897b05315e7eb892525` ON `innovation_pack` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5facd6d188068a5a1c5b6f07fc` ON `innovation_pack` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_e2eaa2213ac4454039cd8abc07` ON `virtual_contributor` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a8890dcd65b8c3ee6e160d33f3` ON `virtual_contributor` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_55b8101bdf4f566645e928c26e` ON `virtual_contributor` (`aiPersonaId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_4504c37764f6962ccbd165a21d` ON `virtual_contributor` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_293f0d3ef60cb0ca0006044ecf` ON `ai_persona` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_ea06eb8894469a0f262d929bf0` ON `space` (`collaborationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_cc0b08eb9679d3daa95153c2af` ON `space` (`contextId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b4250035291aac1329d59224a9` ON `space` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9c664d684f987a735678b0ba82` ON `space` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_980c4643d7d9de1b97bc39f518` ON `space` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8d03fd2c8e8411ec9192c79cd9` ON `space` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_6b1efee39d076d9f7ecb8fef4c` ON `space` (`defaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_68fa2c2b00cc1ed77e7c225e8b` ON `space` (`communityId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_43559aeadc1a5169d17e81b3d4` ON `space` (`libraryId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_592a23e68922853bae6ebecd85` ON `space_defaults` (`innovationFlowTemplateId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_413ba75964e5a534e4bfa54846` ON `space_defaults` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_eb0176ef4b98c143322aa6f809` ON `templates_set` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_eb3f02cf18df8943da1673a25b` ON `community_guidelines_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_e1817f55e97bba03a57b928725` ON `community_guidelines_template` (`guidelinesId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_25dbe2675edea7b3c4f4aec430` ON `community_guidelines_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b94beb9cefe0a8814dceddd10f` ON `callout_template` (`framingId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_75d5ced6c2e92cbbb5d8d0a913` ON `callout_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_6c90723f8f1424e2dd08dddb39` ON `callout_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_479f799f0d86e43c9d8623e827` ON `callout_template` (`contributionDefaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_29ff764dc6de1a9dc289cbfb01` ON `callout_template` (`contributionPolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_bd591d7403dabe091f6a116975` ON `innovation_flow_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3aec561629db1d65a9b2b3a788` ON `innovation_flow_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_cc2faf30ce52648db9299d7072` ON `whiteboard_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5b4948db27c348e65055187d5e` ON `whiteboard_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_c3bdb693adb031b6613edcef4f` ON `post_template` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_4a9c8cefc6c7e33aa728d22a90` ON `post_template` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a03169c3f86480ba3863924f4d` ON `context` (`ecosystemModelId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5f0dbc3b097ef297bd5f4ddb1a` ON `context` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_658580aea4e1a892227e27db90` ON `ecosystem_model` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_bde98d59e8984e7d17034c3b93` ON `actor_group` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a2afa3851ea733de932251b3a1` ON `actor` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_c7d74dd6b92d4202c705cd3676` ON `community` (`applicationFormId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_7fbe50fa78a37776ad962cb764` ON `community` (`communicationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_6e7584bfb417bd0f8e8696ab58` ON `community` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3823de95920943655430125fa9` ON `community` (`policyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_2e7dd2fa8c829352cfbecb2cc9` ON `community` (`guidelinesId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_c0448d2c992a62c9c11bd0f142` ON `platform_invitation` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_f516dd9a46616999c7e9a6adc1` ON `platform` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_dd88d373c64b04e24705d575c9` ON `platform` (`forumId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_ca469f5ec53a7719d155d60aca` ON `platform` (`libraryId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9f621c51dd854634d8766a9cfa` ON `platform` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_425bbb4b951f7f4629710763fc` ON `platform` (`licensingId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3b0c92945f36d06f37de80285d` ON `forum` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5337074c9b818bb63e6f314c80` ON `discussion` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_4555dccdda9ba57d8e3a634cd0` ON `discussion` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_2d8a3ca181c3f0346817685d21` ON `discussion` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a5dae5a376dd49c7c076893d40` ON `licensing` (`licensePolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_0c6a4d0a6c13a3f5df6ac01509` ON `licensing` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_23d4d78ea8db637df031f86f03` ON `license_policy` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3879db652f2421337691219ace` ON `library` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_684b272e6f7459439d41d2879e` ON `community_guidelines` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3d60fe4fa40d54bad7d51bb4bd` ON `community_guidelines` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b132226941570cb650a4023d49` ON `invitation` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b0c80ccf319a1c7a7af12b3998` ON `invitation` (`lifecycleId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_eb99e588873c788a68a035478a` ON `communication` (`updatesId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a20c5901817dd09d5906537e08` ON `communication` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_7ec2857c7d8d16432ffca1cb3d` ON `application` (`lifecycleId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_56f5614fff0028d40370499582` ON `application` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b61c694cacfab25533bd23d9ad` ON `user` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9466682df91534dd95e4dbaa61` ON `user` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_10458c50c10436b6d589b40e5c` ON `user` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_09f909622aa177a097256b7cc2` ON `user` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_028322b763dc94242dc9f638f9` ON `user` (`preferenceSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_e8e32f1e59c349b406a4752e54` ON `user_group` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9912e4cfc1e09848a392a65151` ON `user_group` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_e0e150e4f11d906b931b46a2d8` ON `organization` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_d2cb77c14644156ec8e865608e` ON `organization` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_7f1bec8979b57ed7ebd392a2ca` ON `organization` (`agentId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5a72d5b37312bac2e0a0115718` ON `organization` (`verificationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_58fd47c4a6ac8df9fe2bcaed87` ON `organization` (`preferenceSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_395aa74996a1f978b4969d114b` ON `organization` (`storageAggregatorId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8ed9d1af584fa62f1ad3405b33` ON `agent` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8e76dcf171c45875c44febb1d8` ON `preference_set` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b4cf0f96bf08cf396f68355522` ON `preference` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_c66eddab0caacb1ef8d46bcafd` ON `organization_verification` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_1cc3b275fc2a9d9d9b0ae33b31` ON `organization_verification` (`lifecycleId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_f67a2d25c945269d602c182fbc` ON `collaboration` (`timelineId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b7ece56376ac7ca0b9a56c33b3` ON `collaboration` (`tagsetTemplateSetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_35c6b1de6d4d89dfe8e9c85d77` ON `collaboration` (`innovationFlowId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_262ecf3f5d70b82a4833618425` ON `collaboration` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a6e050daa4c7a3ab1e411c3651` ON `innovation_flow` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_96a8cbe1706f459fd7d883be9b` ON `innovation_flow` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5fe58ece01b48496aebc04733d` ON `timeline` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_56aae15a664b2889a1a11c2cf8` ON `timeline` (`calendarId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_6e74d59afda096b68d12a69969` ON `calendar` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_b5069b11030e9608ee4468f850` ON `calendar_event` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9349e137959f3ca5818c2e62b3` ON `calendar_event` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8ee86afa2808a4ab523b9ee6c5` ON `calendar_event` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_cf776244b01436d8ca5cc76284` ON `callout` (`framingId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_62ed316cda7b75735b20307b47` ON `callout` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_6289dee12effb51320051c6f1f` ON `callout` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_36b0da55acff774d0845aeb55f` ON `callout` (`contributionDefaultsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_1e740008a7e1512966e3b08414` ON `callout` (`contributionPolicyId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_dfa86c46f509a61c6510536cd9` ON `callout_contribution` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_bdf2d0eced5c95968a85caaaae` ON `callout_contribution` (`linkId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_97fefc97fb254c30577696e1c0` ON `callout_contribution` (`postId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_5e34f9a356f6254b8da24f8947` ON `callout_contribution` (`whiteboardId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3bfc8c1aaec1395cc148268d3c` ON `link` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_07f249ac87502495710a62c5c0` ON `link` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_970844fcd10c2b6df7c1b49eac` ON `post` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_390343b22abec869bf80041933` ON `post` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_042b9825d770d6b3009ae206c2` ON `post` (`commentsId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_f53e2d266432e58e538a366705` ON `callout_framing` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_c9d7c2c4eb8a1d012ddc6605da` ON `callout_framing` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_8bc0e1f40be5816d3a593cbf7f` ON `callout_framing` (`whiteboardId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_d3b86160bb7d704212382b0ca4` ON `whiteboard` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_3f9e9e2798d2a4d84b16ee8477` ON `whiteboard` (`profileId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_d1d94dd8e0c417b4188a05ccbc` ON `room` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_73e8ae665a49366ca7e2866a45` ON `reference` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_a96475631aba7dce41db03cc8b` ON `profile` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_4a1c74fd2a61b32d9d9500e065` ON `profile` (`storageBucketId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_432056041df0e4337b17ff7b09` ON `profile` (`locationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_f2f48b57269987b13b415a0058` ON `storage_bucket` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_f3b4d59c0b805c9c1ecb0070e1` ON `storage_aggregator` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_0647707288c243e60091c8d862` ON `storage_aggregator` (`directStorageId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_d9e2dfcccf59233c17cc6bc641` ON `document` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_9fb9257b14ec21daf5bc9aa4c8` ON `document` (`tagsetId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_4fbd109f9bb84f58b7a3c60649` ON `visual` (`authorizationId`)' - ); - await queryRunner.query( - 'CREATE UNIQUE INDEX `IDX_eb59b98ee6ef26c993d0d75c83` ON `tagset` (`authorizationId`)' - ); - } -} diff --git a/src/migrations/1726216394652-fixInnovationFlowFK.ts b/src/migrations/1726216394652-fixInnovationFlowFK.ts deleted file mode 100644 index 0c06463bf5..0000000000 --- a/src/migrations/1726216394652-fixInnovationFlowFK.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixInnovationFlowFK1726216394652 implements MigrationInterface { - name = 'FixInnovationFlowFK1726216394652'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `innovation_flow` DROP FOREIGN KEY `FK_96a8cbe1706f459fd7d883be9bd`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_96a8cbe1706f459fd7d883be9bd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `innovation_flow` DROP FOREIGN KEY `FK_96a8cbe1706f459fd7d883be9bd`' - ); - await queryRunner.query( - 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_96a8cbe1706f459fd7d883be9bd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - } -} diff --git a/src/migrations/1726217001134-templates.ts b/src/migrations/1726217001134-templates.ts deleted file mode 100644 index 6bc9537364..0000000000 --- a/src/migrations/1726217001134-templates.ts +++ /dev/null @@ -1,362 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; -import { escapeString } from './utils/escape-string'; - -export class Templates1726217001134 implements MigrationInterface { - name = 'Templates1726217001134'; - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'CREATE TABLE `template` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `type` varchar(128) NOT NULL, `postDefaultDescription` text NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `templatesSetId` char(36) NULL, `innovationFlowId` char(36) NULL, `communityGuidelinesId` char(36) NULL, `calloutId` char(36) NULL, `whiteboardId` char(36) NULL, `collaborationId` char(36) NULL, UNIQUE INDEX `REL_4318f97beabd362a8a09e9d320` (`authorizationId`), UNIQUE INDEX `REL_f58c3b144b6e010969e199beef` (`profileId`), UNIQUE INDEX `REL_45cf273f30c1fa509456b6b0dd` (`innovationFlowId`), UNIQUE INDEX `REL_eedeae5e63f9a9c3a0161541e9` (`communityGuidelinesId`), UNIQUE INDEX `REL_c6e4d1a07781a809ad3b3ee826` (`calloutId`), UNIQUE INDEX `REL_f09090a77e07377eefb3f731d9` (`whiteboardId`), UNIQUE INDEX `REL_21fdaf6dc88bdd6e8839e29b0b` (`collaborationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' - ); - - await queryRunner.query( - `INSERT INTO \`template\` (id, createdDate, updatedDate, version, nameID, type, authorizationId, profileId, templatesSetId, communityGuidelinesId) - SELECT id, createdDate, updatedDate, version, CONCAT('template-cg', SUBSTRING(id, 1, 8)) as \`nameID\`, 'community-guidelines' as \`type\`, authorizationId, profileId, templatesSetId, guidelinesId as communityGuidelinesId - FROM \`community_guidelines_template\`;` - ); - - await queryRunner.query( - `INSERT INTO \`template\` (id, createdDate, updatedDate, version, nameID, type, authorizationId, profileId, templatesSetId, postDefaultDescription) - SELECT id, createdDate, updatedDate, version, CONCAT('template-po', SUBSTRING(id, 1, 8)) as \`nameID\`, 'post' as \`type\`, authorizationId, profileId, templatesSetId, defaultDescription as postDefaultDescription - FROM \`post_template\`;` - ); - - const innovationFlowTemplates: { - id: string; - createdDate: Date; - updatedDate: Date; - version: number; - nameID: string; - authorizationId: string; - profileId: string; - templatesSetId: string; - storageBucketId: string; - }[] = await queryRunner.query( - `SELECT - innovation_flow_template.id, - innovation_flow_template.createdDate, - innovation_flow_template.updatedDate, - innovation_flow_template.version, - CONCAT('template-if', SUBSTRING(innovation_flow_template.id, 1, 8)) as \`nameID\`, - innovation_flow_template.authorizationId, - innovation_flow_template.profileId, - innovation_flow_template.templatesSetId, - profile.storageBucketId - FROM \`innovation_flow_template\` - LEFT OUTER JOIN \`profile\` ON \`profile\`.id = \`innovation_flow_template\`.profileId - ` - ); - for (const innovationFlowTemplate of innovationFlowTemplates) { - // Create a new InnovationFlow entity for each InnovationFlow - const innovationFlowID = - await this.createInnovationFlowFromInnovationFlowTemplate( - queryRunner, - innovationFlowTemplate.id, - innovationFlowTemplate.storageBucketId - ); - await queryRunner.query( - `INSERT INTO \`template\` (id, createdDate, updatedDate, version, nameID, authorizationId, profileId, templatesSetId, type, innovationFlowId) - VALUES ( - '${innovationFlowTemplate.id}', - '${formatDate(innovationFlowTemplate.createdDate)}', - '${formatDate(innovationFlowTemplate.updatedDate)}', - ${innovationFlowTemplate.version}, - '${innovationFlowTemplate.nameID}', - '${innovationFlowTemplate.authorizationId}', - '${innovationFlowTemplate.profileId}', - '${innovationFlowTemplate.templatesSetId}', - 'innovation-flow', - '${innovationFlowID}')` - ); - } - - await this.cleanUpWhiteboardTemplates(queryRunner); - - const whiteboardTemplates: { - id: string; - createdDate: Date; - updatedDate: Date; - version: number; - nameID: string; - authorizationId: string; - profileId: string; - templatesSetId: string; - storageBucketId: string; - }[] = await queryRunner.query( - `SELECT - whiteboard_template.id, - whiteboard_template.createdDate, - whiteboard_template.updatedDate, - whiteboard_template.version, - CONCAT('template-wb', SUBSTRING(whiteboard_template.id, 1, 8)) as \`nameID\`, - whiteboard_template.authorizationId, - whiteboard_template.profileId, - whiteboard_template.templatesSetId, - profile.storageBucketId - FROM \`whiteboard_template\` - LEFT OUTER JOIN \`profile\` ON \`profile\`.id = \`whiteboard_template\`.profileId - ` - ); - for (const whiteboardTemplate of whiteboardTemplates) { - // Create a new Whiteboard entity for each WhiteboardTemplate - const whiteboardID = await this.createWhiteboardFromWhiteboardTemplate( - queryRunner, - whiteboardTemplate.id, - whiteboardTemplate.storageBucketId - ); - await queryRunner.query( - `INSERT INTO \`template\` (id, createdDate, updatedDate, version, nameID, authorizationId, profileId, templatesSetId, type, whiteboardId) - VALUES ( - '${whiteboardTemplate.id}', - '${formatDate(whiteboardTemplate.createdDate)}', - '${formatDate(whiteboardTemplate.updatedDate)}', - ${whiteboardTemplate.version}, - '${whiteboardTemplate.nameID}', - '${whiteboardTemplate.authorizationId}', - '${whiteboardTemplate.profileId}', - '${whiteboardTemplate.templatesSetId}', - 'whiteboard', - '${whiteboardID}')` - ); - } - - const calloutTemplates: { - id: string; - createdDate: Date; - updatedDate: Date; - version: number; - nameID: string; - authorizationId: string; - profileId: string; - templatesSetId: string; - }[] = await queryRunner.query( - `SELECT - id, - createdDate, - updatedDate, - version, - CONCAT('template-ca', SUBSTRING(callout_template.id, 1, 8)) as \`nameID\`, - authorizationId, - profileId, - templatesSetId, - framingId, - contributionDefaultsId, - contributionPolicyId, - type - FROM \`callout_template\`` - ); - for (const calloutTemplate of calloutTemplates) { - const calloutID = await this.createCalloutFromCalloutTemplate( - queryRunner, - calloutTemplate.id - ); - await queryRunner.query( - `INSERT INTO \`template\` (id, createdDate, updatedDate, version, nameID, authorizationId, profileId, templatesSetId, type, calloutId) - VALUES ( - '${calloutTemplate.id}', - '${formatDate(calloutTemplate.createdDate)}', - '${formatDate(calloutTemplate.updatedDate)}', - ${calloutTemplate.version}, - '${calloutTemplate.nameID}', - '${calloutTemplate.authorizationId}', - '${calloutTemplate.profileId}', - '${calloutTemplate.templatesSetId}', - 'callout', - '${calloutID}')` - ); - } - await queryRunner.query( - `UPDATE \`profile\` SET type = 'template' WHERE type IN ('innovation-flow-template', 'post-template', 'callout-template', 'whiteboard-template', 'community-guidelines-template')` - ); - - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_4318f97beabd362a8a09e9d3203` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_f58c3b144b6e010969e199beeff` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_c7f54e6269c013d9c273f025edd` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_45cf273f30c1fa509456b6b0ddf` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_eedeae5e63f9a9c3a0161541e98` FOREIGN KEY (`communityGuidelinesId`) REFERENCES `community_guidelines`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_c6e4d1a07781a809ad3b3ee8265` FOREIGN KEY (`calloutId`) REFERENCES `callout`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_f09090a77e07377eefb3f731d9f` FOREIGN KEY (`whiteboardId`) REFERENCES `whiteboard`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - await queryRunner.query( - 'ALTER TABLE `template` ADD CONSTRAINT `FK_21fdaf6dc88bdd6e8839e29b0bd` FOREIGN KEY (`collaborationId`) REFERENCES `collaboration`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - // drop the old constraint on space_defaults - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_592a23e68922853bae6ebecd85e\`` - ); - - await queryRunner.query( - 'ALTER TABLE `space_defaults` ADD CONSTRAINT `FK_592a23e68922853bae6ebecd85e` FOREIGN KEY (`innovationFlowTemplateId`) REFERENCES `template`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); - - // Drop the old template tables - await queryRunner.query(`DROP TABLE \`post_template\``); - await queryRunner.query(`DROP TABLE \`whiteboard_template\``); - await queryRunner.query(`DROP TABLE \`community_guidelines_template\``); - await queryRunner.query(`DROP TABLE \`innovation_flow_template\``); - await queryRunner.query(`DROP TABLE \`callout_template\``); - await queryRunner.query(`ALTER TABLE \`post\` DROP COLUMN \`type\``); - } - - public async down(queryRunner: QueryRunner): Promise {} - - private async createInnovationFlowFromInnovationFlowTemplate( - queryRunner: QueryRunner, - innovationFlowTemplateId: string, - storageBucketId: string - ): Promise { - const innovationFlowID = randomUUID(); - const authID = await createAuthorizationPolicy( - queryRunner, - 'innovation-flow' - ); - const profileId = await createProfile( - queryRunner, - 'Innovation Flow', - storageBucketId, - 'innovation-flow' - ); - - await queryRunner.query( - `INSERT INTO innovation_flow (id, createdDate, updatedDate, version, authorizationId, profileId, states) - SELECT '${innovationFlowID}' as \`id\`, createdDate, updatedDate, version, '${authID}' as authorizationId, '${profileId}' as profileId, states - FROM innovation_flow_template WHERE id = '${innovationFlowTemplateId}'` - ); - return innovationFlowID; - } - - private async createWhiteboardFromWhiteboardTemplate( - queryRunner: QueryRunner, - whiteboardTemplateId: string, - storageBucketId: string - ): Promise { - const whiteboardID = randomUUID(); - const nameID = `template-${whiteboardID.slice(0, 8)}`; - const authID = await createAuthorizationPolicy(queryRunner, 'whiteboard'); - const profileId = await createProfile( - queryRunner, - 'Whiteboard', - storageBucketId, - 'whiteboard' - ); - - await queryRunner.query( - `INSERT INTO whiteboard (id, createdDate, updatedDate, version, authorizationId, profileId, content, nameID, contentUpdatePolicy) - SELECT '${whiteboardID}' as \`id\`, createdDate, updatedDate, version, '${authID}' as authorizationId, '${profileId}' as profileId, content, '${nameID}' as nameID, 'admins' as contentUpdatePolicy - FROM whiteboard_template WHERE id = '${whiteboardTemplateId}'` - ); - return whiteboardID; - } - - private async cleanUpWhiteboardTemplates( - queryRunner: QueryRunner - ): Promise { - // In acceptance I've seen an orphan template without templateSetId: - - console.warn( - 'THE FOLLOWING whiteboard_templates ARE GOING TO BE DELETED!!!', - await queryRunner.query( - `SELECT id FROM whiteboard_template WHERE templatesSetId IS NULL` - ) - ); - - await queryRunner.query( - `DELETE FROM profile WHERE id IN (SELECT profileId FROM whiteboard_template WHERE templatesSetId IS NULL)` - ); - await queryRunner.query( - `DELETE FROM authorization_policy WHERE id IN (SELECT authorizationId FROM whiteboard_template WHERE templatesSetId IS NULL)` - ); - await queryRunner.query( - `DELETE FROM whiteboard_template WHERE templatesSetId IS NULL` - ); - } - - private async createCalloutFromCalloutTemplate( - queryRunner: QueryRunner, - calloutTemplateId: string - ): Promise { - const calloutID = randomUUID(); - const nameID = `template-${calloutID.slice(0, 8)}`; - const authID = await createAuthorizationPolicy(queryRunner, 'callout'); - - await queryRunner.query( - `INSERT INTO callout (id, createdDate, updatedDate, version, authorizationId, framingId, contributionDefaultsId, contributionPolicyId, type, visibility, sortOrder, nameID) - SELECT '${calloutID}' as \`id\`, createdDate, updatedDate, version, '${authID}' as authorizationId, - framingId, - contributionDefaultsId, - contributionPolicyId, - \`type\`, - 'template', - 0, - '${nameID}' as nameID - FROM callout_template WHERE id = '${calloutTemplateId}'` - ); - - return calloutID; - } -} - -const createProfile = async ( - queryRunner: QueryRunner, - entityName: string, - templateStorageBucketId: string, - profileType: string -) => { - const profileId = randomUUID(); - const authID = await createAuthorizationPolicy(queryRunner, 'profile'); - const profileStorageBucketId = await createStorageBucket( - queryRunner, - templateStorageBucketId - ); - await queryRunner.query( - `INSERT INTO profile (id, version, authorizationId, locationId, displayName, tagline, storageBucketId, type) VALUES - ('${profileId}', 1, '${authID}', null, '${entityName} Template', '', '${profileStorageBucketId}', '${profileType}')` - ); - - return profileId; -}; - -const createStorageBucket = async ( - queryRunner: QueryRunner, - storageBucketId: string -) => { - const newStorageBucketId = randomUUID(); - const authID = await createAuthorizationPolicy(queryRunner, 'storage-bucket'); - - await queryRunner.query( - `INSERT INTO storage_bucket (id, version, authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId) - SELECT '${newStorageBucketId}' as id, 1 as version, '${authID}' as authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId - FROM storage_bucket WHERE id = '${storageBucketId}'` - ); - - return newStorageBucketId; -}; - -const createAuthorizationPolicy = async ( - queryRunner: QueryRunner, - policyType: string -) => { - const authID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${authID}', - 1, '', '', 0, '', '${policyType}')` - ); - return authID; -}; - -const formatDate = (date: Date) => - date.toISOString().replace('T', ' ').substring(0, 19); diff --git a/src/migrations/1726477422137-tempStorage.ts b/src/migrations/1726477422137-tempStorage.ts deleted file mode 100644 index 4cd474cf01..0000000000 --- a/src/migrations/1726477422137-tempStorage.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class TempStorage1726477422137 implements MigrationInterface { - name = 'TempStorage1726477422137'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `document` ADD `temporaryLocation` tinyint NOT NULL DEFAULT 0' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `document` DROP COLUMN `temporaryLocation`' - ); - } -} diff --git a/src/migrations/1726582217409-SetAssignToNewOrganizationAccounts.ts b/src/migrations/1726582217409-SetAssignToNewOrganizationAccounts.ts deleted file mode 100644 index 007c266544..0000000000 --- a/src/migrations/1726582217409-SetAssignToNewOrganizationAccounts.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class SetAssignToNewOrganizationAccounts1726582217409 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - UPDATE \`license_plan\` - SET assignToNewOrganizationAccounts = true - WHERE name = 'SPACE_FEATURE_VIRTUAL_CONTIBUTORS'; - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - UPDATE \`license_plan\` - SET assignToNewOrganizationAccounts = false - WHERE name = 'SPACE_FEATURE_VIRTUAL_CONTIBUTORS'; - `); - } -} diff --git a/src/migrations/1726843779059-roleSet.ts b/src/migrations/1726843779059-roleSet.ts deleted file mode 100644 index 52b8da1804..0000000000 --- a/src/migrations/1726843779059-roleSet.ts +++ /dev/null @@ -1,377 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class RoleSet1726843779059 implements MigrationInterface { - name = 'RoleSet1726843779059'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_b3d3f3c2ce851d1059c4ed26ba2\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_500cee6f635849f50e19c7e2b76\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_339c1fe2a9c5caef5b982303fb0\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3823de95920943655430125fa93\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_c7d74dd6b92d4202c705cd36769\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3823de95920943655430125fa9\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c7d74dd6b92d4202c705cd3676\` ON \`community\`` - ); - await queryRunner.query( - `CREATE TABLE \`role\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`type\` varchar(128) NOT NULL, - \`credential\` text NOT NULL, \`parentCredentials\` text NOT NULL, - \`requiresEntryRole\` tinyint NOT NULL, - \`requiresSameRoleInParentRoleSet\` tinyint NOT NULL, - \`userPolicy\` text NOT NULL, - \`organizationPolicy\` text NOT NULL, - \`virtualContributorPolicy\` text NOT NULL, - \`roleSetId\` char(36) NULL, - PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`role_set\` (\`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`authorizationId\` char(36) NULL, - \`applicationFormId\` char(36) NULL, - \`parentRoleSetId\` char(36) NULL, - \`entryRoleType\` varchar(128) NOT NULL, - UNIQUE INDEX \`REL_b038f74c8d4eadb839e78b99ce\` (\`authorizationId\`), - UNIQUE INDEX \`REL_00905b142498f63e76d38fb254\` (\`applicationFormId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD \`roleSetId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_3b8f390d76263ef5996869da07\` (\`roleSetId\`)` - ); - - // Migrate the data! First loop ensures all are setup. - const communities: { - id: string; - policyId: string; - applicationFormId: string; - parentCommunityId: string; - }[] = await queryRunner.query( - `SELECT id, policyId, applicationFormId, parentCommunityId FROM \`community\`` - ); - for (const community of communities) { - const [policy]: { - id: string; - member: string; - lead: string; - admin: string; - }[] = await queryRunner.query( - `SELECT id, community_policy.member, community_policy.lead, community_policy.admin FROM community_policy WHERE id = '${community.policyId}'` - ); - if (!policy) { - throw Error(`No policy found for community: ${community.id}`); - } - const roleSetID = randomUUID(); - const roleSetAuthID = await createAuthorizationPolicy( - queryRunner, - 'role-set' - ); - let memberRequiresParentRole = true; - if (!community.parentCommunityId) { - memberRequiresParentRole = false; - } - - await this.createRole( - queryRunner, - 'member', - policy.member, - roleSetID, - 0, - 9, - false, - memberRequiresParentRole - ); - await this.createRole( - queryRunner, - 'lead', - policy.lead, - roleSetID, - 0, - 0, - true, - false - ); - await this.createRole( - queryRunner, - 'admin', - policy.admin, - roleSetID, - 0, - 0, - true, - false - ); - - await queryRunner.query( - `INSERT INTO role_set (id, version, authorizationId, applicationFormId, entryRoleType) VALUES ('${roleSetID}', 1, '${roleSetAuthID}', '${community.applicationFormId}', 'member')` - ); - - await queryRunner.query( - `UPDATE community SET roleSetId = '${roleSetID}' WHERE id = '${community.id}'` - ); - } - - // Second loop makes the hierarchy linked - const communitiesWithRoleSets: { - id: string; - roleSetId: string; - parentCommunityId: string; - }[] = await queryRunner.query( - `SELECT id, roleSetId, parentCommunityId FROM \`community\`` - ); - for (const community of communitiesWithRoleSets) { - if (!community.parentCommunityId) { - continue; - } - const [parentCommunity]: { - id: string; - roleSetId: string; - }[] = await queryRunner.query( - `SELECT id, roleSetId FROM community WHERE id = '${community.parentCommunityId}'` - ); - if (!parentCommunity) { - throw Error( - `Unable to find parent community for community: ${community.id}` - ); - } - await queryRunner.query( - `UPDATE role_set SET parentRoleSetId = '${parentCommunity.roleSetId}' WHERE id = '${community.roleSetId}'` - ); - } - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` CHANGE \`communityId\` \`roleSetId\` char(36) NULL` - ); - await queryRunner.query( - `UPDATE platform_invitation SET roleSetId = (SELECT roleSetId FROM community WHERE id = platform_invitation.roleSetId)` - ); - await queryRunner.query( - `ALTER TABLE \`application\` CHANGE \`communityId\` \`roleSetId\` char(36) NULL` - ); - await queryRunner.query( - `UPDATE application SET roleSetId = (SELECT roleSetId FROM community WHERE id = application.roleSetId)` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` CHANGE \`communityId\` \`roleSetId\` char(36) NULL` - ); - await queryRunner.query( - `UPDATE invitation SET roleSetId = (SELECT roleSetId FROM community WHERE id = invitation.roleSetId)` - ); - - await queryRunner.query( - `ALTER TABLE \`community\` DROP COLUMN \`applicationFormId\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP COLUMN \`policyId\`` - ); - - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\` (\`roleSetId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`role\` ADD CONSTRAINT \`FK_66d695b73839e9b66ff1350d34f\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_562dce4a08bb214f08107b3631e\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_8fb220ad1ac1f9c86ec39d134e4\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_6a3b86c6db10582baae7058f5b9\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_b038f74c8d4eadb839e78b99ce5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_00905b142498f63e76d38fb254e\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_86acc254af20d20c9d87c3503d5\` FOREIGN KEY (\`parentRoleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3b8f390d76263ef5996869da071\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3b8f390d76263ef5996869da07\` ON \`community\`` - ); - - await queryRunner.query(`DROP TABLE \`community_policy\``); - - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_8e8283bdacc9e770918fe689333\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP COLUMN \`parentCommunityId\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3b8f390d76263ef5996869da071\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_86acc254af20d20c9d87c3503d5\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_00905b142498f63e76d38fb254e\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_b038f74c8d4eadb839e78b99ce5\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_6a3b86c6db10582baae7058f5b9\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_8fb220ad1ac1f9c86ec39d134e4\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_562dce4a08bb214f08107b3631e\`` - ); - await queryRunner.query( - `ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_66d695b73839e9b66ff1350d34f\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_3b8f390d76263ef5996869da07\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP COLUMN \`roleSetId\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD \`policyId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD \`applicationFormId\` char(36) NULL` - ); - await queryRunner.query( - `DROP INDEX \`REL_00905b142498f63e76d38fb254\` ON \`role_set\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` - ); - await queryRunner.query(`DROP TABLE \`role_set\``); - await queryRunner.query(`DROP TABLE \`role\``); - await queryRunner.query( - `ALTER TABLE \`invitation\` CHANGE \`roleSetId\` \`communityId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`application\` CHANGE \`roleSetId\` \`communityId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` CHANGE \`roleSetId\` \`communityId\` char(36) NULL` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c7d74dd6b92d4202c705cd3676\` ON \`community\` (\`applicationFormId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3823de95920943655430125fa9\` ON \`community\` (\`policyId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_c7d74dd6b92d4202c705cd36769\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3823de95920943655430125fa93\` FOREIGN KEY (\`policyId\`) REFERENCES \`community_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_339c1fe2a9c5caef5b982303fb0\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_500cee6f635849f50e19c7e2b76\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_b3d3f3c2ce851d1059c4ed26ba2\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - private async createRole( - queryRunner: QueryRunner, - type: string, - communityPolicyStr: string, - roleSetID: string, - vcMin: number, - vcMax: number, - requiresEntryRole: boolean, - requiresSameRoleInParentRoleSet: boolean - ) { - const roleID = randomUUID(); - const communityRolePolicy: CommunityPolicy = JSON.parse(communityPolicyStr); - const userPolicy = { - minimum: communityRolePolicy.minUser, - maximum: communityRolePolicy.maxUser, - }; - const organizationPolicy = { - minimum: communityRolePolicy.minOrg, - maximum: communityRolePolicy.maxOrg, - }; - const vcPolicy = { - minimum: vcMin, - maximum: vcMax, - }; - - // Create the role for the member role - await queryRunner.query(` - INSERT INTO role (id, version, type, credential, parentCredentials, requiresEntryRole, requiresSameRoleInParentRoleSet, userPolicy, organizationPolicy, virtualContributorPolicy, roleSetId) VALUES - ('${roleID}', 1, - '${type}', - '${JSON.stringify(communityRolePolicy.credential)}', - '${JSON.stringify(communityRolePolicy.parentCredentials)}', - ${requiresEntryRole}, - ${requiresSameRoleInParentRoleSet}, - '${JSON.stringify(userPolicy)}', - '${JSON.stringify(organizationPolicy)}', - '${JSON.stringify(vcPolicy)}', - '${roleSetID}')`); - } -} - -const createAuthorizationPolicy = async ( - queryRunner: QueryRunner, - policyType: string -) => { - const authID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${authID}', - 1, '', '', 0, '', '${policyType}')` - ); - return authID; -}; - -export type CredentialDefinition = { - type: string; - resourceID: string; -}; -export type CommunityPolicy = { - credential: CredentialDefinition; - parentCredentials: CredentialDefinition[]; - minUser: number; - maxUser: number; - minOrg: number; - maxOrg: number; - enabled: boolean; -}; diff --git a/src/migrations/1727431656698-calloutTemplatesVisibility.ts b/src/migrations/1727431656698-calloutTemplatesVisibility.ts deleted file mode 100644 index aca2d79218..0000000000 --- a/src/migrations/1727431656698-calloutTemplatesVisibility.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class CalloutTemplatesVisibility1727431656698 - implements MigrationInterface -{ - name = 'CalloutTemplatesVisibility1727431656698'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - 'ALTER TABLE `callout` ADD `isTemplate` tinyint NOT NULL DEFAULT 0' - ); - await queryRunner.query(` - UPDATE \`callout\` SET \`visibility\` = 'draft', \`isTemplate\` = 1 WHERE \`collaborationId\` IS NULL; - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query('ALTER TABLE `callout` DROP COLUMN `isTemplate`'); - } -} diff --git a/src/migrations/1727787748227-extendAiPersonaServiceAndVcInteractionForGenericEngines.ts b/src/migrations/1727787748227-extendAiPersonaServiceAndVcInteractionForGenericEngines.ts deleted file mode 100644 index 93f9dc12d3..0000000000 --- a/src/migrations/1727787748227-extendAiPersonaServiceAndVcInteractionForGenericEngines.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class ExtendAiPersonaServiceAndVcInteractionForGenericEngines1727787748227 - implements MigrationInterface -{ - name = 'ExtendAiPersonaServiceAndVcInteractionForGenericEngines1727787748227'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` ADD \`externalMetadata\` text NOT NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD \`externalConfig\` text NULL` - ); - - await queryRunner.query( - `UPDATE \`ai_persona_service\` SET \`prompt\` = IF(prompt = '', JSON_ARRAY(), JSON_ARRAY(prompt))` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP COLUMN \`externalConfig\`` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` DROP COLUMN \`externalMetadata\`` - ); - } -} diff --git a/src/migrations/1727872794564-cleanupRolesIndexes.ts b/src/migrations/1727872794564-cleanupRolesIndexes.ts deleted file mode 100644 index 147b9cdc74..0000000000 --- a/src/migrations/1727872794564-cleanupRolesIndexes.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { safelyDropFK } from './utils/safely-drop-foreignKey'; -import { safelyDropIndex } from './utils/safely-drop-index'; -import { safelyAddFK } from './utils/safely-add-foreignKey'; - -export class cleanupRolesIndexes1727872794564 implements MigrationInterface { - name = 'cleanupRolesIndexes1727872794564'; - - public async up(queryRunner: QueryRunner): Promise { - // platform_invitation - // This is the new FK using the old index - safelyDropFK( - queryRunner, - 'platform_invitation', - 'FK_562dce4a08bb214f08107b3631e' - ); - - // This is the old index that needs to be removed - safelyDropIndex( - queryRunner, - 'platform_invitation', - 'FK_b3d3f3c2ce851d1059c4ed26ba2' - ); - - // This will add the index and the FK back - safelyAddFK( - queryRunner, - 'platform_invitation', - 'FK_562dce4a08bb214f08107b3631e', - 'roleSetId', - 'role_set', - 'id', - 'CASCADE', - 'NO ACTION' - ); - - // application - - safelyDropFK(queryRunner, 'application', 'FK_8fb220ad1ac1f9c86ec39d134e4'); - safelyDropIndex( - queryRunner, - 'application', - 'FK_500cee6f635849f50e19c7e2b76' - ); - safelyAddFK( - queryRunner, - 'application', - 'FK_8fb220ad1ac1f9c86ec39d134e4', - 'roleSetId', - 'role_set', - 'id', - 'CASCADE', - 'NO ACTION' - ); - - // invitation - safelyDropFK(queryRunner, 'invitation', 'FK_6a3b86c6db10582baae7058f5b9'); - safelyDropIndex( - queryRunner, - 'invitation', - 'FK_339c1fe2a9c5caef5b982303fb0' - ); - safelyAddFK( - queryRunner, - 'invitation', - 'FK_6a3b86c6db10582baae7058f5b9', - 'roleSetId', - 'role_set', - 'id', - 'CASCADE', - 'NO ACTION' - ); - } - - public async down(queryRunner: QueryRunner): Promise { - // leave the FK just add back that wrong index to platform_invitation table - await queryRunner.query( - `CREATE INDEX \`FK_b3d3f3c2ce851d1059c4ed26ba2\` ON \`platform_invitation\` (\`roleSetId\`)` - ); - - // leave the FK just add back that wrong index to application table - await queryRunner.query( - `CREATE INDEX \`FK_500cee6f635849f50e19c7e2b76\` ON \`application\` (\`roleSetId\`)` - ); - - // leave the FK just add back that wrong index to invitation table - await queryRunner.query( - `CREATE INDEX \`FK_339c1fe2a9c5caef5b982303fb0\` ON \`invitation\` (\`roleSetId\`)` - ); - } -} diff --git a/src/migrations/1727930288139-invitationToRole.ts b/src/migrations/1727930288139-invitationToRole.ts deleted file mode 100644 index 0d25ed8ec3..0000000000 --- a/src/migrations/1727930288139-invitationToRole.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class InvitationToRole1727930288139 implements MigrationInterface { - name = 'InvitationToRole1727930288139'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD \`extraRole\` varchar(128) NULL` - ); - - await queryRunner.query( - `ALTER TABLE \`invitation\` CHANGE \`invitedContributor\` \`invitedContributorID\` char(36) NOT NULL` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP COLUMN \`extraRole\`` - ); - - await queryRunner.query( - `ALTER TABLE \`invitation\` CHANGE \`invitedContributorID\` \`invitedContributor\` char(36) NOT NULL` - ); - } -} diff --git a/src/migrations/1728032163157-dropAllIndexesFKsRelations.ts b/src/migrations/1728032163157-dropAllIndexesFKsRelations.ts deleted file mode 100644 index 8684ddebbf..0000000000 --- a/src/migrations/1728032163157-dropAllIndexesFKsRelations.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class DropAllIndexesFKsRelations1728032163157 - implements MigrationInterface -{ - name = 'DropAllIndexesFKsRelations1728032163157'; - - public async up(queryRunner: QueryRunner): Promise { - const dbName = 'alkemio'; // Your database name - - // 1. Drop all foreign keys that can be deleted - const foreignKeysResult = await queryRunner.query(` - SELECT TABLE_NAME, CONSTRAINT_NAME - FROM information_schema.KEY_COLUMN_USAGE - WHERE CONSTRAINT_SCHEMA = '${dbName}' - AND REFERENCED_TABLE_NAME IS NOT NULL; - `); - - for (const fk of foreignKeysResult) { - try { - await queryRunner.query( - `ALTER TABLE \`${fk.TABLE_NAME}\` DROP FOREIGN KEY \`${fk.CONSTRAINT_NAME}\`` - ); - console.log( - `Dropped foreign key ${fk.CONSTRAINT_NAME} on table ${fk.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop foreign key ${fk.CONSTRAINT_NAME} on table ${fk.TABLE_NAME}:`, - error - ); - continue; - } - } - - // 2. Drop all unique constraints that can be deleted - const uniqueConstraintsResult = await queryRunner.query(` - SELECT TABLE_NAME, CONSTRAINT_NAME - FROM information_schema.TABLE_CONSTRAINTS - WHERE CONSTRAINT_SCHEMA = '${dbName}' - AND CONSTRAINT_TYPE = 'UNIQUE'; - `); - - for (const unique of uniqueConstraintsResult) { - try { - await queryRunner.query( - `ALTER TABLE \`${unique.TABLE_NAME}\` DROP INDEX \`${unique.CONSTRAINT_NAME}\`` - ); - console.log( - `Dropped unique constraint ${unique.CONSTRAINT_NAME} on table ${unique.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop unique constraint ${unique.CONSTRAINT_NAME} on table ${unique.TABLE_NAME}:`, - error - ); - continue; - } - } - - // 3. Drop all regular indexes (except primary keys and indexes on AUTO_INCREMENT columns) - const indexesResult = await queryRunner.query(` - SELECT s.TABLE_NAME, s.INDEX_NAME, c.COLUMN_NAME, MAX(c.EXTRA) AS EXTRA - FROM information_schema.STATISTICS s - JOIN information_schema.COLUMNS c - ON s.TABLE_NAME = c.TABLE_NAME - AND s.TABLE_SCHEMA = c.TABLE_SCHEMA - AND s.COLUMN_NAME = c.COLUMN_NAME - WHERE s.TABLE_SCHEMA = '${dbName}' - AND s.INDEX_NAME != 'PRIMARY' - GROUP BY s.TABLE_NAME, s.INDEX_NAME, c.COLUMN_NAME - `); - - for (const index of indexesResult) { - if (index.EXTRA && index.EXTRA.includes('auto_increment')) { - console.log( - `Skipping index ${index.INDEX_NAME} on table ${index.TABLE_NAME} (AUTO_INCREMENT column)` - ); - continue; - } - - // Try to drop the index - try { - await queryRunner.query( - `DROP INDEX \`${index.INDEX_NAME}\` ON \`${index.TABLE_NAME}\`` - ); - console.log( - `Dropped index ${index.INDEX_NAME} on table ${index.TABLE_NAME}` - ); - } catch (error) { - console.error( - `Could not drop index ${index.INDEX_NAME} on table ${index.TABLE_NAME}:`, - error - ); - continue; - } - } - } - - public async down(queryRunner: QueryRunner): Promise { - // Logic for down migration can be added here if needed - } -} diff --git a/src/migrations/1728033296139-fixIndexesFKsRelations-2.ts b/src/migrations/1728033296139-fixIndexesFKsRelations-2.ts deleted file mode 100644 index c2813704db..0000000000 --- a/src/migrations/1728033296139-fixIndexesFKsRelations-2.ts +++ /dev/null @@ -1,779 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class FixIndexesFKsRelations1728033296139 implements MigrationInterface { - name = 'FixIndexesFKsRelations1728033296139'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `DROP INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_432056041df0e4337b17ff7b09\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a96475631aba7dce41db03cc8b\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_73e8ae665a49366ca7e2866a45\` ON \`reference\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f53e2d266432e58e538a366705\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_042b9825d770d6b3009ae206c2\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_390343b22abec869bf80041933\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_07f249ac87502495710a62c5c0\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_1e740008a7e1512966e3b08414\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_36b0da55acff774d0845aeb55f\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_6289dee12effb51320051c6f1f\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_62ed316cda7b75735b20307b47\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_cf776244b01436d8ca5cc76284\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_6e74d59afda096b68d12a69969\` ON \`calendar\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5fe58ece01b48496aebc04733d\` ON \`timeline\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b4cf0f96bf08cf396f68355522\` ON \`preference\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_395aa74996a1f978b4969d114b\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5a72d5b37312bac2e0a0115718\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_d2cb77c14644156ec8e865608e\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9912e4cfc1e09848a392a65151\` ON \`user_group\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a20c5901817dd09d5906537e08\` ON \`communication\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_eb99e588873c788a68a035478a\` ON \`communication\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3879db652f2421337691219ace\` ON \`library\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5337074c9b818bb63e6f314c80\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3b0c92945f36d06f37de80285d\` ON \`forum\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_425bbb4b951f7f4629710763fc\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9f621c51dd854634d8766a9cfa\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_ca469f5ec53a7719d155d60aca\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_dd88d373c64b04e24705d575c9\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_028322b763dc94242dc9f638f9\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_09f909622aa177a097256b7cc2\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_10458c50c10436b6d589b40e5c\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9466682df91534dd95e4dbaa61\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b61c694cacfab25533bd23d9ad\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_56f5614fff0028d40370499582\` ON \`application\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b132226941570cb650a4023d49\` ON \`invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_00905b142498f63e76d38fb254\` ON \`role_set\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_3b8f390d76263ef5996869da07\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_7fbe50fa78a37776ad962cb764\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a2afa3851ea733de932251b3a1\` ON \`actor\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a03169c3f86480ba3863924f4d\` ON \`context\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_4318f97beabd362a8a09e9d320\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f09090a77e07377eefb3f731d9\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_f58c3b144b6e010969e199beef\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_980c4643d7d9de1b97bc39f518\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9c664d684f987a735678b0ba82\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b4250035291aac1329d59224a9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_ea06eb8894469a0f262d929bf0\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_833582df0c439ab8c9adc5240d\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_91a165c1091a6959cc19d52239\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_950221e932175dc7cf7c006488\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9d520fa5fed56042918e48fc4b\` ON \`ai_server\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_950221e932175dc7cf7c006488\` ON \`account\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_91a165c1091a6959cc19d52239\` ON \`account\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_833582df0c439ab8c9adc5240d\` ON \`account\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\` (\`templatesSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8af8122897b05315e7eb892525\` ON \`innovation_pack\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\` (\`aiPersonaId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_ea06eb8894469a0f262d929bf0\` ON \`space\` (\`collaborationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` ON \`space\` (\`contextId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b4250035291aac1329d59224a9\` ON \`space\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9c664d684f987a735678b0ba82\` ON \`space\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_980c4643d7d9de1b97bc39f518\` ON \`space\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` ON \`space\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\` (\`communityId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` ON \`space\` (\`libraryId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_592a23e68922853bae6ebecd85\` ON \`space_defaults\` (\`innovationFlowTemplateId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_413ba75964e5a534e4bfa54846\` ON \`space_defaults\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_eb0176ef4b98c143322aa6f809\` ON \`templates_set\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f58c3b144b6e010969e199beef\` ON \`template\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f09090a77e07377eefb3f731d9\` ON \`template\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` ON \`template\` (\`communityGuidelinesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` ON \`template\` (\`calloutId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` ON \`template\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_4318f97beabd362a8a09e9d320\` ON \`template\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\` (\`collaborationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a03169c3f86480ba3863924f4d\` ON \`context\` (\`ecosystemModelId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_658580aea4e1a892227e27db90\` ON \`ecosystem_model\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_bde98d59e8984e7d17034c3b93\` ON \`actor_group\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a2afa3851ea733de932251b3a1\` ON \`actor\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_7fbe50fa78a37776ad962cb764\` ON \`community\` (\`communicationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` ON \`community\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3b8f390d76263ef5996869da07\` ON \`community\` (\`roleSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\` (\`guidelinesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b038f74c8d4eadb839e78b99ce\` ON \`role_set\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_00905b142498f63e76d38fb254\` ON \`role_set\` (\`applicationFormId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b132226941570cb650a4023d49\` ON \`invitation\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` ON \`application\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_56f5614fff0028d40370499582\` ON \`application\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b61c694cacfab25533bd23d9ad\` ON \`user\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9466682df91534dd95e4dbaa61\` ON \`user\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_10458c50c10436b6d589b40e5c\` ON \`user\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_09f909622aa177a097256b7cc2\` ON \`user\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_028322b763dc94242dc9f638f9\` ON \`user\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` ON \`platform\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_dd88d373c64b04e24705d575c9\` ON \`platform\` (\`forumId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_ca469f5ec53a7719d155d60aca\` ON \`platform\` (\`libraryId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9f621c51dd854634d8766a9cfa\` ON \`platform\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_425bbb4b951f7f4629710763fc\` ON \`platform\` (\`licensingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3b0c92945f36d06f37de80285d\` ON \`forum\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5337074c9b818bb63e6f314c80\` ON \`discussion\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_2d8a3ca181c3f0346817685d21\` ON \`discussion\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a5dae5a376dd49c7c076893d40\` ON \`licensing\` (\`licensePolicyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_23d4d78ea8db637df031f86f03\` ON \`license_policy\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3879db652f2421337691219ace\` ON \`library\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_684b272e6f7459439d41d2879e\` ON \`community_guidelines\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_eb99e588873c788a68a035478a\` ON \`communication\` (\`updatesId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a20c5901817dd09d5906537e08\` ON \`communication\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_e8e32f1e59c349b406a4752e54\` ON \`user_group\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9912e4cfc1e09848a392a65151\` ON \`user_group\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` ON \`organization\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_d2cb77c14644156ec8e865608e\` ON \`organization\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\` (\`agentId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5a72d5b37312bac2e0a0115718\` ON \`organization\` (\`verificationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\` (\`preferenceSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_395aa74996a1f978b4969d114b\` ON \`organization\` (\`storageAggregatorId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` ON \`agent\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8e76dcf171c45875c44febb1d8\` ON \`preference_set\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b4cf0f96bf08cf396f68355522\` ON \`preference\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\` (\`lifecycleId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f67a2d25c945269d602c182fbc\` ON \`collaboration\` (\`timelineId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\` (\`tagsetTemplateSetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\` (\`innovationFlowId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_262ecf3f5d70b82a4833618425\` ON \`collaboration\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5fe58ece01b48496aebc04733d\` ON \`timeline\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` ON \`timeline\` (\`calendarId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_6e74d59afda096b68d12a69969\` ON \`calendar\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_b5069b11030e9608ee4468f850\` ON \`calendar_event\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` ON \`callout\` (\`framingId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` ON \`callout\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_6289dee12effb51320051c6f1f\` ON \`callout\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` ON \`callout\` (\`contributionDefaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` ON \`callout\` (\`contributionPolicyId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\` (\`linkId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\` (\`postId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` ON \`link\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_07f249ac87502495710a62c5c0\` ON \`link\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` ON \`post\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` ON \`post\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` ON \`post\` (\`commentsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f53e2d266432e58e538a366705\` ON \`callout_framing\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\` (\`whiteboardId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\` (\`profileId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` ON \`room\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_73e8ae665a49366ca7e2866a45\` ON \`reference\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_a96475631aba7dce41db03cc8b\` ON \`profile\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` ON \`profile\` (\`storageBucketId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` ON \`profile\` (\`locationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_0647707288c243e60091c8d862\` ON \`storage_aggregator\` (\`directStorageId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` ON \`document\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\` (\`tagsetId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\` (\`authorizationId\`)` - ); - } -} diff --git a/src/migrations/1728936661201-invitationCommunityExtraRole.ts b/src/migrations/1728936661201-invitationCommunityExtraRole.ts deleted file mode 100644 index 45ef02448d..0000000000 --- a/src/migrations/1728936661201-invitationCommunityExtraRole.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class InvitationCommunityExtraRole1728936661201 - implements MigrationInterface -{ - name = 'InvitationCommunityExtraRole1728936661201'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.renameColumn( - 'platform_invitation', - 'communityInvitedToParent', - 'roleSetInvitedToParent' - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD \`roleSetExtraRole\` varchar(128) NULL` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.renameColumn( - 'platform_invitation', - 'roleSetInvitedToParent', - 'communityInvitedToParent' - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP COLUMN \`roleSetExtraRole\`` - ); - } -} diff --git a/src/migrations/1729361588097-xstate5.ts b/src/migrations/1729361588097-xstate5.ts deleted file mode 100644 index af172b79aa..0000000000 --- a/src/migrations/1729361588097-xstate5.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class Xstate51729361588097 implements MigrationInterface { - name = 'Xstate51729361588097'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`lifecycle\` DROP COLUMN \`machineDef\`` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`lifecycle\` ADD \`machineDef\` text NULL` - ); - } -} diff --git a/src/migrations/1729511643484-setUpEmptyExternalMetadataForVcInteractions.ts b/src/migrations/1729511643484-setUpEmptyExternalMetadataForVcInteractions.ts deleted file mode 100644 index fdbd67b5de..0000000000 --- a/src/migrations/1729511643484-setUpEmptyExternalMetadataForVcInteractions.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class SetUpEmptyExternalMetadataForVcInteractions1729511643484 - implements MigrationInterface -{ - name = 'SetUpEmptyExternalMetadataForVcInteractions1729511643484'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`vc_interaction\` SET \`externalMetadata\` = '{}' WHERE externalMetadata IS NULL OR externalMetadata = ''` - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1728033222394-fixIndexesFKsRelations-1.ts b/src/migrations/1730367336792-schemaSetup.ts similarity index 60% rename from src/migrations/1728033222394-fixIndexesFKsRelations-1.ts rename to src/migrations/1730367336792-schemaSetup.ts index 12f4e0d62d..e28cabcc03 100644 --- a/src/migrations/1728033222394-fixIndexesFKsRelations-1.ts +++ b/src/migrations/1730367336792-schemaSetup.ts @@ -1,2561 +1,1701 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; -export class FixIndexesFKsRelations1728033222394 implements MigrationInterface { - name = 'FixIndexesFKsRelations1728033222394'; +export class SchemaSetup1730367336792 implements MigrationInterface { + name = 'SchemaSetup1730367336792'; public async up(queryRunner: QueryRunner): Promise { + // If there are migrations executed on the environment we exit the migration + const migrations = await queryRunner.query( + `SELECT name FROM migrations_typeorm;` + ); + + if (migrations.length > 0) { + return; + } await queryRunner.query( - `ALTER TABLE \`tagset\` ADD UNIQUE INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\` (\`authorizationId\`)` + `CREATE TABLE \`authorization_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`credentialRules\` text NOT NULL, \`privilegeRules\` text NOT NULL, \`verifiedCredentialRules\` text NOT NULL, \`anonymousReadAccess\` tinyint NOT NULL, \`type\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`visual\` ADD UNIQUE INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\` (\`authorizationId\`)` + `CREATE TABLE \`tagset_template_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\` (\`authorizationId\`)` + `CREATE TABLE \`tagset_template\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(128) NOT NULL, \`type\` varchar(128) NOT NULL, \`allowedValues\` text NOT NULL, \`defaultSelectedValue\` varchar(255) NULL, \`tagsetTemplateSetId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`document\` ADD UNIQUE INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\` (\`tagsetId\`)` + `CREATE TABLE \`tagset\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL DEFAULT 'default', \`type\` varchar(128) NOT NULL, \`tags\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`tagsetTemplateId\` char(36) NULL, UNIQUE INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD UNIQUE INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\` (\`authorizationId\`)` + `CREATE TABLE \`visual\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`uri\` varchar(2048) NOT NULL, \`minWidth\` int NOT NULL, \`maxWidth\` int NOT NULL, \`minHeight\` int NOT NULL, \`maxHeight\` int NOT NULL, \`aspectRatio\` decimal(3,1) NOT NULL, \`allowedTypes\` text NOT NULL, \`alternativeText\` varchar(120) NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD UNIQUE INDEX \`IDX_0647707288c243e60091c8d862\` (\`directStorageId\`)` + `CREATE TABLE \`location\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`city\` varchar(128) NULL, \`country\` varchar(128) NULL, \`addressLine1\` varchar(512) NULL, \`addressLine2\` varchar(512) NULL, \`stateOrProvince\` varchar(128) NULL, \`postalCode\` varchar(128) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD UNIQUE INDEX \`IDX_f2f48b57269987b13b415a0058\` (\`authorizationId\`)` + `CREATE TABLE \`document\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`createdBy\` char(36) NULL, \`displayName\` varchar(512) NOT NULL, \`mimeType\` varchar(128) NOT NULL, \`size\` int NOT NULL, \`externalID\` varchar(128) NOT NULL, \`temporaryLocation\` tinyint NOT NULL DEFAULT 0, \`authorizationId\` char(36) NULL, \`storageBucketId\` char(36) NULL, \`tagsetId\` char(36) NULL, UNIQUE INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` (\`authorizationId\`), UNIQUE INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` (\`tagsetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_a96475631aba7dce41db03cc8b\` (\`authorizationId\`)` + `CREATE TABLE \`storage_aggregator\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`parentStorageAggregatorId\` char(36) NULL, \`directStorageId\` char(36) NULL, UNIQUE INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` (\`authorizationId\`), UNIQUE INDEX \`REL_0647707288c243e60091c8d862\` (\`directStorageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_432056041df0e4337b17ff7b09\` (\`locationId\`)` + `CREATE TABLE \`storage_bucket\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`allowedMimeTypes\` text NOT NULL, \`maxFileSize\` int NOT NULL, \`authorizationId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`)` + `CREATE TABLE \`profile\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`displayName\` text NOT NULL, \`tagline\` text NULL, \`description\` text NULL, \`type\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`locationId\` char(36) NULL, \`storageBucketId\` char(36) NULL, UNIQUE INDEX \`REL_a96475631aba7dce41db03cc8b\` (\`authorizationId\`), UNIQUE INDEX \`REL_432056041df0e4337b17ff7b09\` (\`locationId\`), UNIQUE INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`reference\` ADD UNIQUE INDEX \`IDX_73e8ae665a49366ca7e2866a45\` (\`authorizationId\`)` + `CREATE TABLE \`reference\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`uri\` text NOT NULL, \`description\` text NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_73e8ae665a49366ca7e2866a45\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`room\` ADD UNIQUE INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\` (\`authorizationId\`)` + `CREATE TABLE \`vc_interaction\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`threadID\` varchar(44) NOT NULL, \`virtualContributorID\` char(36) NOT NULL, \`externalMetadata\` text NOT NULL, \`roomId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_d3b86160bb7d704212382b0ca4\` (\`authorizationId\`)` + `CREATE TABLE \`room\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`externalRoomID\` varchar(255) NOT NULL, \`messagesCount\` int NOT NULL, \`type\` varchar(128) NOT NULL, \`displayName\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD UNIQUE INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\` (\`profileId\`)` + `CREATE TABLE \`whiteboard\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`content\` longtext NOT NULL, \`createdBy\` char(36) NULL, \`contentUpdatePolicy\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_d3b86160bb7d704212382b0ca4\` (\`authorizationId\`), UNIQUE INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\` (\`authorizationId\`)` + `CREATE TABLE \`callout_framing\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`whiteboardId\` char(36) NULL, UNIQUE INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` (\`authorizationId\`), UNIQUE INDEX \`REL_f53e2d266432e58e538a366705\` (\`profileId\`), UNIQUE INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_f53e2d266432e58e538a366705\` (\`profileId\`)` + `CREATE TABLE \`callout_contribution_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`allowedContributionTypes\` text NOT NULL, \`state\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD UNIQUE INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`)` + `CREATE TABLE \`callout_contribution_defaults\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`postDescription\` text NULL, \`whiteboardContent\` longtext NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_390343b22abec869bf80041933\` (\`authorizationId\`)` + `CREATE TABLE \`post\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`createdBy\` char(36) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, UNIQUE INDEX \`REL_390343b22abec869bf80041933\` (\`authorizationId\`), UNIQUE INDEX \`REL_970844fcd10c2b6df7c1b49eac\` (\`profileId\`), UNIQUE INDEX \`REL_042b9825d770d6b3009ae206c2\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_970844fcd10c2b6df7c1b49eac\` (\`profileId\`)` + `CREATE TABLE \`link\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`uri\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_07f249ac87502495710a62c5c0\` (\`authorizationId\`), UNIQUE INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD UNIQUE INDEX \`IDX_042b9825d770d6b3009ae206c2\` (\`commentsId\`)` + `CREATE TABLE \`callout_contribution\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`createdBy\` char(36) NULL, \`sortOrder\` int NOT NULL, \`authorizationId\` char(36) NULL, \`whiteboardId\` char(36) NULL, \`postId\` char(36) NULL, \`linkId\` char(36) NULL, \`calloutId\` char(36) NULL, UNIQUE INDEX \`REL_dfa86c46f509a61c6510536cd9\` (\`authorizationId\`), UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`), UNIQUE INDEX \`REL_97fefc97fb254c30577696e1c0\` (\`postId\`), UNIQUE INDEX \`REL_bdf2d0eced5c95968a85caaaae\` (\`linkId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`link\` ADD UNIQUE INDEX \`IDX_07f249ac87502495710a62c5c0\` (\`authorizationId\`)` + `CREATE TABLE \`callout\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` text NOT NULL, \`isTemplate\` tinyint NOT NULL DEFAULT 0, \`createdBy\` char(36) NULL, \`visibility\` varchar(128) NOT NULL, \`sortOrder\` int NOT NULL, \`publishedBy\` char(36) NULL, \`publishedDate\` datetime NULL, \`authorizationId\` char(36) NULL, \`framingId\` char(36) NULL, \`contributionPolicyId\` char(36) NULL, \`contributionDefaultsId\` char(36) NULL, \`commentsId\` char(36) NULL, \`collaborationId\` char(36) NULL, UNIQUE INDEX \`REL_6289dee12effb51320051c6f1f\` (\`authorizationId\`), UNIQUE INDEX \`REL_cf776244b01436d8ca5cc76284\` (\`framingId\`), UNIQUE INDEX \`REL_1e740008a7e1512966e3b08414\` (\`contributionPolicyId\`), UNIQUE INDEX \`REL_36b0da55acff774d0845aeb55f\` (\`contributionDefaultsId\`), UNIQUE INDEX \`REL_62ed316cda7b75735b20307b47\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`link\` ADD UNIQUE INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\` (\`profileId\`)` + `CREATE TABLE \`calendar_event\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`createdBy\` char(36) NOT NULL, \`startDate\` datetime NOT NULL, \`wholeDay\` tinyint NOT NULL, \`multipleDays\` tinyint NOT NULL, \`durationMinutes\` int NOT NULL, \`durationDays\` int NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, \`calendarId\` char(36) NULL, UNIQUE INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` (\`authorizationId\`), UNIQUE INDEX \`REL_9349e137959f3ca5818c2e62b3\` (\`profileId\`), UNIQUE INDEX \`REL_b5069b11030e9608ee4468f850\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_dfa86c46f509a61c6510536cd9\` (\`authorizationId\`)` + `CREATE TABLE \`calendar\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_6e74d59afda096b68d12a69969\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`)` + `CREATE TABLE \`timeline\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`calendarId\` char(36) NULL, UNIQUE INDEX \`REL_5fe58ece01b48496aebc04733d\` (\`authorizationId\`), UNIQUE INDEX \`REL_56aae15a664b2889a1a11c2cf8\` (\`calendarId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_97fefc97fb254c30577696e1c0\` (\`postId\`)` + `CREATE TABLE \`innovation_flow\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`states\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` (\`authorizationId\`), UNIQUE INDEX \`REL_96a8cbe1706f459fd7d883be9b\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD UNIQUE INDEX \`IDX_bdf2d0eced5c95968a85caaaae\` (\`linkId\`)` + `CREATE TABLE \`collaboration\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`groupsStr\` text NOT NULL, \`authorizationId\` char(36) NULL, \`tagsetTemplateSetId\` char(36) NULL, \`timelineId\` char(36) NULL, \`innovationFlowId\` char(36) NULL, UNIQUE INDEX \`REL_262ecf3f5d70b82a4833618425\` (\`authorizationId\`), UNIQUE INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` (\`tagsetTemplateSetId\`), UNIQUE INDEX \`REL_f67a2d25c945269d602c182fbc\` (\`timelineId\`), UNIQUE INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` (\`innovationFlowId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_6289dee12effb51320051c6f1f\` (\`authorizationId\`)` + `CREATE TABLE \`lifecycle\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`machineState\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_cf776244b01436d8ca5cc76284\` (\`framingId\`)` + `CREATE TABLE \`organization_verification\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`organizationID\` varchar(36) NOT NULL, \`status\` varchar(128) NOT NULL DEFAULT 'not-verified', \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, UNIQUE INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` (\`authorizationId\`), UNIQUE INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_1e740008a7e1512966e3b08414\` (\`contributionPolicyId\`)` + `CREATE TABLE \`preference_definition\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`definitionSet\` varchar(128) NOT NULL, \`groupName\` varchar(128) NOT NULL, \`displayName\` varchar(128) NOT NULL, \`description\` varchar(255) NOT NULL, \`valueType\` varchar(16) NOT NULL, \`type\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_36b0da55acff774d0845aeb55f\` (\`contributionDefaultsId\`)` + `CREATE TABLE \`preference\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`value\` varchar(16) NOT NULL, \`authorizationId\` char(36) NULL, \`preferenceDefinitionId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, UNIQUE INDEX \`REL_b4cf0f96bf08cf396f68355522\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`callout\` ADD UNIQUE INDEX \`IDX_62ed316cda7b75735b20307b47\` (\`commentsId\`)` + `CREATE TABLE \`preference_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_8e76dcf171c45875c44febb1d8\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\` (\`authorizationId\`)` + `CREATE TABLE \`credential\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`resourceID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`issuer\` char(36) NULL, \`expires\` datetime NULL, \`agentId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_9349e137959f3ca5818c2e62b3\` (\`profileId\`)` + `CREATE TABLE \`agent\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`did\` varchar(255) NULL, \`password\` varchar(255) NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD UNIQUE INDEX \`IDX_b5069b11030e9608ee4468f850\` (\`commentsId\`)` + `CREATE TABLE \`organization\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`accountID\` char(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`legalEntityName\` varchar(255) NOT NULL, \`domain\` varchar(255) NOT NULL, \`website\` varchar(255) NOT NULL, \`contactEmail\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`verificationId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`IDX_9fdd8f0bfe04a676822c7265e1\` (\`rowId\`), UNIQUE INDEX \`REL_e0e150e4f11d906b931b46a2d8\` (\`authorizationId\`), UNIQUE INDEX \`REL_d2cb77c14644156ec8e865608e\` (\`profileId\`), UNIQUE INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` (\`agentId\`), UNIQUE INDEX \`REL_5a72d5b37312bac2e0a0115718\` (\`verificationId\`), UNIQUE INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` (\`preferenceSetId\`), UNIQUE INDEX \`REL_395aa74996a1f978b4969d114b\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`calendar\` ADD UNIQUE INDEX \`IDX_6e74d59afda096b68d12a69969\` (\`authorizationId\`)` + `CREATE TABLE \`user_group\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`organizationId\` char(36) NULL, \`communityId\` char(36) NULL, UNIQUE INDEX \`REL_e8e32f1e59c349b406a4752e54\` (\`authorizationId\`), UNIQUE INDEX \`REL_9912e4cfc1e09848a392a65151\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_5fe58ece01b48496aebc04733d\` (\`authorizationId\`)` + `CREATE TABLE \`communication\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`spaceID\` varchar(36) NOT NULL, \`displayName\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, \`updatesId\` char(36) NULL, UNIQUE INDEX \`REL_a20c5901817dd09d5906537e08\` (\`authorizationId\`), UNIQUE INDEX \`REL_eb99e588873c788a68a035478a\` (\`updatesId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`timeline\` ADD UNIQUE INDEX \`IDX_56aae15a664b2889a1a11c2cf8\` (\`calendarId\`)` + `CREATE TABLE \`community_guidelines\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_684b272e6f7459439d41d2879e\` (\`authorizationId\`), UNIQUE INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\` (\`authorizationId\`)` + `CREATE TABLE \`role\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NOT NULL, \`credential\` text NOT NULL, \`parentCredentials\` text NOT NULL, \`requiresEntryRole\` tinyint NOT NULL, \`requiresSameRoleInParentRoleSet\` tinyint NOT NULL, \`userPolicy\` text NOT NULL, \`organizationPolicy\` text NOT NULL, \`virtualContributorPolicy\` text NOT NULL, \`roleSetId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD UNIQUE INDEX \`IDX_96a8cbe1706f459fd7d883be9b\` (\`profileId\`)` + `CREATE TABLE \`form\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`questions\` text NOT NULL, \`description\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_262ecf3f5d70b82a4833618425\` (\`authorizationId\`)` + `CREATE TABLE \`library\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_3879db652f2421337691219ace\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\` (\`tagsetTemplateSetId\`)` + `CREATE TABLE \`license_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`credentialRulesStr\` text NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_23d4d78ea8db637df031f86f03\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_f67a2d25c945269d602c182fbc\` (\`timelineId\`)` + `CREATE TABLE \`license_plan\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` text NOT NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`sortOrder\` int NOT NULL, \`pricePerMonth\` decimal(10,2) NULL, \`isFree\` tinyint NOT NULL DEFAULT 0, \`trialEnabled\` tinyint NOT NULL DEFAULT 0, \`requiresPaymentMethod\` tinyint NOT NULL DEFAULT 0, \`requiresContactSupport\` tinyint NOT NULL DEFAULT 0, \`licenseCredential\` text NOT NULL, \`type\` varchar(128) NOT NULL, \`assignToNewOrganizationAccounts\` tinyint NOT NULL DEFAULT 0, \`assignToNewUserAccounts\` tinyint NOT NULL DEFAULT 0, \`licensingId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD UNIQUE INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\` (\`innovationFlowId\`)` + `CREATE TABLE \`licensing\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`licensePolicyId\` char(36) NULL, UNIQUE INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` (\`authorizationId\`), UNIQUE INDEX \`REL_a5dae5a376dd49c7c076893d40\` (\`licensePolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\` (\`authorizationId\`)` + `CREATE TABLE \`discussion\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`category\` text NOT NULL, \`createdBy\` char(36) NOT NULL, \`privacy\` varchar(255) NOT NULL DEFAULT 'authenticated', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, \`forumId\` char(36) NULL, UNIQUE INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` (\`authorizationId\`), UNIQUE INDEX \`REL_2d8a3ca181c3f0346817685d21\` (\`profileId\`), UNIQUE INDEX \`REL_5337074c9b818bb63e6f314c80\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD UNIQUE INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\` (\`lifecycleId\`)` + `CREATE TABLE \`forum\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`discussionCategories\` text NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_3b0c92945f36d06f37de80285d\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`preference\` ADD UNIQUE INDEX \`IDX_b4cf0f96bf08cf396f68355522\` (\`authorizationId\`)` + `CREATE TABLE \`platform\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`forumId\` char(36) NULL, \`libraryId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, \`licensingId\` char(36) NULL, UNIQUE INDEX \`REL_9f621c51dd854634d8766a9cfa\` (\`authorizationId\`), UNIQUE INDEX \`REL_dd88d373c64b04e24705d575c9\` (\`forumId\`), UNIQUE INDEX \`REL_ca469f5ec53a7719d155d60aca\` (\`libraryId\`), UNIQUE INDEX \`REL_f516dd9a46616999c7e9a6adc1\` (\`storageAggregatorId\`), UNIQUE INDEX \`REL_425bbb4b951f7f4629710763fc\` (\`licensingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD UNIQUE INDEX \`IDX_8e76dcf171c45875c44febb1d8\` (\`authorizationId\`)` + `CREATE TABLE \`platform_invitation\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`roleSetInvitedToParent\` tinyint NOT NULL DEFAULT 0, \`roleSetExtraRole\` varchar(128) NULL, \`platformRole\` varchar(128) NULL, \`email\` varchar(128) NOT NULL, \`firstName\` varchar(128) NULL, \`lastName\` varchar(128) NULL, \`createdBy\` char(36) NOT NULL, \`welcomeMessage\` varchar(512) NULL, \`profileCreated\` tinyint NOT NULL DEFAULT 0, \`authorizationId\` char(36) NULL, \`roleSetId\` char(36) NULL, \`platformId\` char(36) NULL, UNIQUE INDEX \`REL_c0448d2c992a62c9c11bd0f142\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`agent\` ADD UNIQUE INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\` (\`authorizationId\`)` + `CREATE TABLE \`nvp\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(128) NOT NULL, \`value\` varchar(512) NOT NULL, \`sortOrder\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_e0e150e4f11d906b931b46a2d8\` (\`authorizationId\`)` + `CREATE TABLE \`user\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`accountID\` char(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`accountUpn\` varchar(128) NOT NULL, \`firstName\` varchar(128) NOT NULL, \`lastName\` varchar(128) NOT NULL, \`email\` varchar(512) NOT NULL, \`phone\` varchar(128) NULL, \`serviceProfile\` tinyint NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`IDX_266bc44a18601f893566962df6\` (\`rowId\`), UNIQUE INDEX \`REL_09f909622aa177a097256b7cc2\` (\`authorizationId\`), UNIQUE INDEX \`REL_9466682df91534dd95e4dbaa61\` (\`profileId\`), UNIQUE INDEX \`REL_b61c694cacfab25533bd23d9ad\` (\`agentId\`), UNIQUE INDEX \`REL_028322b763dc94242dc9f638f9\` (\`preferenceSetId\`), UNIQUE INDEX \`REL_10458c50c10436b6d589b40e5c\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_d2cb77c14644156ec8e865608e\` (\`profileId\`)` + `CREATE TABLE \`application\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, \`userId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_56f5614fff0028d40370499582\` (\`authorizationId\`), UNIQUE INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\` (\`agentId\`)` + `CREATE TABLE \`invitation\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`invitedContributorID\` char(36) NOT NULL, \`createdBy\` char(36) NOT NULL, \`welcomeMessage\` varchar(512) NULL, \`invitedToParent\` tinyint NOT NULL DEFAULT 0, \`contributorType\` varchar(128) NOT NULL, \`extraRole\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_b132226941570cb650a4023d49\` (\`authorizationId\`), UNIQUE INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_5a72d5b37312bac2e0a0115718\` (\`verificationId\`)` + `CREATE TABLE \`role_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`entryRoleType\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`applicationFormId\` char(36) NULL, \`parentRoleSetId\` char(36) NULL, UNIQUE INDEX \`REL_b038f74c8d4eadb839e78b99ce\` (\`authorizationId\`), UNIQUE INDEX \`REL_00905b142498f63e76d38fb254\` (\`applicationFormId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\` (\`preferenceSetId\`)` + `CREATE TABLE \`community\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`parentID\` varchar(36) NOT NULL, \`authorizationId\` char(36) NULL, \`communicationId\` char(36) NULL, \`guidelinesId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` (\`authorizationId\`), UNIQUE INDEX \`REL_7fbe50fa78a37776ad962cb764\` (\`communicationId\`), UNIQUE INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` (\`guidelinesId\`), UNIQUE INDEX \`REL_3b8f390d76263ef5996869da07\` (\`roleSetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`organization\` ADD UNIQUE INDEX \`IDX_395aa74996a1f978b4969d114b\` (\`storageAggregatorId\`)` + `CREATE TABLE \`actor\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`description\` text NULL, \`value\` text NULL, \`impact\` varchar(255) NULL, \`authorizationId\` char(36) NULL, \`actorGroupId\` char(36) NULL, UNIQUE INDEX \`REL_a2afa3851ea733de932251b3a1\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`user_group\` ADD UNIQUE INDEX \`IDX_e8e32f1e59c349b406a4752e54\` (\`authorizationId\`)` + `CREATE TABLE \`actor_group\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`description\` text NULL, \`authorizationId\` char(36) NULL, \`ecosystemModelId\` char(36) NULL, UNIQUE INDEX \`REL_bde98d59e8984e7d17034c3b93\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`user_group\` ADD UNIQUE INDEX \`IDX_9912e4cfc1e09848a392a65151\` (\`profileId\`)` + `CREATE TABLE \`ecosystem_model\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`description\` varchar(255) NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_658580aea4e1a892227e27db90\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`communication\` ADD UNIQUE INDEX \`IDX_a20c5901817dd09d5906537e08\` (\`authorizationId\`)` + `CREATE TABLE \`context\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`vision\` text NULL, \`impact\` text NULL, \`who\` text NULL, \`authorizationId\` char(36) NULL, \`ecosystemModelId\` char(36) NULL, UNIQUE INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` (\`authorizationId\`), UNIQUE INDEX \`REL_a03169c3f86480ba3863924f4d\` (\`ecosystemModelId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`communication\` ADD UNIQUE INDEX \`IDX_eb99e588873c788a68a035478a\` (\`updatesId\`)` + `CREATE TABLE \`template\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`postDefaultDescription\` text NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`templatesSetId\` char(36) NULL, \`innovationFlowId\` char(36) NULL, \`communityGuidelinesId\` char(36) NULL, \`calloutId\` char(36) NULL, \`whiteboardId\` char(36) NULL, \`collaborationId\` char(36) NULL, UNIQUE INDEX \`REL_4318f97beabd362a8a09e9d320\` (\`authorizationId\`), UNIQUE INDEX \`REL_f58c3b144b6e010969e199beef\` (\`profileId\`), UNIQUE INDEX \`REL_45cf273f30c1fa509456b6b0dd\` (\`innovationFlowId\`), UNIQUE INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` (\`communityGuidelinesId\`), UNIQUE INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` (\`calloutId\`), UNIQUE INDEX \`REL_f09090a77e07377eefb3f731d9\` (\`whiteboardId\`), UNIQUE INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` (\`collaborationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD UNIQUE INDEX \`IDX_684b272e6f7459439d41d2879e\` (\`authorizationId\`)` + `CREATE TABLE \`templates_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_eb0176ef4b98c143322aa6f809\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD UNIQUE INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\` (\`profileId\`)` + `CREATE TABLE \`space_defaults\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`innovationFlowTemplateId\` char(36) NULL, UNIQUE INDEX \`REL_413ba75964e5a534e4bfa54846\` (\`authorizationId\`), UNIQUE INDEX \`REL_592a23e68922853bae6ebecd85\` (\`innovationFlowTemplateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`library\` ADD UNIQUE INDEX \`IDX_3879db652f2421337691219ace\` (\`authorizationId\`)` + `CREATE TABLE \`space\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`settingsStr\` text NOT NULL, \`type\` varchar(128) NOT NULL, \`levelZeroSpaceID\` char(36) NULL, \`level\` int NOT NULL, \`visibility\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`parentSpaceId\` char(36) NULL, \`accountId\` char(36) NULL, \`collaborationId\` char(36) NULL, \`contextId\` char(36) NULL, \`communityId\` char(36) NULL, \`agentId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, \`libraryId\` char(36) NULL, \`defaultsId\` char(36) NULL, UNIQUE INDEX \`IDX_0f03c61020ea0dfa0198c60304\` (\`rowId\`), UNIQUE INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` (\`authorizationId\`), UNIQUE INDEX \`REL_b4250035291aac1329d59224a9\` (\`profileId\`), UNIQUE INDEX \`REL_ea06eb8894469a0f262d929bf0\` (\`collaborationId\`), UNIQUE INDEX \`REL_cc0b08eb9679d3daa95153c2af\` (\`contextId\`), UNIQUE INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` (\`communityId\`), UNIQUE INDEX \`REL_9c664d684f987a735678b0ba82\` (\`agentId\`), UNIQUE INDEX \`REL_980c4643d7d9de1b97bc39f518\` (\`storageAggregatorId\`), UNIQUE INDEX \`REL_43559aeadc1a5169d17e81b3d4\` (\`libraryId\`), UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD UNIQUE INDEX \`IDX_23d4d78ea8db637df031f86f03\` (\`authorizationId\`)` + `CREATE TABLE \`ai_persona\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`aiPersonaServiceID\` varchar(128) NOT NULL, \`description\` text NULL, \`dataAccessMode\` varchar(128) NOT NULL, \`interactionModes\` text NOT NULL, \`bodyOfKnowledge\` text NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`licensing\` ADD UNIQUE INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\` (\`authorizationId\`)` + `CREATE TABLE \`virtual_contributor\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`accountId\` char(36) NULL, \`aiPersonaId\` char(36) NOT NULL, UNIQUE INDEX \`REL_e2eaa2213ac4454039cd8abc07\` (\`authorizationId\`), UNIQUE INDEX \`REL_4504c37764f6962ccbd165a21d\` (\`profileId\`), UNIQUE INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` (\`agentId\`), UNIQUE INDEX \`REL_55b8101bdf4f566645e928c26e\` (\`aiPersonaId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`licensing\` ADD UNIQUE INDEX \`IDX_a5dae5a376dd49c7c076893d40\` (\`licensePolicyId\`)` + `CREATE TABLE \`innovation_pack\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(36) NOT NULL DEFAULT 'account', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`accountId\` char(36) NULL, \`templatesSetId\` char(36) NULL, UNIQUE INDEX \`REL_8af8122897b05315e7eb892525\` (\`authorizationId\`), UNIQUE INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` (\`profileId\`), UNIQUE INDEX \`REL_a1441e46c8d36090e1f6477cea\` (\`templatesSetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\` (\`authorizationId\`)` + `CREATE TABLE \`account\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`agentId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`REL_91a165c1091a6959cc19d52239\` (\`authorizationId\`), UNIQUE INDEX \`REL_833582df0c439ab8c9adc5240d\` (\`agentId\`), UNIQUE INDEX \`REL_950221e932175dc7cf7c006488\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_2d8a3ca181c3f0346817685d21\` (\`profileId\`)` + `CREATE TABLE \`innovation_hub\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`subdomain\` varchar(63) NOT NULL, \`type\` varchar(255) NOT NULL, \`spaceVisibilityFilter\` varchar(255) NULL, \`spaceListFilter\` text NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(128) NOT NULL DEFAULT 'account', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`accountId\` char(36) NULL, UNIQUE INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` (\`nameID\`), UNIQUE INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` (\`subdomain\`), UNIQUE INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` (\`authorizationId\`), UNIQUE INDEX \`REL_36c8905c2c6c59467c60d94fd8\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`discussion\` ADD UNIQUE INDEX \`IDX_5337074c9b818bb63e6f314c80\` (\`commentsId\`)` + `CREATE TABLE \`activity\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`triggeredBy\` char(36) NOT NULL, \`resourceID\` char(36) NOT NULL, \`parentID\` char(36) NULL, \`collaborationID\` char(36) NOT NULL, \`messageID\` char(44) NULL, \`visibility\` tinyint NOT NULL, \`description\` varchar(512) NULL, \`type\` varchar(128) NOT NULL, UNIQUE INDEX \`IDX_07a39cea9426b689be25fd61de\` (\`rowId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`forum\` ADD UNIQUE INDEX \`IDX_3b0c92945f36d06f37de80285d\` (\`authorizationId\`)` + `CREATE TABLE \`ai_server\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_9d520fa5fed56042918e48fc4b\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_9f621c51dd854634d8766a9cfa\` (\`authorizationId\`)` + `CREATE TABLE \`ai_persona_service\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`engine\` varchar(128) NOT NULL, \`dataAccessMode\` varchar(128) NOT NULL, \`prompt\` text NOT NULL, \`bodyOfKnowledgeType\` varchar(128) NOT NULL, \`bodyOfKnowledgeID\` varchar(128) NULL, \`bodyOfKnowledgeLastUpdated\` datetime NULL, \`externalConfig\` text NULL, \`authorizationId\` char(36) NULL, \`aiServerId\` char(36) NULL, UNIQUE INDEX \`REL_79206feb0038b1c5597668dc4b\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_dd88d373c64b04e24705d575c9\` (\`forumId\`)` + `CREATE TABLE \`application_questions\` (\`applicationId\` char(36) NOT NULL, \`nvpId\` char(36) NOT NULL, INDEX \`IDX_8495fae86f13836b0745642baa\` (\`applicationId\`), INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` (\`nvpId\`), PRIMARY KEY (\`applicationId\`, \`nvpId\`)) ENGINE=InnoDB` ); await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_ca469f5ec53a7719d155d60aca\` (\`libraryId\`)` + `ALTER TABLE \`tagset_template\` ADD CONSTRAINT \`FK_96f23f044acf305c1699e0319d2\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_f516dd9a46616999c7e9a6adc1\` (\`storageAggregatorId\`)` + `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_eb59b98ee6ef26c993d0d75c83c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_425bbb4b951f7f4629710763fc\` (\`licensingId\`)` + `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_81fc213b2d9ad0cddeab1a9ce64\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD UNIQUE INDEX \`IDX_c0448d2c992a62c9c11bd0f142\` (\`authorizationId\`)` + `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_644155610ddc40dc4e19781c8f0\` FOREIGN KEY (\`tagsetTemplateId\`) REFERENCES \`tagset_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_09f909622aa177a097256b7cc2\` (\`authorizationId\`)` + `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_4fbd109f9bb84f58b7a3c60649c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_9466682df91534dd95e4dbaa61\` (\`profileId\`)` + `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_1104f3ef8497ca40d99b9f46b87\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_b61c694cacfab25533bd23d9ad\` (\`agentId\`)` + `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_d9e2dfcccf59233c17cc6bc6418\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_028322b763dc94242dc9f638f9\` (\`preferenceSetId\`)` + `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_851e50ec4be7c62a1f9b9a430bf\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`user\` ADD UNIQUE INDEX \`IDX_10458c50c10436b6d589b40e5c\` (\`storageAggregatorId\`)` + `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_9fb9257b14ec21daf5bc9aa4c8e\` FOREIGN KEY (\`tagsetId\`) REFERENCES \`tagset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`application\` ADD UNIQUE INDEX \`IDX_56f5614fff0028d40370499582\` (\`authorizationId\`)` + `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_f3b4d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`application\` ADD UNIQUE INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\` (\`lifecycleId\`)` + `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_b80c28f5335ab5442f63c644d94\` FOREIGN KEY (\`parentStorageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b132226941570cb650a4023d49\` (\`authorizationId\`)` + `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_0647707288c243e60091c8d8620\` FOREIGN KEY (\`directStorageId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`invitation\` ADD UNIQUE INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`)` + `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_f2f48b57269987b13b415a00587\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`role_set\` ADD UNIQUE INDEX \`IDX_b038f74c8d4eadb839e78b99ce\` (\`authorizationId\`)` + `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`role_set\` ADD UNIQUE INDEX \`IDX_00905b142498f63e76d38fb254\` (\`applicationFormId\`)` + `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_a96475631aba7dce41db03cc8b2\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\` (\`authorizationId\`)` + `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_432056041df0e4337b17ff7b09d\` FOREIGN KEY (\`locationId\`) REFERENCES \`location\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_7fbe50fa78a37776ad962cb764\` (\`communicationId\`)` + `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_4a1c74fd2a61b32d9d9500e0650\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\` (\`guidelinesId\`)` + `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_73e8ae665a49366ca7e2866a45d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`community\` ADD UNIQUE INDEX \`IDX_3b8f390d76263ef5996869da07\` (\`roleSetId\`)` + `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_2f46c698fc4c19a8cc233c5f255\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`actor\` ADD UNIQUE INDEX \`IDX_a2afa3851ea733de932251b3a1\` (\`authorizationId\`)` + `ALTER TABLE \`vc_interaction\` ADD CONSTRAINT \`FK_d6f78c95ff41cdd30e505a4ebbb\` FOREIGN KEY (\`roomId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD UNIQUE INDEX \`IDX_bde98d59e8984e7d17034c3b93\` (\`authorizationId\`)` + `ALTER TABLE \`room\` ADD CONSTRAINT \`FK_d1d94dd8e0c417b4188a05ccbca\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` ADD UNIQUE INDEX \`IDX_658580aea4e1a892227e27db90\` (\`authorizationId\`)` + `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_d3b86160bb7d704212382b0ca44\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`context\` ADD UNIQUE INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\` (\`authorizationId\`)` + `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_3f9e9e2798d2a4d84b16ee8477c\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`context\` ADD UNIQUE INDEX \`IDX_a03169c3f86480ba3863924f4d\` (\`ecosystemModelId\`)` + `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_c9d7c2c4eb8a1d012ddc6605da9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_4318f97beabd362a8a09e9d320\` (\`authorizationId\`)` + `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_f53e2d266432e58e538a366705d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_f58c3b144b6e010969e199beef\` (\`profileId\`)` + `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_45cf273f30c1fa509456b6b0dd\` (\`innovationFlowId\`)` + `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_390343b22abec869bf800419333\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\` (\`communityGuidelinesId\`)` + `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_970844fcd10c2b6df7c1b49eacf\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\` (\`calloutId\`)` + `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_042b9825d770d6b3009ae206c2f\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_f09090a77e07377eefb3f731d9\` (\`whiteboardId\`)` + `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_07f249ac87502495710a62c5c01\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`template\` ADD UNIQUE INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\` (\`collaborationId\`)` + `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_3bfc8c1aaec1395cc148268d3cd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD UNIQUE INDEX \`IDX_eb0176ef4b98c143322aa6f809\` (\`authorizationId\`)` + `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_dfa86c46f509a61c6510536cd9a\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD UNIQUE INDEX \`IDX_413ba75964e5a534e4bfa54846\` (\`authorizationId\`)` + `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD UNIQUE INDEX \`IDX_592a23e68922853bae6ebecd85\` (\`innovationFlowTemplateId\`)` + `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_97fefc97fb254c30577696e1c0a\` FOREIGN KEY (\`postId\`) REFERENCES \`post\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\` (\`authorizationId\`)` + `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`link\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_b4250035291aac1329d59224a9\` (\`profileId\`)` + `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_7370de8eb79ed00b0d403f2299a\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_ea06eb8894469a0f262d929bf0\` (\`collaborationId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_6289dee12effb51320051c6f1fc\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_cc0b08eb9679d3daa95153c2af\` (\`contextId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_cf776244b01436d8ca5cc762848\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\` (\`communityId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_1e740008a7e1512966e3b084148\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_9c664d684f987a735678b0ba82\` (\`agentId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_36b0da55acff774d0845aeb55f2\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_980c4643d7d9de1b97bc39f518\` (\`storageAggregatorId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_62ed316cda7b75735b20307b47e\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_43559aeadc1a5169d17e81b3d4\` (\`libraryId\`)` + `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_9b1c5ee044611ac78249194ec35\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`)` + `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_8ee86afa2808a4ab523b9ee6c5e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD UNIQUE INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\` (\`authorizationId\`)` + `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_9349e137959f3ca5818c2e62b3f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_e2eaa2213ac4454039cd8abc07\` (\`authorizationId\`)` + `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_b5069b11030e9608ee4468f850d\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_4504c37764f6962ccbd165a21d\` (\`profileId\`)` + `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_80ab7835e1749581a27462eb87f\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\` (\`agentId\`)` + `ALTER TABLE \`calendar\` ADD CONSTRAINT \`FK_6e74d59afda096b68d12a699691\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD UNIQUE INDEX \`IDX_55b8101bdf4f566645e928c26e\` (\`aiPersonaId\`)` + `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_5fe58ece01b48496aebc04733da\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_8af8122897b05315e7eb892525\` (\`authorizationId\`)` + `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_56aae15a664b2889a1a11c2cf82\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\` (\`profileId\`)` + `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_a6e050daa4c7a3ab1e411c36517\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD UNIQUE INDEX \`IDX_a1441e46c8d36090e1f6477cea\` (\`templatesSetId\`)` + `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_96a8cbe1706f459fd7d883be9bd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_91a165c1091a6959cc19d52239\` (\`authorizationId\`)` + `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_262ecf3f5d70b82a48336184251\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_833582df0c439ab8c9adc5240d\` (\`agentId\`)` + `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_b7ece56376ac7ca0b9a56c33b3a\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`account\` ADD UNIQUE INDEX \`IDX_950221e932175dc7cf7c006488\` (\`storageAggregatorId\`)` + `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_f67a2d25c945269d602c182fbc0\` FOREIGN KEY (\`timelineId\`) REFERENCES \`timeline\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` (\`nameID\`)` + `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_35c6b1de6d4d89dfe8e9c85d771\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` (\`subdomain\`)` + `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_c66eddab0caacb1ef8d46bcafdb\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\` (\`authorizationId\`)` + `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_1cc3b275fc2a9d9d9b0ae33b310\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD UNIQUE INDEX \`IDX_36c8905c2c6c59467c60d94fd8\` (\`profileId\`)` + `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_b4cf0f96bf08cf396f683555229\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD UNIQUE INDEX \`IDX_9d520fa5fed56042918e48fc4b\` (\`authorizationId\`)` + `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_46d60bf133073f749b8f07e534c\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD UNIQUE INDEX \`IDX_79206feb0038b1c5597668dc4b\` (\`authorizationId\`)` + `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_f4b5742f589e2ac8bfe48b708c0\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\` (\`authorizationId\`)` + `ALTER TABLE \`preference_set\` ADD CONSTRAINT \`FK_8e76dcf171c45875c44febb1d8d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\` (\`authorizationId\`)` + `ALTER TABLE \`credential\` ADD CONSTRAINT \`FK_dbe0929355f82e5995f0b7fd5e2\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\` (\`authorizationId\`)` + `ALTER TABLE \`agent\` ADD CONSTRAINT \`FK_8ed9d1af584fa62f1ad3405b33b\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\` (\`tagsetId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_e0e150e4f11d906b931b46a2d89\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\` (\`authorizationId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_d2cb77c14644156ec8e865608e0\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\` (\`directStorageId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7f1bec8979b57ed7ebd392a2ca9\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\` (\`authorizationId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_5a72d5b37312bac2e0a01157185\` FOREIGN KEY (\`verificationId\`) REFERENCES \`organization_verification\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\` (\`authorizationId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_58fd47c4a6ac8df9fe2bcaed874\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\` (\`locationId\`)` + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_395aa74996a1f978b4969d114b1\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\` (\`storageBucketId\`)` + `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_e8e32f1e59c349b406a4752e545\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\` (\`authorizationId\`)` + `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9912e4cfc1e09848a392a651514\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\` (\`authorizationId\`)` + `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_694ebec955a90e999d9926b7da8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\` (\`authorizationId\`)` + `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9fcc131f256e969d773327f07cb\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\` (\`profileId\`)` + `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_a20c5901817dd09d5906537e087\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\` (\`authorizationId\`)` + `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_eb99e588873c788a68a035478ab\` FOREIGN KEY (\`updatesId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\` (\`profileId\`)` + `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_684b272e6f7459439d41d2879ee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\` (\`whiteboardId\`)` + `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_390343b22abec869bf80041933\` ON \`post\` (\`authorizationId\`)` + `ALTER TABLE \`role\` ADD CONSTRAINT \`FK_66d695b73839e9b66ff1350d34f\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\` (\`profileId\`)` + `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_3879db652f2421337691219ace8\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\` (\`commentsId\`)` + `ALTER TABLE \`license_policy\` ADD CONSTRAINT \`FK_23d4d78ea8db637df031f86f030\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\` (\`authorizationId\`)` + `ALTER TABLE \`license_plan\` ADD CONSTRAINT \`FK_3030904030f5d30f483b49905d1\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\` (\`profileId\`)` + `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_0c6a4d0a6c13a3f5df6ac015096\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\` (\`authorizationId\`)` + `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_a5dae5a376dd49c7c076893d40b\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\` (\`whiteboardId\`)` + `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_4555dccdda9ba57d8e3a634cd0d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\` (\`postId\`)` + `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_2d8a3ca181c3f0346817685d21d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\` (\`linkId\`)` + `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_5337074c9b818bb63e6f314c808\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\` (\`authorizationId\`)` + `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_0de78853c1ee793f61bda7eff79\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\` (\`framingId\`)` + `ALTER TABLE \`forum\` ADD CONSTRAINT \`FK_3b0c92945f36d06f37de80285dd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\` (\`contributionPolicyId\`)` + `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_9f621c51dd854634d8766a9cfaf\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\` (\`contributionDefaultsId\`)` + `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_dd88d373c64b04e24705d575c99\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\` (\`commentsId\`)` + `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_ca469f5ec53a7719d155d60aca1\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\` (\`authorizationId\`)` + `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_f516dd9a46616999c7e9a6adc15\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\` (\`profileId\`)` + `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_425bbb4b951f7f4629710763fc0\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\` (\`commentsId\`)` + `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_c0448d2c992a62c9c11bd0f1422\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\` (\`authorizationId\`)` + `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_562dce4a08bb214f08107b3631e\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\` (\`authorizationId\`)` + `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_809c1e6cf3ef6be03a0a1db3f70\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\` (\`calendarId\`)` + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_09f909622aa177a097256b7cc22\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\` (\`authorizationId\`)` + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_9466682df91534dd95e4dbaa616\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\` (\`profileId\`)` + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_b61c694cacfab25533bd23d9add\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\` (\`authorizationId\`)` + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_028322b763dc94242dc9f638f9b\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\` (\`tagsetTemplateSetId\`)` + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_10458c50c10436b6d589b40e5ca\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\` (\`timelineId\`)` + `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_56f5614fff0028d403704995822\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\` (\`innovationFlowId\`)` + `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_7ec2857c7d8d16432ffca1cb3d9\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\` (\`authorizationId\`)` + `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_b4ae3fea4a24b4be1a86dacf8a2\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\` (\`lifecycleId\`)` + `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_8fb220ad1ac1f9c86ec39d134e4\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\` (\`authorizationId\`)` + `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b132226941570cb650a4023d493\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\` (\`authorizationId\`)` + `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b0c80ccf319a1c7a7af12b39987\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\` (\`authorizationId\`)` + `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_6a3b86c6db10582baae7058f5b9\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\` (\`authorizationId\`)` + `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_b038f74c8d4eadb839e78b99ce5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\` (\`profileId\`)` + `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_00905b142498f63e76d38fb254e\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\` (\`agentId\`)` + `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_86acc254af20d20c9d87c3503d5\` FOREIGN KEY (\`parentRoleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\` (\`verificationId\`)` + `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_6e7584bfb417bd0f8e8696ab585\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\` (\`preferenceSetId\`)` + `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_7fbe50fa78a37776ad962cb7643\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\` (\`storageAggregatorId\`)` + `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_2e7dd2fa8c829352cfbecb2cc93\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\` (\`authorizationId\`)` + `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3b8f390d76263ef5996869da071\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\` (\`profileId\`)` + `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_a2afa3851ea733de932251b3a1f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\` (\`authorizationId\`)` + `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_0f9d41ee193d631a5439bb4f404\` FOREIGN KEY (\`actorGroupId\`) REFERENCES \`actor_group\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\` (\`updatesId\`)` + `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_bde98d59e8984e7d17034c3b937\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\` (\`authorizationId\`)` + `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_cbb1d7afa052a184471723d3297\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\` (\`profileId\`)` + `ALTER TABLE \`ecosystem_model\` ADD CONSTRAINT \`FK_658580aea4e1a892227e27db902\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3879db652f2421337691219ace\` ON \`library\` (\`authorizationId\`)` + `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_5f0dbc3b097ef297bd5f4ddb1a9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\` (\`authorizationId\`)` + `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_a03169c3f86480ba3863924f4d7\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\` (\`authorizationId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_4318f97beabd362a8a09e9d3203\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\` (\`licensePolicyId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f58c3b144b6e010969e199beeff\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\` (\`authorizationId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c7f54e6269c013d9c273f025edd\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\` (\`profileId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_45cf273f30c1fa509456b6b0ddf\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\` (\`commentsId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_eedeae5e63f9a9c3a0161541e98\` FOREIGN KEY (\`communityGuidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\` (\`authorizationId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c6e4d1a07781a809ad3b3ee8265\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\` (\`authorizationId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f09090a77e07377eefb3f731d9f\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\` (\`forumId\`)` + `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_21fdaf6dc88bdd6e8839e29b0bd\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\` (\`libraryId\`)` + `ALTER TABLE \`templates_set\` ADD CONSTRAINT \`FK_eb0176ef4b98c143322aa6f8090\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\` (\`storageAggregatorId\`)` + `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_413ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\` (\`licensingId\`)` + `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_592a23e68922853bae6ebecd85e\` FOREIGN KEY (\`innovationFlowTemplateId\`) REFERENCES \`template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\` (\`authorizationId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_8d03fd2c8e8411ec9192c79cd99\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\` (\`authorizationId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_b4250035291aac1329d59224a96\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\` (\`profileId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\` (\`agentId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6bdeffaf6ea6159b4672a2aed70\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\` (\`preferenceSetId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ea06eb8894469a0f262d929bf06\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\` (\`storageAggregatorId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_cc0b08eb9679d3daa95153c2af5\` FOREIGN KEY (\`contextId\`) REFERENCES \`context\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\` (\`authorizationId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_68fa2c2b00cc1ed77e7c225e8ba\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\` (\`lifecycleId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_9c664d684f987a735678b0ba825\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\` (\`authorizationId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_980c4643d7d9de1b97bc39f5185\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\` (\`lifecycleId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_43559aeadc1a5169d17e81b3d45\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b038f74c8d4eadb839e78b99ce\` ON \`role_set\` (\`authorizationId\`)` + `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_00905b142498f63e76d38fb254\` ON \`role_set\` (\`applicationFormId\`)` + `ALTER TABLE \`ai_persona\` ADD CONSTRAINT \`FK_293f0d3ef60cb0ca0006044ecfd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\` (\`authorizationId\`)` + `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_e2eaa2213ac4454039cd8abc07d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\` (\`communicationId\`)` + `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_4504c37764f6962ccbd165a21de\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\` (\`guidelinesId\`)` + `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a8890dcd65b8c3ee6e160d33f3a\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\` (\`roleSetId\`)` + `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7a962c9b04b0d197bc3c93262a7\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\` (\`authorizationId\`)` + `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_55b8101bdf4f566645e928c26e3\` FOREIGN KEY (\`aiPersonaId\`) REFERENCES \`ai_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\` (\`authorizationId\`)` + `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_8af8122897b05315e7eb8925253\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\` (\`authorizationId\`)` + `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_5facd6d188068a5a1c5b6f07fc3\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\` (\`authorizationId\`)` + `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_51014590f9644e6ff9e0536f40f\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\` (\`ecosystemModelId\`)` + `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_a1441e46c8d36090e1f6477cea5\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4318f97beabd362a8a09e9d320\` ON \`template\` (\`authorizationId\`)` + `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_91a165c1091a6959cc19d522399\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f58c3b144b6e010969e199beef\` ON \`template\` (\`profileId\`)` + `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_833582df0c439ab8c9adc5240d1\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_45cf273f30c1fa509456b6b0dd\` ON \`template\` (\`innovationFlowId\`)` + `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_950221e932175dc7cf7c0064887\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` ON \`template\` (\`communityGuidelinesId\`)` + `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_b411e4f27d77a96eccdabbf4b45\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` ON \`template\` (\`calloutId\`)` + `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_36c8905c2c6c59467c60d94fd8a\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_f09090a77e07377eefb3f731d9\` ON \`template\` (\`whiteboardId\`)` + `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_156fd30246eb151b9d17716abf5\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\` (\`collaborationId\`)` + `ALTER TABLE \`ai_server\` ADD CONSTRAINT \`FK_9d520fa5fed56042918e48fc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\` (\`authorizationId\`)` + `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_79206feb0038b1c5597668dc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\` (\`authorizationId\`)` + `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_b9f20da98058d7bd474152ed6ce\` FOREIGN KEY (\`aiServerId\`) REFERENCES \`ai_server\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\` (\`innovationFlowTemplateId\`)` + `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_8495fae86f13836b0745642baa8\` FOREIGN KEY (\`applicationId\`) REFERENCES \`application\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\` (\`authorizationId\`)` + `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_fe50118fd82e7fe2f74f986a195\` FOREIGN KEY (\`nvpId\`) REFERENCES \`nvp\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\` (\`profileId\`)` + `CREATE TABLE \`query-result-cache\` (\`id\` int NOT NULL AUTO_INCREMENT, \`identifier\` varchar(255) NULL, \`time\` bigint NOT NULL, \`duration\` int NOT NULL, \`query\` text NOT NULL, \`result\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE \`query-result-cache\``); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\` (\`collaborationId\`)` + `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_fe50118fd82e7fe2f74f986a195\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\` (\`contextId\`)` + `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_8495fae86f13836b0745642baa8\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\` (\`communityId\`)` + `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_b9f20da98058d7bd474152ed6ce\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\` (\`agentId\`)` + `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_79206feb0038b1c5597668dc4b5\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\` (\`storageAggregatorId\`)` + `ALTER TABLE \`ai_server\` DROP FOREIGN KEY \`FK_9d520fa5fed56042918e48fc4b5\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\` (\`libraryId\`)` + `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_156fd30246eb151b9d17716abf5\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` + `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_36c8905c2c6c59467c60d94fd8a\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\` (\`authorizationId\`)` + `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_b411e4f27d77a96eccdabbf4b45\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\` (\`authorizationId\`)` + `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_950221e932175dc7cf7c0064887\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\` (\`profileId\`)` + `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_833582df0c439ab8c9adc5240d1\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\` (\`agentId\`)` + `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_91a165c1091a6959cc19d522399\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\` (\`aiPersonaId\`)` + `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_a1441e46c8d36090e1f6477cea5\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\` (\`authorizationId\`)` + `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_51014590f9644e6ff9e0536f40f\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\` (\`profileId\`)` + `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_5facd6d188068a5a1c5b6f07fc3\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\` (\`templatesSetId\`)` + `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_8af8122897b05315e7eb8925253\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\` (\`authorizationId\`)` + `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_55b8101bdf4f566645e928c26e3\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\` (\`agentId\`)` + `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7a962c9b04b0d197bc3c93262a7\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\` (\`storageAggregatorId\`)` + `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a8890dcd65b8c3ee6e160d33f3a\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\` (\`authorizationId\`)` + `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_4504c37764f6962ccbd165a21de\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\` (\`profileId\`)` + `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_e2eaa2213ac4454039cd8abc07d\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\` (\`authorizationId\`)` + `ALTER TABLE \`ai_persona\` DROP FOREIGN KEY \`FK_293f0d3ef60cb0ca0006044ecfd\`` ); await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\` (\`authorizationId\`)` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` ); await queryRunner.query( - `CREATE INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\` (\`applicationId\`)` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_43559aeadc1a5169d17e81b3d45\`` ); await queryRunner.query( - `CREATE INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\` (\`nvpId\`)` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_980c4643d7d9de1b97bc39f5185\`` ); await queryRunner.query( - `ALTER TABLE \`tagset_template\` ADD CONSTRAINT \`FK_96f23f044acf305c1699e0319d2\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_9c664d684f987a735678b0ba825\`` ); await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_eb59b98ee6ef26c993d0d75c83c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_68fa2c2b00cc1ed77e7c225e8ba\`` ); await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_81fc213b2d9ad0cddeab1a9ce64\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_cc0b08eb9679d3daa95153c2af5\`` ); await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_644155610ddc40dc4e19781c8f0\` FOREIGN KEY (\`tagsetTemplateId\`) REFERENCES \`tagset_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ea06eb8894469a0f262d929bf06\`` ); await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_4fbd109f9bb84f58b7a3c60649c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` ); await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_1104f3ef8497ca40d99b9f46b87\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ef1ff4ac7f613cc0677e2295b30\`` ); await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_d9e2dfcccf59233c17cc6bc6418\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_b4250035291aac1329d59224a96\`` ); await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_851e50ec4be7c62a1f9b9a430bf\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_8d03fd2c8e8411ec9192c79cd99\`` ); await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_9fb9257b14ec21daf5bc9aa4c8e\` FOREIGN KEY (\`tagsetId\`) REFERENCES \`tagset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_592a23e68922853bae6ebecd85e\`` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_f3b4d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_413ba75964e5a534e4bfa54846e\`` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_b80c28f5335ab5442f63c644d94\` FOREIGN KEY (\`parentStorageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`templates_set\` DROP FOREIGN KEY \`FK_eb0176ef4b98c143322aa6f8090\`` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_0647707288c243e60091c8d8620\` FOREIGN KEY (\`directStorageId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_21fdaf6dc88bdd6e8839e29b0bd\`` ); await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_f2f48b57269987b13b415a00587\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f09090a77e07377eefb3f731d9f\`` ); await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c6e4d1a07781a809ad3b3ee8265\`` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_a96475631aba7dce41db03cc8b2\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_eedeae5e63f9a9c3a0161541e98\`` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_432056041df0e4337b17ff7b09d\` FOREIGN KEY (\`locationId\`) REFERENCES \`location\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_45cf273f30c1fa509456b6b0ddf\`` ); await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_4a1c74fd2a61b32d9d9500e0650\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c7f54e6269c013d9c273f025edd\`` ); await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_73e8ae665a49366ca7e2866a45d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f58c3b144b6e010969e199beeff\`` ); await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_2f46c698fc4c19a8cc233c5f255\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_4318f97beabd362a8a09e9d3203\`` ); await queryRunner.query( - `ALTER TABLE \`vc_interaction\` ADD CONSTRAINT \`FK_d6f78c95ff41cdd30e505a4ebbb\` FOREIGN KEY (\`roomId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_a03169c3f86480ba3863924f4d7\`` ); await queryRunner.query( - `ALTER TABLE \`room\` ADD CONSTRAINT \`FK_d1d94dd8e0c417b4188a05ccbca\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_5f0dbc3b097ef297bd5f4ddb1a9\`` ); await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_d3b86160bb7d704212382b0ca44\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`ecosystem_model\` DROP FOREIGN KEY \`FK_658580aea4e1a892227e27db902\`` ); await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_3f9e9e2798d2a4d84b16ee8477c\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_cbb1d7afa052a184471723d3297\`` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_c9d7c2c4eb8a1d012ddc6605da9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_bde98d59e8984e7d17034c3b937\`` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_f53e2d266432e58e538a366705d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_0f9d41ee193d631a5439bb4f404\`` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_a2afa3851ea733de932251b3a1f\`` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_390343b22abec869bf800419333\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3b8f390d76263ef5996869da071\`` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_970844fcd10c2b6df7c1b49eacf\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_2e7dd2fa8c829352cfbecb2cc93\`` ); await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_042b9825d770d6b3009ae206c2f\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_7fbe50fa78a37776ad962cb7643\`` ); await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_07f249ac87502495710a62c5c01\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_6e7584bfb417bd0f8e8696ab585\`` ); await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_3bfc8c1aaec1395cc148268d3cd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_86acc254af20d20c9d87c3503d5\`` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_dfa86c46f509a61c6510536cd9a\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_97fefc97fb254c30577696e1c0a\` FOREIGN KEY (\`postId\`) REFERENCES \`post\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`link\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_7370de8eb79ed00b0d403f2299a\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_6289dee12effb51320051c6f1fc\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_cf776244b01436d8ca5cc762848\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_1e740008a7e1512966e3b084148\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_36b0da55acff774d0845aeb55f2\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_62ed316cda7b75735b20307b47e\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_9b1c5ee044611ac78249194ec35\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_8ee86afa2808a4ab523b9ee6c5e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_9349e137959f3ca5818c2e62b3f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_b5069b11030e9608ee4468f850d\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_80ab7835e1749581a27462eb87f\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD CONSTRAINT \`FK_6e74d59afda096b68d12a699691\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_5fe58ece01b48496aebc04733da\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_56aae15a664b2889a1a11c2cf82\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_a6e050daa4c7a3ab1e411c36517\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_96a8cbe1706f459fd7d883be9bd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_262ecf3f5d70b82a48336184251\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_b7ece56376ac7ca0b9a56c33b3a\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_f67a2d25c945269d602c182fbc0\` FOREIGN KEY (\`timelineId\`) REFERENCES \`timeline\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_35c6b1de6d4d89dfe8e9c85d771\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_c66eddab0caacb1ef8d46bcafdb\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_1cc3b275fc2a9d9d9b0ae33b310\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_b4cf0f96bf08cf396f683555229\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_46d60bf133073f749b8f07e534c\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_f4b5742f589e2ac8bfe48b708c0\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD CONSTRAINT \`FK_8e76dcf171c45875c44febb1d8d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` ADD CONSTRAINT \`FK_dbe0929355f82e5995f0b7fd5e2\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` ADD CONSTRAINT \`FK_8ed9d1af584fa62f1ad3405b33b\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_e0e150e4f11d906b931b46a2d89\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_d2cb77c14644156ec8e865608e0\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7f1bec8979b57ed7ebd392a2ca9\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_5a72d5b37312bac2e0a01157185\` FOREIGN KEY (\`verificationId\`) REFERENCES \`organization_verification\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_58fd47c4a6ac8df9fe2bcaed874\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_395aa74996a1f978b4969d114b1\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_e8e32f1e59c349b406a4752e545\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9912e4cfc1e09848a392a651514\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_694ebec955a90e999d9926b7da8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9fcc131f256e969d773327f07cb\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_a20c5901817dd09d5906537e087\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_eb99e588873c788a68a035478ab\` FOREIGN KEY (\`updatesId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_684b272e6f7459439d41d2879ee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role\` ADD CONSTRAINT \`FK_66d695b73839e9b66ff1350d34f\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_3879db652f2421337691219ace8\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD CONSTRAINT \`FK_23d4d78ea8db637df031f86f030\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD CONSTRAINT \`FK_3030904030f5d30f483b49905d1\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_0c6a4d0a6c13a3f5df6ac015096\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_a5dae5a376dd49c7c076893d40b\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_4555dccdda9ba57d8e3a634cd0d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_2d8a3ca181c3f0346817685d21d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_5337074c9b818bb63e6f314c808\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_0de78853c1ee793f61bda7eff79\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` ADD CONSTRAINT \`FK_3b0c92945f36d06f37de80285dd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_9f621c51dd854634d8766a9cfaf\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_dd88d373c64b04e24705d575c99\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_ca469f5ec53a7719d155d60aca1\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_f516dd9a46616999c7e9a6adc15\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_425bbb4b951f7f4629710763fc0\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_c0448d2c992a62c9c11bd0f1422\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_562dce4a08bb214f08107b3631e\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_809c1e6cf3ef6be03a0a1db3f70\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_09f909622aa177a097256b7cc22\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_9466682df91534dd95e4dbaa616\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_b61c694cacfab25533bd23d9add\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_028322b763dc94242dc9f638f9b\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_10458c50c10436b6d589b40e5ca\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_56f5614fff0028d403704995822\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_7ec2857c7d8d16432ffca1cb3d9\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_b4ae3fea4a24b4be1a86dacf8a2\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_8fb220ad1ac1f9c86ec39d134e4\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b132226941570cb650a4023d493\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b0c80ccf319a1c7a7af12b39987\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_6a3b86c6db10582baae7058f5b9\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_b038f74c8d4eadb839e78b99ce5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_00905b142498f63e76d38fb254e\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_86acc254af20d20c9d87c3503d5\` FOREIGN KEY (\`parentRoleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_6e7584bfb417bd0f8e8696ab585\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_7fbe50fa78a37776ad962cb7643\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_2e7dd2fa8c829352cfbecb2cc93\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3b8f390d76263ef5996869da071\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_a2afa3851ea733de932251b3a1f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_0f9d41ee193d631a5439bb4f404\` FOREIGN KEY (\`actorGroupId\`) REFERENCES \`actor_group\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_bde98d59e8984e7d17034c3b937\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_cbb1d7afa052a184471723d3297\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` ADD CONSTRAINT \`FK_658580aea4e1a892227e27db902\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_5f0dbc3b097ef297bd5f4ddb1a9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_a03169c3f86480ba3863924f4d7\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_4318f97beabd362a8a09e9d3203\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f58c3b144b6e010969e199beeff\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c7f54e6269c013d9c273f025edd\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_45cf273f30c1fa509456b6b0ddf\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_eedeae5e63f9a9c3a0161541e98\` FOREIGN KEY (\`communityGuidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c6e4d1a07781a809ad3b3ee8265\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f09090a77e07377eefb3f731d9f\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_21fdaf6dc88bdd6e8839e29b0bd\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD CONSTRAINT \`FK_eb0176ef4b98c143322aa6f8090\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_413ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_592a23e68922853bae6ebecd85e\` FOREIGN KEY (\`innovationFlowTemplateId\`) REFERENCES \`template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_8d03fd2c8e8411ec9192c79cd99\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_b4250035291aac1329d59224a96\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6bdeffaf6ea6159b4672a2aed70\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ea06eb8894469a0f262d929bf06\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_cc0b08eb9679d3daa95153c2af5\` FOREIGN KEY (\`contextId\`) REFERENCES \`context\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_68fa2c2b00cc1ed77e7c225e8ba\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_9c664d684f987a735678b0ba825\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_980c4643d7d9de1b97bc39f5185\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_43559aeadc1a5169d17e81b3d45\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD CONSTRAINT \`FK_293f0d3ef60cb0ca0006044ecfd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_e2eaa2213ac4454039cd8abc07d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_4504c37764f6962ccbd165a21de\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a8890dcd65b8c3ee6e160d33f3a\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7a962c9b04b0d197bc3c93262a7\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_55b8101bdf4f566645e928c26e3\` FOREIGN KEY (\`aiPersonaId\`) REFERENCES \`ai_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_8af8122897b05315e7eb8925253\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_5facd6d188068a5a1c5b6f07fc3\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_51014590f9644e6ff9e0536f40f\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_a1441e46c8d36090e1f6477cea5\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_91a165c1091a6959cc19d522399\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_833582df0c439ab8c9adc5240d1\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_950221e932175dc7cf7c0064887\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_b411e4f27d77a96eccdabbf4b45\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_36c8905c2c6c59467c60d94fd8a\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_156fd30246eb151b9d17716abf5\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD CONSTRAINT \`FK_9d520fa5fed56042918e48fc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_79206feb0038b1c5597668dc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_b9f20da98058d7bd474152ed6ce\` FOREIGN KEY (\`aiServerId\`) REFERENCES \`ai_server\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_8495fae86f13836b0745642baa8\` FOREIGN KEY (\`applicationId\`) REFERENCES \`application\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_fe50118fd82e7fe2f74f986a195\` FOREIGN KEY (\`nvpId\`) REFERENCES \`nvp\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_fe50118fd82e7fe2f74f986a195\`` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_8495fae86f13836b0745642baa8\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_b9f20da98058d7bd474152ed6ce\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_79206feb0038b1c5597668dc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` DROP FOREIGN KEY \`FK_9d520fa5fed56042918e48fc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_156fd30246eb151b9d17716abf5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_36c8905c2c6c59467c60d94fd8a\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_b411e4f27d77a96eccdabbf4b45\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_950221e932175dc7cf7c0064887\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_833582df0c439ab8c9adc5240d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_91a165c1091a6959cc19d522399\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_a1441e46c8d36090e1f6477cea5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_51014590f9644e6ff9e0536f40f\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_5facd6d188068a5a1c5b6f07fc3\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_8af8122897b05315e7eb8925253\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_55b8101bdf4f566645e928c26e3\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7a962c9b04b0d197bc3c93262a7\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a8890dcd65b8c3ee6e160d33f3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_4504c37764f6962ccbd165a21de\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_e2eaa2213ac4454039cd8abc07d\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP FOREIGN KEY \`FK_293f0d3ef60cb0ca0006044ecfd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_43559aeadc1a5169d17e81b3d45\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_980c4643d7d9de1b97bc39f5185\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_9c664d684f987a735678b0ba825\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_68fa2c2b00cc1ed77e7c225e8ba\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_cc0b08eb9679d3daa95153c2af5\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ea06eb8894469a0f262d929bf06\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ef1ff4ac7f613cc0677e2295b30\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_b4250035291aac1329d59224a96\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_8d03fd2c8e8411ec9192c79cd99\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_592a23e68922853bae6ebecd85e\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_413ba75964e5a534e4bfa54846e\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP FOREIGN KEY \`FK_eb0176ef4b98c143322aa6f8090\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_21fdaf6dc88bdd6e8839e29b0bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f09090a77e07377eefb3f731d9f\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c6e4d1a07781a809ad3b3ee8265\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_eedeae5e63f9a9c3a0161541e98\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_45cf273f30c1fa509456b6b0ddf\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c7f54e6269c013d9c273f025edd\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f58c3b144b6e010969e199beeff\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_4318f97beabd362a8a09e9d3203\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_a03169c3f86480ba3863924f4d7\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_5f0dbc3b097ef297bd5f4ddb1a9\`` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` DROP FOREIGN KEY \`FK_658580aea4e1a892227e27db902\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_cbb1d7afa052a184471723d3297\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_bde98d59e8984e7d17034c3b937\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_0f9d41ee193d631a5439bb4f404\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_a2afa3851ea733de932251b3a1f\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3b8f390d76263ef5996869da071\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_2e7dd2fa8c829352cfbecb2cc93\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_7fbe50fa78a37776ad962cb7643\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_6e7584bfb417bd0f8e8696ab585\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_86acc254af20d20c9d87c3503d5\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_00905b142498f63e76d38fb254e\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_b038f74c8d4eadb839e78b99ce5\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_6a3b86c6db10582baae7058f5b9\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b0c80ccf319a1c7a7af12b39987\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b132226941570cb650a4023d493\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_8fb220ad1ac1f9c86ec39d134e4\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_b4ae3fea4a24b4be1a86dacf8a2\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_7ec2857c7d8d16432ffca1cb3d9\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_56f5614fff0028d403704995822\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_10458c50c10436b6d589b40e5ca\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_028322b763dc94242dc9f638f9b\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_b61c694cacfab25533bd23d9add\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_9466682df91534dd95e4dbaa616\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_09f909622aa177a097256b7cc22\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_809c1e6cf3ef6be03a0a1db3f70\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_562dce4a08bb214f08107b3631e\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_c0448d2c992a62c9c11bd0f1422\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_425bbb4b951f7f4629710763fc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_f516dd9a46616999c7e9a6adc15\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_ca469f5ec53a7719d155d60aca1\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_dd88d373c64b04e24705d575c99\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_9f621c51dd854634d8766a9cfaf\`` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` DROP FOREIGN KEY \`FK_3b0c92945f36d06f37de80285dd\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_0de78853c1ee793f61bda7eff79\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_5337074c9b818bb63e6f314c808\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_2d8a3ca181c3f0346817685d21d\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_4555dccdda9ba57d8e3a634cd0d\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_a5dae5a376dd49c7c076893d40b\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_0c6a4d0a6c13a3f5df6ac015096\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP FOREIGN KEY \`FK_3030904030f5d30f483b49905d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP FOREIGN KEY \`FK_23d4d78ea8db637df031f86f030\`` - ); - await queryRunner.query( - `ALTER TABLE \`library\` DROP FOREIGN KEY \`FK_3879db652f2421337691219ace8\`` - ); - await queryRunner.query( - `ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_66d695b73839e9b66ff1350d34f\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_684b272e6f7459439d41d2879ee\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_eb99e588873c788a68a035478ab\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_a20c5901817dd09d5906537e087\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9fcc131f256e969d773327f07cb\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_694ebec955a90e999d9926b7da8\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9912e4cfc1e09848a392a651514\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_e8e32f1e59c349b406a4752e545\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_395aa74996a1f978b4969d114b1\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_58fd47c4a6ac8df9fe2bcaed874\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_5a72d5b37312bac2e0a01157185\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7f1bec8979b57ed7ebd392a2ca9\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_d2cb77c14644156ec8e865608e0\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_e0e150e4f11d906b931b46a2d89\`` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` DROP FOREIGN KEY \`FK_8ed9d1af584fa62f1ad3405b33b\`` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` DROP FOREIGN KEY \`FK_dbe0929355f82e5995f0b7fd5e2\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` DROP FOREIGN KEY \`FK_8e76dcf171c45875c44febb1d8d\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_f4b5742f589e2ac8bfe48b708c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_46d60bf133073f749b8f07e534c\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_b4cf0f96bf08cf396f683555229\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_1cc3b275fc2a9d9d9b0ae33b310\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_c66eddab0caacb1ef8d46bcafdb\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_35c6b1de6d4d89dfe8e9c85d771\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_f67a2d25c945269d602c182fbc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_b7ece56376ac7ca0b9a56c33b3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_262ecf3f5d70b82a48336184251\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_96a8cbe1706f459fd7d883be9bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_a6e050daa4c7a3ab1e411c36517\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_56aae15a664b2889a1a11c2cf82\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_5fe58ece01b48496aebc04733da\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` DROP FOREIGN KEY \`FK_6e74d59afda096b68d12a699691\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_80ab7835e1749581a27462eb87f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_b5069b11030e9608ee4468f850d\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_9349e137959f3ca5818c2e62b3f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_8ee86afa2808a4ab523b9ee6c5e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_9b1c5ee044611ac78249194ec35\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_62ed316cda7b75735b20307b47e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_36b0da55acff774d0845aeb55f2\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_1e740008a7e1512966e3b084148\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_cf776244b01436d8ca5cc762848\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_6289dee12effb51320051c6f1fc\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_7370de8eb79ed00b0d403f2299a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_97fefc97fb254c30577696e1c0a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_dfa86c46f509a61c6510536cd9a\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_3bfc8c1aaec1395cc148268d3cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_07f249ac87502495710a62c5c01\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_042b9825d770d6b3009ae206c2f\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_970844fcd10c2b6df7c1b49eacf\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_390343b22abec869bf800419333\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_f53e2d266432e58e538a366705d\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_c9d7c2c4eb8a1d012ddc6605da9\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_3f9e9e2798d2a4d84b16ee8477c\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_d3b86160bb7d704212382b0ca44\`` - ); - await queryRunner.query( - `ALTER TABLE \`room\` DROP FOREIGN KEY \`FK_d1d94dd8e0c417b4188a05ccbca\`` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` DROP FOREIGN KEY \`FK_d6f78c95ff41cdd30e505a4ebbb\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_2f46c698fc4c19a8cc233c5f255\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_73e8ae665a49366ca7e2866a45d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_4a1c74fd2a61b32d9d9500e0650\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_432056041df0e4337b17ff7b09d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_a96475631aba7dce41db03cc8b2\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_11d0ed50a26da5513f7e4347847\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_f2f48b57269987b13b415a00587\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_0647707288c243e60091c8d8620\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_b80c28f5335ab5442f63c644d94\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_f3b4d59c0b805c9c1ecb0070e16\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_9fb9257b14ec21daf5bc9aa4c8e\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_851e50ec4be7c62a1f9b9a430bf\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_d9e2dfcccf59233c17cc6bc6418\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_1104f3ef8497ca40d99b9f46b87\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_4fbd109f9bb84f58b7a3c60649c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_644155610ddc40dc4e19781c8f0\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_81fc213b2d9ad0cddeab1a9ce64\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_eb59b98ee6ef26c993d0d75c83c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset_template\` DROP FOREIGN KEY \`FK_96f23f044acf305c1699e0319d2\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` + `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_00905b142498f63e76d38fb254e\`` ); await queryRunner.query( - `DROP INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` + `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_b038f74c8d4eadb839e78b99ce5\`` ); await queryRunner.query( - `DROP INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` + `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_6a3b86c6db10582baae7058f5b9\`` ); await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` + `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b0c80ccf319a1c7a7af12b39987\`` ); await queryRunner.query( - `DROP INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\`` + `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b132226941570cb650a4023d493\`` ); await queryRunner.query( - `DROP INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\`` + `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_8fb220ad1ac1f9c86ec39d134e4\`` ); await queryRunner.query( - `DROP INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\`` + `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_b4ae3fea4a24b4be1a86dacf8a2\`` ); await queryRunner.query( - `DROP INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` + `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_7ec2857c7d8d16432ffca1cb3d9\`` ); await queryRunner.query( - `DROP INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\`` + `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_56f5614fff0028d403704995822\`` ); await queryRunner.query( - `DROP INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\`` + `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_10458c50c10436b6d589b40e5ca\`` ); await queryRunner.query( - `DROP INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\`` + `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_028322b763dc94242dc9f638f9b\`` ); await queryRunner.query( - `DROP INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` + `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_b61c694cacfab25533bd23d9add\`` ); await queryRunner.query( - `DROP INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` + `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_9466682df91534dd95e4dbaa616\`` ); await queryRunner.query( - `DROP INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` + `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_09f909622aa177a097256b7cc22\`` ); await queryRunner.query( - `DROP INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` + `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_809c1e6cf3ef6be03a0a1db3f70\`` ); await queryRunner.query( - `DROP INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\`` + `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_562dce4a08bb214f08107b3631e\`` ); await queryRunner.query( - `DROP INDEX \`REL_f09090a77e07377eefb3f731d9\` ON \`template\`` + `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_c0448d2c992a62c9c11bd0f1422\`` ); await queryRunner.query( - `DROP INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` + `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_425bbb4b951f7f4629710763fc0\`` ); await queryRunner.query( - `DROP INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` + `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_f516dd9a46616999c7e9a6adc15\`` ); await queryRunner.query( - `DROP INDEX \`REL_45cf273f30c1fa509456b6b0dd\` ON \`template\`` + `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_ca469f5ec53a7719d155d60aca1\`` ); await queryRunner.query( - `DROP INDEX \`REL_f58c3b144b6e010969e199beef\` ON \`template\`` + `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_dd88d373c64b04e24705d575c99\`` ); await queryRunner.query( - `DROP INDEX \`REL_4318f97beabd362a8a09e9d320\` ON \`template\`` + `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_9f621c51dd854634d8766a9cfaf\`` ); await queryRunner.query( - `DROP INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\`` + `ALTER TABLE \`forum\` DROP FOREIGN KEY \`FK_3b0c92945f36d06f37de80285dd\`` ); await queryRunner.query( - `DROP INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` + `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_0de78853c1ee793f61bda7eff79\`` ); await queryRunner.query( - `DROP INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` + `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_5337074c9b818bb63e6f314c808\`` ); await queryRunner.query( - `DROP INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` + `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_2d8a3ca181c3f0346817685d21d\`` ); await queryRunner.query( - `DROP INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\`` + `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_4555dccdda9ba57d8e3a634cd0d\`` ); await queryRunner.query( - `DROP INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\`` + `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_a5dae5a376dd49c7c076893d40b\`` ); await queryRunner.query( - `DROP INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` + `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_0c6a4d0a6c13a3f5df6ac015096\`` ); await queryRunner.query( - `DROP INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\`` + `ALTER TABLE \`license_plan\` DROP FOREIGN KEY \`FK_3030904030f5d30f483b49905d1\`` ); await queryRunner.query( - `DROP INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` + `ALTER TABLE \`license_policy\` DROP FOREIGN KEY \`FK_23d4d78ea8db637df031f86f030\`` ); await queryRunner.query( - `DROP INDEX \`REL_00905b142498f63e76d38fb254\` ON \`role_set\`` + `ALTER TABLE \`library\` DROP FOREIGN KEY \`FK_3879db652f2421337691219ace8\`` ); await queryRunner.query( - `DROP INDEX \`REL_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` + `ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_66d695b73839e9b66ff1350d34f\`` ); await queryRunner.query( - `DROP INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` + `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` ); await queryRunner.query( - `DROP INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\`` + `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_684b272e6f7459439d41d2879ee\`` ); await queryRunner.query( - `DROP INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` + `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_eb99e588873c788a68a035478ab\`` ); await queryRunner.query( - `DROP INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\`` + `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_a20c5901817dd09d5906537e087\`` ); await queryRunner.query( - `DROP INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\`` + `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9fcc131f256e969d773327f07cb\`` ); await queryRunner.query( - `DROP INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\`` + `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_694ebec955a90e999d9926b7da8\`` ); await queryRunner.query( - `DROP INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\`` + `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9912e4cfc1e09848a392a651514\`` ); await queryRunner.query( - `DROP INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\`` + `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_e8e32f1e59c349b406a4752e545\`` ); await queryRunner.query( - `DROP INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_395aa74996a1f978b4969d114b1\`` ); await queryRunner.query( - `DROP INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_58fd47c4a6ac8df9fe2bcaed874\`` ); await queryRunner.query( - `DROP INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_5a72d5b37312bac2e0a01157185\`` ); await queryRunner.query( - `DROP INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7f1bec8979b57ed7ebd392a2ca9\`` ); await queryRunner.query( - `DROP INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_d2cb77c14644156ec8e865608e0\`` ); await queryRunner.query( - `DROP INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\`` + `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_e0e150e4f11d906b931b46a2d89\`` ); await queryRunner.query( - `DROP INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\`` + `ALTER TABLE \`agent\` DROP FOREIGN KEY \`FK_8ed9d1af584fa62f1ad3405b33b\`` ); await queryRunner.query( - `DROP INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\`` + `ALTER TABLE \`credential\` DROP FOREIGN KEY \`FK_dbe0929355f82e5995f0b7fd5e2\`` ); await queryRunner.query( - `DROP INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\`` + `ALTER TABLE \`preference_set\` DROP FOREIGN KEY \`FK_8e76dcf171c45875c44febb1d8d\`` ); await queryRunner.query( - `DROP INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` + `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_f4b5742f589e2ac8bfe48b708c0\`` ); await queryRunner.query( - `DROP INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` + `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_46d60bf133073f749b8f07e534c\`` ); await queryRunner.query( - `DROP INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` + `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_b4cf0f96bf08cf396f683555229\`` ); await queryRunner.query( - `DROP INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` + `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_1cc3b275fc2a9d9d9b0ae33b310\`` ); await queryRunner.query( - `DROP INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` + `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_c66eddab0caacb1ef8d46bcafdb\`` ); await queryRunner.query( - `DROP INDEX \`REL_3879db652f2421337691219ace\` ON \`library\`` + `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_35c6b1de6d4d89dfe8e9c85d771\`` ); await queryRunner.query( - `DROP INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` + `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_f67a2d25c945269d602c182fbc0\`` ); await queryRunner.query( - `DROP INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` + `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_b7ece56376ac7ca0b9a56c33b3a\`` ); await queryRunner.query( - `DROP INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\`` + `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_262ecf3f5d70b82a48336184251\`` ); await queryRunner.query( - `DROP INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\`` + `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_96a8cbe1706f459fd7d883be9bd\`` ); await queryRunner.query( - `DROP INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\`` + `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_a6e050daa4c7a3ab1e411c36517\`` ); await queryRunner.query( - `DROP INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` + `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_56aae15a664b2889a1a11c2cf82\`` ); await queryRunner.query( - `DROP INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\`` + `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_5fe58ece01b48496aebc04733da\`` ); await queryRunner.query( - `DROP INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` + `ALTER TABLE \`calendar\` DROP FOREIGN KEY \`FK_6e74d59afda096b68d12a699691\`` ); await queryRunner.query( - `DROP INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\`` + `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_80ab7835e1749581a27462eb87f\`` ); await queryRunner.query( - `DROP INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` + `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_b5069b11030e9608ee4468f850d\`` ); await queryRunner.query( - `DROP INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\`` + `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_9349e137959f3ca5818c2e62b3f\`` ); await queryRunner.query( - `DROP INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` + `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_8ee86afa2808a4ab523b9ee6c5e\`` ); await queryRunner.query( - `DROP INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_9b1c5ee044611ac78249194ec35\`` ); await queryRunner.query( - `DROP INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_62ed316cda7b75735b20307b47e\`` ); await queryRunner.query( - `DROP INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_36b0da55acff774d0845aeb55f2\`` ); await queryRunner.query( - `DROP INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_1e740008a7e1512966e3b084148\`` ); await queryRunner.query( - `DROP INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_cf776244b01436d8ca5cc762848\`` ); await queryRunner.query( - `DROP INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` + `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_6289dee12effb51320051c6f1fc\`` ); await queryRunner.query( - `DROP INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` + `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_7370de8eb79ed00b0d403f2299a\`` ); await queryRunner.query( - `DROP INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` + `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` ); await queryRunner.query( - `DROP INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` + `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_97fefc97fb254c30577696e1c0a\`` ); await queryRunner.query( - `DROP INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` + `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` ); await queryRunner.query( - `DROP INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` + `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_dfa86c46f509a61c6510536cd9a\`` ); await queryRunner.query( - `DROP INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` + `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_3bfc8c1aaec1395cc148268d3cd\`` ); await queryRunner.query( - `DROP INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\`` + `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_07f249ac87502495710a62c5c01\`` ); await queryRunner.query( - `DROP INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\`` + `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_042b9825d770d6b3009ae206c2f\`` ); await queryRunner.query( - `DROP INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` + `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_970844fcd10c2b6df7c1b49eacf\`` ); await queryRunner.query( - `DROP INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` + `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_390343b22abec869bf800419333\`` ); await queryRunner.query( - `DROP INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` + `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` ); await queryRunner.query( - `DROP INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\`` + `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_f53e2d266432e58e538a366705d\`` ); await queryRunner.query( - `DROP INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\`` + `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_c9d7c2c4eb8a1d012ddc6605da9\`` ); await queryRunner.query( - `DROP INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\`` + `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_3f9e9e2798d2a4d84b16ee8477c\`` ); await queryRunner.query( - `DROP INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\`` + `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_d3b86160bb7d704212382b0ca44\`` ); await queryRunner.query( - `DROP INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\`` + `ALTER TABLE \`room\` DROP FOREIGN KEY \`FK_d1d94dd8e0c417b4188a05ccbca\`` ); await queryRunner.query( - `DROP INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` + `ALTER TABLE \`vc_interaction\` DROP FOREIGN KEY \`FK_d6f78c95ff41cdd30e505a4ebbb\`` ); await queryRunner.query( - `DROP INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` + `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_2f46c698fc4c19a8cc233c5f255\`` ); await queryRunner.query( - `DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` + `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_73e8ae665a49366ca7e2866a45d\`` ); await queryRunner.query( - `DROP INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` + `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_4a1c74fd2a61b32d9d9500e0650\`` ); await queryRunner.query( - `DROP INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` + `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_432056041df0e4337b17ff7b09d\`` ); await queryRunner.query( - `DROP INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\`` + `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_a96475631aba7dce41db03cc8b2\`` ); await queryRunner.query( - `DROP INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\`` + `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_11d0ed50a26da5513f7e4347847\`` ); await queryRunner.query( - `DROP INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\`` + `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_f2f48b57269987b13b415a00587\`` ); await queryRunner.query( - `DROP INDEX \`REL_390343b22abec869bf80041933\` ON \`post\`` + `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_0647707288c243e60091c8d8620\`` ); await queryRunner.query( - `DROP INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` + `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_b80c28f5335ab5442f63c644d94\`` ); await queryRunner.query( - `DROP INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\`` + `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_f3b4d59c0b805c9c1ecb0070e16\`` ); await queryRunner.query( - `DROP INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` + `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_9fb9257b14ec21daf5bc9aa4c8e\`` ); await queryRunner.query( - `DROP INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` + `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_851e50ec4be7c62a1f9b9a430bf\`` ); await queryRunner.query( - `DROP INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` + `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_d9e2dfcccf59233c17cc6bc6418\`` ); await queryRunner.query( - `DROP INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` + `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_1104f3ef8497ca40d99b9f46b87\`` ); await queryRunner.query( - `DROP INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\`` + `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_4fbd109f9bb84f58b7a3c60649c\`` ); await queryRunner.query( - `DROP INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` + `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_644155610ddc40dc4e19781c8f0\`` ); await queryRunner.query( - `DROP INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\`` + `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_81fc213b2d9ad0cddeab1a9ce64\`` ); await queryRunner.query( - `DROP INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\`` + `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_eb59b98ee6ef26c993d0d75c83c\`` ); await queryRunner.query( - `DROP INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` + `ALTER TABLE \`tagset_template\` DROP FOREIGN KEY \`FK_96f23f044acf305c1699e0319d2\`` ); await queryRunner.query( - `DROP INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` + `DROP INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\`` ); await queryRunner.query( - `DROP INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` + `DROP INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\`` ); + await queryRunner.query(`DROP TABLE \`application_questions\``); await queryRunner.query( - `DROP INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` + `DROP INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` ); + await queryRunner.query(`DROP TABLE \`ai_persona_service\``); await queryRunner.query( - `DROP INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` + `DROP INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` ); + await queryRunner.query(`DROP TABLE \`ai_server\``); await queryRunner.query( - `DROP INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` + `DROP INDEX \`IDX_07a39cea9426b689be25fd61de\` ON \`activity\`` ); + await queryRunner.query(`DROP TABLE \`activity\``); await queryRunner.query( - `DROP INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` + `DROP INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` ); await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP INDEX \`IDX_79206feb0038b1c5597668dc4b\`` + `DROP INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` ); await queryRunner.query( - `ALTER TABLE \`ai_server\` DROP INDEX \`IDX_9d520fa5fed56042918e48fc4b\`` + `DROP INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` ON \`innovation_hub\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_36c8905c2c6c59467c60d94fd8\`` + `DROP INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` ON \`innovation_hub\`` ); + await queryRunner.query(`DROP TABLE \`innovation_hub\``); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_b411e4f27d77a96eccdabbf4b4\`` + `DROP INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\`` + `DROP INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP INDEX \`IDX_1d39dac2c6d2f17286d90c306b\`` + `DROP INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\`` ); + await queryRunner.query(`DROP TABLE \`account\``); await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_950221e932175dc7cf7c006488\`` + `DROP INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` ); await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_833582df0c439ab8c9adc5240d\`` + `DROP INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` ); await queryRunner.query( - `ALTER TABLE \`account\` DROP INDEX \`IDX_91a165c1091a6959cc19d52239\`` + `DROP INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` ); + await queryRunner.query(`DROP TABLE \`innovation_pack\``); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_a1441e46c8d36090e1f6477cea\`` + `DROP INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_5facd6d188068a5a1c5b6f07fc\`` + `DROP INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP INDEX \`IDX_8af8122897b05315e7eb892525\`` + `DROP INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_55b8101bdf4f566645e928c26e\`` + `DROP INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` ); + await queryRunner.query(`DROP TABLE \`virtual_contributor\``); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_a8890dcd65b8c3ee6e160d33f3\`` + `DROP INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` ); + await queryRunner.query(`DROP TABLE \`ai_persona\``); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_4504c37764f6962ccbd165a21d\`` + `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP INDEX \`IDX_e2eaa2213ac4454039cd8abc07\`` + `DROP INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP INDEX \`IDX_293f0d3ef60cb0ca0006044ecf\`` + `DROP INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_6b1efee39d076d9f7ecb8fef4c\`` + `DROP INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_43559aeadc1a5169d17e81b3d4\`` + `DROP INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_980c4643d7d9de1b97bc39f518\`` + `DROP INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_9c664d684f987a735678b0ba82\`` + `DROP INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_68fa2c2b00cc1ed77e7c225e8b\`` + `DROP INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_cc0b08eb9679d3daa95153c2af\`` + `DROP INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_ea06eb8894469a0f262d929bf0\`` + `DROP INDEX \`IDX_0f03c61020ea0dfa0198c60304\` ON \`space\`` ); + await queryRunner.query(`DROP TABLE \`space\``); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_b4250035291aac1329d59224a9\`` + `DROP INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` ); await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_8d03fd2c8e8411ec9192c79cd9\`` + `DROP INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` ); + await queryRunner.query(`DROP TABLE \`space_defaults\``); await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_592a23e68922853bae6ebecd85\`` + `DROP INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` ); + await queryRunner.query(`DROP TABLE \`templates_set\``); await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP INDEX \`IDX_413ba75964e5a534e4bfa54846\`` + `DROP INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP INDEX \`IDX_eb0176ef4b98c143322aa6f809\`` + `DROP INDEX \`REL_f09090a77e07377eefb3f731d9\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_21fdaf6dc88bdd6e8839e29b0b\`` + `DROP INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_f09090a77e07377eefb3f731d9\`` + `DROP INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_c6e4d1a07781a809ad3b3ee826\`` + `DROP INDEX \`REL_45cf273f30c1fa509456b6b0dd\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_eedeae5e63f9a9c3a0161541e9\`` + `DROP INDEX \`REL_f58c3b144b6e010969e199beef\` ON \`template\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_45cf273f30c1fa509456b6b0dd\`` + `DROP INDEX \`REL_4318f97beabd362a8a09e9d320\` ON \`template\`` ); + await queryRunner.query(`DROP TABLE \`template\``); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_f58c3b144b6e010969e199beef\`` + `DROP INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\`` ); await queryRunner.query( - `ALTER TABLE \`template\` DROP INDEX \`IDX_4318f97beabd362a8a09e9d320\`` + `DROP INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` ); + await queryRunner.query(`DROP TABLE \`context\``); await queryRunner.query( - `ALTER TABLE \`context\` DROP INDEX \`IDX_a03169c3f86480ba3863924f4d\`` + `DROP INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` ); + await queryRunner.query(`DROP TABLE \`ecosystem_model\``); await queryRunner.query( - `ALTER TABLE \`context\` DROP INDEX \`IDX_5f0dbc3b097ef297bd5f4ddb1a\`` + `DROP INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` ); + await queryRunner.query(`DROP TABLE \`actor_group\``); await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` DROP INDEX \`IDX_658580aea4e1a892227e27db90\`` + `DROP INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\`` ); + await queryRunner.query(`DROP TABLE \`actor\``); await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP INDEX \`IDX_bde98d59e8984e7d17034c3b93\`` + `DROP INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\`` ); await queryRunner.query( - `ALTER TABLE \`actor\` DROP INDEX \`IDX_a2afa3851ea733de932251b3a1\`` + `DROP INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` ); await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_3b8f390d76263ef5996869da07\`` + `DROP INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\`` ); await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_2e7dd2fa8c829352cfbecb2cc9\`` + `DROP INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` ); + await queryRunner.query(`DROP TABLE \`community\``); await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_7fbe50fa78a37776ad962cb764\`` + `DROP INDEX \`REL_00905b142498f63e76d38fb254\` ON \`role_set\`` ); await queryRunner.query( - `ALTER TABLE \`community\` DROP INDEX \`IDX_6e7584bfb417bd0f8e8696ab58\`` + `DROP INDEX \`REL_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` ); + await queryRunner.query(`DROP TABLE \`role_set\``); await queryRunner.query( - `ALTER TABLE \`role_set\` DROP INDEX \`IDX_00905b142498f63e76d38fb254\`` + `DROP INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` ); await queryRunner.query( - `ALTER TABLE \`role_set\` DROP INDEX \`IDX_b038f74c8d4eadb839e78b99ce\`` + `DROP INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\`` ); + await queryRunner.query(`DROP TABLE \`invitation\``); await queryRunner.query( - `ALTER TABLE \`invitation\` DROP INDEX \`IDX_b0c80ccf319a1c7a7af12b3998\`` + `DROP INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` ); await queryRunner.query( - `ALTER TABLE \`invitation\` DROP INDEX \`IDX_b132226941570cb650a4023d49\`` + `DROP INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\`` ); + await queryRunner.query(`DROP TABLE \`application\``); await queryRunner.query( - `ALTER TABLE \`application\` DROP INDEX \`IDX_7ec2857c7d8d16432ffca1cb3d\`` + `DROP INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\`` ); await queryRunner.query( - `ALTER TABLE \`application\` DROP INDEX \`IDX_56f5614fff0028d40370499582\`` + `DROP INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\`` ); await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_10458c50c10436b6d589b40e5c\`` + `DROP INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\`` ); await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_028322b763dc94242dc9f638f9\`` + `DROP INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\`` ); await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_b61c694cacfab25533bd23d9ad\`` + `DROP INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\`` ); await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_9466682df91534dd95e4dbaa61\`` + `DROP INDEX \`IDX_266bc44a18601f893566962df6\` ON \`user\`` ); + await queryRunner.query(`DROP TABLE \`user\``); + await queryRunner.query(`DROP TABLE \`nvp\``); await queryRunner.query( - `ALTER TABLE \`user\` DROP INDEX \`IDX_09f909622aa177a097256b7cc2\`` + `DROP INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` ); + await queryRunner.query(`DROP TABLE \`platform_invitation\``); await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP INDEX \`IDX_c0448d2c992a62c9c11bd0f142\`` + `DROP INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\`` ); await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_425bbb4b951f7f4629710763fc\`` + `DROP INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` ); await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_f516dd9a46616999c7e9a6adc1\`` + `DROP INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\`` ); await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_ca469f5ec53a7719d155d60aca\`` + `DROP INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\`` ); await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_dd88d373c64b04e24705d575c9\`` + `DROP INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\`` ); + await queryRunner.query(`DROP TABLE \`platform\``); await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_9f621c51dd854634d8766a9cfa\`` + `DROP INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\`` ); + await queryRunner.query(`DROP TABLE \`forum\``); await queryRunner.query( - `ALTER TABLE \`forum\` DROP INDEX \`IDX_3b0c92945f36d06f37de80285d\`` + `DROP INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\`` ); await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_5337074c9b818bb63e6f314c80\`` + `DROP INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` ); await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_2d8a3ca181c3f0346817685d21\`` + `DROP INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` ); + await queryRunner.query(`DROP TABLE \`discussion\``); await queryRunner.query( - `ALTER TABLE \`discussion\` DROP INDEX \`IDX_4555dccdda9ba57d8e3a634cd0\`` + `DROP INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` ); await queryRunner.query( - `ALTER TABLE \`licensing\` DROP INDEX \`IDX_a5dae5a376dd49c7c076893d40\`` + `DROP INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` ); + await queryRunner.query(`DROP TABLE \`licensing\``); + await queryRunner.query(`DROP TABLE \`license_plan\``); await queryRunner.query( - `ALTER TABLE \`licensing\` DROP INDEX \`IDX_0c6a4d0a6c13a3f5df6ac01509\`` + `DROP INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` ); + await queryRunner.query(`DROP TABLE \`license_policy\``); await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP INDEX \`IDX_23d4d78ea8db637df031f86f03\`` + `DROP INDEX \`REL_3879db652f2421337691219ace\` ON \`library\`` ); + await queryRunner.query(`DROP TABLE \`library\``); + await queryRunner.query(`DROP TABLE \`form\``); + await queryRunner.query(`DROP TABLE \`role\``); await queryRunner.query( - `ALTER TABLE \`library\` DROP INDEX \`IDX_3879db652f2421337691219ace\`` + `DROP INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` ); await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP INDEX \`IDX_3d60fe4fa40d54bad7d51bb4bd\`` + `DROP INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` ); + await queryRunner.query(`DROP TABLE \`community_guidelines\``); await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP INDEX \`IDX_684b272e6f7459439d41d2879e\`` + `DROP INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\`` ); await queryRunner.query( - `ALTER TABLE \`communication\` DROP INDEX \`IDX_eb99e588873c788a68a035478a\`` + `DROP INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\`` ); + await queryRunner.query(`DROP TABLE \`communication\``); await queryRunner.query( - `ALTER TABLE \`communication\` DROP INDEX \`IDX_a20c5901817dd09d5906537e08\`` + `DROP INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\`` ); await queryRunner.query( - `ALTER TABLE \`user_group\` DROP INDEX \`IDX_9912e4cfc1e09848a392a65151\`` + `DROP INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` ); + await queryRunner.query(`DROP TABLE \`user_group\``); await queryRunner.query( - `ALTER TABLE \`user_group\` DROP INDEX \`IDX_e8e32f1e59c349b406a4752e54\`` + `DROP INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_395aa74996a1f978b4969d114b\`` + `DROP INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_58fd47c4a6ac8df9fe2bcaed87\`` + `DROP INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_5a72d5b37312bac2e0a0115718\`` + `DROP INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_7f1bec8979b57ed7ebd392a2ca\`` + `DROP INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_d2cb77c14644156ec8e865608e\`` + `DROP INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` ); await queryRunner.query( - `ALTER TABLE \`organization\` DROP INDEX \`IDX_e0e150e4f11d906b931b46a2d8\`` + `DROP INDEX \`IDX_9fdd8f0bfe04a676822c7265e1\` ON \`organization\`` ); + await queryRunner.query(`DROP TABLE \`organization\``); await queryRunner.query( - `ALTER TABLE \`agent\` DROP INDEX \`IDX_8ed9d1af584fa62f1ad3405b33\`` + `DROP INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` ); + await queryRunner.query(`DROP TABLE \`agent\``); + await queryRunner.query(`DROP TABLE \`credential\``); await queryRunner.query( - `ALTER TABLE \`preference_set\` DROP INDEX \`IDX_8e76dcf171c45875c44febb1d8\`` + `DROP INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` ); + await queryRunner.query(`DROP TABLE \`preference_set\``); await queryRunner.query( - `ALTER TABLE \`preference\` DROP INDEX \`IDX_b4cf0f96bf08cf396f68355522\`` + `DROP INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\`` ); + await queryRunner.query(`DROP TABLE \`preference\``); + await queryRunner.query(`DROP TABLE \`preference_definition\``); await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP INDEX \`IDX_1cc3b275fc2a9d9d9b0ae33b31\`` + `DROP INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` ); await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP INDEX \`IDX_c66eddab0caacb1ef8d46bcafd\`` + `DROP INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` ); + await queryRunner.query(`DROP TABLE \`organization_verification\``); + await queryRunner.query(`DROP TABLE \`lifecycle\``); await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_35c6b1de6d4d89dfe8e9c85d77\`` + `DROP INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_f67a2d25c945269d602c182fbc\`` + `DROP INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_b7ece56376ac7ca0b9a56c33b3\`` + `DROP INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` ); await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP INDEX \`IDX_262ecf3f5d70b82a4833618425\`` + `DROP INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` ); + await queryRunner.query(`DROP TABLE \`collaboration\``); await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP INDEX \`IDX_96a8cbe1706f459fd7d883be9b\`` + `DROP INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` ); await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP INDEX \`IDX_a6e050daa4c7a3ab1e411c3651\`` + `DROP INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` ); + await queryRunner.query(`DROP TABLE \`innovation_flow\``); await queryRunner.query( - `ALTER TABLE \`timeline\` DROP INDEX \`IDX_56aae15a664b2889a1a11c2cf8\`` + `DROP INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` ); await queryRunner.query( - `ALTER TABLE \`timeline\` DROP INDEX \`IDX_5fe58ece01b48496aebc04733d\`` + `DROP INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\`` ); + await queryRunner.query(`DROP TABLE \`timeline\``); await queryRunner.query( - `ALTER TABLE \`calendar\` DROP INDEX \`IDX_6e74d59afda096b68d12a69969\`` + `DROP INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\`` ); + await queryRunner.query(`DROP TABLE \`calendar\``); await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_b5069b11030e9608ee4468f850\`` + `DROP INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` ); await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_9349e137959f3ca5818c2e62b3\`` + `DROP INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` ); await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP INDEX \`IDX_8ee86afa2808a4ab523b9ee6c5\`` + `DROP INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` ); + await queryRunner.query(`DROP TABLE \`calendar_event\``); await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_62ed316cda7b75735b20307b47\`` + `DROP INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\`` ); await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_36b0da55acff774d0845aeb55f\`` + `DROP INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\`` ); await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_1e740008a7e1512966e3b08414\`` + `DROP INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\`` ); await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_cf776244b01436d8ca5cc76284\`` + `DROP INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\`` ); await queryRunner.query( - `ALTER TABLE \`callout\` DROP INDEX \`IDX_6289dee12effb51320051c6f1f\`` + `DROP INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\`` ); + await queryRunner.query(`DROP TABLE \`callout\``); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_bdf2d0eced5c95968a85caaaae\`` + `DROP INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_97fefc97fb254c30577696e1c0\`` + `DROP INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_5e34f9a356f6254b8da24f8947\`` + `DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` ); await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP INDEX \`IDX_dfa86c46f509a61c6510536cd9\`` + `DROP INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` ); + await queryRunner.query(`DROP TABLE \`callout_contribution\``); await queryRunner.query( - `ALTER TABLE \`link\` DROP INDEX \`IDX_3bfc8c1aaec1395cc148268d3c\`` + `DROP INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` ); await queryRunner.query( - `ALTER TABLE \`link\` DROP INDEX \`IDX_07f249ac87502495710a62c5c0\`` + `DROP INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\`` ); + await queryRunner.query(`DROP TABLE \`link\``); await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_042b9825d770d6b3009ae206c2\`` + `DROP INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\`` ); await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_970844fcd10c2b6df7c1b49eac\`` + `DROP INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\`` ); await queryRunner.query( - `ALTER TABLE \`post\` DROP INDEX \`IDX_390343b22abec869bf80041933\`` + `DROP INDEX \`REL_390343b22abec869bf80041933\` ON \`post\`` ); + await queryRunner.query(`DROP TABLE \`post\``); + await queryRunner.query(`DROP TABLE \`callout_contribution_defaults\``); + await queryRunner.query(`DROP TABLE \`callout_contribution_policy\``); await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_8bc0e1f40be5816d3a593cbf7f\`` + `DROP INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_f53e2d266432e58e538a366705\`` + `DROP INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\`` ); await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP INDEX \`IDX_c9d7c2c4eb8a1d012ddc6605da\`` + `DROP INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` ); + await queryRunner.query(`DROP TABLE \`callout_framing\``); await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_3f9e9e2798d2a4d84b16ee8477\`` + `DROP INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` ); await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP INDEX \`IDX_d3b86160bb7d704212382b0ca4\`` + `DROP INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` ); + await queryRunner.query(`DROP TABLE \`whiteboard\``); await queryRunner.query( - `ALTER TABLE \`room\` DROP INDEX \`IDX_d1d94dd8e0c417b4188a05ccbc\`` + `DROP INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` ); + await queryRunner.query(`DROP TABLE \`room\``); + await queryRunner.query(`DROP TABLE \`vc_interaction\``); await queryRunner.query( - `ALTER TABLE \`reference\` DROP INDEX \`IDX_73e8ae665a49366ca7e2866a45\`` + `DROP INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\`` ); + await queryRunner.query(`DROP TABLE \`reference\``); await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_4a1c74fd2a61b32d9d9500e065\`` + `DROP INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` ); await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_432056041df0e4337b17ff7b09\`` + `DROP INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\`` ); await queryRunner.query( - `ALTER TABLE \`profile\` DROP INDEX \`IDX_a96475631aba7dce41db03cc8b\`` + `DROP INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\`` ); + await queryRunner.query(`DROP TABLE \`profile\``); await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP INDEX \`IDX_f2f48b57269987b13b415a0058\`` + `DROP INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` ); + await queryRunner.query(`DROP TABLE \`storage_bucket\``); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP INDEX \`IDX_0647707288c243e60091c8d862\`` + `DROP INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` ); await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP INDEX \`IDX_f3b4d59c0b805c9c1ecb0070e1\`` + `DROP INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` ); + await queryRunner.query(`DROP TABLE \`storage_aggregator\``); await queryRunner.query( - `ALTER TABLE \`document\` DROP INDEX \`IDX_9fb9257b14ec21daf5bc9aa4c8\`` + `DROP INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` ); await queryRunner.query( - `ALTER TABLE \`document\` DROP INDEX \`IDX_d9e2dfcccf59233c17cc6bc641\`` + `DROP INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` ); + await queryRunner.query(`DROP TABLE \`document\``); + await queryRunner.query(`DROP TABLE \`location\``); await queryRunner.query( - `ALTER TABLE \`visual\` DROP INDEX \`IDX_4fbd109f9bb84f58b7a3c60649\`` + `DROP INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` ); + await queryRunner.query(`DROP TABLE \`visual\``); await queryRunner.query( - `ALTER TABLE \`tagset\` DROP INDEX \`IDX_eb59b98ee6ef26c993d0d75c83\`` + `DROP INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` ); + await queryRunner.query(`DROP TABLE \`tagset\``); + await queryRunner.query(`DROP TABLE \`tagset_template\``); + await queryRunner.query(`DROP TABLE \`tagset_template_set\``); + await queryRunner.query(`DROP TABLE \`authorization_policy\``); } } From e8cbc472fc2e905bace0852a8ba60910a1b15da9 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 31 Oct 2024 15:47:24 +0200 Subject: [PATCH 04/42] Add separate privilege for application approval --- .../authorization/policy.rule.constants.ts | 2 ++ src/common/enums/authorization.privilege.ts | 1 + .../application.service.authorization.ts | 21 +++++++++++++++++++ .../application.service.lifecycle.ts | 4 ++-- .../role-set/role.set.resolver.mutations.ts | 6 ------ .../role.set.service.lifecycle.application.ts | 9 ++++++++ 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/common/constants/authorization/policy.rule.constants.ts b/src/common/constants/authorization/policy.rule.constants.ts index ec0f9cc331..fc07daeff6 100644 --- a/src/common/constants/authorization/policy.rule.constants.ts +++ b/src/common/constants/authorization/policy.rule.constants.ts @@ -27,3 +27,5 @@ export const PRIVILEGE_RULE_READ_USER_SETTINGS = export const POLICY_RULE_COMMUNITY_INVITE_MEMBER = 'policyRule-communityInvite'; export const POLICY_RULE_COMMUNITY_ADD_VC = 'policyRule-communityAddVirtualContributor'; +export const POLICY_RULE_COMMUNITY_APPROVE_APPLICATION = + 'policyRule-communityApproveApplication'; diff --git a/src/common/enums/authorization.privilege.ts b/src/common/enums/authorization.privilege.ts index a48180b0e1..9a97b27fa5 100644 --- a/src/common/enums/authorization.privilege.ts +++ b/src/common/enums/authorization.privilege.ts @@ -30,6 +30,7 @@ export enum AuthorizationPrivilege { UPDATE_INNOVATION_FLOW = 'update-innovation-flow', COMMUNITY_JOIN = 'community-join', COMMUNITY_APPLY = 'community-apply', + COMMUNITY_APPLY_ACCEPT = 'community-apply-accept', COMMUNITY_INVITE = 'community-invite', COMMUNITY_INVITE_ACCEPT = 'community-invite-accept', COMMUNITY_ADD_MEMBER = 'community-add-member', // only for global admins diff --git a/src/domain/access/application/application.service.authorization.ts b/src/domain/access/application/application.service.authorization.ts index 5ff0590867..5f062aefc9 100644 --- a/src/domain/access/application/application.service.authorization.ts +++ b/src/domain/access/application/application.service.authorization.ts @@ -6,6 +6,8 @@ import { IAuthorizationPolicy } from '@domain/common/authorization-policy/author import { IApplication } from './application.interface'; import { IAuthorizationPolicyRuleCredential } from '@core/authorization/authorization.policy.rule.credential.interface'; import { CREDENTIAL_RULE_COMMUNITY_USER_APPLICATION } from '@common/constants/authorization/credential.rule.constants'; +import { AuthorizationPolicyRulePrivilege } from '@core/authorization/authorization.policy.rule.privilege'; +import { POLICY_RULE_COMMUNITY_APPROVE_APPLICATION } from '@common/constants'; @Injectable() export class ApplicationAuthorizationService { @@ -24,6 +26,10 @@ export class ApplicationAuthorizationService { parentAuthorization ); + application.authorization = this.appendPrivilegeRules( + application.authorization + ); + application.authorization = await this.extendAuthorizationPolicy(application); @@ -61,4 +67,19 @@ export class ApplicationAuthorizationService { newRules ); } + + private appendPrivilegeRules( + authorization: IAuthorizationPolicy + ): IAuthorizationPolicy { + const approveApplicationPrivilege = new AuthorizationPolicyRulePrivilege( + [AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT], + AuthorizationPrivilege.GRANT, + POLICY_RULE_COMMUNITY_APPROVE_APPLICATION + ); + + return this.authorizationPolicyService.appendPrivilegeAuthorizationRules( + authorization, + [approveApplicationPrivilege] + ); + } } diff --git a/src/domain/access/application/application.service.lifecycle.ts b/src/domain/access/application/application.service.lifecycle.ts index 63c023d12f..e27f5f0644 100644 --- a/src/domain/access/application/application.service.lifecycle.ts +++ b/src/domain/access/application/application.service.lifecycle.ts @@ -60,7 +60,7 @@ export const applicationLifecycleMachine: ILifecycleDefinition = { new: { on: { APPROVE: { - guards: 'hasUpdatePrivilege', + guards: 'hasApplicationAcceptPrivilege', target: ApplicationLifecycleState.APPROVING, }, REJECT: { @@ -72,7 +72,7 @@ export const applicationLifecycleMachine: ILifecycleDefinition = { approving: { on: { APPROVED: { - guards: 'hasUpdatePrivilege', + guards: 'hasApplicationAcceptPrivilege', target: ApplicationLifecycleState.APPROVED, }, }, diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index a0a2b901e0..b5d580455b 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -692,12 +692,6 @@ export class RoleSetResolverMutations { let application = await this.applicationService.getApplicationOrFail( eventData.applicationID ); - this.authorizationService.grantAccessOrFail( - agentInfo, - application.authorization, - AuthorizationPrivilege.UPDATE, - `event on application: ${application.id}` - ); // Send the event, translated if needed this.logger.verbose?.( diff --git a/src/domain/access/role-set/role.set.service.lifecycle.application.ts b/src/domain/access/role-set/role.set.service.lifecycle.application.ts index bde1865406..ac00819474 100644 --- a/src/domain/access/role-set/role.set.service.lifecycle.application.ts +++ b/src/domain/access/role-set/role.set.service.lifecycle.application.ts @@ -33,6 +33,15 @@ export class RoleSetServiceLifecycleApplication { AuthorizationPrivilege.UPDATE ); }, + hasApplicationAcceptPrivilege: ({ event }) => { + const agentInfo: AgentInfo = event.agentInfo; + const authorizationPolicy: IAuthorizationPolicy = event.authorization; + return this.authorizationService.isAccessGranted( + agentInfo, + authorizationPolicy, + AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT + ); + }, }, }); return machine.createMachine(applicationLifecycleMachine); From 446b02d9c63b8a1988cd3a98db707cb5867e05dc Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 31 Oct 2024 16:04:11 +0200 Subject: [PATCH 05/42] Temporary fix --- src/domain/access/role-set/role.set.resolver.mutations.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index b5d580455b..bc10bed3f5 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -692,6 +692,12 @@ export class RoleSetResolverMutations { let application = await this.applicationService.getApplicationOrFail( eventData.applicationID ); + this.authorizationService.grantAccessOrFail( + agentInfo, + application.authorization, + AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT, + `event on application: ${application.id}` + ); // Send the event, translated if needed this.logger.verbose?.( From e66c91841fce9bc933f98d5a4b0f4734ed1d442e Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 31 Oct 2024 16:05:03 +0200 Subject: [PATCH 06/42] Add comment --- src/domain/access/role-set/role.set.resolver.mutations.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index bc10bed3f5..b1627bba01 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -692,6 +692,8 @@ export class RoleSetResolverMutations { let application = await this.applicationService.getApplicationOrFail( eventData.applicationID ); + + //toDo fix this temporary fix. Patches the immediate issue but doesn't solve the design issue of guards not being triggered on transitions this.authorizationService.grantAccessOrFail( agentInfo, application.authorization, From 23732a61a5663e406948019ed43036f0e022613d Mon Sep 17 00:00:00 2001 From: Svetoslav Petkov Date: Fri, 1 Nov 2024 12:00:08 +0200 Subject: [PATCH 07/42] skip file reupload if outside Alkemio (#4658) --- src/domain/profile-documents/profile.documents.service.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/domain/profile-documents/profile.documents.service.ts b/src/domain/profile-documents/profile.documents.service.ts index a053e4edeb..77fac5f11c 100644 --- a/src/domain/profile-documents/profile.documents.service.ts +++ b/src/domain/profile-documents/profile.documents.service.ts @@ -25,12 +25,9 @@ export class ProfileDocumentsService { fileUrl: string, profile: IProfile ): Promise { + // if outside Alkemio - skip if (!this.documentService.isAlkemioDocumentURL(fileUrl)) { - throw new BaseException( - 'File URL not inside Alkemio', - LogContext.COLLABORATION, - AlkemioErrorStatus.UNSPECIFIED - ); + return undefined; } const storageBucketToCheck = profile.storageBucket; From 138fa259e8b16b8f224d12a1067788d05ce3d142 Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 12:31:46 +0100 Subject: [PATCH 08/42] BugFix #4657 Subspace template fails to be deleted --- src/domain/template/template/template.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/domain/template/template/template.service.ts b/src/domain/template/template/template.service.ts index 112e3cfa28..d439e94ea4 100644 --- a/src/domain/template/template/template.service.ts +++ b/src/domain/template/template/template.service.ts @@ -284,6 +284,7 @@ export class TemplateService { callout: true, whiteboard: true, innovationFlow: true, + collaboration: true, }, }); From 2ba2bcbd6d808df4d824ca795ed6b7d9ad43d53f Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 14:00:17 +0100 Subject: [PATCH 09/42] Fixed migration --- src/migrations/1729511643555-templatesManager.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/migrations/1729511643555-templatesManager.ts b/src/migrations/1729511643555-templatesManager.ts index 05b70ff9ac..8c92fc69b2 100644 --- a/src/migrations/1729511643555-templatesManager.ts +++ b/src/migrations/1729511643555-templatesManager.ts @@ -46,18 +46,12 @@ export class TemplatesManager1729511643555 implements MigrationInterface { await queryRunner.query( `ALTER TABLE \`platform\` ADD \`templatesManagerId\` char(36) NULL` ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD UNIQUE INDEX \`IDX_81f92b22d30540102e9654e892\` (\`templatesManagerId\`)` - ); await queryRunner.query( `CREATE UNIQUE INDEX \`REL_81f92b22d30540102e9654e892\` ON \`platform\` (\`templatesManagerId\`)` ); await queryRunner.query( `ALTER TABLE \`space\` ADD \`templatesManagerId\` char(36) NULL` ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD UNIQUE INDEX \`IDX_dea52ce918df6950019678fa35\` (\`templatesManagerId\`)` - ); await queryRunner.query( `CREATE UNIQUE INDEX \`REL_dea52ce918df6950019678fa35\` ON \`space\` (\`templatesManagerId\`)` ); @@ -255,15 +249,9 @@ export class TemplatesManager1729511643555 implements MigrationInterface { await queryRunner.query( `DROP INDEX \`REL_81f92b22d30540102e9654e892\` ON \`platform\`` ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP INDEX \`IDX_dea52ce918df6950019678fa35\`` - ); await queryRunner.query( `ALTER TABLE \`space\` DROP COLUMN \`templatesManagerId\`` ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP INDEX \`IDX_81f92b22d30540102e9654e892\`` - ); await queryRunner.query( `ALTER TABLE \`platform\` DROP COLUMN \`templatesManagerId\`` ); From 31312ce21cc76aff00b53ec92a2626831dbdac3e Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 14:00:39 +0100 Subject: [PATCH 10/42] Fixed nameId generation --- src/services/infrastructure/naming/naming.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/infrastructure/naming/naming.service.ts b/src/services/infrastructure/naming/naming.service.ts index c2e48f7cf6..1d626538a5 100644 --- a/src/services/infrastructure/naming/naming.service.ts +++ b/src/services/infrastructure/naming/naming.service.ts @@ -23,6 +23,7 @@ import { SpaceReservedName } from '@common/enums/space.reserved.name'; import { generateNameId } from '@services/infrastructure/naming/generate.name.id'; import { Template } from '@domain/template/template/template.entity'; import { IRoleSet } from '@domain/access/role-set'; +import { NAMEID_MAX_LENGTH } from '@common/constants'; export class NamingService { constructor( @@ -232,7 +233,7 @@ export class NamingService { let count = 1; while (reservedNameIDs.includes(result)) { // If the nameID is already reserved, try again with a new random suffix starting from 1 but with two digits - result = `${guess}-${count.toString()}`; + result = `${guess.substring(0, NAMEID_MAX_LENGTH - 1 - count.toString().length)}-${count.toString()}`; count++; } return result; From 150b7bfcab0b9c18ff745075910f3ae1bb2adcc0 Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 17:05:09 +0100 Subject: [PATCH 11/42] Fix: Posts don't have comments when comming from a subspace template --- .../collaboration/collaboration/collaboration.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/domain/collaboration/collaboration/collaboration.service.ts b/src/domain/collaboration/collaboration/collaboration.service.ts index 9a7afa87f7..d584b86f86 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.ts @@ -54,6 +54,7 @@ import { Callout } from '@domain/collaboration/callout'; import { AuthorizationPolicyType } from '@common/enums/authorization.policy.type'; import { CreateInnovationFlowInput } from '../innovation-flow/dto/innovation.flow.dto.create'; import { IRoleSet } from '@domain/access/role-set'; +import { CalloutState } from '@common/enums/callout.state'; @Injectable() export class CollaborationService { @@ -216,6 +217,12 @@ export class CollaborationService { ); calloutNameIds.push(calloutDefault.nameID); } + if ( + calloutDefault.type === CalloutType.POST && + calloutDefault.contributionPolicy?.state === CalloutState.OPEN + ) { + calloutDefault.enableComments = true; + } const callout = await this.calloutService.createCallout( calloutDefault, collaboration.tagsetTemplateSet.tagsetTemplates, From 29ce8c33f1f714f353b6e499a73007c23b252dad Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 17:29:57 +0100 Subject: [PATCH 12/42] Fix space default template being ignored --- .../space.defaults/space.defaults.service.ts | 39 ++++++++++++------- .../space/space/dto/space.dto.create.ts | 3 ++ src/domain/space/space/space.service.ts | 5 ++- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/domain/space/space.defaults/space.defaults.service.ts b/src/domain/space/space.defaults/space.defaults.service.ts index 5b5b86d983..7003e0fa93 100644 --- a/src/domain/space/space.defaults/space.defaults.service.ts +++ b/src/domain/space/space.defaults/space.defaults.service.ts @@ -25,6 +25,7 @@ import { TemplatesManagerService } from '@domain/template/templates-manager/temp import { TemplateDefaultType } from '@common/enums/template.default.type'; import { ValidationException } from '@common/exceptions'; import { CollaborationService } from '@domain/collaboration/collaboration/collaboration.service'; +import { ITemplatesManager } from '@domain/template/templates-manager'; @Injectable() export class SpaceDefaultsService { @@ -38,7 +39,8 @@ export class SpaceDefaultsService { public async createCollaborationInput( collaborationData: CreateCollaborationOnSpaceInput, - spaceType: SpaceType + spaceType: SpaceType, + parentSpaceTemplatesManager?: ITemplatesManager ): Promise { const platformTemplatesManager = await this.platformService.getTemplatesManagerOrFail(); @@ -47,12 +49,29 @@ export class SpaceDefaultsService { switch (spaceType) { case SpaceType.CHALLENGE: case SpaceType.OPPORTUNITY: { - const subspaceTemplate = - await this.templatesManagerService.getTemplateFromTemplateDefault( - platformTemplatesManager.id, - TemplateDefaultType.PLATFORM_SUBSPACE - ); - templateID = subspaceTemplate.id; + if (parentSpaceTemplatesManager) { + try { + const subspaceTemplate = + await this.templatesManagerService.getTemplateFromTemplateDefault( + parentSpaceTemplatesManager.id, + TemplateDefaultType.SPACE_SUBSPACE + ); + if (subspaceTemplate) { + templateID = subspaceTemplate.id; + } + } catch (e) { + // Space does not have a subspace default template, just use the platform default + } + } + // Get the platform default template if no parent template + if (!templateID) { + const subspaceTemplate = + await this.templatesManagerService.getTemplateFromTemplateDefault( + platformTemplatesManager.id, + TemplateDefaultType.PLATFORM_SUBSPACE + ); + templateID = subspaceTemplate.id; + } break; } case SpaceType.SPACE: { @@ -144,10 +163,6 @@ export class SpaceDefaultsService { } // Move callouts that are not in valid groups or flowStates to the default group & first flowState - const defaultGroupName = - collaborationTemplateInput?.defaultCalloutGroupName; - const defaultFlowStateName = - collaborationData.innovationFlowData?.states?.[0]?.displayName; const validGroupNames = collaborationData.calloutGroups?.map( group => group.displayName ); @@ -157,8 +172,6 @@ export class SpaceDefaultsService { ); this.collaborationService.moveCalloutsToCorrectGroupAndState( - defaultGroupName, - defaultFlowStateName, validGroupNames ?? [], validFlowStateNames ?? [], collaborationData.calloutsData ?? [] diff --git a/src/domain/space/space/dto/space.dto.create.ts b/src/domain/space/space/dto/space.dto.create.ts index 47cb91d150..34983c9a0a 100644 --- a/src/domain/space/space/dto/space.dto.create.ts +++ b/src/domain/space/space/dto/space.dto.create.ts @@ -7,6 +7,7 @@ import { CreateContextInput } from '@domain/context/context/dto/context.dto.crea import { CreateNameableInput } from '@domain/common/entity/nameable-entity/dto/nameable.dto.create'; import { CreateCollaborationOnSpaceInput } from './space.dto.create.collaboration'; import { SpaceLevel } from '@common/enums/space.level'; +import { ITemplatesManager } from '@domain/template/templates-manager'; @InputType() export class CreateSpaceInput extends CreateNameableInput { @@ -27,6 +28,8 @@ export class CreateSpaceInput extends CreateNameableInput { // For passing on the hierarchy of storage aggregators storageAggregatorParent?: IStorageAggregator; + // For accessing the default templates of the parent space + templatesManagerParent?: ITemplatesManager; level!: SpaceLevel; diff --git a/src/domain/space/space/space.service.ts b/src/domain/space/space/space.service.ts index 70cacce356..6d7437813b 100644 --- a/src/domain/space/space/space.service.ts +++ b/src/domain/space/space/space.service.ts @@ -218,7 +218,8 @@ export class SpaceService { collaborationData = await this.spaceDefaultsService.createCollaborationInput( collaborationData, - space.type + space.type, + spaceData.templatesManagerParent ); space.collaboration = await this.collaborationService.createCollaboration( collaborationData, @@ -873,6 +874,7 @@ export class SpaceService { const space = await this.getSpaceOrFail(subspaceData.spaceID, { relations: { storageAggregator: true, + templatesManager: true, community: { roleSet: true, }, @@ -906,6 +908,7 @@ export class SpaceService { // Update the subspace data being passed in to set the storage aggregator to use subspaceData.storageAggregatorParent = space.storageAggregator; + subspaceData.templatesManagerParent = space.templatesManager; subspaceData.level = space.level + 1; let subspace = await this.createSpace(subspaceData, agentInfo); From 72a05ffc83706763abef631d33c507c2f7ab9995 Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 17:30:41 +0100 Subject: [PATCH 13/42] refactor a bit and fix some tutorials falling on the wrong group --- .../collaboration/collaboration.service.ts | 13 +++++++++---- .../template-applier/template.applier.service.ts | 9 --------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/domain/collaboration/collaboration/collaboration.service.ts b/src/domain/collaboration/collaboration/collaboration.service.ts index d584b86f86..d19f67b470 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.ts @@ -153,6 +153,12 @@ export class CollaborationService { storageAggregator ); + this.moveCalloutsToCorrectGroupAndState( + groupTagsetTemplateInput.allowedValues, + statesTagsetTemplate.allowedValues, + collaboration.callouts + ); + return collaboration; } @@ -780,13 +786,9 @@ export class CollaborationService { /** * Move callouts that are not in valid groups or flowStates to the default group & first flowState - * @param defaultGroupName - * @param defaultFlowStateName * @param callouts */ public moveCalloutsToCorrectGroupAndState( - defaultGroupName: string | undefined, - defaultFlowStateName: string | undefined, validGroupNames: string[], validFlowStateNames: string[], callouts: { @@ -801,6 +803,9 @@ export class CollaborationService { }; }[] ): void { + const defaultGroupName: string | undefined = validGroupNames?.[0]; + const defaultFlowStateName: string | undefined = validFlowStateNames?.[0]; + for (const callout of callouts) { if (!callout.framing.profile.tagsets) { callout.framing.profile.tagsets = []; diff --git a/src/domain/template/template-applier/template.applier.service.ts b/src/domain/template/template-applier/template.applier.service.ts index cf27ce2674..4030300103 100644 --- a/src/domain/template/template-applier/template.applier.service.ts +++ b/src/domain/template/template-applier/template.applier.service.ts @@ -77,24 +77,15 @@ export class TemplateApplierService { ); targetCollaboration.callouts?.push(...newCallouts); - const defaultGroupName = - targetCollaboration.tagsetTemplateSet?.tagsetTemplates.find( - tagset => tagset.name === TagsetReservedName.CALLOUT_GROUP - )?.defaultSelectedValue; const validGroupNames = targetCollaboration.tagsetTemplateSet?.tagsetTemplates.find( tagset => tagset.name === TagsetReservedName.CALLOUT_GROUP )?.allowedValues; - const defaultFlowState = this.innovationFlowService.getStates( - targetCollaboration.innovationFlow - )?.[0].displayName; const validFlowStates = this.innovationFlowService .getStates(targetCollaboration.innovationFlow) ?.map(state => state.displayName); this.collaborationService.moveCalloutsToCorrectGroupAndState( - defaultGroupName, - defaultFlowState, validGroupNames ?? [], validFlowStates ?? [], targetCollaboration.callouts From 6e7202077e414dbe8580f26bdf661a8259e57570 Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 1 Nov 2024 18:30:17 +0100 Subject: [PATCH 14/42] Fix problem with whiteboard templates --- src/domain/template/template/template.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/domain/template/template/template.service.ts b/src/domain/template/template/template.service.ts index d439e94ea4..382d1254e5 100644 --- a/src/domain/template/template/template.service.ts +++ b/src/domain/template/template/template.service.ts @@ -241,6 +241,8 @@ export class TemplateService { }, select: { id: true, + type: true, + postDefaultDescription: templateInput.type === TemplateType.POST, whiteboard: templateInput.type === TemplateType.WHITEBOARD ? { @@ -267,10 +269,8 @@ export class TemplateService { template.whiteboard && templateData.whiteboardContent ) { - await this.whiteboardService.updateWhiteboardContent( - template.whiteboard.id, - templateData.whiteboardContent - ); + // If we don't update the content here, the whiteboard will is overwritten with the old content + template.whiteboard.content = templateData.whiteboardContent; } return await this.templateRepository.save(template); From 7cb003667b444a0f51e5d9acf15c4bb5b13d3fb3 Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Mon, 4 Nov 2024 09:21:11 +0100 Subject: [PATCH 15/42] revert nameId problem changes --- src/services/infrastructure/naming/naming.service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/infrastructure/naming/naming.service.ts b/src/services/infrastructure/naming/naming.service.ts index 1d626538a5..c2e48f7cf6 100644 --- a/src/services/infrastructure/naming/naming.service.ts +++ b/src/services/infrastructure/naming/naming.service.ts @@ -23,7 +23,6 @@ import { SpaceReservedName } from '@common/enums/space.reserved.name'; import { generateNameId } from '@services/infrastructure/naming/generate.name.id'; import { Template } from '@domain/template/template/template.entity'; import { IRoleSet } from '@domain/access/role-set'; -import { NAMEID_MAX_LENGTH } from '@common/constants'; export class NamingService { constructor( @@ -233,7 +232,7 @@ export class NamingService { let count = 1; while (reservedNameIDs.includes(result)) { // If the nameID is already reserved, try again with a new random suffix starting from 1 but with two digits - result = `${guess.substring(0, NAMEID_MAX_LENGTH - 1 - count.toString().length)}-${count.toString()}`; + result = `${guess}-${count.toString()}`; count++; } return result; From 43b051dbd6a06054eb6208459400f47e5b7df30a Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Mon, 4 Nov 2024 11:45:25 +0200 Subject: [PATCH 16/42] Updated migration --- .../1729511643555-templatesManager.ts | 305 --- src/migrations/1730367336792-schemaSetup.ts | 1701 ---------------- src/migrations/1730713372181-schemaSetup.ts | 1728 +++++++++++++++++ 3 files changed, 1728 insertions(+), 2006 deletions(-) delete mode 100644 src/migrations/1729511643555-templatesManager.ts delete mode 100644 src/migrations/1730367336792-schemaSetup.ts create mode 100644 src/migrations/1730713372181-schemaSetup.ts diff --git a/src/migrations/1729511643555-templatesManager.ts b/src/migrations/1729511643555-templatesManager.ts deleted file mode 100644 index 8c92fc69b2..0000000000 --- a/src/migrations/1729511643555-templatesManager.ts +++ /dev/null @@ -1,305 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { randomUUID } from 'crypto'; - -export class TemplatesManager1729511643555 implements MigrationInterface { - name = 'TemplatesManager1729511643555'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_43559aeadc1a5169d17e81b3d45\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - - await queryRunner.query(`CREATE TABLE \`template_default\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`type\` varchar(128) NOT NULL, - \`allowedTemplateType\` varchar(128) NOT NULL, - \`authorizationId\` char(36) NULL, - \`templatesManagerId\` char(36) NULL, - \`templateId\` char(36) NULL, - UNIQUE INDEX \`REL_9dbeb9326140b3ce01c1037efe\` (\`authorizationId\`), - UNIQUE INDEX \`REL_b6617b64c6ea8ebb24947ddbd4\` (\`templateId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query(`CREATE TABLE \`templates_manager\` ( - \`id\` char(36) NOT NULL, - \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - \`version\` int NOT NULL, - \`authorizationId\` char(36) NULL, - \`templatesSetId\` char(36) NULL, - UNIQUE INDEX \`REL_19ea19263c6016f411fb008243\` (\`authorizationId\`), - UNIQUE INDEX \`REL_7ba875eee72ec5fcbe2355124d\` (\`templatesSetId\`), - PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - - await queryRunner.query( - `ALTER TABLE \`platform\` ADD \`templatesManagerId\` char(36) NULL` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_81f92b22d30540102e9654e892\` ON \`platform\` (\`templatesManagerId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`templatesManagerId\` char(36) NULL` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_dea52ce918df6950019678fa35\` ON \`space\` (\`templatesManagerId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD \`isTemplate\` tinyint NOT NULL DEFAULT 0` - ); - - const levelZeroSpaces: { - id: string; - libraryId: string; - }[] = await queryRunner.query( - `SELECT id, libraryId FROM \`space\` where level = 0` - ); - for (const space of levelZeroSpaces) { - const templatesManagerID = await this.createTemplatesManager( - queryRunner, - space.libraryId - ); - await queryRunner.query( - `UPDATE \`space\` SET templatesManagerId = '${templatesManagerID}' WHERE id = '${space.id}'` - ); - // create the template defaults - await this.createTemplateDefault( - queryRunner, - templatesManagerID, - TemplateDefaultType.SPACE_SUBSPACE, - TemplateType.COLLABORATION - ); - } - - const platformTemplatesManagerID = await this.createTemplatesManager( - queryRunner, - undefined - ); - await queryRunner.query( - `UPDATE \`platform\` SET templatesManagerId = '${platformTemplatesManagerID}'` - ); - await this.createTemplateDefault( - queryRunner, - platformTemplatesManagerID, - TemplateDefaultType.PLATFORM_SPACE, - TemplateType.COLLABORATION - ); - await this.createTemplateDefault( - queryRunner, - platformTemplatesManagerID, - TemplateDefaultType.PLATFORM_SUBSPACE, - TemplateType.COLLABORATION - ); - await this.createTemplateDefault( - queryRunner, - platformTemplatesManagerID, - TemplateDefaultType.PLATFORM_SPACE_TUTORIALS, - TemplateType.COLLABORATION - ); - await this.createTemplateDefault( - queryRunner, - platformTemplatesManagerID, - TemplateDefaultType.PLATFORM_SUBSPACE_KNOWLEDGE, - TemplateType.COLLABORATION - ); - - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`defaultsId\``); - await queryRunner.query(`ALTER TABLE \`space\` DROP COLUMN \`libraryId\``); - await queryRunner.query( - `ALTER TABLE \`template_default\` ADD CONSTRAINT \`FK_9dbeb9326140b3ce01c1037efee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template_default\` ADD CONSTRAINT \`FK_c1135fa45c07ba625e1db9f93bd\` FOREIGN KEY (\`templatesManagerId\`) REFERENCES \`templates_manager\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template_default\` ADD CONSTRAINT \`FK_b6617b64c6ea8ebb24947ddbd45\` FOREIGN KEY (\`templateId\`) REFERENCES \`template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`templates_manager\` ADD CONSTRAINT \`FK_19ea19263c6016f411fb0082437\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`templates_manager\` ADD CONSTRAINT \`FK_7ba875eee72ec5fcbe2355124df\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_81f92b22d30540102e9654e892c\` FOREIGN KEY (\`templatesManagerId\`) REFERENCES \`templates_manager\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_dea52ce918df6950019678fa355\` FOREIGN KEY (\`templatesManagerId\`) REFERENCES \`templates_manager\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query(`DROP TABLE \`space_defaults\``); - } - - private async createTemplatesManager( - queryRunner: QueryRunner, - templatesSetInputId: string | undefined - ): Promise { - const templatesManagerID = randomUUID(); - const templatesManagerAuthID = await this.createAuthorizationPolicy( - queryRunner, - 'templates_manager' - ); - let templatesSetID = templatesSetInputId; - if (!templatesSetID) { - templatesSetID = await this.createTemplatesSet(queryRunner); - } - - // create the new templates manager - await queryRunner.query( - `INSERT INTO templates_manager (id, version, authorizationId, templatesSetId) VALUES - ( - '${templatesManagerID}', - 1, - '${templatesManagerAuthID}', - '${templatesSetID}')` - ); - - return templatesManagerID; - } - - private async createTemplatesSet(queryRunner: QueryRunner): Promise { - const templatesSetID = randomUUID(); - const templatesSetAuthID = await this.createAuthorizationPolicy( - queryRunner, - 'templates_set' - ); - // create the new templates set - await queryRunner.query( - `INSERT INTO templates_set (id, version, authorizationId) VALUES - ( - '${templatesSetID}', - 1, - '${templatesSetAuthID}')` - ); - return templatesSetID; - } - - private async createAuthorizationPolicy( - queryRunner: QueryRunner, - policyType: string - ): Promise { - const authID = randomUUID(); - await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${authID}', - 1, '', '', 0, '', '${policyType}')` - ); - return authID; - } - - private async createTemplateDefault( - queryRunner: QueryRunner, - templatesManagerID: string, - templateDefaultType: TemplateDefaultType, - allowedTemplateType: TemplateType - ): Promise { - const templateDefaultID = randomUUID(); - const templateDefaultAuthID = await this.createAuthorizationPolicy( - queryRunner, - 'template_default' - ); - await queryRunner.query( - `INSERT INTO template_default (id, version, type, allowedTemplateType, authorizationId, templatesManagerId) VALUES - ( - '${templateDefaultID}', - 1, - '${templateDefaultType}', - '${allowedTemplateType}', - '${templateDefaultAuthID}', - '${templatesManagerID}')` - ); - return templateDefaultID; - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_dea52ce918df6950019678fa355\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_81f92b22d30540102e9654e892c\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_manager\` DROP FOREIGN KEY \`FK_7ba875eee72ec5fcbe2355124df\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_manager\` DROP FOREIGN KEY \`FK_19ea19263c6016f411fb0082437\`` - ); - await queryRunner.query( - `ALTER TABLE \`template_default\` DROP FOREIGN KEY \`FK_b6617b64c6ea8ebb24947ddbd45\`` - ); - await queryRunner.query( - `ALTER TABLE \`template_default\` DROP FOREIGN KEY \`FK_c1135fa45c07ba625e1db9f93bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`template_default\` DROP FOREIGN KEY \`FK_9dbeb9326140b3ce01c1037efee\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_dea52ce918df6950019678fa35\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_81f92b22d30540102e9654e892\` ON \`platform\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP COLUMN \`templatesManagerId\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP COLUMN \`templatesManagerId\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`libraryId\` char(36) NULL` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD \`defaultsId\` char(36) NULL` - ); - await queryRunner.query( - `DROP INDEX \`REL_7ba875eee72ec5fcbe2355124d\` ON \`templates_manager\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_19ea19263c6016f411fb008243\` ON \`templates_manager\`` - ); - await queryRunner.query(`DROP TABLE \`templates_manager\``); - await queryRunner.query( - `DROP INDEX \`REL_b6617b64c6ea8ebb24947ddbd4\` ON \`template_default\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9dbeb9326140b3ce01c1037efe\` ON \`template_default\`` - ); - await queryRunner.query(`DROP TABLE \`template_default\``); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\` (\`defaultsId\`)` - ); - await queryRunner.query( - `CREATE UNIQUE INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\` (\`libraryId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_43559aeadc1a5169d17e81b3d45\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - } -} - -enum TemplateDefaultType { - PLATFORM_SPACE = 'platform-space', - PLATFORM_SPACE_TUTORIALS = 'platform-space-tutorials', - PLATFORM_SUBSPACE = 'platform-subspace', - PLATFORM_SUBSPACE_KNOWLEDGE = 'platform-subspace-knowledge', - SPACE_SUBSPACE = 'space-subspace', -} - -enum TemplateType { - CALLOUT = 'callout', - POST = 'post', - WHITEBOARD = 'whiteboard', - COMMUNITY_GUIDELINES = 'community-guidelines', - INNOVATION_FLOW = 'innovation-flow', - COLLABORATION = 'collaboration', -} diff --git a/src/migrations/1730367336792-schemaSetup.ts b/src/migrations/1730367336792-schemaSetup.ts deleted file mode 100644 index e28cabcc03..0000000000 --- a/src/migrations/1730367336792-schemaSetup.ts +++ /dev/null @@ -1,1701 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class SchemaSetup1730367336792 implements MigrationInterface { - name = 'SchemaSetup1730367336792'; - - public async up(queryRunner: QueryRunner): Promise { - // If there are migrations executed on the environment we exit the migration - const migrations = await queryRunner.query( - `SELECT name FROM migrations_typeorm;` - ); - - if (migrations.length > 0) { - return; - } - await queryRunner.query( - `CREATE TABLE \`authorization_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`credentialRules\` text NOT NULL, \`privilegeRules\` text NOT NULL, \`verifiedCredentialRules\` text NOT NULL, \`anonymousReadAccess\` tinyint NOT NULL, \`type\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`tagset_template_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`tagset_template\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(128) NOT NULL, \`type\` varchar(128) NOT NULL, \`allowedValues\` text NOT NULL, \`defaultSelectedValue\` varchar(255) NULL, \`tagsetTemplateSetId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`tagset\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL DEFAULT 'default', \`type\` varchar(128) NOT NULL, \`tags\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`tagsetTemplateId\` char(36) NULL, UNIQUE INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`visual\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`uri\` varchar(2048) NOT NULL, \`minWidth\` int NOT NULL, \`maxWidth\` int NOT NULL, \`minHeight\` int NOT NULL, \`maxHeight\` int NOT NULL, \`aspectRatio\` decimal(3,1) NOT NULL, \`allowedTypes\` text NOT NULL, \`alternativeText\` varchar(120) NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`location\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`city\` varchar(128) NULL, \`country\` varchar(128) NULL, \`addressLine1\` varchar(512) NULL, \`addressLine2\` varchar(512) NULL, \`stateOrProvince\` varchar(128) NULL, \`postalCode\` varchar(128) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`document\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`createdBy\` char(36) NULL, \`displayName\` varchar(512) NOT NULL, \`mimeType\` varchar(128) NOT NULL, \`size\` int NOT NULL, \`externalID\` varchar(128) NOT NULL, \`temporaryLocation\` tinyint NOT NULL DEFAULT 0, \`authorizationId\` char(36) NULL, \`storageBucketId\` char(36) NULL, \`tagsetId\` char(36) NULL, UNIQUE INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` (\`authorizationId\`), UNIQUE INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` (\`tagsetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`storage_aggregator\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`parentStorageAggregatorId\` char(36) NULL, \`directStorageId\` char(36) NULL, UNIQUE INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` (\`authorizationId\`), UNIQUE INDEX \`REL_0647707288c243e60091c8d862\` (\`directStorageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`storage_bucket\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`allowedMimeTypes\` text NOT NULL, \`maxFileSize\` int NOT NULL, \`authorizationId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`REL_f2f48b57269987b13b415a0058\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`profile\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`displayName\` text NOT NULL, \`tagline\` text NULL, \`description\` text NULL, \`type\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`locationId\` char(36) NULL, \`storageBucketId\` char(36) NULL, UNIQUE INDEX \`REL_a96475631aba7dce41db03cc8b\` (\`authorizationId\`), UNIQUE INDEX \`REL_432056041df0e4337b17ff7b09\` (\`locationId\`), UNIQUE INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` (\`storageBucketId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`reference\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`uri\` text NOT NULL, \`description\` text NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_73e8ae665a49366ca7e2866a45\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`vc_interaction\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`threadID\` varchar(44) NOT NULL, \`virtualContributorID\` char(36) NOT NULL, \`externalMetadata\` text NOT NULL, \`roomId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`room\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`externalRoomID\` varchar(255) NOT NULL, \`messagesCount\` int NOT NULL, \`type\` varchar(128) NOT NULL, \`displayName\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`whiteboard\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`content\` longtext NOT NULL, \`createdBy\` char(36) NULL, \`contentUpdatePolicy\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_d3b86160bb7d704212382b0ca4\` (\`authorizationId\`), UNIQUE INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`callout_framing\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`whiteboardId\` char(36) NULL, UNIQUE INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` (\`authorizationId\`), UNIQUE INDEX \`REL_f53e2d266432e58e538a366705\` (\`profileId\`), UNIQUE INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` (\`whiteboardId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`callout_contribution_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`allowedContributionTypes\` text NOT NULL, \`state\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`callout_contribution_defaults\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`postDescription\` text NULL, \`whiteboardContent\` longtext NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`post\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`createdBy\` char(36) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, UNIQUE INDEX \`REL_390343b22abec869bf80041933\` (\`authorizationId\`), UNIQUE INDEX \`REL_970844fcd10c2b6df7c1b49eac\` (\`profileId\`), UNIQUE INDEX \`REL_042b9825d770d6b3009ae206c2\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`link\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`uri\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_07f249ac87502495710a62c5c0\` (\`authorizationId\`), UNIQUE INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`callout_contribution\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`createdBy\` char(36) NULL, \`sortOrder\` int NOT NULL, \`authorizationId\` char(36) NULL, \`whiteboardId\` char(36) NULL, \`postId\` char(36) NULL, \`linkId\` char(36) NULL, \`calloutId\` char(36) NULL, UNIQUE INDEX \`REL_dfa86c46f509a61c6510536cd9\` (\`authorizationId\`), UNIQUE INDEX \`REL_5e34f9a356f6254b8da24f8947\` (\`whiteboardId\`), UNIQUE INDEX \`REL_97fefc97fb254c30577696e1c0\` (\`postId\`), UNIQUE INDEX \`REL_bdf2d0eced5c95968a85caaaae\` (\`linkId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`callout\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` text NOT NULL, \`isTemplate\` tinyint NOT NULL DEFAULT 0, \`createdBy\` char(36) NULL, \`visibility\` varchar(128) NOT NULL, \`sortOrder\` int NOT NULL, \`publishedBy\` char(36) NULL, \`publishedDate\` datetime NULL, \`authorizationId\` char(36) NULL, \`framingId\` char(36) NULL, \`contributionPolicyId\` char(36) NULL, \`contributionDefaultsId\` char(36) NULL, \`commentsId\` char(36) NULL, \`collaborationId\` char(36) NULL, UNIQUE INDEX \`REL_6289dee12effb51320051c6f1f\` (\`authorizationId\`), UNIQUE INDEX \`REL_cf776244b01436d8ca5cc76284\` (\`framingId\`), UNIQUE INDEX \`REL_1e740008a7e1512966e3b08414\` (\`contributionPolicyId\`), UNIQUE INDEX \`REL_36b0da55acff774d0845aeb55f\` (\`contributionDefaultsId\`), UNIQUE INDEX \`REL_62ed316cda7b75735b20307b47\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`calendar_event\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`createdBy\` char(36) NOT NULL, \`startDate\` datetime NOT NULL, \`wholeDay\` tinyint NOT NULL, \`multipleDays\` tinyint NOT NULL, \`durationMinutes\` int NOT NULL, \`durationDays\` int NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, \`calendarId\` char(36) NULL, UNIQUE INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` (\`authorizationId\`), UNIQUE INDEX \`REL_9349e137959f3ca5818c2e62b3\` (\`profileId\`), UNIQUE INDEX \`REL_b5069b11030e9608ee4468f850\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`calendar\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_6e74d59afda096b68d12a69969\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`timeline\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`calendarId\` char(36) NULL, UNIQUE INDEX \`REL_5fe58ece01b48496aebc04733d\` (\`authorizationId\`), UNIQUE INDEX \`REL_56aae15a664b2889a1a11c2cf8\` (\`calendarId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`innovation_flow\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`states\` text NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` (\`authorizationId\`), UNIQUE INDEX \`REL_96a8cbe1706f459fd7d883be9b\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`collaboration\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`groupsStr\` text NOT NULL, \`authorizationId\` char(36) NULL, \`tagsetTemplateSetId\` char(36) NULL, \`timelineId\` char(36) NULL, \`innovationFlowId\` char(36) NULL, UNIQUE INDEX \`REL_262ecf3f5d70b82a4833618425\` (\`authorizationId\`), UNIQUE INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` (\`tagsetTemplateSetId\`), UNIQUE INDEX \`REL_f67a2d25c945269d602c182fbc\` (\`timelineId\`), UNIQUE INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` (\`innovationFlowId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`lifecycle\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`machineState\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`organization_verification\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`organizationID\` varchar(36) NOT NULL, \`status\` varchar(128) NOT NULL DEFAULT 'not-verified', \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, UNIQUE INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` (\`authorizationId\`), UNIQUE INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`preference_definition\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`definitionSet\` varchar(128) NOT NULL, \`groupName\` varchar(128) NOT NULL, \`displayName\` varchar(128) NOT NULL, \`description\` varchar(255) NOT NULL, \`valueType\` varchar(16) NOT NULL, \`type\` varchar(128) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`preference\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`value\` varchar(16) NOT NULL, \`authorizationId\` char(36) NULL, \`preferenceDefinitionId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, UNIQUE INDEX \`REL_b4cf0f96bf08cf396f68355522\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`preference_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_8e76dcf171c45875c44febb1d8\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`credential\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`resourceID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`issuer\` char(36) NULL, \`expires\` datetime NULL, \`agentId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`agent\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`did\` varchar(255) NULL, \`password\` varchar(255) NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`organization\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`accountID\` char(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`legalEntityName\` varchar(255) NOT NULL, \`domain\` varchar(255) NOT NULL, \`website\` varchar(255) NOT NULL, \`contactEmail\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`verificationId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`IDX_9fdd8f0bfe04a676822c7265e1\` (\`rowId\`), UNIQUE INDEX \`REL_e0e150e4f11d906b931b46a2d8\` (\`authorizationId\`), UNIQUE INDEX \`REL_d2cb77c14644156ec8e865608e\` (\`profileId\`), UNIQUE INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` (\`agentId\`), UNIQUE INDEX \`REL_5a72d5b37312bac2e0a0115718\` (\`verificationId\`), UNIQUE INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` (\`preferenceSetId\`), UNIQUE INDEX \`REL_395aa74996a1f978b4969d114b\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`user_group\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`organizationId\` char(36) NULL, \`communityId\` char(36) NULL, UNIQUE INDEX \`REL_e8e32f1e59c349b406a4752e54\` (\`authorizationId\`), UNIQUE INDEX \`REL_9912e4cfc1e09848a392a65151\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`communication\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`spaceID\` varchar(36) NOT NULL, \`displayName\` varchar(255) NOT NULL, \`authorizationId\` char(36) NULL, \`updatesId\` char(36) NULL, UNIQUE INDEX \`REL_a20c5901817dd09d5906537e08\` (\`authorizationId\`), UNIQUE INDEX \`REL_eb99e588873c788a68a035478a\` (\`updatesId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`community_guidelines\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, UNIQUE INDEX \`REL_684b272e6f7459439d41d2879e\` (\`authorizationId\`), UNIQUE INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`role\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NOT NULL, \`credential\` text NOT NULL, \`parentCredentials\` text NOT NULL, \`requiresEntryRole\` tinyint NOT NULL, \`requiresSameRoleInParentRoleSet\` tinyint NOT NULL, \`userPolicy\` text NOT NULL, \`organizationPolicy\` text NOT NULL, \`virtualContributorPolicy\` text NOT NULL, \`roleSetId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`form\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`questions\` text NOT NULL, \`description\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`library\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_3879db652f2421337691219ace\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`license_policy\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`credentialRulesStr\` text NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_23d4d78ea8db637df031f86f03\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`license_plan\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` text NOT NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`sortOrder\` int NOT NULL, \`pricePerMonth\` decimal(10,2) NULL, \`isFree\` tinyint NOT NULL DEFAULT 0, \`trialEnabled\` tinyint NOT NULL DEFAULT 0, \`requiresPaymentMethod\` tinyint NOT NULL DEFAULT 0, \`requiresContactSupport\` tinyint NOT NULL DEFAULT 0, \`licenseCredential\` text NOT NULL, \`type\` varchar(128) NOT NULL, \`assignToNewOrganizationAccounts\` tinyint NOT NULL DEFAULT 0, \`assignToNewUserAccounts\` tinyint NOT NULL DEFAULT 0, \`licensingId\` char(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`licensing\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`licensePolicyId\` char(36) NULL, UNIQUE INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` (\`authorizationId\`), UNIQUE INDEX \`REL_a5dae5a376dd49c7c076893d40\` (\`licensePolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`discussion\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`category\` text NOT NULL, \`createdBy\` char(36) NOT NULL, \`privacy\` varchar(255) NOT NULL DEFAULT 'authenticated', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`commentsId\` char(36) NULL, \`forumId\` char(36) NULL, UNIQUE INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` (\`authorizationId\`), UNIQUE INDEX \`REL_2d8a3ca181c3f0346817685d21\` (\`profileId\`), UNIQUE INDEX \`REL_5337074c9b818bb63e6f314c80\` (\`commentsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`forum\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`discussionCategories\` text NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_3b0c92945f36d06f37de80285d\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`platform\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`forumId\` char(36) NULL, \`libraryId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, \`licensingId\` char(36) NULL, UNIQUE INDEX \`REL_9f621c51dd854634d8766a9cfa\` (\`authorizationId\`), UNIQUE INDEX \`REL_dd88d373c64b04e24705d575c9\` (\`forumId\`), UNIQUE INDEX \`REL_ca469f5ec53a7719d155d60aca\` (\`libraryId\`), UNIQUE INDEX \`REL_f516dd9a46616999c7e9a6adc1\` (\`storageAggregatorId\`), UNIQUE INDEX \`REL_425bbb4b951f7f4629710763fc\` (\`licensingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`platform_invitation\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`roleSetInvitedToParent\` tinyint NOT NULL DEFAULT 0, \`roleSetExtraRole\` varchar(128) NULL, \`platformRole\` varchar(128) NULL, \`email\` varchar(128) NOT NULL, \`firstName\` varchar(128) NULL, \`lastName\` varchar(128) NULL, \`createdBy\` char(36) NOT NULL, \`welcomeMessage\` varchar(512) NULL, \`profileCreated\` tinyint NOT NULL DEFAULT 0, \`authorizationId\` char(36) NULL, \`roleSetId\` char(36) NULL, \`platformId\` char(36) NULL, UNIQUE INDEX \`REL_c0448d2c992a62c9c11bd0f142\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`nvp\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(128) NOT NULL, \`value\` varchar(512) NOT NULL, \`sortOrder\` int NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`user\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`accountID\` char(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`accountUpn\` varchar(128) NOT NULL, \`firstName\` varchar(128) NOT NULL, \`lastName\` varchar(128) NOT NULL, \`email\` varchar(512) NOT NULL, \`phone\` varchar(128) NULL, \`serviceProfile\` tinyint NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`preferenceSetId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`IDX_266bc44a18601f893566962df6\` (\`rowId\`), UNIQUE INDEX \`REL_09f909622aa177a097256b7cc2\` (\`authorizationId\`), UNIQUE INDEX \`REL_9466682df91534dd95e4dbaa61\` (\`profileId\`), UNIQUE INDEX \`REL_b61c694cacfab25533bd23d9ad\` (\`agentId\`), UNIQUE INDEX \`REL_028322b763dc94242dc9f638f9\` (\`preferenceSetId\`), UNIQUE INDEX \`REL_10458c50c10436b6d589b40e5c\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`application\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, \`userId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_56f5614fff0028d40370499582\` (\`authorizationId\`), UNIQUE INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`invitation\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`invitedContributorID\` char(36) NOT NULL, \`createdBy\` char(36) NOT NULL, \`welcomeMessage\` varchar(512) NULL, \`invitedToParent\` tinyint NOT NULL DEFAULT 0, \`contributorType\` varchar(128) NOT NULL, \`extraRole\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`lifecycleId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_b132226941570cb650a4023d49\` (\`authorizationId\`), UNIQUE INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` (\`lifecycleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`role_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`entryRoleType\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`applicationFormId\` char(36) NULL, \`parentRoleSetId\` char(36) NULL, UNIQUE INDEX \`REL_b038f74c8d4eadb839e78b99ce\` (\`authorizationId\`), UNIQUE INDEX \`REL_00905b142498f63e76d38fb254\` (\`applicationFormId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`community\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`parentID\` varchar(36) NOT NULL, \`authorizationId\` char(36) NULL, \`communicationId\` char(36) NULL, \`guidelinesId\` char(36) NULL, \`roleSetId\` char(36) NULL, UNIQUE INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` (\`authorizationId\`), UNIQUE INDEX \`REL_7fbe50fa78a37776ad962cb764\` (\`communicationId\`), UNIQUE INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` (\`guidelinesId\`), UNIQUE INDEX \`REL_3b8f390d76263ef5996869da07\` (\`roleSetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`actor\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`description\` text NULL, \`value\` text NULL, \`impact\` varchar(255) NULL, \`authorizationId\` char(36) NULL, \`actorGroupId\` char(36) NULL, UNIQUE INDEX \`REL_a2afa3851ea733de932251b3a1\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`actor_group\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`description\` text NULL, \`authorizationId\` char(36) NULL, \`ecosystemModelId\` char(36) NULL, UNIQUE INDEX \`REL_bde98d59e8984e7d17034c3b93\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`ecosystem_model\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`description\` varchar(255) NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_658580aea4e1a892227e27db90\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`context\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`vision\` text NULL, \`impact\` text NULL, \`who\` text NULL, \`authorizationId\` char(36) NULL, \`ecosystemModelId\` char(36) NULL, UNIQUE INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` (\`authorizationId\`), UNIQUE INDEX \`REL_a03169c3f86480ba3863924f4d\` (\`ecosystemModelId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`template\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`type\` varchar(128) NOT NULL, \`postDefaultDescription\` text NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`templatesSetId\` char(36) NULL, \`innovationFlowId\` char(36) NULL, \`communityGuidelinesId\` char(36) NULL, \`calloutId\` char(36) NULL, \`whiteboardId\` char(36) NULL, \`collaborationId\` char(36) NULL, UNIQUE INDEX \`REL_4318f97beabd362a8a09e9d320\` (\`authorizationId\`), UNIQUE INDEX \`REL_f58c3b144b6e010969e199beef\` (\`profileId\`), UNIQUE INDEX \`REL_45cf273f30c1fa509456b6b0dd\` (\`innovationFlowId\`), UNIQUE INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` (\`communityGuidelinesId\`), UNIQUE INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` (\`calloutId\`), UNIQUE INDEX \`REL_f09090a77e07377eefb3f731d9\` (\`whiteboardId\`), UNIQUE INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` (\`collaborationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`templates_set\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_eb0176ef4b98c143322aa6f809\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`space_defaults\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, \`innovationFlowTemplateId\` char(36) NULL, UNIQUE INDEX \`REL_413ba75964e5a534e4bfa54846\` (\`authorizationId\`), UNIQUE INDEX \`REL_592a23e68922853bae6ebecd85\` (\`innovationFlowTemplateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`space\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`settingsStr\` text NOT NULL, \`type\` varchar(128) NOT NULL, \`levelZeroSpaceID\` char(36) NULL, \`level\` int NOT NULL, \`visibility\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`parentSpaceId\` char(36) NULL, \`accountId\` char(36) NULL, \`collaborationId\` char(36) NULL, \`contextId\` char(36) NULL, \`communityId\` char(36) NULL, \`agentId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, \`libraryId\` char(36) NULL, \`defaultsId\` char(36) NULL, UNIQUE INDEX \`IDX_0f03c61020ea0dfa0198c60304\` (\`rowId\`), UNIQUE INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` (\`authorizationId\`), UNIQUE INDEX \`REL_b4250035291aac1329d59224a9\` (\`profileId\`), UNIQUE INDEX \`REL_ea06eb8894469a0f262d929bf0\` (\`collaborationId\`), UNIQUE INDEX \`REL_cc0b08eb9679d3daa95153c2af\` (\`contextId\`), UNIQUE INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` (\`communityId\`), UNIQUE INDEX \`REL_9c664d684f987a735678b0ba82\` (\`agentId\`), UNIQUE INDEX \`REL_980c4643d7d9de1b97bc39f518\` (\`storageAggregatorId\`), UNIQUE INDEX \`REL_43559aeadc1a5169d17e81b3d4\` (\`libraryId\`), UNIQUE INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` (\`defaultsId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`ai_persona\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`aiPersonaServiceID\` varchar(128) NOT NULL, \`description\` text NULL, \`dataAccessMode\` varchar(128) NOT NULL, \`interactionModes\` text NOT NULL, \`bodyOfKnowledge\` text NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`virtual_contributor\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`communicationID\` varchar(255) NOT NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(128) NOT NULL, \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`agentId\` char(36) NULL, \`accountId\` char(36) NULL, \`aiPersonaId\` char(36) NOT NULL, UNIQUE INDEX \`REL_e2eaa2213ac4454039cd8abc07\` (\`authorizationId\`), UNIQUE INDEX \`REL_4504c37764f6962ccbd165a21d\` (\`profileId\`), UNIQUE INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` (\`agentId\`), UNIQUE INDEX \`REL_55b8101bdf4f566645e928c26e\` (\`aiPersonaId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`innovation_pack\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(36) NOT NULL DEFAULT 'account', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`accountId\` char(36) NULL, \`templatesSetId\` char(36) NULL, UNIQUE INDEX \`REL_8af8122897b05315e7eb892525\` (\`authorizationId\`), UNIQUE INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` (\`profileId\`), UNIQUE INDEX \`REL_a1441e46c8d36090e1f6477cea\` (\`templatesSetId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`account\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`type\` varchar(128) NULL, \`authorizationId\` char(36) NULL, \`agentId\` char(36) NULL, \`storageAggregatorId\` char(36) NULL, UNIQUE INDEX \`REL_91a165c1091a6959cc19d52239\` (\`authorizationId\`), UNIQUE INDEX \`REL_833582df0c439ab8c9adc5240d\` (\`agentId\`), UNIQUE INDEX \`REL_950221e932175dc7cf7c006488\` (\`storageAggregatorId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`innovation_hub\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`nameID\` varchar(36) NOT NULL, \`subdomain\` varchar(63) NOT NULL, \`type\` varchar(255) NOT NULL, \`spaceVisibilityFilter\` varchar(255) NULL, \`spaceListFilter\` text NULL, \`listedInStore\` tinyint NOT NULL, \`searchVisibility\` varchar(128) NOT NULL DEFAULT 'account', \`authorizationId\` char(36) NULL, \`profileId\` char(36) NULL, \`accountId\` char(36) NULL, UNIQUE INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` (\`nameID\`), UNIQUE INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` (\`subdomain\`), UNIQUE INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` (\`authorizationId\`), UNIQUE INDEX \`REL_36c8905c2c6c59467c60d94fd8\` (\`profileId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`activity\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`rowId\` int NOT NULL AUTO_INCREMENT, \`triggeredBy\` char(36) NOT NULL, \`resourceID\` char(36) NOT NULL, \`parentID\` char(36) NULL, \`collaborationID\` char(36) NOT NULL, \`messageID\` char(44) NULL, \`visibility\` tinyint NOT NULL, \`description\` varchar(512) NULL, \`type\` varchar(128) NOT NULL, UNIQUE INDEX \`IDX_07a39cea9426b689be25fd61de\` (\`rowId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`ai_server\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`authorizationId\` char(36) NULL, UNIQUE INDEX \`REL_9d520fa5fed56042918e48fc4b\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`ai_persona_service\` (\`id\` char(36) NOT NULL, \`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`version\` int NOT NULL, \`engine\` varchar(128) NOT NULL, \`dataAccessMode\` varchar(128) NOT NULL, \`prompt\` text NOT NULL, \`bodyOfKnowledgeType\` varchar(128) NOT NULL, \`bodyOfKnowledgeID\` varchar(128) NULL, \`bodyOfKnowledgeLastUpdated\` datetime NULL, \`externalConfig\` text NULL, \`authorizationId\` char(36) NULL, \`aiServerId\` char(36) NULL, UNIQUE INDEX \`REL_79206feb0038b1c5597668dc4b\` (\`authorizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `CREATE TABLE \`application_questions\` (\`applicationId\` char(36) NOT NULL, \`nvpId\` char(36) NOT NULL, INDEX \`IDX_8495fae86f13836b0745642baa\` (\`applicationId\`), INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` (\`nvpId\`), PRIMARY KEY (\`applicationId\`, \`nvpId\`)) ENGINE=InnoDB` - ); - await queryRunner.query( - `ALTER TABLE \`tagset_template\` ADD CONSTRAINT \`FK_96f23f044acf305c1699e0319d2\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_eb59b98ee6ef26c993d0d75c83c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_81fc213b2d9ad0cddeab1a9ce64\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` ADD CONSTRAINT \`FK_644155610ddc40dc4e19781c8f0\` FOREIGN KEY (\`tagsetTemplateId\`) REFERENCES \`tagset_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_4fbd109f9bb84f58b7a3c60649c\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` ADD CONSTRAINT \`FK_1104f3ef8497ca40d99b9f46b87\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_d9e2dfcccf59233c17cc6bc6418\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_851e50ec4be7c62a1f9b9a430bf\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`document\` ADD CONSTRAINT \`FK_9fb9257b14ec21daf5bc9aa4c8e\` FOREIGN KEY (\`tagsetId\`) REFERENCES \`tagset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_f3b4d59c0b805c9c1ecb0070e16\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_b80c28f5335ab5442f63c644d94\` FOREIGN KEY (\`parentStorageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` ADD CONSTRAINT \`FK_0647707288c243e60091c8d8620\` FOREIGN KEY (\`directStorageId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_f2f48b57269987b13b415a00587\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_a96475631aba7dce41db03cc8b2\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_432056041df0e4337b17ff7b09d\` FOREIGN KEY (\`locationId\`) REFERENCES \`location\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_4a1c74fd2a61b32d9d9500e0650\` FOREIGN KEY (\`storageBucketId\`) REFERENCES \`storage_bucket\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_73e8ae665a49366ca7e2866a45d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` ADD CONSTRAINT \`FK_2f46c698fc4c19a8cc233c5f255\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` ADD CONSTRAINT \`FK_d6f78c95ff41cdd30e505a4ebbb\` FOREIGN KEY (\`roomId\`) REFERENCES \`room\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`room\` ADD CONSTRAINT \`FK_d1d94dd8e0c417b4188a05ccbca\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_d3b86160bb7d704212382b0ca44\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` ADD CONSTRAINT \`FK_3f9e9e2798d2a4d84b16ee8477c\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_c9d7c2c4eb8a1d012ddc6605da9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_f53e2d266432e58e538a366705d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` ADD CONSTRAINT \`FK_8bc0e1f40be5816d3a593cbf7fa\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_390343b22abec869bf800419333\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_970844fcd10c2b6df7c1b49eacf\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`post\` ADD CONSTRAINT \`FK_042b9825d770d6b3009ae206c2f\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_07f249ac87502495710a62c5c01\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`link\` ADD CONSTRAINT \`FK_3bfc8c1aaec1395cc148268d3cd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_dfa86c46f509a61c6510536cd9a\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_5e34f9a356f6254b8da24f8947b\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_97fefc97fb254c30577696e1c0a\` FOREIGN KEY (\`postId\`) REFERENCES \`post\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_bdf2d0eced5c95968a85caaaaee\` FOREIGN KEY (\`linkId\`) REFERENCES \`link\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` ADD CONSTRAINT \`FK_7370de8eb79ed00b0d403f2299a\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_6289dee12effb51320051c6f1fc\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_cf776244b01436d8ca5cc762848\` FOREIGN KEY (\`framingId\`) REFERENCES \`callout_framing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_1e740008a7e1512966e3b084148\` FOREIGN KEY (\`contributionPolicyId\`) REFERENCES \`callout_contribution_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_36b0da55acff774d0845aeb55f2\` FOREIGN KEY (\`contributionDefaultsId\`) REFERENCES \`callout_contribution_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_62ed316cda7b75735b20307b47e\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` ADD CONSTRAINT \`FK_9b1c5ee044611ac78249194ec35\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_8ee86afa2808a4ab523b9ee6c5e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_9349e137959f3ca5818c2e62b3f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_b5069b11030e9608ee4468f850d\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` ADD CONSTRAINT \`FK_80ab7835e1749581a27462eb87f\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` ADD CONSTRAINT \`FK_6e74d59afda096b68d12a699691\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_5fe58ece01b48496aebc04733da\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` ADD CONSTRAINT \`FK_56aae15a664b2889a1a11c2cf82\` FOREIGN KEY (\`calendarId\`) REFERENCES \`calendar\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_a6e050daa4c7a3ab1e411c36517\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` ADD CONSTRAINT \`FK_96a8cbe1706f459fd7d883be9bd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_262ecf3f5d70b82a48336184251\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_b7ece56376ac7ca0b9a56c33b3a\` FOREIGN KEY (\`tagsetTemplateSetId\`) REFERENCES \`tagset_template_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_f67a2d25c945269d602c182fbc0\` FOREIGN KEY (\`timelineId\`) REFERENCES \`timeline\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` ADD CONSTRAINT \`FK_35c6b1de6d4d89dfe8e9c85d771\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_c66eddab0caacb1ef8d46bcafdb\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` ADD CONSTRAINT \`FK_1cc3b275fc2a9d9d9b0ae33b310\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_b4cf0f96bf08cf396f683555229\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_46d60bf133073f749b8f07e534c\` FOREIGN KEY (\`preferenceDefinitionId\`) REFERENCES \`preference_definition\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` ADD CONSTRAINT \`FK_f4b5742f589e2ac8bfe48b708c0\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` ADD CONSTRAINT \`FK_8e76dcf171c45875c44febb1d8d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` ADD CONSTRAINT \`FK_dbe0929355f82e5995f0b7fd5e2\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` ADD CONSTRAINT \`FK_8ed9d1af584fa62f1ad3405b33b\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_e0e150e4f11d906b931b46a2d89\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_d2cb77c14644156ec8e865608e0\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7f1bec8979b57ed7ebd392a2ca9\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_5a72d5b37312bac2e0a01157185\` FOREIGN KEY (\`verificationId\`) REFERENCES \`organization_verification\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_58fd47c4a6ac8df9fe2bcaed874\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_395aa74996a1f978b4969d114b1\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_e8e32f1e59c349b406a4752e545\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9912e4cfc1e09848a392a651514\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_694ebec955a90e999d9926b7da8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` ADD CONSTRAINT \`FK_9fcc131f256e969d773327f07cb\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_a20c5901817dd09d5906537e087\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_eb99e588873c788a68a035478ab\` FOREIGN KEY (\`updatesId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_684b272e6f7459439d41d2879ee\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` ADD CONSTRAINT \`FK_3d60fe4fa40d54bad7d51bb4bd1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role\` ADD CONSTRAINT \`FK_66d695b73839e9b66ff1350d34f\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`library\` ADD CONSTRAINT \`FK_3879db652f2421337691219ace8\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` ADD CONSTRAINT \`FK_23d4d78ea8db637df031f86f030\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` ADD CONSTRAINT \`FK_3030904030f5d30f483b49905d1\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_0c6a4d0a6c13a3f5df6ac015096\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` ADD CONSTRAINT \`FK_a5dae5a376dd49c7c076893d40b\` FOREIGN KEY (\`licensePolicyId\`) REFERENCES \`license_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_4555dccdda9ba57d8e3a634cd0d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_2d8a3ca181c3f0346817685d21d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_5337074c9b818bb63e6f314c808\` FOREIGN KEY (\`commentsId\`) REFERENCES \`room\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` ADD CONSTRAINT \`FK_0de78853c1ee793f61bda7eff79\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` ADD CONSTRAINT \`FK_3b0c92945f36d06f37de80285dd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_9f621c51dd854634d8766a9cfaf\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_dd88d373c64b04e24705d575c99\` FOREIGN KEY (\`forumId\`) REFERENCES \`forum\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_ca469f5ec53a7719d155d60aca1\` FOREIGN KEY (\`libraryId\`) REFERENCES \`library\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_f516dd9a46616999c7e9a6adc15\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` ADD CONSTRAINT \`FK_425bbb4b951f7f4629710763fc0\` FOREIGN KEY (\`licensingId\`) REFERENCES \`licensing\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_c0448d2c992a62c9c11bd0f1422\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_562dce4a08bb214f08107b3631e\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` ADD CONSTRAINT \`FK_809c1e6cf3ef6be03a0a1db3f70\` FOREIGN KEY (\`platformId\`) REFERENCES \`platform\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_09f909622aa177a097256b7cc22\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_9466682df91534dd95e4dbaa616\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_b61c694cacfab25533bd23d9add\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_028322b763dc94242dc9f638f9b\` FOREIGN KEY (\`preferenceSetId\`) REFERENCES \`preference_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_10458c50c10436b6d589b40e5ca\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_56f5614fff0028d403704995822\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_7ec2857c7d8d16432ffca1cb3d9\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_b4ae3fea4a24b4be1a86dacf8a2\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application\` ADD CONSTRAINT \`FK_8fb220ad1ac1f9c86ec39d134e4\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b132226941570cb650a4023d493\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_b0c80ccf319a1c7a7af12b39987\` FOREIGN KEY (\`lifecycleId\`) REFERENCES \`lifecycle\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` ADD CONSTRAINT \`FK_6a3b86c6db10582baae7058f5b9\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_b038f74c8d4eadb839e78b99ce5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_00905b142498f63e76d38fb254e\` FOREIGN KEY (\`applicationFormId\`) REFERENCES \`form\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` ADD CONSTRAINT \`FK_86acc254af20d20c9d87c3503d5\` FOREIGN KEY (\`parentRoleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_6e7584bfb417bd0f8e8696ab585\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_7fbe50fa78a37776ad962cb7643\` FOREIGN KEY (\`communicationId\`) REFERENCES \`communication\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_2e7dd2fa8c829352cfbecb2cc93\` FOREIGN KEY (\`guidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`community\` ADD CONSTRAINT \`FK_3b8f390d76263ef5996869da071\` FOREIGN KEY (\`roleSetId\`) REFERENCES \`role_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_a2afa3851ea733de932251b3a1f\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` ADD CONSTRAINT \`FK_0f9d41ee193d631a5439bb4f404\` FOREIGN KEY (\`actorGroupId\`) REFERENCES \`actor_group\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_bde98d59e8984e7d17034c3b937\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` ADD CONSTRAINT \`FK_cbb1d7afa052a184471723d3297\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` ADD CONSTRAINT \`FK_658580aea4e1a892227e27db902\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_5f0dbc3b097ef297bd5f4ddb1a9\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`context\` ADD CONSTRAINT \`FK_a03169c3f86480ba3863924f4d7\` FOREIGN KEY (\`ecosystemModelId\`) REFERENCES \`ecosystem_model\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_4318f97beabd362a8a09e9d3203\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f58c3b144b6e010969e199beeff\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c7f54e6269c013d9c273f025edd\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_45cf273f30c1fa509456b6b0ddf\` FOREIGN KEY (\`innovationFlowId\`) REFERENCES \`innovation_flow\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_eedeae5e63f9a9c3a0161541e98\` FOREIGN KEY (\`communityGuidelinesId\`) REFERENCES \`community_guidelines\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_c6e4d1a07781a809ad3b3ee8265\` FOREIGN KEY (\`calloutId\`) REFERENCES \`callout\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_f09090a77e07377eefb3f731d9f\` FOREIGN KEY (\`whiteboardId\`) REFERENCES \`whiteboard\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`template\` ADD CONSTRAINT \`FK_21fdaf6dc88bdd6e8839e29b0bd\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` ADD CONSTRAINT \`FK_eb0176ef4b98c143322aa6f8090\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_413ba75964e5a534e4bfa54846e\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` ADD CONSTRAINT \`FK_592a23e68922853bae6ebecd85e\` FOREIGN KEY (\`innovationFlowTemplateId\`) REFERENCES \`template\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_8d03fd2c8e8411ec9192c79cd99\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_b4250035291aac1329d59224a96\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ef1ff4ac7f613cc0677e2295b30\` FOREIGN KEY (\`parentSpaceId\`) REFERENCES \`space\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6bdeffaf6ea6159b4672a2aed70\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_ea06eb8894469a0f262d929bf06\` FOREIGN KEY (\`collaborationId\`) REFERENCES \`collaboration\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_cc0b08eb9679d3daa95153c2af5\` FOREIGN KEY (\`contextId\`) REFERENCES \`context\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_68fa2c2b00cc1ed77e7c225e8ba\` FOREIGN KEY (\`communityId\`) REFERENCES \`community\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_9c664d684f987a735678b0ba825\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_980c4643d7d9de1b97bc39f5185\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_43559aeadc1a5169d17e81b3d45\` FOREIGN KEY (\`libraryId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`space\` ADD CONSTRAINT \`FK_6b1efee39d076d9f7ecb8fef4cd\` FOREIGN KEY (\`defaultsId\`) REFERENCES \`space_defaults\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` ADD CONSTRAINT \`FK_293f0d3ef60cb0ca0006044ecfd\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_e2eaa2213ac4454039cd8abc07d\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_4504c37764f6962ccbd165a21de\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_a8890dcd65b8c3ee6e160d33f3a\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_7a962c9b04b0d197bc3c93262a7\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` ADD CONSTRAINT \`FK_55b8101bdf4f566645e928c26e3\` FOREIGN KEY (\`aiPersonaId\`) REFERENCES \`ai_persona\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_8af8122897b05315e7eb8925253\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_5facd6d188068a5a1c5b6f07fc3\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_51014590f9644e6ff9e0536f40f\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` ADD CONSTRAINT \`FK_a1441e46c8d36090e1f6477cea5\` FOREIGN KEY (\`templatesSetId\`) REFERENCES \`templates_set\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_91a165c1091a6959cc19d522399\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_833582df0c439ab8c9adc5240d1\` FOREIGN KEY (\`agentId\`) REFERENCES \`agent\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`account\` ADD CONSTRAINT \`FK_950221e932175dc7cf7c0064887\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_b411e4f27d77a96eccdabbf4b45\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_36c8905c2c6c59467c60d94fd8a\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` ADD CONSTRAINT \`FK_156fd30246eb151b9d17716abf5\` FOREIGN KEY (\`accountId\`) REFERENCES \`account\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` ADD CONSTRAINT \`FK_9d520fa5fed56042918e48fc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_79206feb0038b1c5597668dc4b5\` FOREIGN KEY (\`authorizationId\`) REFERENCES \`authorization_policy\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` ADD CONSTRAINT \`FK_b9f20da98058d7bd474152ed6ce\` FOREIGN KEY (\`aiServerId\`) REFERENCES \`ai_server\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_8495fae86f13836b0745642baa8\` FOREIGN KEY (\`applicationId\`) REFERENCES \`application\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` ADD CONSTRAINT \`FK_fe50118fd82e7fe2f74f986a195\` FOREIGN KEY (\`nvpId\`) REFERENCES \`nvp\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `CREATE TABLE \`query-result-cache\` (\`id\` int NOT NULL AUTO_INCREMENT, \`identifier\` varchar(255) NULL, \`time\` bigint NOT NULL, \`duration\` int NOT NULL, \`query\` text NOT NULL, \`result\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB` - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP TABLE \`query-result-cache\``); - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_fe50118fd82e7fe2f74f986a195\`` - ); - await queryRunner.query( - `ALTER TABLE \`application_questions\` DROP FOREIGN KEY \`FK_8495fae86f13836b0745642baa8\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_b9f20da98058d7bd474152ed6ce\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona_service\` DROP FOREIGN KEY \`FK_79206feb0038b1c5597668dc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_server\` DROP FOREIGN KEY \`FK_9d520fa5fed56042918e48fc4b5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_156fd30246eb151b9d17716abf5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_36c8905c2c6c59467c60d94fd8a\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_hub\` DROP FOREIGN KEY \`FK_b411e4f27d77a96eccdabbf4b45\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_950221e932175dc7cf7c0064887\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_833582df0c439ab8c9adc5240d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`account\` DROP FOREIGN KEY \`FK_91a165c1091a6959cc19d522399\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_a1441e46c8d36090e1f6477cea5\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_51014590f9644e6ff9e0536f40f\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_5facd6d188068a5a1c5b6f07fc3\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_pack\` DROP FOREIGN KEY \`FK_8af8122897b05315e7eb8925253\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_55b8101bdf4f566645e928c26e3\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_7a962c9b04b0d197bc3c93262a7\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_a8890dcd65b8c3ee6e160d33f3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_4504c37764f6962ccbd165a21de\`` - ); - await queryRunner.query( - `ALTER TABLE \`virtual_contributor\` DROP FOREIGN KEY \`FK_e2eaa2213ac4454039cd8abc07d\`` - ); - await queryRunner.query( - `ALTER TABLE \`ai_persona\` DROP FOREIGN KEY \`FK_293f0d3ef60cb0ca0006044ecfd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6b1efee39d076d9f7ecb8fef4cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_43559aeadc1a5169d17e81b3d45\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_980c4643d7d9de1b97bc39f5185\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_9c664d684f987a735678b0ba825\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_68fa2c2b00cc1ed77e7c225e8ba\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_cc0b08eb9679d3daa95153c2af5\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ea06eb8894469a0f262d929bf06\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_6bdeffaf6ea6159b4672a2aed70\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_ef1ff4ac7f613cc0677e2295b30\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_b4250035291aac1329d59224a96\`` - ); - await queryRunner.query( - `ALTER TABLE \`space\` DROP FOREIGN KEY \`FK_8d03fd2c8e8411ec9192c79cd99\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_592a23e68922853bae6ebecd85e\`` - ); - await queryRunner.query( - `ALTER TABLE \`space_defaults\` DROP FOREIGN KEY \`FK_413ba75964e5a534e4bfa54846e\`` - ); - await queryRunner.query( - `ALTER TABLE \`templates_set\` DROP FOREIGN KEY \`FK_eb0176ef4b98c143322aa6f8090\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_21fdaf6dc88bdd6e8839e29b0bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f09090a77e07377eefb3f731d9f\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c6e4d1a07781a809ad3b3ee8265\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_eedeae5e63f9a9c3a0161541e98\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_45cf273f30c1fa509456b6b0ddf\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_c7f54e6269c013d9c273f025edd\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_f58c3b144b6e010969e199beeff\`` - ); - await queryRunner.query( - `ALTER TABLE \`template\` DROP FOREIGN KEY \`FK_4318f97beabd362a8a09e9d3203\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_a03169c3f86480ba3863924f4d7\`` - ); - await queryRunner.query( - `ALTER TABLE \`context\` DROP FOREIGN KEY \`FK_5f0dbc3b097ef297bd5f4ddb1a9\`` - ); - await queryRunner.query( - `ALTER TABLE \`ecosystem_model\` DROP FOREIGN KEY \`FK_658580aea4e1a892227e27db902\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_cbb1d7afa052a184471723d3297\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor_group\` DROP FOREIGN KEY \`FK_bde98d59e8984e7d17034c3b937\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_0f9d41ee193d631a5439bb4f404\`` - ); - await queryRunner.query( - `ALTER TABLE \`actor\` DROP FOREIGN KEY \`FK_a2afa3851ea733de932251b3a1f\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_3b8f390d76263ef5996869da071\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_2e7dd2fa8c829352cfbecb2cc93\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_7fbe50fa78a37776ad962cb7643\`` - ); - await queryRunner.query( - `ALTER TABLE \`community\` DROP FOREIGN KEY \`FK_6e7584bfb417bd0f8e8696ab585\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_86acc254af20d20c9d87c3503d5\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_00905b142498f63e76d38fb254e\`` - ); - await queryRunner.query( - `ALTER TABLE \`role_set\` DROP FOREIGN KEY \`FK_b038f74c8d4eadb839e78b99ce5\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_6a3b86c6db10582baae7058f5b9\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b0c80ccf319a1c7a7af12b39987\`` - ); - await queryRunner.query( - `ALTER TABLE \`invitation\` DROP FOREIGN KEY \`FK_b132226941570cb650a4023d493\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_8fb220ad1ac1f9c86ec39d134e4\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_b4ae3fea4a24b4be1a86dacf8a2\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_7ec2857c7d8d16432ffca1cb3d9\`` - ); - await queryRunner.query( - `ALTER TABLE \`application\` DROP FOREIGN KEY \`FK_56f5614fff0028d403704995822\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_10458c50c10436b6d589b40e5ca\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_028322b763dc94242dc9f638f9b\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_b61c694cacfab25533bd23d9add\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_9466682df91534dd95e4dbaa616\`` - ); - await queryRunner.query( - `ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_09f909622aa177a097256b7cc22\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_809c1e6cf3ef6be03a0a1db3f70\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_562dce4a08bb214f08107b3631e\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform_invitation\` DROP FOREIGN KEY \`FK_c0448d2c992a62c9c11bd0f1422\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_425bbb4b951f7f4629710763fc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_f516dd9a46616999c7e9a6adc15\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_ca469f5ec53a7719d155d60aca1\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_dd88d373c64b04e24705d575c99\`` - ); - await queryRunner.query( - `ALTER TABLE \`platform\` DROP FOREIGN KEY \`FK_9f621c51dd854634d8766a9cfaf\`` - ); - await queryRunner.query( - `ALTER TABLE \`forum\` DROP FOREIGN KEY \`FK_3b0c92945f36d06f37de80285dd\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_0de78853c1ee793f61bda7eff79\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_5337074c9b818bb63e6f314c808\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_2d8a3ca181c3f0346817685d21d\`` - ); - await queryRunner.query( - `ALTER TABLE \`discussion\` DROP FOREIGN KEY \`FK_4555dccdda9ba57d8e3a634cd0d\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_a5dae5a376dd49c7c076893d40b\`` - ); - await queryRunner.query( - `ALTER TABLE \`licensing\` DROP FOREIGN KEY \`FK_0c6a4d0a6c13a3f5df6ac015096\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_plan\` DROP FOREIGN KEY \`FK_3030904030f5d30f483b49905d1\`` - ); - await queryRunner.query( - `ALTER TABLE \`license_policy\` DROP FOREIGN KEY \`FK_23d4d78ea8db637df031f86f030\`` - ); - await queryRunner.query( - `ALTER TABLE \`library\` DROP FOREIGN KEY \`FK_3879db652f2421337691219ace8\`` - ); - await queryRunner.query( - `ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_66d695b73839e9b66ff1350d34f\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_3d60fe4fa40d54bad7d51bb4bd1\`` - ); - await queryRunner.query( - `ALTER TABLE \`community_guidelines\` DROP FOREIGN KEY \`FK_684b272e6f7459439d41d2879ee\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_eb99e588873c788a68a035478ab\`` - ); - await queryRunner.query( - `ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_a20c5901817dd09d5906537e087\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9fcc131f256e969d773327f07cb\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_694ebec955a90e999d9926b7da8\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_9912e4cfc1e09848a392a651514\`` - ); - await queryRunner.query( - `ALTER TABLE \`user_group\` DROP FOREIGN KEY \`FK_e8e32f1e59c349b406a4752e545\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_395aa74996a1f978b4969d114b1\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_58fd47c4a6ac8df9fe2bcaed874\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_5a72d5b37312bac2e0a01157185\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7f1bec8979b57ed7ebd392a2ca9\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_d2cb77c14644156ec8e865608e0\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_e0e150e4f11d906b931b46a2d89\`` - ); - await queryRunner.query( - `ALTER TABLE \`agent\` DROP FOREIGN KEY \`FK_8ed9d1af584fa62f1ad3405b33b\`` - ); - await queryRunner.query( - `ALTER TABLE \`credential\` DROP FOREIGN KEY \`FK_dbe0929355f82e5995f0b7fd5e2\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference_set\` DROP FOREIGN KEY \`FK_8e76dcf171c45875c44febb1d8d\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_f4b5742f589e2ac8bfe48b708c0\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_46d60bf133073f749b8f07e534c\`` - ); - await queryRunner.query( - `ALTER TABLE \`preference\` DROP FOREIGN KEY \`FK_b4cf0f96bf08cf396f683555229\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_1cc3b275fc2a9d9d9b0ae33b310\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_verification\` DROP FOREIGN KEY \`FK_c66eddab0caacb1ef8d46bcafdb\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_35c6b1de6d4d89dfe8e9c85d771\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_f67a2d25c945269d602c182fbc0\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_b7ece56376ac7ca0b9a56c33b3a\`` - ); - await queryRunner.query( - `ALTER TABLE \`collaboration\` DROP FOREIGN KEY \`FK_262ecf3f5d70b82a48336184251\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_96a8cbe1706f459fd7d883be9bd\`` - ); - await queryRunner.query( - `ALTER TABLE \`innovation_flow\` DROP FOREIGN KEY \`FK_a6e050daa4c7a3ab1e411c36517\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_56aae15a664b2889a1a11c2cf82\`` - ); - await queryRunner.query( - `ALTER TABLE \`timeline\` DROP FOREIGN KEY \`FK_5fe58ece01b48496aebc04733da\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar\` DROP FOREIGN KEY \`FK_6e74d59afda096b68d12a699691\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_80ab7835e1749581a27462eb87f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_b5069b11030e9608ee4468f850d\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_9349e137959f3ca5818c2e62b3f\`` - ); - await queryRunner.query( - `ALTER TABLE \`calendar_event\` DROP FOREIGN KEY \`FK_8ee86afa2808a4ab523b9ee6c5e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_9b1c5ee044611ac78249194ec35\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_62ed316cda7b75735b20307b47e\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_36b0da55acff774d0845aeb55f2\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_1e740008a7e1512966e3b084148\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_cf776244b01436d8ca5cc762848\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout\` DROP FOREIGN KEY \`FK_6289dee12effb51320051c6f1fc\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_7370de8eb79ed00b0d403f2299a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_bdf2d0eced5c95968a85caaaaee\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_97fefc97fb254c30577696e1c0a\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_5e34f9a356f6254b8da24f8947b\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_contribution\` DROP FOREIGN KEY \`FK_dfa86c46f509a61c6510536cd9a\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_3bfc8c1aaec1395cc148268d3cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`link\` DROP FOREIGN KEY \`FK_07f249ac87502495710a62c5c01\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_042b9825d770d6b3009ae206c2f\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_970844fcd10c2b6df7c1b49eacf\`` - ); - await queryRunner.query( - `ALTER TABLE \`post\` DROP FOREIGN KEY \`FK_390343b22abec869bf800419333\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_8bc0e1f40be5816d3a593cbf7fa\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_f53e2d266432e58e538a366705d\`` - ); - await queryRunner.query( - `ALTER TABLE \`callout_framing\` DROP FOREIGN KEY \`FK_c9d7c2c4eb8a1d012ddc6605da9\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_3f9e9e2798d2a4d84b16ee8477c\`` - ); - await queryRunner.query( - `ALTER TABLE \`whiteboard\` DROP FOREIGN KEY \`FK_d3b86160bb7d704212382b0ca44\`` - ); - await queryRunner.query( - `ALTER TABLE \`room\` DROP FOREIGN KEY \`FK_d1d94dd8e0c417b4188a05ccbca\`` - ); - await queryRunner.query( - `ALTER TABLE \`vc_interaction\` DROP FOREIGN KEY \`FK_d6f78c95ff41cdd30e505a4ebbb\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_2f46c698fc4c19a8cc233c5f255\`` - ); - await queryRunner.query( - `ALTER TABLE \`reference\` DROP FOREIGN KEY \`FK_73e8ae665a49366ca7e2866a45d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_4a1c74fd2a61b32d9d9500e0650\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_432056041df0e4337b17ff7b09d\`` - ); - await queryRunner.query( - `ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_a96475631aba7dce41db03cc8b2\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_11d0ed50a26da5513f7e4347847\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_bucket\` DROP FOREIGN KEY \`FK_f2f48b57269987b13b415a00587\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_0647707288c243e60091c8d8620\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_b80c28f5335ab5442f63c644d94\`` - ); - await queryRunner.query( - `ALTER TABLE \`storage_aggregator\` DROP FOREIGN KEY \`FK_f3b4d59c0b805c9c1ecb0070e16\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_9fb9257b14ec21daf5bc9aa4c8e\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_851e50ec4be7c62a1f9b9a430bf\`` - ); - await queryRunner.query( - `ALTER TABLE \`document\` DROP FOREIGN KEY \`FK_d9e2dfcccf59233c17cc6bc6418\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_1104f3ef8497ca40d99b9f46b87\`` - ); - await queryRunner.query( - `ALTER TABLE \`visual\` DROP FOREIGN KEY \`FK_4fbd109f9bb84f58b7a3c60649c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_644155610ddc40dc4e19781c8f0\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_81fc213b2d9ad0cddeab1a9ce64\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset\` DROP FOREIGN KEY \`FK_eb59b98ee6ef26c993d0d75c83c\`` - ); - await queryRunner.query( - `ALTER TABLE \`tagset_template\` DROP FOREIGN KEY \`FK_96f23f044acf305c1699e0319d2\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_fe50118fd82e7fe2f74f986a19\` ON \`application_questions\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8495fae86f13836b0745642baa\` ON \`application_questions\`` - ); - await queryRunner.query(`DROP TABLE \`application_questions\``); - await queryRunner.query( - `DROP INDEX \`REL_79206feb0038b1c5597668dc4b\` ON \`ai_persona_service\`` - ); - await queryRunner.query(`DROP TABLE \`ai_persona_service\``); - await queryRunner.query( - `DROP INDEX \`REL_9d520fa5fed56042918e48fc4b\` ON \`ai_server\`` - ); - await queryRunner.query(`DROP TABLE \`ai_server\``); - await queryRunner.query( - `DROP INDEX \`IDX_07a39cea9426b689be25fd61de\` ON \`activity\`` - ); - await queryRunner.query(`DROP TABLE \`activity\``); - await queryRunner.query( - `DROP INDEX \`REL_36c8905c2c6c59467c60d94fd8\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b411e4f27d77a96eccdabbf4b4\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_8f35d04d098bb6c7c57a9a83ac\` ON \`innovation_hub\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_1d39dac2c6d2f17286d90c306b\` ON \`innovation_hub\`` - ); - await queryRunner.query(`DROP TABLE \`innovation_hub\``); - await queryRunner.query( - `DROP INDEX \`REL_950221e932175dc7cf7c006488\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_833582df0c439ab8c9adc5240d\` ON \`account\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_91a165c1091a6959cc19d52239\` ON \`account\`` - ); - await queryRunner.query(`DROP TABLE \`account\``); - await queryRunner.query( - `DROP INDEX \`REL_a1441e46c8d36090e1f6477cea\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5facd6d188068a5a1c5b6f07fc\` ON \`innovation_pack\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8af8122897b05315e7eb892525\` ON \`innovation_pack\`` - ); - await queryRunner.query(`DROP TABLE \`innovation_pack\``); - await queryRunner.query( - `DROP INDEX \`REL_55b8101bdf4f566645e928c26e\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a8890dcd65b8c3ee6e160d33f3\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4504c37764f6962ccbd165a21d\` ON \`virtual_contributor\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e2eaa2213ac4454039cd8abc07\` ON \`virtual_contributor\`` - ); - await queryRunner.query(`DROP TABLE \`virtual_contributor\``); - await queryRunner.query( - `DROP INDEX \`REL_293f0d3ef60cb0ca0006044ecf\` ON \`ai_persona\`` - ); - await queryRunner.query(`DROP TABLE \`ai_persona\``); - await queryRunner.query( - `DROP INDEX \`REL_6b1efee39d076d9f7ecb8fef4c\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_43559aeadc1a5169d17e81b3d4\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_980c4643d7d9de1b97bc39f518\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9c664d684f987a735678b0ba82\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_68fa2c2b00cc1ed77e7c225e8b\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_cc0b08eb9679d3daa95153c2af\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_ea06eb8894469a0f262d929bf0\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b4250035291aac1329d59224a9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8d03fd2c8e8411ec9192c79cd9\` ON \`space\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_0f03c61020ea0dfa0198c60304\` ON \`space\`` - ); - await queryRunner.query(`DROP TABLE \`space\``); - await queryRunner.query( - `DROP INDEX \`REL_592a23e68922853bae6ebecd85\` ON \`space_defaults\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_413ba75964e5a534e4bfa54846\` ON \`space_defaults\`` - ); - await queryRunner.query(`DROP TABLE \`space_defaults\``); - await queryRunner.query( - `DROP INDEX \`REL_eb0176ef4b98c143322aa6f809\` ON \`templates_set\`` - ); - await queryRunner.query(`DROP TABLE \`templates_set\``); - await queryRunner.query( - `DROP INDEX \`REL_21fdaf6dc88bdd6e8839e29b0b\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f09090a77e07377eefb3f731d9\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c6e4d1a07781a809ad3b3ee826\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_eedeae5e63f9a9c3a0161541e9\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_45cf273f30c1fa509456b6b0dd\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f58c3b144b6e010969e199beef\` ON \`template\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4318f97beabd362a8a09e9d320\` ON \`template\`` - ); - await queryRunner.query(`DROP TABLE \`template\``); - await queryRunner.query( - `DROP INDEX \`REL_a03169c3f86480ba3863924f4d\` ON \`context\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5f0dbc3b097ef297bd5f4ddb1a\` ON \`context\`` - ); - await queryRunner.query(`DROP TABLE \`context\``); - await queryRunner.query( - `DROP INDEX \`REL_658580aea4e1a892227e27db90\` ON \`ecosystem_model\`` - ); - await queryRunner.query(`DROP TABLE \`ecosystem_model\``); - await queryRunner.query( - `DROP INDEX \`REL_bde98d59e8984e7d17034c3b93\` ON \`actor_group\`` - ); - await queryRunner.query(`DROP TABLE \`actor_group\``); - await queryRunner.query( - `DROP INDEX \`REL_a2afa3851ea733de932251b3a1\` ON \`actor\`` - ); - await queryRunner.query(`DROP TABLE \`actor\``); - await queryRunner.query( - `DROP INDEX \`REL_3b8f390d76263ef5996869da07\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_2e7dd2fa8c829352cfbecb2cc9\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7fbe50fa78a37776ad962cb764\` ON \`community\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6e7584bfb417bd0f8e8696ab58\` ON \`community\`` - ); - await queryRunner.query(`DROP TABLE \`community\``); - await queryRunner.query( - `DROP INDEX \`REL_00905b142498f63e76d38fb254\` ON \`role_set\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b038f74c8d4eadb839e78b99ce\` ON \`role_set\`` - ); - await queryRunner.query(`DROP TABLE \`role_set\``); - await queryRunner.query( - `DROP INDEX \`REL_b0c80ccf319a1c7a7af12b3998\` ON \`invitation\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b132226941570cb650a4023d49\` ON \`invitation\`` - ); - await queryRunner.query(`DROP TABLE \`invitation\``); - await queryRunner.query( - `DROP INDEX \`REL_7ec2857c7d8d16432ffca1cb3d\` ON \`application\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_56f5614fff0028d40370499582\` ON \`application\`` - ); - await queryRunner.query(`DROP TABLE \`application\``); - await queryRunner.query( - `DROP INDEX \`REL_10458c50c10436b6d589b40e5c\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_028322b763dc94242dc9f638f9\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b61c694cacfab25533bd23d9ad\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9466682df91534dd95e4dbaa61\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_09f909622aa177a097256b7cc2\` ON \`user\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_266bc44a18601f893566962df6\` ON \`user\`` - ); - await queryRunner.query(`DROP TABLE \`user\``); - await queryRunner.query(`DROP TABLE \`nvp\``); - await queryRunner.query( - `DROP INDEX \`REL_c0448d2c992a62c9c11bd0f142\` ON \`platform_invitation\`` - ); - await queryRunner.query(`DROP TABLE \`platform_invitation\``); - await queryRunner.query( - `DROP INDEX \`REL_425bbb4b951f7f4629710763fc\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f516dd9a46616999c7e9a6adc1\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_ca469f5ec53a7719d155d60aca\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_dd88d373c64b04e24705d575c9\` ON \`platform\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9f621c51dd854634d8766a9cfa\` ON \`platform\`` - ); - await queryRunner.query(`DROP TABLE \`platform\``); - await queryRunner.query( - `DROP INDEX \`REL_3b0c92945f36d06f37de80285d\` ON \`forum\`` - ); - await queryRunner.query(`DROP TABLE \`forum\``); - await queryRunner.query( - `DROP INDEX \`REL_5337074c9b818bb63e6f314c80\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_2d8a3ca181c3f0346817685d21\` ON \`discussion\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_4555dccdda9ba57d8e3a634cd0\` ON \`discussion\`` - ); - await queryRunner.query(`DROP TABLE \`discussion\``); - await queryRunner.query( - `DROP INDEX \`REL_a5dae5a376dd49c7c076893d40\` ON \`licensing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_0c6a4d0a6c13a3f5df6ac01509\` ON \`licensing\`` - ); - await queryRunner.query(`DROP TABLE \`licensing\``); - await queryRunner.query(`DROP TABLE \`license_plan\``); - await queryRunner.query( - `DROP INDEX \`REL_23d4d78ea8db637df031f86f03\` ON \`license_policy\`` - ); - await queryRunner.query(`DROP TABLE \`license_policy\``); - await queryRunner.query( - `DROP INDEX \`REL_3879db652f2421337691219ace\` ON \`library\`` - ); - await queryRunner.query(`DROP TABLE \`library\``); - await queryRunner.query(`DROP TABLE \`form\``); - await queryRunner.query(`DROP TABLE \`role\``); - await queryRunner.query( - `DROP INDEX \`REL_3d60fe4fa40d54bad7d51bb4bd\` ON \`community_guidelines\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_684b272e6f7459439d41d2879e\` ON \`community_guidelines\`` - ); - await queryRunner.query(`DROP TABLE \`community_guidelines\``); - await queryRunner.query( - `DROP INDEX \`REL_eb99e588873c788a68a035478a\` ON \`communication\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a20c5901817dd09d5906537e08\` ON \`communication\`` - ); - await queryRunner.query(`DROP TABLE \`communication\``); - await queryRunner.query( - `DROP INDEX \`REL_9912e4cfc1e09848a392a65151\` ON \`user_group\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e8e32f1e59c349b406a4752e54\` ON \`user_group\`` - ); - await queryRunner.query(`DROP TABLE \`user_group\``); - await queryRunner.query( - `DROP INDEX \`REL_395aa74996a1f978b4969d114b\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_58fd47c4a6ac8df9fe2bcaed87\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5a72d5b37312bac2e0a0115718\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_7f1bec8979b57ed7ebd392a2ca\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d2cb77c14644156ec8e865608e\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_e0e150e4f11d906b931b46a2d8\` ON \`organization\`` - ); - await queryRunner.query( - `DROP INDEX \`IDX_9fdd8f0bfe04a676822c7265e1\` ON \`organization\`` - ); - await queryRunner.query(`DROP TABLE \`organization\``); - await queryRunner.query( - `DROP INDEX \`REL_8ed9d1af584fa62f1ad3405b33\` ON \`agent\`` - ); - await queryRunner.query(`DROP TABLE \`agent\``); - await queryRunner.query(`DROP TABLE \`credential\``); - await queryRunner.query( - `DROP INDEX \`REL_8e76dcf171c45875c44febb1d8\` ON \`preference_set\`` - ); - await queryRunner.query(`DROP TABLE \`preference_set\``); - await queryRunner.query( - `DROP INDEX \`REL_b4cf0f96bf08cf396f68355522\` ON \`preference\`` - ); - await queryRunner.query(`DROP TABLE \`preference\``); - await queryRunner.query(`DROP TABLE \`preference_definition\``); - await queryRunner.query( - `DROP INDEX \`REL_1cc3b275fc2a9d9d9b0ae33b31\` ON \`organization_verification\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c66eddab0caacb1ef8d46bcafd\` ON \`organization_verification\`` - ); - await queryRunner.query(`DROP TABLE \`organization_verification\``); - await queryRunner.query(`DROP TABLE \`lifecycle\``); - await queryRunner.query( - `DROP INDEX \`REL_35c6b1de6d4d89dfe8e9c85d77\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f67a2d25c945269d602c182fbc\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_b7ece56376ac7ca0b9a56c33b3\` ON \`collaboration\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_262ecf3f5d70b82a4833618425\` ON \`collaboration\`` - ); - await queryRunner.query(`DROP TABLE \`collaboration\``); - await queryRunner.query( - `DROP INDEX \`REL_96a8cbe1706f459fd7d883be9b\` ON \`innovation_flow\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a6e050daa4c7a3ab1e411c3651\` ON \`innovation_flow\`` - ); - await queryRunner.query(`DROP TABLE \`innovation_flow\``); - await queryRunner.query( - `DROP INDEX \`REL_56aae15a664b2889a1a11c2cf8\` ON \`timeline\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5fe58ece01b48496aebc04733d\` ON \`timeline\`` - ); - await queryRunner.query(`DROP TABLE \`timeline\``); - await queryRunner.query( - `DROP INDEX \`REL_6e74d59afda096b68d12a69969\` ON \`calendar\`` - ); - await queryRunner.query(`DROP TABLE \`calendar\``); - await queryRunner.query( - `DROP INDEX \`REL_b5069b11030e9608ee4468f850\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_9349e137959f3ca5818c2e62b3\` ON \`calendar_event\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_8ee86afa2808a4ab523b9ee6c5\` ON \`calendar_event\`` - ); - await queryRunner.query(`DROP TABLE \`calendar_event\``); - await queryRunner.query( - `DROP INDEX \`REL_62ed316cda7b75735b20307b47\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_36b0da55acff774d0845aeb55f\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_1e740008a7e1512966e3b08414\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_cf776244b01436d8ca5cc76284\` ON \`callout\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_6289dee12effb51320051c6f1f\` ON \`callout\`` - ); - await queryRunner.query(`DROP TABLE \`callout\``); - await queryRunner.query( - `DROP INDEX \`REL_bdf2d0eced5c95968a85caaaae\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_97fefc97fb254c30577696e1c0\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_5e34f9a356f6254b8da24f8947\` ON \`callout_contribution\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_dfa86c46f509a61c6510536cd9\` ON \`callout_contribution\`` - ); - await queryRunner.query(`DROP TABLE \`callout_contribution\``); - await queryRunner.query( - `DROP INDEX \`REL_3bfc8c1aaec1395cc148268d3c\` ON \`link\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_07f249ac87502495710a62c5c0\` ON \`link\`` - ); - await queryRunner.query(`DROP TABLE \`link\``); - await queryRunner.query( - `DROP INDEX \`REL_042b9825d770d6b3009ae206c2\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_970844fcd10c2b6df7c1b49eac\` ON \`post\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_390343b22abec869bf80041933\` ON \`post\`` - ); - await queryRunner.query(`DROP TABLE \`post\``); - await queryRunner.query(`DROP TABLE \`callout_contribution_defaults\``); - await queryRunner.query(`DROP TABLE \`callout_contribution_policy\``); - await queryRunner.query( - `DROP INDEX \`REL_8bc0e1f40be5816d3a593cbf7f\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f53e2d266432e58e538a366705\` ON \`callout_framing\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_c9d7c2c4eb8a1d012ddc6605da\` ON \`callout_framing\`` - ); - await queryRunner.query(`DROP TABLE \`callout_framing\``); - await queryRunner.query( - `DROP INDEX \`REL_3f9e9e2798d2a4d84b16ee8477\` ON \`whiteboard\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d3b86160bb7d704212382b0ca4\` ON \`whiteboard\`` - ); - await queryRunner.query(`DROP TABLE \`whiteboard\``); - await queryRunner.query( - `DROP INDEX \`REL_d1d94dd8e0c417b4188a05ccbc\` ON \`room\`` - ); - await queryRunner.query(`DROP TABLE \`room\``); - await queryRunner.query(`DROP TABLE \`vc_interaction\``); - await queryRunner.query( - `DROP INDEX \`REL_73e8ae665a49366ca7e2866a45\` ON \`reference\`` - ); - await queryRunner.query(`DROP TABLE \`reference\``); - await queryRunner.query( - `DROP INDEX \`REL_4a1c74fd2a61b32d9d9500e065\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_432056041df0e4337b17ff7b09\` ON \`profile\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_a96475631aba7dce41db03cc8b\` ON \`profile\`` - ); - await queryRunner.query(`DROP TABLE \`profile\``); - await queryRunner.query( - `DROP INDEX \`REL_f2f48b57269987b13b415a0058\` ON \`storage_bucket\`` - ); - await queryRunner.query(`DROP TABLE \`storage_bucket\``); - await queryRunner.query( - `DROP INDEX \`REL_0647707288c243e60091c8d862\` ON \`storage_aggregator\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_f3b4d59c0b805c9c1ecb0070e1\` ON \`storage_aggregator\`` - ); - await queryRunner.query(`DROP TABLE \`storage_aggregator\``); - await queryRunner.query( - `DROP INDEX \`REL_9fb9257b14ec21daf5bc9aa4c8\` ON \`document\`` - ); - await queryRunner.query( - `DROP INDEX \`REL_d9e2dfcccf59233c17cc6bc641\` ON \`document\`` - ); - await queryRunner.query(`DROP TABLE \`document\``); - await queryRunner.query(`DROP TABLE \`location\``); - await queryRunner.query( - `DROP INDEX \`REL_4fbd109f9bb84f58b7a3c60649\` ON \`visual\`` - ); - await queryRunner.query(`DROP TABLE \`visual\``); - await queryRunner.query( - `DROP INDEX \`REL_eb59b98ee6ef26c993d0d75c83\` ON \`tagset\`` - ); - await queryRunner.query(`DROP TABLE \`tagset\``); - await queryRunner.query(`DROP TABLE \`tagset_template\``); - await queryRunner.query(`DROP TABLE \`tagset_template_set\``); - await queryRunner.query(`DROP TABLE \`authorization_policy\``); - } -} diff --git a/src/migrations/1730713372181-schemaSetup.ts b/src/migrations/1730713372181-schemaSetup.ts new file mode 100644 index 0000000000..34095a8d6e --- /dev/null +++ b/src/migrations/1730713372181-schemaSetup.ts @@ -0,0 +1,1728 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class SchemaSetup1730713372181 implements MigrationInterface { + name = 'SchemaSetup1730713372181'; + + public async up(queryRunner: QueryRunner): Promise { + const migrations = await queryRunner.query( + 'SELECT name FROM migrations_typeorm;' + ); + + if (migrations.length > 0) { + return; + } + await queryRunner.query( + 'CREATE TABLE `authorization_policy` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `credentialRules` text NOT NULL, `privilegeRules` text NOT NULL, `verifiedCredentialRules` text NOT NULL, `anonymousReadAccess` tinyint NOT NULL, `type` varchar(128) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `tagset_template_set` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `tagset_template` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(128) NOT NULL, `type` varchar(128) NOT NULL, `allowedValues` text NOT NULL, `defaultSelectedValue` varchar(255) NULL, `tagsetTemplateSetId` char(36) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + "CREATE TABLE `tagset` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(255) NOT NULL DEFAULT 'default', `type` varchar(128) NOT NULL, `tags` text NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `tagsetTemplateId` char(36) NULL, UNIQUE INDEX `REL_eb59b98ee6ef26c993d0d75c83` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB" + ); + await queryRunner.query( + 'CREATE TABLE `visual` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(255) NOT NULL, `uri` varchar(2048) NOT NULL, `minWidth` int NOT NULL, `maxWidth` int NOT NULL, `minHeight` int NOT NULL, `maxHeight` int NOT NULL, `aspectRatio` decimal(3,1) NOT NULL, `allowedTypes` text NOT NULL, `alternativeText` varchar(120) NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_4fbd109f9bb84f58b7a3c60649` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `location` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `city` varchar(128) NULL, `country` varchar(128) NULL, `addressLine1` varchar(512) NULL, `addressLine2` varchar(512) NULL, `stateOrProvince` varchar(128) NULL, `postalCode` varchar(128) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `document` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `createdBy` char(36) NULL, `displayName` varchar(512) NOT NULL, `mimeType` varchar(128) NOT NULL, `size` int NOT NULL, `externalID` varchar(128) NOT NULL, `temporaryLocation` tinyint NOT NULL DEFAULT 0, `authorizationId` char(36) NULL, `storageBucketId` char(36) NULL, `tagsetId` char(36) NULL, UNIQUE INDEX `REL_d9e2dfcccf59233c17cc6bc641` (`authorizationId`), UNIQUE INDEX `REL_9fb9257b14ec21daf5bc9aa4c8` (`tagsetId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `storage_aggregator` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `type` varchar(128) NULL, `authorizationId` char(36) NULL, `parentStorageAggregatorId` char(36) NULL, `directStorageId` char(36) NULL, UNIQUE INDEX `REL_f3b4d59c0b805c9c1ecb0070e1` (`authorizationId`), UNIQUE INDEX `REL_0647707288c243e60091c8d862` (`directStorageId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `storage_bucket` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `allowedMimeTypes` text NOT NULL, `maxFileSize` int NOT NULL, `authorizationId` char(36) NULL, `storageAggregatorId` char(36) NULL, UNIQUE INDEX `REL_f2f48b57269987b13b415a0058` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `profile` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `displayName` text NOT NULL, `tagline` text NULL, `description` text NULL, `type` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `locationId` char(36) NULL, `storageBucketId` char(36) NULL, UNIQUE INDEX `REL_a96475631aba7dce41db03cc8b` (`authorizationId`), UNIQUE INDEX `REL_432056041df0e4337b17ff7b09` (`locationId`), UNIQUE INDEX `REL_4a1c74fd2a61b32d9d9500e065` (`storageBucketId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `reference` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(255) NOT NULL, `uri` text NOT NULL, `description` text NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_73e8ae665a49366ca7e2866a45` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `vc_interaction` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `threadID` varchar(44) NOT NULL, `virtualContributorID` char(36) NOT NULL, `externalMetadata` text NOT NULL, `roomId` char(36) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `room` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `externalRoomID` varchar(255) NOT NULL, `messagesCount` int NOT NULL, `type` varchar(128) NOT NULL, `displayName` varchar(255) NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_d1d94dd8e0c417b4188a05ccbc` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `whiteboard` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `content` longtext NOT NULL, `createdBy` char(36) NULL, `contentUpdatePolicy` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_d3b86160bb7d704212382b0ca4` (`authorizationId`), UNIQUE INDEX `REL_3f9e9e2798d2a4d84b16ee8477` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `callout_framing` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `whiteboardId` char(36) NULL, UNIQUE INDEX `REL_c9d7c2c4eb8a1d012ddc6605da` (`authorizationId`), UNIQUE INDEX `REL_f53e2d266432e58e538a366705` (`profileId`), UNIQUE INDEX `REL_8bc0e1f40be5816d3a593cbf7f` (`whiteboardId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `callout_contribution_policy` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `allowedContributionTypes` text NOT NULL, `state` varchar(128) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `callout_contribution_defaults` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `postDescription` text NULL, `whiteboardContent` longtext NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `post` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `createdBy` char(36) NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `commentsId` char(36) NULL, UNIQUE INDEX `REL_390343b22abec869bf80041933` (`authorizationId`), UNIQUE INDEX `REL_970844fcd10c2b6df7c1b49eac` (`profileId`), UNIQUE INDEX `REL_042b9825d770d6b3009ae206c2` (`commentsId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `link` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `uri` text NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_07f249ac87502495710a62c5c0` (`authorizationId`), UNIQUE INDEX `REL_3bfc8c1aaec1395cc148268d3c` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `callout_contribution` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `createdBy` char(36) NULL, `sortOrder` int NOT NULL, `authorizationId` char(36) NULL, `whiteboardId` char(36) NULL, `postId` char(36) NULL, `linkId` char(36) NULL, `calloutId` char(36) NULL, UNIQUE INDEX `REL_dfa86c46f509a61c6510536cd9` (`authorizationId`), UNIQUE INDEX `REL_5e34f9a356f6254b8da24f8947` (`whiteboardId`), UNIQUE INDEX `REL_97fefc97fb254c30577696e1c0` (`postId`), UNIQUE INDEX `REL_bdf2d0eced5c95968a85caaaae` (`linkId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `callout` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `type` text NOT NULL, `isTemplate` tinyint NOT NULL DEFAULT 0, `createdBy` char(36) NULL, `visibility` varchar(128) NOT NULL, `sortOrder` int NOT NULL, `publishedBy` char(36) NULL, `publishedDate` datetime NULL, `authorizationId` char(36) NULL, `framingId` char(36) NULL, `contributionPolicyId` char(36) NULL, `contributionDefaultsId` char(36) NULL, `commentsId` char(36) NULL, `collaborationId` char(36) NULL, UNIQUE INDEX `REL_6289dee12effb51320051c6f1f` (`authorizationId`), UNIQUE INDEX `REL_cf776244b01436d8ca5cc76284` (`framingId`), UNIQUE INDEX `REL_1e740008a7e1512966e3b08414` (`contributionPolicyId`), UNIQUE INDEX `REL_36b0da55acff774d0845aeb55f` (`contributionDefaultsId`), UNIQUE INDEX `REL_62ed316cda7b75735b20307b47` (`commentsId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `calendar_event` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `type` varchar(128) NOT NULL, `createdBy` char(36) NOT NULL, `startDate` datetime NOT NULL, `wholeDay` tinyint NOT NULL, `multipleDays` tinyint NOT NULL, `durationMinutes` int NOT NULL, `durationDays` int NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `commentsId` char(36) NULL, `calendarId` char(36) NULL, UNIQUE INDEX `REL_8ee86afa2808a4ab523b9ee6c5` (`authorizationId`), UNIQUE INDEX `REL_9349e137959f3ca5818c2e62b3` (`profileId`), UNIQUE INDEX `REL_b5069b11030e9608ee4468f850` (`commentsId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `calendar` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_6e74d59afda096b68d12a69969` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `timeline` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `calendarId` char(36) NULL, UNIQUE INDEX `REL_5fe58ece01b48496aebc04733d` (`authorizationId`), UNIQUE INDEX `REL_56aae15a664b2889a1a11c2cf8` (`calendarId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `innovation_flow` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `states` text NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_a6e050daa4c7a3ab1e411c3651` (`authorizationId`), UNIQUE INDEX `REL_96a8cbe1706f459fd7d883be9b` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `collaboration` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `isTemplate` tinyint NOT NULL DEFAULT 0, `groupsStr` text NOT NULL, `authorizationId` char(36) NULL, `tagsetTemplateSetId` char(36) NULL, `timelineId` char(36) NULL, `innovationFlowId` char(36) NULL, UNIQUE INDEX `REL_262ecf3f5d70b82a4833618425` (`authorizationId`), UNIQUE INDEX `REL_b7ece56376ac7ca0b9a56c33b3` (`tagsetTemplateSetId`), UNIQUE INDEX `REL_f67a2d25c945269d602c182fbc` (`timelineId`), UNIQUE INDEX `REL_35c6b1de6d4d89dfe8e9c85d77` (`innovationFlowId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `lifecycle` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `machineState` text NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + "CREATE TABLE `organization_verification` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `organizationID` varchar(36) NOT NULL, `status` varchar(128) NOT NULL DEFAULT 'not-verified', `authorizationId` char(36) NULL, `lifecycleId` char(36) NULL, UNIQUE INDEX `REL_c66eddab0caacb1ef8d46bcafd` (`authorizationId`), UNIQUE INDEX `REL_1cc3b275fc2a9d9d9b0ae33b31` (`lifecycleId`), PRIMARY KEY (`id`)) ENGINE=InnoDB" + ); + await queryRunner.query( + 'CREATE TABLE `preference_definition` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `definitionSet` varchar(128) NOT NULL, `groupName` varchar(128) NOT NULL, `displayName` varchar(128) NOT NULL, `description` varchar(255) NOT NULL, `valueType` varchar(16) NOT NULL, `type` varchar(128) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `preference` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `value` varchar(16) NOT NULL, `authorizationId` char(36) NULL, `preferenceDefinitionId` char(36) NULL, `preferenceSetId` char(36) NULL, UNIQUE INDEX `REL_b4cf0f96bf08cf396f68355522` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `preference_set` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_8e76dcf171c45875c44febb1d8` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `credential` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `resourceID` varchar(36) NOT NULL, `type` varchar(128) NOT NULL, `issuer` char(36) NULL, `expires` datetime NULL, `agentId` char(36) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `agent` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `did` varchar(255) NULL, `password` varchar(255) NULL, `type` varchar(128) NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_8ed9d1af584fa62f1ad3405b33` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `organization` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `communicationID` varchar(255) NOT NULL, `accountID` char(36) NOT NULL, `rowId` int NOT NULL AUTO_INCREMENT, `legalEntityName` varchar(255) NOT NULL, `domain` varchar(255) NOT NULL, `website` varchar(255) NOT NULL, `contactEmail` varchar(255) NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `agentId` char(36) NULL, `verificationId` char(36) NULL, `preferenceSetId` char(36) NULL, `storageAggregatorId` char(36) NULL, UNIQUE INDEX `IDX_9fdd8f0bfe04a676822c7265e1` (`rowId`), UNIQUE INDEX `REL_e0e150e4f11d906b931b46a2d8` (`authorizationId`), UNIQUE INDEX `REL_d2cb77c14644156ec8e865608e` (`profileId`), UNIQUE INDEX `REL_7f1bec8979b57ed7ebd392a2ca` (`agentId`), UNIQUE INDEX `REL_5a72d5b37312bac2e0a0115718` (`verificationId`), UNIQUE INDEX `REL_58fd47c4a6ac8df9fe2bcaed87` (`preferenceSetId`), UNIQUE INDEX `REL_395aa74996a1f978b4969d114b` (`storageAggregatorId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `user_group` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `organizationId` char(36) NULL, `communityId` char(36) NULL, UNIQUE INDEX `REL_e8e32f1e59c349b406a4752e54` (`authorizationId`), UNIQUE INDEX `REL_9912e4cfc1e09848a392a65151` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `communication` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `spaceID` varchar(36) NOT NULL, `displayName` varchar(255) NOT NULL, `authorizationId` char(36) NULL, `updatesId` char(36) NULL, UNIQUE INDEX `REL_a20c5901817dd09d5906537e08` (`authorizationId`), UNIQUE INDEX `REL_eb99e588873c788a68a035478a` (`updatesId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `community_guidelines` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, UNIQUE INDEX `REL_684b272e6f7459439d41d2879e` (`authorizationId`), UNIQUE INDEX `REL_3d60fe4fa40d54bad7d51bb4bd` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `role` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `type` varchar(128) NOT NULL, `credential` text NOT NULL, `parentCredentials` text NOT NULL, `requiresEntryRole` tinyint NOT NULL, `requiresSameRoleInParentRoleSet` tinyint NOT NULL, `userPolicy` text NOT NULL, `organizationPolicy` text NOT NULL, `virtualContributorPolicy` text NOT NULL, `roleSetId` char(36) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `form` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `questions` text NOT NULL, `description` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `library` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_3879db652f2421337691219ace` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `license_policy` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `credentialRulesStr` text NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_23d4d78ea8db637df031f86f03` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `license_plan` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` text NOT NULL, `enabled` tinyint NOT NULL DEFAULT 1, `sortOrder` int NOT NULL, `pricePerMonth` decimal(10,2) NULL, `isFree` tinyint NOT NULL DEFAULT 0, `trialEnabled` tinyint NOT NULL DEFAULT 0, `requiresPaymentMethod` tinyint NOT NULL DEFAULT 0, `requiresContactSupport` tinyint NOT NULL DEFAULT 0, `licenseCredential` text NOT NULL, `type` varchar(128) NOT NULL, `assignToNewOrganizationAccounts` tinyint NOT NULL DEFAULT 0, `assignToNewUserAccounts` tinyint NOT NULL DEFAULT 0, `licensingId` char(36) NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `licensing` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `licensePolicyId` char(36) NULL, UNIQUE INDEX `REL_0c6a4d0a6c13a3f5df6ac01509` (`authorizationId`), UNIQUE INDEX `REL_a5dae5a376dd49c7c076893d40` (`licensePolicyId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + "CREATE TABLE `discussion` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `category` text NOT NULL, `createdBy` char(36) NOT NULL, `privacy` varchar(255) NOT NULL DEFAULT 'authenticated', `authorizationId` char(36) NULL, `profileId` char(36) NULL, `commentsId` char(36) NULL, `forumId` char(36) NULL, UNIQUE INDEX `REL_4555dccdda9ba57d8e3a634cd0` (`authorizationId`), UNIQUE INDEX `REL_2d8a3ca181c3f0346817685d21` (`profileId`), UNIQUE INDEX `REL_5337074c9b818bb63e6f314c80` (`commentsId`), PRIMARY KEY (`id`)) ENGINE=InnoDB" + ); + await queryRunner.query( + 'CREATE TABLE `forum` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `discussionCategories` text NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_3b0c92945f36d06f37de80285d` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `templates_set` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_eb0176ef4b98c143322aa6f809` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `template` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `type` varchar(128) NOT NULL, `postDefaultDescription` text NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `templatesSetId` char(36) NULL, `innovationFlowId` char(36) NULL, `communityGuidelinesId` char(36) NULL, `calloutId` char(36) NULL, `whiteboardId` char(36) NULL, `collaborationId` char(36) NULL, UNIQUE INDEX `REL_4318f97beabd362a8a09e9d320` (`authorizationId`), UNIQUE INDEX `REL_f58c3b144b6e010969e199beef` (`profileId`), UNIQUE INDEX `REL_45cf273f30c1fa509456b6b0dd` (`innovationFlowId`), UNIQUE INDEX `REL_eedeae5e63f9a9c3a0161541e9` (`communityGuidelinesId`), UNIQUE INDEX `REL_c6e4d1a07781a809ad3b3ee826` (`calloutId`), UNIQUE INDEX `REL_f09090a77e07377eefb3f731d9` (`whiteboardId`), UNIQUE INDEX `REL_21fdaf6dc88bdd6e8839e29b0b` (`collaborationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `template_default` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `type` varchar(128) NOT NULL, `allowedTemplateType` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `templatesManagerId` char(36) NULL, `templateId` char(36) NULL, UNIQUE INDEX `REL_9dbeb9326140b3ce01c1037efe` (`authorizationId`), UNIQUE INDEX `REL_b6617b64c6ea8ebb24947ddbd4` (`templateId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `templates_manager` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `templatesSetId` char(36) NULL, UNIQUE INDEX `REL_19ea19263c6016f411fb008243` (`authorizationId`), UNIQUE INDEX `REL_7ba875eee72ec5fcbe2355124d` (`templatesSetId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `platform` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `forumId` char(36) NULL, `libraryId` char(36) NULL, `templatesManagerId` char(36) NULL, `storageAggregatorId` char(36) NULL, `licensingId` char(36) NULL, UNIQUE INDEX `REL_9f621c51dd854634d8766a9cfa` (`authorizationId`), UNIQUE INDEX `REL_dd88d373c64b04e24705d575c9` (`forumId`), UNIQUE INDEX `REL_ca469f5ec53a7719d155d60aca` (`libraryId`), UNIQUE INDEX `REL_81f92b22d30540102e9654e892` (`templatesManagerId`), UNIQUE INDEX `REL_f516dd9a46616999c7e9a6adc1` (`storageAggregatorId`), UNIQUE INDEX `REL_425bbb4b951f7f4629710763fc` (`licensingId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `platform_invitation` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `roleSetInvitedToParent` tinyint NOT NULL DEFAULT 0, `roleSetExtraRole` varchar(128) NULL, `platformRole` varchar(128) NULL, `email` varchar(128) NOT NULL, `firstName` varchar(128) NULL, `lastName` varchar(128) NULL, `createdBy` char(36) NOT NULL, `welcomeMessage` varchar(512) NULL, `profileCreated` tinyint NOT NULL DEFAULT 0, `authorizationId` char(36) NULL, `roleSetId` char(36) NULL, `platformId` char(36) NULL, UNIQUE INDEX `REL_c0448d2c992a62c9c11bd0f142` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `nvp` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(128) NOT NULL, `value` varchar(512) NOT NULL, `sortOrder` int NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `user` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `communicationID` varchar(255) NOT NULL, `accountID` char(36) NOT NULL, `rowId` int NOT NULL AUTO_INCREMENT, `accountUpn` varchar(128) NOT NULL, `firstName` varchar(128) NOT NULL, `lastName` varchar(128) NOT NULL, `email` varchar(512) NOT NULL, `phone` varchar(128) NULL, `serviceProfile` tinyint NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `agentId` char(36) NULL, `preferenceSetId` char(36) NULL, `storageAggregatorId` char(36) NULL, UNIQUE INDEX `IDX_266bc44a18601f893566962df6` (`rowId`), UNIQUE INDEX `REL_09f909622aa177a097256b7cc2` (`authorizationId`), UNIQUE INDEX `REL_9466682df91534dd95e4dbaa61` (`profileId`), UNIQUE INDEX `REL_b61c694cacfab25533bd23d9ad` (`agentId`), UNIQUE INDEX `REL_028322b763dc94242dc9f638f9` (`preferenceSetId`), UNIQUE INDEX `REL_10458c50c10436b6d589b40e5c` (`storageAggregatorId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `application` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, `lifecycleId` char(36) NULL, `userId` char(36) NULL, `roleSetId` char(36) NULL, UNIQUE INDEX `REL_56f5614fff0028d40370499582` (`authorizationId`), UNIQUE INDEX `REL_7ec2857c7d8d16432ffca1cb3d` (`lifecycleId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `invitation` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `invitedContributorID` char(36) NOT NULL, `createdBy` char(36) NOT NULL, `welcomeMessage` varchar(512) NULL, `invitedToParent` tinyint NOT NULL DEFAULT 0, `contributorType` varchar(128) NOT NULL, `extraRole` varchar(128) NULL, `authorizationId` char(36) NULL, `lifecycleId` char(36) NULL, `roleSetId` char(36) NULL, UNIQUE INDEX `REL_b132226941570cb650a4023d49` (`authorizationId`), UNIQUE INDEX `REL_b0c80ccf319a1c7a7af12b3998` (`lifecycleId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `role_set` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `entryRoleType` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `applicationFormId` char(36) NULL, `parentRoleSetId` char(36) NULL, UNIQUE INDEX `REL_b038f74c8d4eadb839e78b99ce` (`authorizationId`), UNIQUE INDEX `REL_00905b142498f63e76d38fb254` (`applicationFormId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `community` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `parentID` varchar(36) NOT NULL, `authorizationId` char(36) NULL, `communicationId` char(36) NULL, `guidelinesId` char(36) NULL, `roleSetId` char(36) NULL, UNIQUE INDEX `REL_6e7584bfb417bd0f8e8696ab58` (`authorizationId`), UNIQUE INDEX `REL_7fbe50fa78a37776ad962cb764` (`communicationId`), UNIQUE INDEX `REL_2e7dd2fa8c829352cfbecb2cc9` (`guidelinesId`), UNIQUE INDEX `REL_3b8f390d76263ef5996869da07` (`roleSetId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `actor` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(255) NOT NULL, `description` text NULL, `value` text NULL, `impact` varchar(255) NULL, `authorizationId` char(36) NULL, `actorGroupId` char(36) NULL, UNIQUE INDEX `REL_a2afa3851ea733de932251b3a1` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `actor_group` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `name` varchar(255) NOT NULL, `description` text NULL, `authorizationId` char(36) NULL, `ecosystemModelId` char(36) NULL, UNIQUE INDEX `REL_bde98d59e8984e7d17034c3b93` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `ecosystem_model` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `description` varchar(255) NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_658580aea4e1a892227e27db90` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `context` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `vision` text NULL, `impact` text NULL, `who` text NULL, `authorizationId` char(36) NULL, `ecosystemModelId` char(36) NULL, UNIQUE INDEX `REL_5f0dbc3b097ef297bd5f4ddb1a` (`authorizationId`), UNIQUE INDEX `REL_a03169c3f86480ba3863924f4d` (`ecosystemModelId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `space` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `rowId` int NOT NULL AUTO_INCREMENT, `settingsStr` text NOT NULL, `type` varchar(128) NOT NULL, `levelZeroSpaceID` char(36) NULL, `level` int NOT NULL, `visibility` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `parentSpaceId` char(36) NULL, `accountId` char(36) NULL, `collaborationId` char(36) NULL, `contextId` char(36) NULL, `communityId` char(36) NULL, `agentId` char(36) NULL, `storageAggregatorId` char(36) NULL, `templatesManagerId` char(36) NULL, UNIQUE INDEX `IDX_0f03c61020ea0dfa0198c60304` (`rowId`), UNIQUE INDEX `REL_8d03fd2c8e8411ec9192c79cd9` (`authorizationId`), UNIQUE INDEX `REL_b4250035291aac1329d59224a9` (`profileId`), UNIQUE INDEX `REL_ea06eb8894469a0f262d929bf0` (`collaborationId`), UNIQUE INDEX `REL_cc0b08eb9679d3daa95153c2af` (`contextId`), UNIQUE INDEX `REL_68fa2c2b00cc1ed77e7c225e8b` (`communityId`), UNIQUE INDEX `REL_9c664d684f987a735678b0ba82` (`agentId`), UNIQUE INDEX `REL_980c4643d7d9de1b97bc39f518` (`storageAggregatorId`), UNIQUE INDEX `REL_dea52ce918df6950019678fa35` (`templatesManagerId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `ai_persona` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `aiPersonaServiceID` varchar(128) NOT NULL, `description` text NULL, `dataAccessMode` varchar(128) NOT NULL, `interactionModes` text NOT NULL, `bodyOfKnowledge` text NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_293f0d3ef60cb0ca0006044ecf` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `virtual_contributor` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `communicationID` varchar(255) NOT NULL, `listedInStore` tinyint NOT NULL, `searchVisibility` varchar(128) NOT NULL, `authorizationId` char(36) NULL, `profileId` char(36) NULL, `agentId` char(36) NULL, `accountId` char(36) NULL, `aiPersonaId` char(36) NOT NULL, UNIQUE INDEX `REL_e2eaa2213ac4454039cd8abc07` (`authorizationId`), UNIQUE INDEX `REL_4504c37764f6962ccbd165a21d` (`profileId`), UNIQUE INDEX `REL_a8890dcd65b8c3ee6e160d33f3` (`agentId`), UNIQUE INDEX `REL_55b8101bdf4f566645e928c26e` (`aiPersonaId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + "CREATE TABLE `innovation_pack` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `listedInStore` tinyint NOT NULL, `searchVisibility` varchar(36) NOT NULL DEFAULT 'account', `authorizationId` char(36) NULL, `profileId` char(36) NULL, `accountId` char(36) NULL, `templatesSetId` char(36) NULL, UNIQUE INDEX `REL_8af8122897b05315e7eb892525` (`authorizationId`), UNIQUE INDEX `REL_5facd6d188068a5a1c5b6f07fc` (`profileId`), UNIQUE INDEX `REL_a1441e46c8d36090e1f6477cea` (`templatesSetId`), PRIMARY KEY (`id`)) ENGINE=InnoDB" + ); + await queryRunner.query( + 'CREATE TABLE `account` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `type` varchar(128) NULL, `authorizationId` char(36) NULL, `agentId` char(36) NULL, `storageAggregatorId` char(36) NULL, UNIQUE INDEX `REL_91a165c1091a6959cc19d52239` (`authorizationId`), UNIQUE INDEX `REL_833582df0c439ab8c9adc5240d` (`agentId`), UNIQUE INDEX `REL_950221e932175dc7cf7c006488` (`storageAggregatorId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + "CREATE TABLE `innovation_hub` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `nameID` varchar(36) NOT NULL, `subdomain` varchar(63) NOT NULL, `type` varchar(255) NOT NULL, `spaceVisibilityFilter` varchar(255) NULL, `spaceListFilter` text NULL, `listedInStore` tinyint NOT NULL, `searchVisibility` varchar(128) NOT NULL DEFAULT 'account', `authorizationId` char(36) NULL, `profileId` char(36) NULL, `accountId` char(36) NULL, UNIQUE INDEX `IDX_1d39dac2c6d2f17286d90c306b` (`nameID`), UNIQUE INDEX `IDX_8f35d04d098bb6c7c57a9a83ac` (`subdomain`), UNIQUE INDEX `REL_b411e4f27d77a96eccdabbf4b4` (`authorizationId`), UNIQUE INDEX `REL_36c8905c2c6c59467c60d94fd8` (`profileId`), PRIMARY KEY (`id`)) ENGINE=InnoDB" + ); + await queryRunner.query( + 'CREATE TABLE `activity` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `rowId` int NOT NULL AUTO_INCREMENT, `triggeredBy` char(36) NOT NULL, `resourceID` char(36) NOT NULL, `parentID` char(36) NULL, `collaborationID` char(36) NOT NULL, `messageID` char(44) NULL, `visibility` tinyint NOT NULL, `description` varchar(512) NULL, `type` varchar(128) NOT NULL, UNIQUE INDEX `IDX_07a39cea9426b689be25fd61de` (`rowId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `ai_persona_service` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `engine` varchar(128) NOT NULL, `dataAccessMode` varchar(128) NOT NULL, `prompt` text NOT NULL, `bodyOfKnowledgeType` varchar(128) NOT NULL, `bodyOfKnowledgeID` varchar(128) NULL, `bodyOfKnowledgeLastUpdated` datetime NULL, `externalConfig` text NULL, `authorizationId` char(36) NULL, `aiServerId` char(36) NULL, UNIQUE INDEX `REL_79206feb0038b1c5597668dc4b` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `ai_server` (`id` char(36) NOT NULL, `createdDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `updatedDate` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `version` int NOT NULL, `authorizationId` char(36) NULL, UNIQUE INDEX `REL_9d520fa5fed56042918e48fc4b` (`authorizationId`), PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'CREATE TABLE `application_questions` (`applicationId` char(36) NOT NULL, `nvpId` char(36) NOT NULL, INDEX `IDX_8495fae86f13836b0745642baa` (`applicationId`), INDEX `IDX_fe50118fd82e7fe2f74f986a19` (`nvpId`), PRIMARY KEY (`applicationId`, `nvpId`)) ENGINE=InnoDB' + ); + await queryRunner.query( + 'ALTER TABLE `tagset_template` ADD CONSTRAINT `FK_96f23f044acf305c1699e0319d2` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_eb59b98ee6ef26c993d0d75c83c` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_81fc213b2d9ad0cddeab1a9ce64` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` ADD CONSTRAINT `FK_644155610ddc40dc4e19781c8f0` FOREIGN KEY (`tagsetTemplateId`) REFERENCES `tagset_template`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `visual` ADD CONSTRAINT `FK_4fbd109f9bb84f58b7a3c60649c` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `visual` ADD CONSTRAINT `FK_1104f3ef8497ca40d99b9f46b87` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `document` ADD CONSTRAINT `FK_d9e2dfcccf59233c17cc6bc6418` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `document` ADD CONSTRAINT `FK_851e50ec4be7c62a1f9b9a430bf` FOREIGN KEY (`storageBucketId`) REFERENCES `storage_bucket`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `document` ADD CONSTRAINT `FK_9fb9257b14ec21daf5bc9aa4c8e` FOREIGN KEY (`tagsetId`) REFERENCES `tagset`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_f3b4d59c0b805c9c1ecb0070e16` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_b80c28f5335ab5442f63c644d94` FOREIGN KEY (`parentStorageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_0647707288c243e60091c8d8620` FOREIGN KEY (`directStorageId`) REFERENCES `storage_bucket`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `storage_bucket` ADD CONSTRAINT `FK_f2f48b57269987b13b415a00587` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `storage_bucket` ADD CONSTRAINT `FK_11d0ed50a26da5513f7e4347847` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `profile` ADD CONSTRAINT `FK_a96475631aba7dce41db03cc8b2` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `profile` ADD CONSTRAINT `FK_432056041df0e4337b17ff7b09d` FOREIGN KEY (`locationId`) REFERENCES `location`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `profile` ADD CONSTRAINT `FK_4a1c74fd2a61b32d9d9500e0650` FOREIGN KEY (`storageBucketId`) REFERENCES `storage_bucket`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `reference` ADD CONSTRAINT `FK_73e8ae665a49366ca7e2866a45d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `reference` ADD CONSTRAINT `FK_2f46c698fc4c19a8cc233c5f255` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `vc_interaction` ADD CONSTRAINT `FK_d6f78c95ff41cdd30e505a4ebbb` FOREIGN KEY (`roomId`) REFERENCES `room`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `room` ADD CONSTRAINT `FK_d1d94dd8e0c417b4188a05ccbca` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `whiteboard` ADD CONSTRAINT `FK_d3b86160bb7d704212382b0ca44` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `whiteboard` ADD CONSTRAINT `FK_3f9e9e2798d2a4d84b16ee8477c` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` ADD CONSTRAINT `FK_c9d7c2c4eb8a1d012ddc6605da9` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` ADD CONSTRAINT `FK_f53e2d266432e58e538a366705d` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` ADD CONSTRAINT `FK_8bc0e1f40be5816d3a593cbf7fa` FOREIGN KEY (`whiteboardId`) REFERENCES `whiteboard`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `post` ADD CONSTRAINT `FK_390343b22abec869bf800419333` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `post` ADD CONSTRAINT `FK_970844fcd10c2b6df7c1b49eacf` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `post` ADD CONSTRAINT `FK_042b9825d770d6b3009ae206c2f` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `link` ADD CONSTRAINT `FK_07f249ac87502495710a62c5c01` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `link` ADD CONSTRAINT `FK_3bfc8c1aaec1395cc148268d3cd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` ADD CONSTRAINT `FK_dfa86c46f509a61c6510536cd9a` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` ADD CONSTRAINT `FK_5e34f9a356f6254b8da24f8947b` FOREIGN KEY (`whiteboardId`) REFERENCES `whiteboard`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` ADD CONSTRAINT `FK_97fefc97fb254c30577696e1c0a` FOREIGN KEY (`postId`) REFERENCES `post`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` ADD CONSTRAINT `FK_bdf2d0eced5c95968a85caaaaee` FOREIGN KEY (`linkId`) REFERENCES `link`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` ADD CONSTRAINT `FK_7370de8eb79ed00b0d403f2299a` FOREIGN KEY (`calloutId`) REFERENCES `callout`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_6289dee12effb51320051c6f1fc` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_cf776244b01436d8ca5cc762848` FOREIGN KEY (`framingId`) REFERENCES `callout_framing`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_1e740008a7e1512966e3b084148` FOREIGN KEY (`contributionPolicyId`) REFERENCES `callout_contribution_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_36b0da55acff774d0845aeb55f2` FOREIGN KEY (`contributionDefaultsId`) REFERENCES `callout_contribution_defaults`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_62ed316cda7b75735b20307b47e` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `callout` ADD CONSTRAINT `FK_9b1c5ee044611ac78249194ec35` FOREIGN KEY (`collaborationId`) REFERENCES `collaboration`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_8ee86afa2808a4ab523b9ee6c5e` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_9349e137959f3ca5818c2e62b3f` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_b5069b11030e9608ee4468f850d` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` ADD CONSTRAINT `FK_80ab7835e1749581a27462eb87f` FOREIGN KEY (`calendarId`) REFERENCES `calendar`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `calendar` ADD CONSTRAINT `FK_6e74d59afda096b68d12a699691` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `timeline` ADD CONSTRAINT `FK_5fe58ece01b48496aebc04733da` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `timeline` ADD CONSTRAINT `FK_56aae15a664b2889a1a11c2cf82` FOREIGN KEY (`calendarId`) REFERENCES `calendar`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_a6e050daa4c7a3ab1e411c36517` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_flow` ADD CONSTRAINT `FK_96a8cbe1706f459fd7d883be9bd` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_262ecf3f5d70b82a48336184251` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_b7ece56376ac7ca0b9a56c33b3a` FOREIGN KEY (`tagsetTemplateSetId`) REFERENCES `tagset_template_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_f67a2d25c945269d602c182fbc0` FOREIGN KEY (`timelineId`) REFERENCES `timeline`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` ADD CONSTRAINT `FK_35c6b1de6d4d89dfe8e9c85d771` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_c66eddab0caacb1ef8d46bcafdb` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization_verification` ADD CONSTRAINT `FK_1cc3b275fc2a9d9d9b0ae33b310` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `preference` ADD CONSTRAINT `FK_b4cf0f96bf08cf396f683555229` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `preference` ADD CONSTRAINT `FK_46d60bf133073f749b8f07e534c` FOREIGN KEY (`preferenceDefinitionId`) REFERENCES `preference_definition`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `preference` ADD CONSTRAINT `FK_f4b5742f589e2ac8bfe48b708c0` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `preference_set` ADD CONSTRAINT `FK_8e76dcf171c45875c44febb1d8d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `credential` ADD CONSTRAINT `FK_dbe0929355f82e5995f0b7fd5e2` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `agent` ADD CONSTRAINT `FK_8ed9d1af584fa62f1ad3405b33b` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_e0e150e4f11d906b931b46a2d89` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_d2cb77c14644156ec8e865608e0` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_7f1bec8979b57ed7ebd392a2ca9` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_5a72d5b37312bac2e0a01157185` FOREIGN KEY (`verificationId`) REFERENCES `organization_verification`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_58fd47c4a6ac8df9fe2bcaed874` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `organization` ADD CONSTRAINT `FK_395aa74996a1f978b4969d114b1` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_e8e32f1e59c349b406a4752e545` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_9912e4cfc1e09848a392a651514` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_694ebec955a90e999d9926b7da8` FOREIGN KEY (`organizationId`) REFERENCES `organization`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` ADD CONSTRAINT `FK_9fcc131f256e969d773327f07cb` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `communication` ADD CONSTRAINT `FK_a20c5901817dd09d5906537e087` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `communication` ADD CONSTRAINT `FK_eb99e588873c788a68a035478ab` FOREIGN KEY (`updatesId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community_guidelines` ADD CONSTRAINT `FK_684b272e6f7459439d41d2879ee` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community_guidelines` ADD CONSTRAINT `FK_3d60fe4fa40d54bad7d51bb4bd1` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `role` ADD CONSTRAINT `FK_66d695b73839e9b66ff1350d34f` FOREIGN KEY (`roleSetId`) REFERENCES `role_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `library` ADD CONSTRAINT `FK_3879db652f2421337691219ace8` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `license_policy` ADD CONSTRAINT `FK_23d4d78ea8db637df031f86f030` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `license_plan` ADD CONSTRAINT `FK_3030904030f5d30f483b49905d1` FOREIGN KEY (`licensingId`) REFERENCES `licensing`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `licensing` ADD CONSTRAINT `FK_0c6a4d0a6c13a3f5df6ac015096` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `licensing` ADD CONSTRAINT `FK_a5dae5a376dd49c7c076893d40b` FOREIGN KEY (`licensePolicyId`) REFERENCES `license_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` ADD CONSTRAINT `FK_4555dccdda9ba57d8e3a634cd0d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` ADD CONSTRAINT `FK_2d8a3ca181c3f0346817685d21d` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` ADD CONSTRAINT `FK_5337074c9b818bb63e6f314c808` FOREIGN KEY (`commentsId`) REFERENCES `room`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` ADD CONSTRAINT `FK_0de78853c1ee793f61bda7eff79` FOREIGN KEY (`forumId`) REFERENCES `forum`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `forum` ADD CONSTRAINT `FK_3b0c92945f36d06f37de80285dd` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `templates_set` ADD CONSTRAINT `FK_eb0176ef4b98c143322aa6f8090` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_4318f97beabd362a8a09e9d3203` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_f58c3b144b6e010969e199beeff` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_c7f54e6269c013d9c273f025edd` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_45cf273f30c1fa509456b6b0ddf` FOREIGN KEY (`innovationFlowId`) REFERENCES `innovation_flow`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_eedeae5e63f9a9c3a0161541e98` FOREIGN KEY (`communityGuidelinesId`) REFERENCES `community_guidelines`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_c6e4d1a07781a809ad3b3ee8265` FOREIGN KEY (`calloutId`) REFERENCES `callout`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_f09090a77e07377eefb3f731d9f` FOREIGN KEY (`whiteboardId`) REFERENCES `whiteboard`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template` ADD CONSTRAINT `FK_21fdaf6dc88bdd6e8839e29b0bd` FOREIGN KEY (`collaborationId`) REFERENCES `collaboration`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` ADD CONSTRAINT `FK_9dbeb9326140b3ce01c1037efee` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` ADD CONSTRAINT `FK_c1135fa45c07ba625e1db9f93bd` FOREIGN KEY (`templatesManagerId`) REFERENCES `templates_manager`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` ADD CONSTRAINT `FK_b6617b64c6ea8ebb24947ddbd45` FOREIGN KEY (`templateId`) REFERENCES `template`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `templates_manager` ADD CONSTRAINT `FK_19ea19263c6016f411fb0082437` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `templates_manager` ADD CONSTRAINT `FK_7ba875eee72ec5fcbe2355124df` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_9f621c51dd854634d8766a9cfaf` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_dd88d373c64b04e24705d575c99` FOREIGN KEY (`forumId`) REFERENCES `forum`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_ca469f5ec53a7719d155d60aca1` FOREIGN KEY (`libraryId`) REFERENCES `library`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_81f92b22d30540102e9654e892c` FOREIGN KEY (`templatesManagerId`) REFERENCES `templates_manager`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_f516dd9a46616999c7e9a6adc15` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform` ADD CONSTRAINT `FK_425bbb4b951f7f4629710763fc0` FOREIGN KEY (`licensingId`) REFERENCES `licensing`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` ADD CONSTRAINT `FK_c0448d2c992a62c9c11bd0f1422` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` ADD CONSTRAINT `FK_562dce4a08bb214f08107b3631e` FOREIGN KEY (`roleSetId`) REFERENCES `role_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` ADD CONSTRAINT `FK_809c1e6cf3ef6be03a0a1db3f70` FOREIGN KEY (`platformId`) REFERENCES `platform`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user` ADD CONSTRAINT `FK_09f909622aa177a097256b7cc22` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user` ADD CONSTRAINT `FK_9466682df91534dd95e4dbaa616` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user` ADD CONSTRAINT `FK_b61c694cacfab25533bd23d9add` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user` ADD CONSTRAINT `FK_028322b763dc94242dc9f638f9b` FOREIGN KEY (`preferenceSetId`) REFERENCES `preference_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `user` ADD CONSTRAINT `FK_10458c50c10436b6d589b40e5ca` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `application` ADD CONSTRAINT `FK_56f5614fff0028d403704995822` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `application` ADD CONSTRAINT `FK_7ec2857c7d8d16432ffca1cb3d9` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `application` ADD CONSTRAINT `FK_b4ae3fea4a24b4be1a86dacf8a2` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `application` ADD CONSTRAINT `FK_8fb220ad1ac1f9c86ec39d134e4` FOREIGN KEY (`roleSetId`) REFERENCES `role_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_b132226941570cb650a4023d493` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_b0c80ccf319a1c7a7af12b39987` FOREIGN KEY (`lifecycleId`) REFERENCES `lifecycle`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` ADD CONSTRAINT `FK_6a3b86c6db10582baae7058f5b9` FOREIGN KEY (`roleSetId`) REFERENCES `role_set`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` ADD CONSTRAINT `FK_b038f74c8d4eadb839e78b99ce5` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` ADD CONSTRAINT `FK_00905b142498f63e76d38fb254e` FOREIGN KEY (`applicationFormId`) REFERENCES `form`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` ADD CONSTRAINT `FK_86acc254af20d20c9d87c3503d5` FOREIGN KEY (`parentRoleSetId`) REFERENCES `role_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community` ADD CONSTRAINT `FK_6e7584bfb417bd0f8e8696ab585` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community` ADD CONSTRAINT `FK_7fbe50fa78a37776ad962cb7643` FOREIGN KEY (`communicationId`) REFERENCES `communication`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community` ADD CONSTRAINT `FK_2e7dd2fa8c829352cfbecb2cc93` FOREIGN KEY (`guidelinesId`) REFERENCES `community_guidelines`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `community` ADD CONSTRAINT `FK_3b8f390d76263ef5996869da071` FOREIGN KEY (`roleSetId`) REFERENCES `role_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `actor` ADD CONSTRAINT `FK_a2afa3851ea733de932251b3a1f` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `actor` ADD CONSTRAINT `FK_0f9d41ee193d631a5439bb4f404` FOREIGN KEY (`actorGroupId`) REFERENCES `actor_group`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `actor_group` ADD CONSTRAINT `FK_bde98d59e8984e7d17034c3b937` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `actor_group` ADD CONSTRAINT `FK_cbb1d7afa052a184471723d3297` FOREIGN KEY (`ecosystemModelId`) REFERENCES `ecosystem_model`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `ecosystem_model` ADD CONSTRAINT `FK_658580aea4e1a892227e27db902` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `context` ADD CONSTRAINT `FK_5f0dbc3b097ef297bd5f4ddb1a9` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `context` ADD CONSTRAINT `FK_a03169c3f86480ba3863924f4d7` FOREIGN KEY (`ecosystemModelId`) REFERENCES `ecosystem_model`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_8d03fd2c8e8411ec9192c79cd99` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_b4250035291aac1329d59224a96` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_ef1ff4ac7f613cc0677e2295b30` FOREIGN KEY (`parentSpaceId`) REFERENCES `space`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_6bdeffaf6ea6159b4672a2aed70` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_ea06eb8894469a0f262d929bf06` FOREIGN KEY (`collaborationId`) REFERENCES `collaboration`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_cc0b08eb9679d3daa95153c2af5` FOREIGN KEY (`contextId`) REFERENCES `context`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_68fa2c2b00cc1ed77e7c225e8ba` FOREIGN KEY (`communityId`) REFERENCES `community`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_9c664d684f987a735678b0ba825` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_980c4643d7d9de1b97bc39f5185` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `space` ADD CONSTRAINT `FK_dea52ce918df6950019678fa355` FOREIGN KEY (`templatesManagerId`) REFERENCES `templates_manager`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona` ADD CONSTRAINT `FK_293f0d3ef60cb0ca0006044ecfd` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` ADD CONSTRAINT `FK_e2eaa2213ac4454039cd8abc07d` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` ADD CONSTRAINT `FK_4504c37764f6962ccbd165a21de` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` ADD CONSTRAINT `FK_a8890dcd65b8c3ee6e160d33f3a` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` ADD CONSTRAINT `FK_7a962c9b04b0d197bc3c93262a7` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` ADD CONSTRAINT `FK_55b8101bdf4f566645e928c26e3` FOREIGN KEY (`aiPersonaId`) REFERENCES `ai_persona`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_8af8122897b05315e7eb8925253` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_5facd6d188068a5a1c5b6f07fc3` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_51014590f9644e6ff9e0536f40f` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` ADD CONSTRAINT `FK_a1441e46c8d36090e1f6477cea5` FOREIGN KEY (`templatesSetId`) REFERENCES `templates_set`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `account` ADD CONSTRAINT `FK_91a165c1091a6959cc19d522399` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `account` ADD CONSTRAINT `FK_833582df0c439ab8c9adc5240d1` FOREIGN KEY (`agentId`) REFERENCES `agent`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `account` ADD CONSTRAINT `FK_950221e932175dc7cf7c0064887` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_b411e4f27d77a96eccdabbf4b45` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_36c8905c2c6c59467c60d94fd8a` FOREIGN KEY (`profileId`) REFERENCES `profile`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` ADD CONSTRAINT `FK_156fd30246eb151b9d17716abf5` FOREIGN KEY (`accountId`) REFERENCES `account`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona_service` ADD CONSTRAINT `FK_79206feb0038b1c5597668dc4b5` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona_service` ADD CONSTRAINT `FK_b9f20da98058d7bd474152ed6ce` FOREIGN KEY (`aiServerId`) REFERENCES `ai_server`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `ai_server` ADD CONSTRAINT `FK_9d520fa5fed56042918e48fc4b5` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + await queryRunner.query( + 'ALTER TABLE `application_questions` ADD CONSTRAINT `FK_8495fae86f13836b0745642baa8` FOREIGN KEY (`applicationId`) REFERENCES `application`(`id`) ON DELETE CASCADE ON UPDATE CASCADE' + ); + await queryRunner.query( + 'ALTER TABLE `application_questions` ADD CONSTRAINT `FK_fe50118fd82e7fe2f74f986a195` FOREIGN KEY (`nvpId`) REFERENCES `nvp`(`id`) ON DELETE CASCADE ON UPDATE CASCADE' + ); + await queryRunner.query( + 'CREATE TABLE `query-result-cache` (`id` int NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NULL, `time` bigint NOT NULL, `duration` int NOT NULL, `query` text NOT NULL, `result` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB' + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query('DROP TABLE `query-result-cache`'); + await queryRunner.query( + 'ALTER TABLE `application_questions` DROP FOREIGN KEY `FK_fe50118fd82e7fe2f74f986a195`' + ); + await queryRunner.query( + 'ALTER TABLE `application_questions` DROP FOREIGN KEY `FK_8495fae86f13836b0745642baa8`' + ); + await queryRunner.query( + 'ALTER TABLE `ai_server` DROP FOREIGN KEY `FK_9d520fa5fed56042918e48fc4b5`' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona_service` DROP FOREIGN KEY `FK_b9f20da98058d7bd474152ed6ce`' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona_service` DROP FOREIGN KEY `FK_79206feb0038b1c5597668dc4b5`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` DROP FOREIGN KEY `FK_156fd30246eb151b9d17716abf5`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` DROP FOREIGN KEY `FK_36c8905c2c6c59467c60d94fd8a`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_hub` DROP FOREIGN KEY `FK_b411e4f27d77a96eccdabbf4b45`' + ); + await queryRunner.query( + 'ALTER TABLE `account` DROP FOREIGN KEY `FK_950221e932175dc7cf7c0064887`' + ); + await queryRunner.query( + 'ALTER TABLE `account` DROP FOREIGN KEY `FK_833582df0c439ab8c9adc5240d1`' + ); + await queryRunner.query( + 'ALTER TABLE `account` DROP FOREIGN KEY `FK_91a165c1091a6959cc19d522399`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` DROP FOREIGN KEY `FK_a1441e46c8d36090e1f6477cea5`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` DROP FOREIGN KEY `FK_51014590f9644e6ff9e0536f40f`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` DROP FOREIGN KEY `FK_5facd6d188068a5a1c5b6f07fc3`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_pack` DROP FOREIGN KEY `FK_8af8122897b05315e7eb8925253`' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` DROP FOREIGN KEY `FK_55b8101bdf4f566645e928c26e3`' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` DROP FOREIGN KEY `FK_7a962c9b04b0d197bc3c93262a7`' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` DROP FOREIGN KEY `FK_a8890dcd65b8c3ee6e160d33f3a`' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` DROP FOREIGN KEY `FK_4504c37764f6962ccbd165a21de`' + ); + await queryRunner.query( + 'ALTER TABLE `virtual_contributor` DROP FOREIGN KEY `FK_e2eaa2213ac4454039cd8abc07d`' + ); + await queryRunner.query( + 'ALTER TABLE `ai_persona` DROP FOREIGN KEY `FK_293f0d3ef60cb0ca0006044ecfd`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_dea52ce918df6950019678fa355`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_980c4643d7d9de1b97bc39f5185`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_9c664d684f987a735678b0ba825`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_68fa2c2b00cc1ed77e7c225e8ba`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_cc0b08eb9679d3daa95153c2af5`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_ea06eb8894469a0f262d929bf06`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_6bdeffaf6ea6159b4672a2aed70`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_ef1ff4ac7f613cc0677e2295b30`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_b4250035291aac1329d59224a96`' + ); + await queryRunner.query( + 'ALTER TABLE `space` DROP FOREIGN KEY `FK_8d03fd2c8e8411ec9192c79cd99`' + ); + await queryRunner.query( + 'ALTER TABLE `context` DROP FOREIGN KEY `FK_a03169c3f86480ba3863924f4d7`' + ); + await queryRunner.query( + 'ALTER TABLE `context` DROP FOREIGN KEY `FK_5f0dbc3b097ef297bd5f4ddb1a9`' + ); + await queryRunner.query( + 'ALTER TABLE `ecosystem_model` DROP FOREIGN KEY `FK_658580aea4e1a892227e27db902`' + ); + await queryRunner.query( + 'ALTER TABLE `actor_group` DROP FOREIGN KEY `FK_cbb1d7afa052a184471723d3297`' + ); + await queryRunner.query( + 'ALTER TABLE `actor_group` DROP FOREIGN KEY `FK_bde98d59e8984e7d17034c3b937`' + ); + await queryRunner.query( + 'ALTER TABLE `actor` DROP FOREIGN KEY `FK_0f9d41ee193d631a5439bb4f404`' + ); + await queryRunner.query( + 'ALTER TABLE `actor` DROP FOREIGN KEY `FK_a2afa3851ea733de932251b3a1f`' + ); + await queryRunner.query( + 'ALTER TABLE `community` DROP FOREIGN KEY `FK_3b8f390d76263ef5996869da071`' + ); + await queryRunner.query( + 'ALTER TABLE `community` DROP FOREIGN KEY `FK_2e7dd2fa8c829352cfbecb2cc93`' + ); + await queryRunner.query( + 'ALTER TABLE `community` DROP FOREIGN KEY `FK_7fbe50fa78a37776ad962cb7643`' + ); + await queryRunner.query( + 'ALTER TABLE `community` DROP FOREIGN KEY `FK_6e7584bfb417bd0f8e8696ab585`' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` DROP FOREIGN KEY `FK_86acc254af20d20c9d87c3503d5`' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` DROP FOREIGN KEY `FK_00905b142498f63e76d38fb254e`' + ); + await queryRunner.query( + 'ALTER TABLE `role_set` DROP FOREIGN KEY `FK_b038f74c8d4eadb839e78b99ce5`' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_6a3b86c6db10582baae7058f5b9`' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_b0c80ccf319a1c7a7af12b39987`' + ); + await queryRunner.query( + 'ALTER TABLE `invitation` DROP FOREIGN KEY `FK_b132226941570cb650a4023d493`' + ); + await queryRunner.query( + 'ALTER TABLE `application` DROP FOREIGN KEY `FK_8fb220ad1ac1f9c86ec39d134e4`' + ); + await queryRunner.query( + 'ALTER TABLE `application` DROP FOREIGN KEY `FK_b4ae3fea4a24b4be1a86dacf8a2`' + ); + await queryRunner.query( + 'ALTER TABLE `application` DROP FOREIGN KEY `FK_7ec2857c7d8d16432ffca1cb3d9`' + ); + await queryRunner.query( + 'ALTER TABLE `application` DROP FOREIGN KEY `FK_56f5614fff0028d403704995822`' + ); + await queryRunner.query( + 'ALTER TABLE `user` DROP FOREIGN KEY `FK_10458c50c10436b6d589b40e5ca`' + ); + await queryRunner.query( + 'ALTER TABLE `user` DROP FOREIGN KEY `FK_028322b763dc94242dc9f638f9b`' + ); + await queryRunner.query( + 'ALTER TABLE `user` DROP FOREIGN KEY `FK_b61c694cacfab25533bd23d9add`' + ); + await queryRunner.query( + 'ALTER TABLE `user` DROP FOREIGN KEY `FK_9466682df91534dd95e4dbaa616`' + ); + await queryRunner.query( + 'ALTER TABLE `user` DROP FOREIGN KEY `FK_09f909622aa177a097256b7cc22`' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` DROP FOREIGN KEY `FK_809c1e6cf3ef6be03a0a1db3f70`' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` DROP FOREIGN KEY `FK_562dce4a08bb214f08107b3631e`' + ); + await queryRunner.query( + 'ALTER TABLE `platform_invitation` DROP FOREIGN KEY `FK_c0448d2c992a62c9c11bd0f1422`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_425bbb4b951f7f4629710763fc0`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_f516dd9a46616999c7e9a6adc15`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_81f92b22d30540102e9654e892c`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_ca469f5ec53a7719d155d60aca1`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_dd88d373c64b04e24705d575c99`' + ); + await queryRunner.query( + 'ALTER TABLE `platform` DROP FOREIGN KEY `FK_9f621c51dd854634d8766a9cfaf`' + ); + await queryRunner.query( + 'ALTER TABLE `templates_manager` DROP FOREIGN KEY `FK_7ba875eee72ec5fcbe2355124df`' + ); + await queryRunner.query( + 'ALTER TABLE `templates_manager` DROP FOREIGN KEY `FK_19ea19263c6016f411fb0082437`' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` DROP FOREIGN KEY `FK_b6617b64c6ea8ebb24947ddbd45`' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` DROP FOREIGN KEY `FK_c1135fa45c07ba625e1db9f93bd`' + ); + await queryRunner.query( + 'ALTER TABLE `template_default` DROP FOREIGN KEY `FK_9dbeb9326140b3ce01c1037efee`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_21fdaf6dc88bdd6e8839e29b0bd`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_f09090a77e07377eefb3f731d9f`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_c6e4d1a07781a809ad3b3ee8265`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_eedeae5e63f9a9c3a0161541e98`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_45cf273f30c1fa509456b6b0ddf`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_c7f54e6269c013d9c273f025edd`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_f58c3b144b6e010969e199beeff`' + ); + await queryRunner.query( + 'ALTER TABLE `template` DROP FOREIGN KEY `FK_4318f97beabd362a8a09e9d3203`' + ); + await queryRunner.query( + 'ALTER TABLE `templates_set` DROP FOREIGN KEY `FK_eb0176ef4b98c143322aa6f8090`' + ); + await queryRunner.query( + 'ALTER TABLE `forum` DROP FOREIGN KEY `FK_3b0c92945f36d06f37de80285dd`' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` DROP FOREIGN KEY `FK_0de78853c1ee793f61bda7eff79`' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` DROP FOREIGN KEY `FK_5337074c9b818bb63e6f314c808`' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` DROP FOREIGN KEY `FK_2d8a3ca181c3f0346817685d21d`' + ); + await queryRunner.query( + 'ALTER TABLE `discussion` DROP FOREIGN KEY `FK_4555dccdda9ba57d8e3a634cd0d`' + ); + await queryRunner.query( + 'ALTER TABLE `licensing` DROP FOREIGN KEY `FK_a5dae5a376dd49c7c076893d40b`' + ); + await queryRunner.query( + 'ALTER TABLE `licensing` DROP FOREIGN KEY `FK_0c6a4d0a6c13a3f5df6ac015096`' + ); + await queryRunner.query( + 'ALTER TABLE `license_plan` DROP FOREIGN KEY `FK_3030904030f5d30f483b49905d1`' + ); + await queryRunner.query( + 'ALTER TABLE `license_policy` DROP FOREIGN KEY `FK_23d4d78ea8db637df031f86f030`' + ); + await queryRunner.query( + 'ALTER TABLE `library` DROP FOREIGN KEY `FK_3879db652f2421337691219ace8`' + ); + await queryRunner.query( + 'ALTER TABLE `role` DROP FOREIGN KEY `FK_66d695b73839e9b66ff1350d34f`' + ); + await queryRunner.query( + 'ALTER TABLE `community_guidelines` DROP FOREIGN KEY `FK_3d60fe4fa40d54bad7d51bb4bd1`' + ); + await queryRunner.query( + 'ALTER TABLE `community_guidelines` DROP FOREIGN KEY `FK_684b272e6f7459439d41d2879ee`' + ); + await queryRunner.query( + 'ALTER TABLE `communication` DROP FOREIGN KEY `FK_eb99e588873c788a68a035478ab`' + ); + await queryRunner.query( + 'ALTER TABLE `communication` DROP FOREIGN KEY `FK_a20c5901817dd09d5906537e087`' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` DROP FOREIGN KEY `FK_9fcc131f256e969d773327f07cb`' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` DROP FOREIGN KEY `FK_694ebec955a90e999d9926b7da8`' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` DROP FOREIGN KEY `FK_9912e4cfc1e09848a392a651514`' + ); + await queryRunner.query( + 'ALTER TABLE `user_group` DROP FOREIGN KEY `FK_e8e32f1e59c349b406a4752e545`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_395aa74996a1f978b4969d114b1`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_58fd47c4a6ac8df9fe2bcaed874`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_5a72d5b37312bac2e0a01157185`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_7f1bec8979b57ed7ebd392a2ca9`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_d2cb77c14644156ec8e865608e0`' + ); + await queryRunner.query( + 'ALTER TABLE `organization` DROP FOREIGN KEY `FK_e0e150e4f11d906b931b46a2d89`' + ); + await queryRunner.query( + 'ALTER TABLE `agent` DROP FOREIGN KEY `FK_8ed9d1af584fa62f1ad3405b33b`' + ); + await queryRunner.query( + 'ALTER TABLE `credential` DROP FOREIGN KEY `FK_dbe0929355f82e5995f0b7fd5e2`' + ); + await queryRunner.query( + 'ALTER TABLE `preference_set` DROP FOREIGN KEY `FK_8e76dcf171c45875c44febb1d8d`' + ); + await queryRunner.query( + 'ALTER TABLE `preference` DROP FOREIGN KEY `FK_f4b5742f589e2ac8bfe48b708c0`' + ); + await queryRunner.query( + 'ALTER TABLE `preference` DROP FOREIGN KEY `FK_46d60bf133073f749b8f07e534c`' + ); + await queryRunner.query( + 'ALTER TABLE `preference` DROP FOREIGN KEY `FK_b4cf0f96bf08cf396f683555229`' + ); + await queryRunner.query( + 'ALTER TABLE `organization_verification` DROP FOREIGN KEY `FK_1cc3b275fc2a9d9d9b0ae33b310`' + ); + await queryRunner.query( + 'ALTER TABLE `organization_verification` DROP FOREIGN KEY `FK_c66eddab0caacb1ef8d46bcafdb`' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` DROP FOREIGN KEY `FK_35c6b1de6d4d89dfe8e9c85d771`' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` DROP FOREIGN KEY `FK_f67a2d25c945269d602c182fbc0`' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` DROP FOREIGN KEY `FK_b7ece56376ac7ca0b9a56c33b3a`' + ); + await queryRunner.query( + 'ALTER TABLE `collaboration` DROP FOREIGN KEY `FK_262ecf3f5d70b82a48336184251`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_flow` DROP FOREIGN KEY `FK_96a8cbe1706f459fd7d883be9bd`' + ); + await queryRunner.query( + 'ALTER TABLE `innovation_flow` DROP FOREIGN KEY `FK_a6e050daa4c7a3ab1e411c36517`' + ); + await queryRunner.query( + 'ALTER TABLE `timeline` DROP FOREIGN KEY `FK_56aae15a664b2889a1a11c2cf82`' + ); + await queryRunner.query( + 'ALTER TABLE `timeline` DROP FOREIGN KEY `FK_5fe58ece01b48496aebc04733da`' + ); + await queryRunner.query( + 'ALTER TABLE `calendar` DROP FOREIGN KEY `FK_6e74d59afda096b68d12a699691`' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` DROP FOREIGN KEY `FK_80ab7835e1749581a27462eb87f`' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` DROP FOREIGN KEY `FK_b5069b11030e9608ee4468f850d`' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` DROP FOREIGN KEY `FK_9349e137959f3ca5818c2e62b3f`' + ); + await queryRunner.query( + 'ALTER TABLE `calendar_event` DROP FOREIGN KEY `FK_8ee86afa2808a4ab523b9ee6c5e`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_9b1c5ee044611ac78249194ec35`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_62ed316cda7b75735b20307b47e`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_36b0da55acff774d0845aeb55f2`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_1e740008a7e1512966e3b084148`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_cf776244b01436d8ca5cc762848`' + ); + await queryRunner.query( + 'ALTER TABLE `callout` DROP FOREIGN KEY `FK_6289dee12effb51320051c6f1fc`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` DROP FOREIGN KEY `FK_7370de8eb79ed00b0d403f2299a`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` DROP FOREIGN KEY `FK_bdf2d0eced5c95968a85caaaaee`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` DROP FOREIGN KEY `FK_97fefc97fb254c30577696e1c0a`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` DROP FOREIGN KEY `FK_5e34f9a356f6254b8da24f8947b`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_contribution` DROP FOREIGN KEY `FK_dfa86c46f509a61c6510536cd9a`' + ); + await queryRunner.query( + 'ALTER TABLE `link` DROP FOREIGN KEY `FK_3bfc8c1aaec1395cc148268d3cd`' + ); + await queryRunner.query( + 'ALTER TABLE `link` DROP FOREIGN KEY `FK_07f249ac87502495710a62c5c01`' + ); + await queryRunner.query( + 'ALTER TABLE `post` DROP FOREIGN KEY `FK_042b9825d770d6b3009ae206c2f`' + ); + await queryRunner.query( + 'ALTER TABLE `post` DROP FOREIGN KEY `FK_970844fcd10c2b6df7c1b49eacf`' + ); + await queryRunner.query( + 'ALTER TABLE `post` DROP FOREIGN KEY `FK_390343b22abec869bf800419333`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` DROP FOREIGN KEY `FK_8bc0e1f40be5816d3a593cbf7fa`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` DROP FOREIGN KEY `FK_f53e2d266432e58e538a366705d`' + ); + await queryRunner.query( + 'ALTER TABLE `callout_framing` DROP FOREIGN KEY `FK_c9d7c2c4eb8a1d012ddc6605da9`' + ); + await queryRunner.query( + 'ALTER TABLE `whiteboard` DROP FOREIGN KEY `FK_3f9e9e2798d2a4d84b16ee8477c`' + ); + await queryRunner.query( + 'ALTER TABLE `whiteboard` DROP FOREIGN KEY `FK_d3b86160bb7d704212382b0ca44`' + ); + await queryRunner.query( + 'ALTER TABLE `room` DROP FOREIGN KEY `FK_d1d94dd8e0c417b4188a05ccbca`' + ); + await queryRunner.query( + 'ALTER TABLE `vc_interaction` DROP FOREIGN KEY `FK_d6f78c95ff41cdd30e505a4ebbb`' + ); + await queryRunner.query( + 'ALTER TABLE `reference` DROP FOREIGN KEY `FK_2f46c698fc4c19a8cc233c5f255`' + ); + await queryRunner.query( + 'ALTER TABLE `reference` DROP FOREIGN KEY `FK_73e8ae665a49366ca7e2866a45d`' + ); + await queryRunner.query( + 'ALTER TABLE `profile` DROP FOREIGN KEY `FK_4a1c74fd2a61b32d9d9500e0650`' + ); + await queryRunner.query( + 'ALTER TABLE `profile` DROP FOREIGN KEY `FK_432056041df0e4337b17ff7b09d`' + ); + await queryRunner.query( + 'ALTER TABLE `profile` DROP FOREIGN KEY `FK_a96475631aba7dce41db03cc8b2`' + ); + await queryRunner.query( + 'ALTER TABLE `storage_bucket` DROP FOREIGN KEY `FK_11d0ed50a26da5513f7e4347847`' + ); + await queryRunner.query( + 'ALTER TABLE `storage_bucket` DROP FOREIGN KEY `FK_f2f48b57269987b13b415a00587`' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` DROP FOREIGN KEY `FK_0647707288c243e60091c8d8620`' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` DROP FOREIGN KEY `FK_b80c28f5335ab5442f63c644d94`' + ); + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` DROP FOREIGN KEY `FK_f3b4d59c0b805c9c1ecb0070e16`' + ); + await queryRunner.query( + 'ALTER TABLE `document` DROP FOREIGN KEY `FK_9fb9257b14ec21daf5bc9aa4c8e`' + ); + await queryRunner.query( + 'ALTER TABLE `document` DROP FOREIGN KEY `FK_851e50ec4be7c62a1f9b9a430bf`' + ); + await queryRunner.query( + 'ALTER TABLE `document` DROP FOREIGN KEY `FK_d9e2dfcccf59233c17cc6bc6418`' + ); + await queryRunner.query( + 'ALTER TABLE `visual` DROP FOREIGN KEY `FK_1104f3ef8497ca40d99b9f46b87`' + ); + await queryRunner.query( + 'ALTER TABLE `visual` DROP FOREIGN KEY `FK_4fbd109f9bb84f58b7a3c60649c`' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` DROP FOREIGN KEY `FK_644155610ddc40dc4e19781c8f0`' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` DROP FOREIGN KEY `FK_81fc213b2d9ad0cddeab1a9ce64`' + ); + await queryRunner.query( + 'ALTER TABLE `tagset` DROP FOREIGN KEY `FK_eb59b98ee6ef26c993d0d75c83c`' + ); + await queryRunner.query( + 'ALTER TABLE `tagset_template` DROP FOREIGN KEY `FK_96f23f044acf305c1699e0319d2`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_fe50118fd82e7fe2f74f986a19` ON `application_questions`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_8495fae86f13836b0745642baa` ON `application_questions`' + ); + await queryRunner.query('DROP TABLE `application_questions`'); + await queryRunner.query( + 'DROP INDEX `REL_9d520fa5fed56042918e48fc4b` ON `ai_server`' + ); + await queryRunner.query('DROP TABLE `ai_server`'); + await queryRunner.query( + 'DROP INDEX `REL_79206feb0038b1c5597668dc4b` ON `ai_persona_service`' + ); + await queryRunner.query('DROP TABLE `ai_persona_service`'); + await queryRunner.query( + 'DROP INDEX `IDX_07a39cea9426b689be25fd61de` ON `activity`' + ); + await queryRunner.query('DROP TABLE `activity`'); + await queryRunner.query( + 'DROP INDEX `REL_36c8905c2c6c59467c60d94fd8` ON `innovation_hub`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b411e4f27d77a96eccdabbf4b4` ON `innovation_hub`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_8f35d04d098bb6c7c57a9a83ac` ON `innovation_hub`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_1d39dac2c6d2f17286d90c306b` ON `innovation_hub`' + ); + await queryRunner.query('DROP TABLE `innovation_hub`'); + await queryRunner.query( + 'DROP INDEX `REL_950221e932175dc7cf7c006488` ON `account`' + ); + await queryRunner.query( + 'DROP INDEX `REL_833582df0c439ab8c9adc5240d` ON `account`' + ); + await queryRunner.query( + 'DROP INDEX `REL_91a165c1091a6959cc19d52239` ON `account`' + ); + await queryRunner.query('DROP TABLE `account`'); + await queryRunner.query( + 'DROP INDEX `REL_a1441e46c8d36090e1f6477cea` ON `innovation_pack`' + ); + await queryRunner.query( + 'DROP INDEX `REL_5facd6d188068a5a1c5b6f07fc` ON `innovation_pack`' + ); + await queryRunner.query( + 'DROP INDEX `REL_8af8122897b05315e7eb892525` ON `innovation_pack`' + ); + await queryRunner.query('DROP TABLE `innovation_pack`'); + await queryRunner.query( + 'DROP INDEX `REL_55b8101bdf4f566645e928c26e` ON `virtual_contributor`' + ); + await queryRunner.query( + 'DROP INDEX `REL_a8890dcd65b8c3ee6e160d33f3` ON `virtual_contributor`' + ); + await queryRunner.query( + 'DROP INDEX `REL_4504c37764f6962ccbd165a21d` ON `virtual_contributor`' + ); + await queryRunner.query( + 'DROP INDEX `REL_e2eaa2213ac4454039cd8abc07` ON `virtual_contributor`' + ); + await queryRunner.query('DROP TABLE `virtual_contributor`'); + await queryRunner.query( + 'DROP INDEX `REL_293f0d3ef60cb0ca0006044ecf` ON `ai_persona`' + ); + await queryRunner.query('DROP TABLE `ai_persona`'); + await queryRunner.query( + 'DROP INDEX `REL_dea52ce918df6950019678fa35` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_980c4643d7d9de1b97bc39f518` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_9c664d684f987a735678b0ba82` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_68fa2c2b00cc1ed77e7c225e8b` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_cc0b08eb9679d3daa95153c2af` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_ea06eb8894469a0f262d929bf0` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b4250035291aac1329d59224a9` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `REL_8d03fd2c8e8411ec9192c79cd9` ON `space`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_0f03c61020ea0dfa0198c60304` ON `space`' + ); + await queryRunner.query('DROP TABLE `space`'); + await queryRunner.query( + 'DROP INDEX `REL_a03169c3f86480ba3863924f4d` ON `context`' + ); + await queryRunner.query( + 'DROP INDEX `REL_5f0dbc3b097ef297bd5f4ddb1a` ON `context`' + ); + await queryRunner.query('DROP TABLE `context`'); + await queryRunner.query( + 'DROP INDEX `REL_658580aea4e1a892227e27db90` ON `ecosystem_model`' + ); + await queryRunner.query('DROP TABLE `ecosystem_model`'); + await queryRunner.query( + 'DROP INDEX `REL_bde98d59e8984e7d17034c3b93` ON `actor_group`' + ); + await queryRunner.query('DROP TABLE `actor_group`'); + await queryRunner.query( + 'DROP INDEX `REL_a2afa3851ea733de932251b3a1` ON `actor`' + ); + await queryRunner.query('DROP TABLE `actor`'); + await queryRunner.query( + 'DROP INDEX `REL_3b8f390d76263ef5996869da07` ON `community`' + ); + await queryRunner.query( + 'DROP INDEX `REL_2e7dd2fa8c829352cfbecb2cc9` ON `community`' + ); + await queryRunner.query( + 'DROP INDEX `REL_7fbe50fa78a37776ad962cb764` ON `community`' + ); + await queryRunner.query( + 'DROP INDEX `REL_6e7584bfb417bd0f8e8696ab58` ON `community`' + ); + await queryRunner.query('DROP TABLE `community`'); + await queryRunner.query( + 'DROP INDEX `REL_00905b142498f63e76d38fb254` ON `role_set`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b038f74c8d4eadb839e78b99ce` ON `role_set`' + ); + await queryRunner.query('DROP TABLE `role_set`'); + await queryRunner.query( + 'DROP INDEX `REL_b0c80ccf319a1c7a7af12b3998` ON `invitation`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b132226941570cb650a4023d49` ON `invitation`' + ); + await queryRunner.query('DROP TABLE `invitation`'); + await queryRunner.query( + 'DROP INDEX `REL_7ec2857c7d8d16432ffca1cb3d` ON `application`' + ); + await queryRunner.query( + 'DROP INDEX `REL_56f5614fff0028d40370499582` ON `application`' + ); + await queryRunner.query('DROP TABLE `application`'); + await queryRunner.query( + 'DROP INDEX `REL_10458c50c10436b6d589b40e5c` ON `user`' + ); + await queryRunner.query( + 'DROP INDEX `REL_028322b763dc94242dc9f638f9` ON `user`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b61c694cacfab25533bd23d9ad` ON `user`' + ); + await queryRunner.query( + 'DROP INDEX `REL_9466682df91534dd95e4dbaa61` ON `user`' + ); + await queryRunner.query( + 'DROP INDEX `REL_09f909622aa177a097256b7cc2` ON `user`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_266bc44a18601f893566962df6` ON `user`' + ); + await queryRunner.query('DROP TABLE `user`'); + await queryRunner.query('DROP TABLE `nvp`'); + await queryRunner.query( + 'DROP INDEX `REL_c0448d2c992a62c9c11bd0f142` ON `platform_invitation`' + ); + await queryRunner.query('DROP TABLE `platform_invitation`'); + await queryRunner.query( + 'DROP INDEX `REL_425bbb4b951f7f4629710763fc` ON `platform`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f516dd9a46616999c7e9a6adc1` ON `platform`' + ); + await queryRunner.query( + 'DROP INDEX `REL_81f92b22d30540102e9654e892` ON `platform`' + ); + await queryRunner.query( + 'DROP INDEX `REL_ca469f5ec53a7719d155d60aca` ON `platform`' + ); + await queryRunner.query( + 'DROP INDEX `REL_dd88d373c64b04e24705d575c9` ON `platform`' + ); + await queryRunner.query( + 'DROP INDEX `REL_9f621c51dd854634d8766a9cfa` ON `platform`' + ); + await queryRunner.query('DROP TABLE `platform`'); + await queryRunner.query( + 'DROP INDEX `REL_7ba875eee72ec5fcbe2355124d` ON `templates_manager`' + ); + await queryRunner.query( + 'DROP INDEX `REL_19ea19263c6016f411fb008243` ON `templates_manager`' + ); + await queryRunner.query('DROP TABLE `templates_manager`'); + await queryRunner.query( + 'DROP INDEX `REL_b6617b64c6ea8ebb24947ddbd4` ON `template_default`' + ); + await queryRunner.query( + 'DROP INDEX `REL_9dbeb9326140b3ce01c1037efe` ON `template_default`' + ); + await queryRunner.query('DROP TABLE `template_default`'); + await queryRunner.query( + 'DROP INDEX `REL_21fdaf6dc88bdd6e8839e29b0b` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f09090a77e07377eefb3f731d9` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_c6e4d1a07781a809ad3b3ee826` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_eedeae5e63f9a9c3a0161541e9` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_45cf273f30c1fa509456b6b0dd` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f58c3b144b6e010969e199beef` ON `template`' + ); + await queryRunner.query( + 'DROP INDEX `REL_4318f97beabd362a8a09e9d320` ON `template`' + ); + await queryRunner.query('DROP TABLE `template`'); + await queryRunner.query( + 'DROP INDEX `REL_eb0176ef4b98c143322aa6f809` ON `templates_set`' + ); + await queryRunner.query('DROP TABLE `templates_set`'); + await queryRunner.query( + 'DROP INDEX `REL_3b0c92945f36d06f37de80285d` ON `forum`' + ); + await queryRunner.query('DROP TABLE `forum`'); + await queryRunner.query( + 'DROP INDEX `REL_5337074c9b818bb63e6f314c80` ON `discussion`' + ); + await queryRunner.query( + 'DROP INDEX `REL_2d8a3ca181c3f0346817685d21` ON `discussion`' + ); + await queryRunner.query( + 'DROP INDEX `REL_4555dccdda9ba57d8e3a634cd0` ON `discussion`' + ); + await queryRunner.query('DROP TABLE `discussion`'); + await queryRunner.query( + 'DROP INDEX `REL_a5dae5a376dd49c7c076893d40` ON `licensing`' + ); + await queryRunner.query( + 'DROP INDEX `REL_0c6a4d0a6c13a3f5df6ac01509` ON `licensing`' + ); + await queryRunner.query('DROP TABLE `licensing`'); + await queryRunner.query('DROP TABLE `license_plan`'); + await queryRunner.query( + 'DROP INDEX `REL_23d4d78ea8db637df031f86f03` ON `license_policy`' + ); + await queryRunner.query('DROP TABLE `license_policy`'); + await queryRunner.query( + 'DROP INDEX `REL_3879db652f2421337691219ace` ON `library`' + ); + await queryRunner.query('DROP TABLE `library`'); + await queryRunner.query('DROP TABLE `form`'); + await queryRunner.query('DROP TABLE `role`'); + await queryRunner.query( + 'DROP INDEX `REL_3d60fe4fa40d54bad7d51bb4bd` ON `community_guidelines`' + ); + await queryRunner.query( + 'DROP INDEX `REL_684b272e6f7459439d41d2879e` ON `community_guidelines`' + ); + await queryRunner.query('DROP TABLE `community_guidelines`'); + await queryRunner.query( + 'DROP INDEX `REL_eb99e588873c788a68a035478a` ON `communication`' + ); + await queryRunner.query( + 'DROP INDEX `REL_a20c5901817dd09d5906537e08` ON `communication`' + ); + await queryRunner.query('DROP TABLE `communication`'); + await queryRunner.query( + 'DROP INDEX `REL_9912e4cfc1e09848a392a65151` ON `user_group`' + ); + await queryRunner.query( + 'DROP INDEX `REL_e8e32f1e59c349b406a4752e54` ON `user_group`' + ); + await queryRunner.query('DROP TABLE `user_group`'); + await queryRunner.query( + 'DROP INDEX `REL_395aa74996a1f978b4969d114b` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `REL_58fd47c4a6ac8df9fe2bcaed87` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `REL_5a72d5b37312bac2e0a0115718` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `REL_7f1bec8979b57ed7ebd392a2ca` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `REL_d2cb77c14644156ec8e865608e` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `REL_e0e150e4f11d906b931b46a2d8` ON `organization`' + ); + await queryRunner.query( + 'DROP INDEX `IDX_9fdd8f0bfe04a676822c7265e1` ON `organization`' + ); + await queryRunner.query('DROP TABLE `organization`'); + await queryRunner.query( + 'DROP INDEX `REL_8ed9d1af584fa62f1ad3405b33` ON `agent`' + ); + await queryRunner.query('DROP TABLE `agent`'); + await queryRunner.query('DROP TABLE `credential`'); + await queryRunner.query( + 'DROP INDEX `REL_8e76dcf171c45875c44febb1d8` ON `preference_set`' + ); + await queryRunner.query('DROP TABLE `preference_set`'); + await queryRunner.query( + 'DROP INDEX `REL_b4cf0f96bf08cf396f68355522` ON `preference`' + ); + await queryRunner.query('DROP TABLE `preference`'); + await queryRunner.query('DROP TABLE `preference_definition`'); + await queryRunner.query( + 'DROP INDEX `REL_1cc3b275fc2a9d9d9b0ae33b31` ON `organization_verification`' + ); + await queryRunner.query( + 'DROP INDEX `REL_c66eddab0caacb1ef8d46bcafd` ON `organization_verification`' + ); + await queryRunner.query('DROP TABLE `organization_verification`'); + await queryRunner.query('DROP TABLE `lifecycle`'); + await queryRunner.query( + 'DROP INDEX `REL_35c6b1de6d4d89dfe8e9c85d77` ON `collaboration`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f67a2d25c945269d602c182fbc` ON `collaboration`' + ); + await queryRunner.query( + 'DROP INDEX `REL_b7ece56376ac7ca0b9a56c33b3` ON `collaboration`' + ); + await queryRunner.query( + 'DROP INDEX `REL_262ecf3f5d70b82a4833618425` ON `collaboration`' + ); + await queryRunner.query('DROP TABLE `collaboration`'); + await queryRunner.query( + 'DROP INDEX `REL_96a8cbe1706f459fd7d883be9b` ON `innovation_flow`' + ); + await queryRunner.query( + 'DROP INDEX `REL_a6e050daa4c7a3ab1e411c3651` ON `innovation_flow`' + ); + await queryRunner.query('DROP TABLE `innovation_flow`'); + await queryRunner.query( + 'DROP INDEX `REL_56aae15a664b2889a1a11c2cf8` ON `timeline`' + ); + await queryRunner.query( + 'DROP INDEX `REL_5fe58ece01b48496aebc04733d` ON `timeline`' + ); + await queryRunner.query('DROP TABLE `timeline`'); + await queryRunner.query( + 'DROP INDEX `REL_6e74d59afda096b68d12a69969` ON `calendar`' + ); + await queryRunner.query('DROP TABLE `calendar`'); + await queryRunner.query( + 'DROP INDEX `REL_b5069b11030e9608ee4468f850` ON `calendar_event`' + ); + await queryRunner.query( + 'DROP INDEX `REL_9349e137959f3ca5818c2e62b3` ON `calendar_event`' + ); + await queryRunner.query( + 'DROP INDEX `REL_8ee86afa2808a4ab523b9ee6c5` ON `calendar_event`' + ); + await queryRunner.query('DROP TABLE `calendar_event`'); + await queryRunner.query( + 'DROP INDEX `REL_62ed316cda7b75735b20307b47` ON `callout`' + ); + await queryRunner.query( + 'DROP INDEX `REL_36b0da55acff774d0845aeb55f` ON `callout`' + ); + await queryRunner.query( + 'DROP INDEX `REL_1e740008a7e1512966e3b08414` ON `callout`' + ); + await queryRunner.query( + 'DROP INDEX `REL_cf776244b01436d8ca5cc76284` ON `callout`' + ); + await queryRunner.query( + 'DROP INDEX `REL_6289dee12effb51320051c6f1f` ON `callout`' + ); + await queryRunner.query('DROP TABLE `callout`'); + await queryRunner.query( + 'DROP INDEX `REL_bdf2d0eced5c95968a85caaaae` ON `callout_contribution`' + ); + await queryRunner.query( + 'DROP INDEX `REL_97fefc97fb254c30577696e1c0` ON `callout_contribution`' + ); + await queryRunner.query( + 'DROP INDEX `REL_5e34f9a356f6254b8da24f8947` ON `callout_contribution`' + ); + await queryRunner.query( + 'DROP INDEX `REL_dfa86c46f509a61c6510536cd9` ON `callout_contribution`' + ); + await queryRunner.query('DROP TABLE `callout_contribution`'); + await queryRunner.query( + 'DROP INDEX `REL_3bfc8c1aaec1395cc148268d3c` ON `link`' + ); + await queryRunner.query( + 'DROP INDEX `REL_07f249ac87502495710a62c5c0` ON `link`' + ); + await queryRunner.query('DROP TABLE `link`'); + await queryRunner.query( + 'DROP INDEX `REL_042b9825d770d6b3009ae206c2` ON `post`' + ); + await queryRunner.query( + 'DROP INDEX `REL_970844fcd10c2b6df7c1b49eac` ON `post`' + ); + await queryRunner.query( + 'DROP INDEX `REL_390343b22abec869bf80041933` ON `post`' + ); + await queryRunner.query('DROP TABLE `post`'); + await queryRunner.query('DROP TABLE `callout_contribution_defaults`'); + await queryRunner.query('DROP TABLE `callout_contribution_policy`'); + await queryRunner.query( + 'DROP INDEX `REL_8bc0e1f40be5816d3a593cbf7f` ON `callout_framing`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f53e2d266432e58e538a366705` ON `callout_framing`' + ); + await queryRunner.query( + 'DROP INDEX `REL_c9d7c2c4eb8a1d012ddc6605da` ON `callout_framing`' + ); + await queryRunner.query('DROP TABLE `callout_framing`'); + await queryRunner.query( + 'DROP INDEX `REL_3f9e9e2798d2a4d84b16ee8477` ON `whiteboard`' + ); + await queryRunner.query( + 'DROP INDEX `REL_d3b86160bb7d704212382b0ca4` ON `whiteboard`' + ); + await queryRunner.query('DROP TABLE `whiteboard`'); + await queryRunner.query( + 'DROP INDEX `REL_d1d94dd8e0c417b4188a05ccbc` ON `room`' + ); + await queryRunner.query('DROP TABLE `room`'); + await queryRunner.query('DROP TABLE `vc_interaction`'); + await queryRunner.query( + 'DROP INDEX `REL_73e8ae665a49366ca7e2866a45` ON `reference`' + ); + await queryRunner.query('DROP TABLE `reference`'); + await queryRunner.query( + 'DROP INDEX `REL_4a1c74fd2a61b32d9d9500e065` ON `profile`' + ); + await queryRunner.query( + 'DROP INDEX `REL_432056041df0e4337b17ff7b09` ON `profile`' + ); + await queryRunner.query( + 'DROP INDEX `REL_a96475631aba7dce41db03cc8b` ON `profile`' + ); + await queryRunner.query('DROP TABLE `profile`'); + await queryRunner.query( + 'DROP INDEX `REL_f2f48b57269987b13b415a0058` ON `storage_bucket`' + ); + await queryRunner.query('DROP TABLE `storage_bucket`'); + await queryRunner.query( + 'DROP INDEX `REL_0647707288c243e60091c8d862` ON `storage_aggregator`' + ); + await queryRunner.query( + 'DROP INDEX `REL_f3b4d59c0b805c9c1ecb0070e1` ON `storage_aggregator`' + ); + await queryRunner.query('DROP TABLE `storage_aggregator`'); + await queryRunner.query( + 'DROP INDEX `REL_9fb9257b14ec21daf5bc9aa4c8` ON `document`' + ); + await queryRunner.query( + 'DROP INDEX `REL_d9e2dfcccf59233c17cc6bc641` ON `document`' + ); + await queryRunner.query('DROP TABLE `document`'); + await queryRunner.query('DROP TABLE `location`'); + await queryRunner.query( + 'DROP INDEX `REL_4fbd109f9bb84f58b7a3c60649` ON `visual`' + ); + await queryRunner.query('DROP TABLE `visual`'); + await queryRunner.query( + 'DROP INDEX `REL_eb59b98ee6ef26c993d0d75c83` ON `tagset`' + ); + await queryRunner.query('DROP TABLE `tagset`'); + await queryRunner.query('DROP TABLE `tagset_template`'); + await queryRunner.query('DROP TABLE `tagset_template_set`'); + await queryRunner.query('DROP TABLE `authorization_policy`'); + } +} From 9b46ae3d2d43e501cb38a69d8919130f112fb1fe Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Mon, 4 Nov 2024 16:34:03 +0200 Subject: [PATCH 17/42] extend scalar validation for nameID to 28 symbols for edge cases for nameIDs with reservedNames with 25 characters (#4662) * extend scalar validation for nameID to 27 symbols for edge cases for nameIDs with reservedNames with 25 characters * Update scalar.nameid.ts --------- Co-authored-by: Carlos Cano --- src/domain/common/scalars/scalar.nameid.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/domain/common/scalars/scalar.nameid.ts b/src/domain/common/scalars/scalar.nameid.ts index f443431026..e3e478ab67 100644 --- a/src/domain/common/scalars/scalar.nameid.ts +++ b/src/domain/common/scalars/scalar.nameid.ts @@ -8,10 +8,10 @@ import { Kind, ValueNode } from 'graphql'; @Scalar('NameID') export class NameID implements CustomScalar { static MIN_LENGTH = 3; - static MAX_LENGTH = NAMEID_MAX_LENGTH; + static MAX_LENGTH = NAMEID_MAX_LENGTH + 3; // the sliced 25 symbols, concatenated with '-' and a digit (or two), for nameIDs generated with 25 characters and overlapping a reserved nameID static REGEX = /^[a-zA-Z0-9\-]+$/; description = - 'A human readable identifier, 3 <= length <= 25. Used for URL paths in clients. Characters allowed: a-z,A-Z,0-9.'; + 'A human readable identifier, 3 <= length <= 28. Used for URL paths in clients. Characters allowed: a-z,A-Z,0-9.'; parseValue(value: unknown): string { return this.validate(value); From 7371877e851ff7bfc17732fea631d0a386efa0b1 Mon Sep 17 00:00:00 2001 From: Bobby Kolev Date: Mon, 4 Nov 2024 16:43:58 +0200 Subject: [PATCH 18/42] Subspacetemplates fixes 2 (#4667) * 0.95.0 * Subspaces templates Fixes (#4660) * 0.95.1 * - Address Valentin's comments (logging + rename of function - Fix Template Post callouts generating comments when they shouldn't - Fix 7131 - Preserve callout state * Ensure correct group and state when not adding new callouts * Collaboration templates shouldn't have a timeline --------- Co-authored-by: Carlos Cano --- package-lock.json | 4 +- package.json | 2 +- .../collaboration.service.authorization.ts | 12 +-- .../collaboration/collaboration.service.ts | 12 +-- .../space.defaults/space.defaults.service.ts | 13 ++- .../template.applier.service.ts | 87 ++++++++++++------- 6 files changed, 79 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3dc372df56..f6cfb36727 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "alkemio-server", - "version": "0.94.0", + "version": "0.95.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "alkemio-server", - "version": "0.94.0", + "version": "0.95.1", "license": "EUPL-1.2", "dependencies": { "@alkemio/matrix-adapter-lib": "^0.4.1", diff --git a/package.json b/package.json index 4035692261..86e0c4df25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alkemio-server", - "version": "0.94.0", + "version": "0.95.1", "description": "Alkemio server, responsible for managing the shared Alkemio platform", "author": "Alkemio Foundation", "private": false, diff --git a/src/domain/collaboration/collaboration/collaboration.service.authorization.ts b/src/domain/collaboration/collaboration/collaboration.service.authorization.ts index 01ad0aae89..11808579a2 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.authorization.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.authorization.ts @@ -62,11 +62,7 @@ export class CollaborationAuthorizationService { }, } ); - if ( - !collaboration.callouts || - !collaboration.innovationFlow || - !collaboration.timeline - ) { + if (!collaboration.callouts || !collaboration.innovationFlow) { throw new RelationshipNotFoundException( `Unable to load child entities for collaboration authorization: ${collaboration.id}`, LogContext.SPACES @@ -121,8 +117,7 @@ export class CollaborationAuthorizationService { if ( !collaboration.callouts || !collaboration.innovationFlow || - !collaboration.innovationFlow.profile || - !collaboration.timeline + !collaboration.innovationFlow.profile ) { throw new RelationshipNotFoundException( `Unable to load child entities for collaboration authorization children: ${collaboration.id}`, @@ -148,7 +143,8 @@ export class CollaborationAuthorizationService { collaboration.authorization ); - if (roleSet && spaceSettings) { + // Collaboration templates don't have timeline so this won't be executed for them + if (roleSet && spaceSettings && collaboration.timeline) { const extendedAuthorizationContributors = await this.appendCredentialRulesForContributors( clonedAuthorization, diff --git a/src/domain/collaboration/collaboration/collaboration.service.ts b/src/domain/collaboration/collaboration/collaboration.service.ts index d19f67b470..15dcd0fb4c 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.ts @@ -95,12 +95,15 @@ export class CollaborationService { AuthorizationPolicyType.COLLABORATION ); collaboration.callouts = []; - collaboration.timeline = this.timelineService.createTimeline(); collaboration.groupsStr = this.calloutGroupsService.serializeGroups( collaborationData.calloutGroups ); collaboration.isTemplate = collaborationData.isTemplate || false; + if (!collaboration.isTemplate) { + collaboration.timeline = this.timelineService.createTimeline(); + } + collaboration.tagsetTemplateSet = this.tagsetTemplateSetService.createTagsetTemplateSet(); @@ -153,7 +156,7 @@ export class CollaborationService { storageAggregator ); - this.moveCalloutsToCorrectGroupAndState( + this.moveCalloutsToDefaultGroupAndState( groupTagsetTemplateInput.allowedValues, statesTagsetTemplate.allowedValues, collaboration.callouts @@ -224,6 +227,7 @@ export class CollaborationService { calloutNameIds.push(calloutDefault.nameID); } if ( + calloutDefault.isTemplate === false && calloutDefault.type === CalloutType.POST && calloutDefault.contributionPolicy?.state === CalloutState.OPEN ) { @@ -235,8 +239,6 @@ export class CollaborationService { storageAggregator, userID ); - // default callouts are already published - callout.visibility = CalloutVisibility.PUBLISHED; callouts.push(callout); } return callouts; @@ -788,7 +790,7 @@ export class CollaborationService { * Move callouts that are not in valid groups or flowStates to the default group & first flowState * @param callouts */ - public moveCalloutsToCorrectGroupAndState( + public moveCalloutsToDefaultGroupAndState( validGroupNames: string[], validFlowStateNames: string[], callouts: { diff --git a/src/domain/space/space.defaults/space.defaults.service.ts b/src/domain/space/space.defaults/space.defaults.service.ts index 7003e0fa93..c10d7d7b27 100644 --- a/src/domain/space/space.defaults/space.defaults.service.ts +++ b/src/domain/space/space.defaults/space.defaults.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@nestjs/common'; +import { Inject, Injectable, LoggerService } from '@nestjs/common'; import { LogContext } from '@common/enums/logging.context'; import { ISpaceSettings } from '../space.settings/space.settings.interface'; import { subspaceCommunityRoles } from './definitions/subspace.community.roles'; @@ -26,6 +26,7 @@ import { TemplateDefaultType } from '@common/enums/template.default.type'; import { ValidationException } from '@common/exceptions'; import { CollaborationService } from '@domain/collaboration/collaboration/collaboration.service'; import { ITemplatesManager } from '@domain/template/templates-manager'; +import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; @Injectable() export class SpaceDefaultsService { @@ -34,7 +35,8 @@ export class SpaceDefaultsService { private inputCreatorService: InputCreatorService, private platformService: PlatformService, private collaborationService: CollaborationService, - private templatesManagerService: TemplatesManagerService + private templatesManagerService: TemplatesManagerService, + @Inject(WINSTON_MODULE_NEST_PROVIDER) private readonly logger: LoggerService ) {} public async createCollaborationInput( @@ -61,6 +63,11 @@ export class SpaceDefaultsService { } } catch (e) { // Space does not have a subspace default template, just use the platform default + this.logger.warn( + `Space does not have a subspace default template, using platform default parentSpaceTemplatesManager.id: ${parentSpaceTemplatesManager?.id}`, + undefined, + LogContext.TEMPLATES + ); } } // Get the platform default template if no parent template @@ -171,7 +178,7 @@ export class SpaceDefaultsService { state => state.displayName ); - this.collaborationService.moveCalloutsToCorrectGroupAndState( + this.collaborationService.moveCalloutsToDefaultGroupAndState( validGroupNames ?? [], validFlowStateNames ?? [], collaborationData.calloutsData ?? [] diff --git a/src/domain/template/template-applier/template.applier.service.ts b/src/domain/template/template-applier/template.applier.service.ts index 4030300103..2aa9294522 100644 --- a/src/domain/template/template-applier/template.applier.service.ts +++ b/src/domain/template/template-applier/template.applier.service.ts @@ -13,6 +13,7 @@ import { AuthorizationPolicyService } from '@domain/common/authorization-policy/ import { IAuthorizationPolicy } from '@domain/common/authorization-policy'; import { NamingService } from '@services/infrastructure/naming/naming.service'; import { TagsetReservedName } from '@common/enums/tagset.reserved.name'; +import { ICallout } from '@domain/collaboration/callout'; @Injectable() export class TemplateApplierService { @@ -76,46 +77,68 @@ export class TemplateApplierService { userID ); targetCollaboration.callouts?.push(...newCallouts); - - const validGroupNames = - targetCollaboration.tagsetTemplateSet?.tagsetTemplates.find( - tagset => tagset.name === TagsetReservedName.CALLOUT_GROUP - )?.allowedValues; - const validFlowStates = this.innovationFlowService - .getStates(targetCollaboration.innovationFlow) - ?.map(state => state.displayName); - - this.collaborationService.moveCalloutsToCorrectGroupAndState( - validGroupNames ?? [], - validFlowStates ?? [], - targetCollaboration.callouts - ); - - const authorizations: IAuthorizationPolicy[] = []; - - const { roleSet: communityPolicy, spaceSettings } = - await this.namingService.getRoleSetAndSettingsForCollaboration( - targetCollaboration.id - ); + this.ensureCalloutsInValidGroupsAndStates(targetCollaboration); // Need to save before applying authorization policy to get the callout ids const result = await this.collaborationService.save(targetCollaboration); - for (const callout of newCallouts) { - const calloutAuthorizations = - await this.calloutAuthorizationService.applyAuthorizationPolicy( - callout.id, - targetCollaboration.authorization, - communityPolicy, - spaceSettings - ); - authorizations.push(...calloutAuthorizations); - } - await this.authorizationPolicyService.saveAll(authorizations); + await this.applyAuthorizationPolicyToNewCallouts( + targetCollaboration, + newCallouts + ); return result; } else { + this.ensureCalloutsInValidGroupsAndStates(targetCollaboration); return await this.collaborationService.save(targetCollaboration); } } + private ensureCalloutsInValidGroupsAndStates( + targetCollaboration: ICollaboration + ) { + // We don't have callouts or we don't have innovationFlow, can't do anything + if (!targetCollaboration.innovationFlow || !targetCollaboration.callouts) { + throw new RelationshipNotFoundException( + `Unable to load Callouts or InnovationFlow ${targetCollaboration.id} `, + LogContext.TEMPLATES + ); + } + + const validGroupNames = + targetCollaboration.tagsetTemplateSet?.tagsetTemplates.find( + tagset => tagset.name === TagsetReservedName.CALLOUT_GROUP + )?.allowedValues; + const validFlowStates = this.innovationFlowService + .getStates(targetCollaboration.innovationFlow) + ?.map(state => state.displayName); + + this.collaborationService.moveCalloutsToDefaultGroupAndState( + validGroupNames ?? [], + validFlowStates ?? [], + targetCollaboration.callouts + ); + } + private async applyAuthorizationPolicyToNewCallouts( + targetCollaboration: ICollaboration, + newCallouts: ICallout[] + ): Promise { + const authorizations: IAuthorizationPolicy[] = []; + + const { roleSet: communityPolicy, spaceSettings } = + await this.namingService.getRoleSetAndSettingsForCollaboration( + targetCollaboration.id + ); + + for (const callout of newCallouts) { + const calloutAuthorizations = + await this.calloutAuthorizationService.applyAuthorizationPolicy( + callout.id, + targetCollaboration.authorization, + communityPolicy, + spaceSettings + ); + authorizations.push(...calloutAuthorizations); + } + return await this.authorizationPolicyService.saveAll(authorizations); + } } From 3731456ef0d566f04b43ca0e082658b74d1e8bfc Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Tue, 5 Nov 2024 18:53:27 +0200 Subject: [PATCH 19/42] Minor version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f6cfb36727..8817eb5184 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "alkemio-server", - "version": "0.95.1", + "version": "0.95.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "alkemio-server", - "version": "0.95.1", + "version": "0.95.2", "license": "EUPL-1.2", "dependencies": { "@alkemio/matrix-adapter-lib": "^0.4.1", diff --git a/package.json b/package.json index 86e0c4df25..f810c42b79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alkemio-server", - "version": "0.95.1", + "version": "0.95.2", "description": "Alkemio server, responsible for managing the shared Alkemio platform", "author": "Alkemio Foundation", "private": false, From 79375aef1594c88739d8d534ca4058c0c29cdc85 Mon Sep 17 00:00:00 2001 From: Neil Smyth <30729240+techsmyth@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:00:25 +0100 Subject: [PATCH 20/42] fixed guard usage in XState machines; removed APPLICATION_ACCEPT which is equivalent to GRANT (#4675) Co-authored-by: Valentin Yanakiev --- src/common/enums/authorization.privilege.ts | 1 - .../application.service.authorization.ts | 23 +------------------ .../application.service.lifecycle.ts | 10 ++++---- .../invitation.service.lifecycle.ts | 10 ++++---- .../role-set/role.set.resolver.mutations.ts | 4 ++-- .../role.set.service.lifecycle.application.ts | 5 ++-- ...nization.verification.service.lifecycle.ts | 10 ++++---- 7 files changed, 21 insertions(+), 42 deletions(-) diff --git a/src/common/enums/authorization.privilege.ts b/src/common/enums/authorization.privilege.ts index 9a97b27fa5..a48180b0e1 100644 --- a/src/common/enums/authorization.privilege.ts +++ b/src/common/enums/authorization.privilege.ts @@ -30,7 +30,6 @@ export enum AuthorizationPrivilege { UPDATE_INNOVATION_FLOW = 'update-innovation-flow', COMMUNITY_JOIN = 'community-join', COMMUNITY_APPLY = 'community-apply', - COMMUNITY_APPLY_ACCEPT = 'community-apply-accept', COMMUNITY_INVITE = 'community-invite', COMMUNITY_INVITE_ACCEPT = 'community-invite-accept', COMMUNITY_ADD_MEMBER = 'community-add-member', // only for global admins diff --git a/src/domain/access/application/application.service.authorization.ts b/src/domain/access/application/application.service.authorization.ts index 5f062aefc9..bf85939470 100644 --- a/src/domain/access/application/application.service.authorization.ts +++ b/src/domain/access/application/application.service.authorization.ts @@ -6,9 +6,6 @@ import { IAuthorizationPolicy } from '@domain/common/authorization-policy/author import { IApplication } from './application.interface'; import { IAuthorizationPolicyRuleCredential } from '@core/authorization/authorization.policy.rule.credential.interface'; import { CREDENTIAL_RULE_COMMUNITY_USER_APPLICATION } from '@common/constants/authorization/credential.rule.constants'; -import { AuthorizationPolicyRulePrivilege } from '@core/authorization/authorization.policy.rule.privilege'; -import { POLICY_RULE_COMMUNITY_APPROVE_APPLICATION } from '@common/constants'; - @Injectable() export class ApplicationAuthorizationService { constructor( @@ -26,10 +23,6 @@ export class ApplicationAuthorizationService { parentAuthorization ); - application.authorization = this.appendPrivilegeRules( - application.authorization - ); - application.authorization = await this.extendAuthorizationPolicy(application); @@ -45,6 +38,7 @@ export class ApplicationAuthorizationService { const user = await this.applicationService.getContributor(application.id); // also grant the user privileges to manage their own application + // Note: the GRANT privilege iS NOT assigned to the user; that is what is actually used to approve the application const userApplicationRule = this.authorizationPolicyService.createCredentialRule( [ @@ -67,19 +61,4 @@ export class ApplicationAuthorizationService { newRules ); } - - private appendPrivilegeRules( - authorization: IAuthorizationPolicy - ): IAuthorizationPolicy { - const approveApplicationPrivilege = new AuthorizationPolicyRulePrivilege( - [AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT], - AuthorizationPrivilege.GRANT, - POLICY_RULE_COMMUNITY_APPROVE_APPLICATION - ); - - return this.authorizationPolicyService.appendPrivilegeAuthorizationRules( - authorization, - [approveApplicationPrivilege] - ); - } } diff --git a/src/domain/access/application/application.service.lifecycle.ts b/src/domain/access/application/application.service.lifecycle.ts index e27f5f0644..7d02fdaf54 100644 --- a/src/domain/access/application/application.service.lifecycle.ts +++ b/src/domain/access/application/application.service.lifecycle.ts @@ -60,11 +60,11 @@ export const applicationLifecycleMachine: ILifecycleDefinition = { new: { on: { APPROVE: { - guards: 'hasApplicationAcceptPrivilege', + guard: 'hasGrantPrivilege', target: ApplicationLifecycleState.APPROVING, }, REJECT: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: ApplicationLifecycleState.REJECTED, }, }, @@ -72,7 +72,7 @@ export const applicationLifecycleMachine: ILifecycleDefinition = { approving: { on: { APPROVED: { - guards: 'hasApplicationAcceptPrivilege', + guard: 'hasGrantPrivilege', target: ApplicationLifecycleState.APPROVED, }, }, @@ -83,11 +83,11 @@ export const applicationLifecycleMachine: ILifecycleDefinition = { rejected: { on: { REOPEN: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: ApplicationLifecycleState.NEW, }, ARCHIVE: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: ApplicationLifecycleState.ARCHIVED, }, }, diff --git a/src/domain/access/invitation/invitation.service.lifecycle.ts b/src/domain/access/invitation/invitation.service.lifecycle.ts index 6f67f7d7b1..92d0db07e7 100644 --- a/src/domain/access/invitation/invitation.service.lifecycle.ts +++ b/src/domain/access/invitation/invitation.service.lifecycle.ts @@ -61,11 +61,11 @@ export const invitationLifecycleMachine: ILifecycleDefinition = { invited: { on: { ACCEPT: { - guards: 'hasInvitationAcceptPrivilege', + guard: 'hasInvitationAcceptPrivilege', target: InvitationLifecycleState.ACCEPTING, }, REJECT: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: InvitationLifecycleState.REJECTED, }, }, @@ -73,7 +73,7 @@ export const invitationLifecycleMachine: ILifecycleDefinition = { accepting: { on: { ACCEPTED: { - guards: 'hasInvitationAcceptPrivilege', + guard: 'hasInvitationAcceptPrivilege', target: InvitationLifecycleState.ACCEPTED, }, }, @@ -84,11 +84,11 @@ export const invitationLifecycleMachine: ILifecycleDefinition = { rejected: { on: { REINVITE: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: InvitationLifecycleState.INVITED, }, ARCHIVE: { - guards: 'hasUpdatePrivilege', + guard: 'hasUpdatePrivilege', target: InvitationLifecycleState.ARCHIVED, }, }, diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index b1627bba01..5f1726b654 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -693,11 +693,11 @@ export class RoleSetResolverMutations { eventData.applicationID ); - //toDo fix this temporary fix. Patches the immediate issue but doesn't solve the design issue of guards not being triggered on transitions + // Assumption is that the user with the GRANT also has UPDATE this.authorizationService.grantAccessOrFail( agentInfo, application.authorization, - AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT, + AuthorizationPrivilege.UPDATE, `event on application: ${application.id}` ); diff --git a/src/domain/access/role-set/role.set.service.lifecycle.application.ts b/src/domain/access/role-set/role.set.service.lifecycle.application.ts index ac00819474..a687c4c5c0 100644 --- a/src/domain/access/role-set/role.set.service.lifecycle.application.ts +++ b/src/domain/access/role-set/role.set.service.lifecycle.application.ts @@ -24,6 +24,7 @@ export class RoleSetServiceLifecycleApplication { private getMachine(): AnyStateMachine { const machine = setup({ guards: { + // UPDATE privilege is used to manage lifecycle transitions, EXCEPT those related to approving which require GRANT hasUpdatePrivilege: ({ event }) => { const agentInfo: AgentInfo = event.agentInfo; const authorizationPolicy: IAuthorizationPolicy = event.authorization; @@ -33,13 +34,13 @@ export class RoleSetServiceLifecycleApplication { AuthorizationPrivilege.UPDATE ); }, - hasApplicationAcceptPrivilege: ({ event }) => { + hasGrantPrivilege: ({ event }) => { const agentInfo: AgentInfo = event.agentInfo; const authorizationPolicy: IAuthorizationPolicy = event.authorization; return this.authorizationService.isAccessGranted( agentInfo, authorizationPolicy, - AuthorizationPrivilege.COMMUNITY_APPLY_ACCEPT + AuthorizationPrivilege.GRANT ); }, }, diff --git a/src/domain/community/organization-verification/organization.verification.service.lifecycle.ts b/src/domain/community/organization-verification/organization.verification.service.lifecycle.ts index 4b71d3a107..4cdfc590f5 100644 --- a/src/domain/community/organization-verification/organization.verification.service.lifecycle.ts +++ b/src/domain/community/organization-verification/organization.verification.service.lifecycle.ts @@ -84,7 +84,7 @@ export class OrganizationVerificationLifecycleService { VERIFICATION_REQUEST: { target: OrganizationVerificationLifecycleState.VERIFICATION_PENDING, - guards: { + guard: { type: 'hasUpdatePrivilege', }, }, @@ -94,7 +94,7 @@ export class OrganizationVerificationLifecycleService { on: { MANUALLY_VERIFY: { target: OrganizationVerificationLifecycleState.MANUALLY_VERIFIED, - guards: 'hasGrantPrivilege', + guard: 'hasGrantPrivilege', }, REJECT: OrganizationVerificationLifecycleState.REJECTED, }, @@ -104,7 +104,7 @@ export class OrganizationVerificationLifecycleService { on: { RESET: { target: OrganizationVerificationLifecycleState.NOT_VERIFIED, - guards: 'hasGrantPrivilege', + guard: 'hasGrantPrivilege', }, }, }, @@ -112,11 +112,11 @@ export class OrganizationVerificationLifecycleService { on: { REOPEN: { target: OrganizationVerificationLifecycleState.NOT_VERIFIED, - guards: 'hasGrantPrivilege', + guard: 'hasGrantPrivilege', }, ARCHIVE: { target: OrganizationVerificationLifecycleState.ARCHIVED, - guards: 'hasGrantPrivilege', + guard: 'hasGrantPrivilege', }, }, }, From 59aca6334fd606301456902b412b52b95aafda09 Mon Sep 17 00:00:00 2001 From: Neil Smyth Date: Wed, 6 Nov 2024 11:35:08 +0100 Subject: [PATCH 21/42] fix wrong logic --- src/domain/access/role-set/role.set.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/access/role-set/role.set.service.ts b/src/domain/access/role-set/role.set.service.ts index 3776600536..ee1452a120 100644 --- a/src/domain/access/role-set/role.set.service.ts +++ b/src/domain/access/role-set/role.set.service.ts @@ -757,7 +757,7 @@ export class RoleSetService { if (!hasAnotherAdminRole) { await this.removeContributorFromImplicitRole( - roleSet, + parentRoleSet, agent, CommunityRoleImplicit.SUBSPACE_ADMIN ); From abee5a5622d76e68c73174c5d1b8e4eb839e3db5 Mon Sep 17 00:00:00 2001 From: Neil Smyth <30729240+techsmyth@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:04:54 +0100 Subject: [PATCH 22/42] robustness around the accepting of invitations (#4680) Co-authored-by: Valentin Yanakiev --- .../access/role-set/role.set.service.ts | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/domain/access/role-set/role.set.service.ts b/src/domain/access/role-set/role.set.service.ts index ee1452a120..0a0610e532 100644 --- a/src/domain/access/role-set/role.set.service.ts +++ b/src/domain/access/role-set/role.set.service.ts @@ -560,14 +560,23 @@ export class RoleSetService { LogContext.COMMUNITY ); } - await this.assignContributorToRole( - roleSet.parentRoleSet, - CommunityRoleType.MEMBER, - contributorID, - invitation.contributorType, - agentInfo, - true + // Check if the user is already a member of the parent roleSet + const { agent } = + await this.contributorService.getContributorAndAgent(contributorID); + const isMemberOfParentRoleSet = await this.isMember( + agent, + roleSet.parentRoleSet ); + if (!isMemberOfParentRoleSet) { + await this.assignContributorToRole( + roleSet.parentRoleSet, + CommunityRoleType.MEMBER, + contributorID, + invitation.contributorType, + agentInfo, + true + ); + } } await this.assignContributorToRole( roleSet, @@ -578,14 +587,22 @@ export class RoleSetService { true ); if (invitation.extraRole) { - await this.assignContributorToRole( - roleSet, - invitation.extraRole, - contributorID, - invitation.contributorType, - agentInfo, - false - ); + try { + await this.assignContributorToRole( + roleSet, + invitation.extraRole, + contributorID, + invitation.contributorType, + agentInfo, + false + ); + } catch (e: any) { + // Do not throw an exception further as there might not be entitlements to grant the extra role + this.logger.warn?.( + `Unable to add contributor (${contributorID}) to extra role (${invitation.extraRole}) in community: ${e}`, + LogContext.COMMUNITY + ); + } } } catch (e: any) { this.logger.error?.( From a8e2e11f9536709ed81127abe03d145a1e564bb6 Mon Sep 17 00:00:00 2001 From: Neil Smyth <30729240+techsmyth@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:12:47 +0100 Subject: [PATCH 23/42] Authorization related fixes (#4678) * made bootstrap pick up admin role directly, not store on service; ensure 3 singlton entities have authorization policy type set * fixed issues with authorization reset controller; moved user auth reset to be via ID to make clear it is reloaded * fixed typos * fixed admin account not having auth policy properly set --------- Co-authored-by: Valentin Yanakiev --- src/common/enums/authorization.policy.type.ts | 3 + src/core/bootstrap/bootstrap.service.ts | 56 +++++++++++-------- .../role-set/role.set.resolver.mutations.ts | 4 +- .../community/user/user.resolver.mutations.ts | 2 +- .../user/user.service.authorization.ts | 18 +++--- .../1730877510629-authorizationPolicy.ts | 45 +++++++++++++++ .../registration.resolver.mutations.ts | 6 +- .../subscriber/auth-reset.controller.ts | 17 ++++-- test/mocks/user.authorization.service.mock.ts | 2 +- 9 files changed, 109 insertions(+), 44 deletions(-) create mode 100644 src/migrations/1730877510629-authorizationPolicy.ts diff --git a/src/common/enums/authorization.policy.type.ts b/src/common/enums/authorization.policy.type.ts index 8e511bbce9..7d3f2e2021 100644 --- a/src/common/enums/authorization.policy.type.ts +++ b/src/common/enums/authorization.policy.type.ts @@ -21,6 +21,7 @@ export enum AuthorizationPolicyType { COMMUNICATION = 'communication', ROOM = 'room', AI_PERSONA = 'ai-persona', + AI_SERVER = 'ai-server', APPLICATION = 'application', ROLE_SET = 'role-set', COMMUNITY = 'community', @@ -50,8 +51,10 @@ export enum AuthorizationPolicyType { CALENDAR = 'calendar', CALENDAR_EVENT = 'calendar-event', TIMELINE = 'timeline', + LIBRARY = 'library', IN_MEMORY = 'in-memory', LICENSING = 'licensing', + LICENSE_POLICY = 'license-policy', UNKNOWN = 'unknown', AI_PERSONA_SERVICE = 'ai-persona-service', } diff --git a/src/core/bootstrap/bootstrap.service.ts b/src/core/bootstrap/bootstrap.service.ts index c426fd1338..25a0e3616e 100644 --- a/src/core/bootstrap/bootstrap.service.ts +++ b/src/core/bootstrap/bootstrap.service.ts @@ -58,8 +58,6 @@ import { bootstrapSpaceTutorialsCallouts } from './platform-template-definitions @Injectable() export class BootstrapService { - private adminAgentInfo?: AgentInfo; - constructor( private accountService: AccountService, private accountAuthorizationService: AccountAuthorizationService, @@ -296,7 +294,7 @@ export class BootstrapService { userData.email ); if (!userExists) { - let user = await this.userService.createUser({ + const user = await this.userService.createUser({ email: userData.email, accountUpn: userData.email, firstName: userData.firstName, @@ -306,19 +304,11 @@ export class BootstrapService { }, }); - const credentialsData = userData.credentials; - for (const credentialData of credentialsData) { - await this.adminAuthorizationService.grantCredentialToUser({ - userID: user.id, - type: credentialData.type, - resourceID: credentialData.resourceID, - }); - } - user = await this.userAuthorizationService.grantCredentials(user); - // Once all is done, reset the user authorizations const userAuthorizations = - await this.userAuthorizationService.applyAuthorizationPolicy(user); + await this.userAuthorizationService.applyAuthorizationPolicy( + user.id + ); await this.authorizationPolicyService.saveAll(userAuthorizations); const account = await this.userService.getAccount(user); @@ -327,16 +317,18 @@ export class BootstrapService { account ); await this.authorizationPolicyService.saveAll(accountAuthorizations); - if (!this.adminAgentInfo) { - this.adminAgentInfo = await this.createSystemAgentInfo(user); - } - } else { - if (!this.adminAgentInfo) { - const user = await this.userService.getUserByEmail(userData.email); - if (user) { - this.adminAgentInfo = await this.createSystemAgentInfo(user); - } + + const credentialsData = userData.credentials; + for (const credentialData of credentialsData) { + await this.adminAuthorizationService.grantCredentialToUser({ + userID: user.id, + type: credentialData.type, + resourceID: credentialData.resourceID, + }); } + await this.userAuthorizationService.grantCredentialsAllUsersReceive( + user.id + ); } } } catch (error: any) { @@ -432,6 +424,7 @@ export class BootstrapService { DEFAULT_HOST_ORG_NAMEID ); if (!hostOrganization) { + const adminAgentInfo = await this.getAdminAgentInfo(); hostOrganization = await this.organizationService.createOrganization( { nameID: DEFAULT_HOST_ORG_NAMEID, @@ -439,7 +432,7 @@ export class BootstrapService { displayName: DEFAULT_HOST_ORG_DISPLAY_NAME, }, }, - this.adminAgentInfo + adminAgentInfo ); const orgAuthorizations = await this.organizationAuthorizationService.applyAuthorizationPolicy( @@ -457,6 +450,21 @@ export class BootstrapService { } } + private async getAdminAgentInfo(): Promise { + const adminUserEmail = 'admin@alkem.io'; + const adminUser = await this.userService.getUserByEmail(adminUserEmail, { + relations: { + agent: true, + }, + }); + if (!adminUser) { + throw new BootstrapException( + `Unable to load fixed admin user for creating organization: ${adminUserEmail}` + ); + } + return this.createSystemAgentInfo(adminUser); + } + private async ensureSpaceSingleton() { this.logger.verbose?.( '=== Ensuring at least one Account with a space is present ===', diff --git a/src/domain/access/role-set/role.set.resolver.mutations.ts b/src/domain/access/role-set/role.set.resolver.mutations.ts index 5f1726b654..cdb900bd62 100644 --- a/src/domain/access/role-set/role.set.resolver.mutations.ts +++ b/src/domain/access/role-set/role.set.resolver.mutations.ts @@ -125,7 +125,7 @@ export class RoleSetResolverMutations { // reset the user authorization policy so that their profile is visible to other community members const user = await this.userService.getUserOrFail(roleData.contributorID); const authorizations = - await this.userAuthorizationService.applyAuthorizationPolicy(user); + await this.userAuthorizationService.applyAuthorizationPolicy(user.id); await this.authorizationPolicyService.saveAll(authorizations); return await this.userService.getUserOrFail(roleData.contributorID); } @@ -249,7 +249,7 @@ export class RoleSetResolverMutations { // to other community members const user = await this.userService.getUserOrFail(roleData.contributorID); const authorizations = - await this.userAuthorizationService.applyAuthorizationPolicy(user); + await this.userAuthorizationService.applyAuthorizationPolicy(user.id); await this.authorizationPolicyService.saveAll(authorizations); return await this.userService.getUserOrFail(roleData.contributorID); } diff --git a/src/domain/community/user/user.resolver.mutations.ts b/src/domain/community/user/user.resolver.mutations.ts index 2c8961a727..7d174f4d98 100644 --- a/src/domain/community/user/user.resolver.mutations.ts +++ b/src/domain/community/user/user.resolver.mutations.ts @@ -129,7 +129,7 @@ export class UserResolverMutations { `reset authorization definition on user: ${authorizationResetData.userID}` ); const updatedAuthorizations = - await this.userAuthorizationService.applyAuthorizationPolicy(user); + await this.userAuthorizationService.applyAuthorizationPolicy(user.id); await this.authorizationPolicyService.saveAll(updatedAuthorizations); return await this.userService.getUserOrFail(user.id); diff --git a/src/domain/community/user/user.service.authorization.ts b/src/domain/community/user/user.service.authorization.ts index f54435dd50..e8e730a579 100644 --- a/src/domain/community/user/user.service.authorization.ts +++ b/src/domain/community/user/user.service.authorization.ts @@ -45,9 +45,9 @@ export class UserAuthorizationService { ) {} async applyAuthorizationPolicy( - userInput: IUser + userID: string ): Promise { - const user = await this.userService.getUserOrFail(userInput.id, { + const user = await this.userService.getUserOrFail(userID, { loadEagerRelations: false, relations: { authorization: true, @@ -169,20 +169,20 @@ export class UserAuthorizationService { return updatedAuthorizations; } - async grantCredentials(user: IUser): Promise { - const agent = await this.userService.getAgent(user.id); + async grantCredentialsAllUsersReceive(userID: string): Promise { + const agent = await this.userService.getAgent(userID); - user.agent = await this.agentService.grantCredential({ + await this.agentService.grantCredential({ type: AuthorizationCredential.GLOBAL_REGISTERED, agentID: agent.id, }); - user.agent = await this.agentService.grantCredential({ + await this.agentService.grantCredential({ type: AuthorizationCredential.USER_SELF_MANAGEMENT, agentID: agent.id, - resourceID: user.id, + resourceID: userID, }); - user.agent = await this.agentService.saveAgent(user.agent); - return user; + + return await this.userService.getUserOrFail(userID); } private appendGlobalCredentialRules( diff --git a/src/migrations/1730877510629-authorizationPolicy.ts b/src/migrations/1730877510629-authorizationPolicy.ts new file mode 100644 index 0000000000..de6d28c718 --- /dev/null +++ b/src/migrations/1730877510629-authorizationPolicy.ts @@ -0,0 +1,45 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AuthorizationPolicy1730877510629 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + // Get the authorization ID on the ai_server table + await this.updateAuthorizationPolicyTypeOnSingleton( + queryRunner, + 'ai_server', + 'ai-server' + ); + await this.updateAuthorizationPolicyTypeOnSingleton( + queryRunner, + 'license_policy', + 'license-policy' + ); + await this.updateAuthorizationPolicyTypeOnSingleton( + queryRunner, + 'library', + 'library' + ); + } + + public async down(queryRunner: QueryRunner): Promise {} + + private async updateAuthorizationPolicyTypeOnSingleton( + queryRunner: QueryRunner, + tableName: string, + type: string + ) { + const entities: { + id: string; + authorizationId: string; + }[] = await queryRunner.query( + `SELECT id, authorizationId FROM ${tableName}` + ); + if (entities.length !== 1) { + throw new Error(`Expected exactly one ${tableName} record`); + } + const entity = entities[0]; + // update the authorization policy to include the new type + await queryRunner.query( + `UPDATE authorization_policy SET type = '${type}' WHERE id = '${entity.authorizationId}'` + ); + } +} diff --git a/src/services/api/registration/registration.resolver.mutations.ts b/src/services/api/registration/registration.resolver.mutations.ts index 82d3cf5378..50b05c6f99 100644 --- a/src/services/api/registration/registration.resolver.mutations.ts +++ b/src/services/api/registration/registration.resolver.mutations.ts @@ -78,10 +78,12 @@ export class RegistrationResolverMutations { agentInfo: AgentInfo ): Promise { const user = - await this.userAuthorizationService.grantCredentials(userInput); + await this.userAuthorizationService.grantCredentialsAllUsersReceive( + userInput.id + ); const userAuthorizations = - await this.userAuthorizationService.applyAuthorizationPolicy(user); + await this.userAuthorizationService.applyAuthorizationPolicy(user.id); await this.authorizationPolicyService.saveAll(userAuthorizations); const userAccount = await this.userService.getAccount(user); diff --git a/src/services/auth-reset/subscriber/auth-reset.controller.ts b/src/services/auth-reset/subscriber/auth-reset.controller.ts index fa4085429b..69dc9b8ef6 100644 --- a/src/services/auth-reset/subscriber/auth-reset.controller.ts +++ b/src/services/auth-reset/subscriber/auth-reset.controller.ts @@ -100,7 +100,9 @@ export class AuthResetController { const retryCount = originalMsg.properties.headers?.[RETRY_HEADER] ?? 0; try { - await this.platformAuthorizationService.applyAuthorizationPolicy(); + const authorizations = + await this.platformAuthorizationService.applyAuthorizationPolicy(); + await this.authorizationPolicyService.saveAll(authorizations); this.logger.verbose?.( 'Finished resetting authorization for platform.', LogContext.AUTH_POLICY @@ -146,7 +148,10 @@ export class AuthResetController { try { const user = await this.userService.getUserOrFail(payload.id); - await this.userAuthorizationService.applyAuthorizationPolicy(user); + const authorizations = + await this.userAuthorizationService.applyAuthorizationPolicy(user.id); + await this.authorizationPolicyService.saveAll(authorizations); + channel.ack(originalMsg); const message = `Finished resetting authorization for user with id ${payload.id}.`; @@ -195,9 +200,11 @@ export class AuthResetController { const organization = await this.organizationService.getOrganizationOrFail( payload.id ); - await this.organizationAuthorizationService.applyAuthorizationPolicy( - organization - ); + const authorizations = + await this.organizationAuthorizationService.applyAuthorizationPolicy( + organization + ); + await this.authorizationPolicyService.saveAll(authorizations); channel.ack(originalMsg); const message = `Finished resetting authorization for organization with id ${payload.id}.`; diff --git a/test/mocks/user.authorization.service.mock.ts b/test/mocks/user.authorization.service.mock.ts index 0426a8aca2..5a9a1caa3f 100644 --- a/test/mocks/user.authorization.service.mock.ts +++ b/test/mocks/user.authorization.service.mock.ts @@ -7,7 +7,7 @@ export const MockUserAuthorizationService: ValueProvider< > = { provide: UserAuthorizationService, useValue: { - grantCredentials: jest.fn(), + grantCredentialsAllUsersReceive: jest.fn(), applyAuthorizationPolicy: jest.fn(), }, }; From 11a537c1739435d34ff453b0020a3798376b4ab3 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Wed, 6 Nov 2024 18:21:34 +0200 Subject: [PATCH 24/42] Initial data setup --- src/migrations/1730713372181-schemaSetup.ts | 7 +- src/migrations/1730906666882-initialData.ts | 125 ++++++++++++++++++++ 2 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 src/migrations/1730906666882-initialData.ts diff --git a/src/migrations/1730713372181-schemaSetup.ts b/src/migrations/1730713372181-schemaSetup.ts index 34095a8d6e..de845cc270 100644 --- a/src/migrations/1730713372181-schemaSetup.ts +++ b/src/migrations/1730713372181-schemaSetup.ts @@ -257,15 +257,10 @@ export class SchemaSetup1730713372181 implements MigrationInterface { await queryRunner.query( 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_b80c28f5335ab5442f63c644d94` FOREIGN KEY (`parentStorageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' ); - await queryRunner.query( - 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_0647707288c243e60091c8d8620` FOREIGN KEY (`directStorageId`) REFERENCES `storage_bucket`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); + await queryRunner.query( 'ALTER TABLE `storage_bucket` ADD CONSTRAINT `FK_f2f48b57269987b13b415a00587` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' ); - await queryRunner.query( - 'ALTER TABLE `storage_bucket` ADD CONSTRAINT `FK_11d0ed50a26da5513f7e4347847` FOREIGN KEY (`storageAggregatorId`) REFERENCES `storage_aggregator`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' - ); await queryRunner.query( 'ALTER TABLE `profile` ADD CONSTRAINT `FK_a96475631aba7dce41db03cc8b2` FOREIGN KEY (`authorizationId`) REFERENCES `authorization_policy`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' ); diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts new file mode 100644 index 0000000000..99a117ee7d --- /dev/null +++ b/src/migrations/1730906666882-initialData.ts @@ -0,0 +1,125 @@ +import { randomUUID } from 'crypto'; +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { + allowedTypes, + maxAllowedFileSize, +} from './utils/storage/storage-bucket-utils'; + +export class InitialData1730906666882 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + // create library instance with authorization + const libraryAuthID = randomUUID(); + const libraryID = randomUUID(); + const libraryAuthPolicy = `[{"type":"global-admin","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true},{"type":"global-admin-hubs","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true}]`; + + await queryRunner.query( + `INSERT INTO authorization_policy VALUES ('${libraryAuthID}', NOW(), NOW(), 1, '${libraryAuthPolicy}', '', '', 0, 'library')` + ); + await queryRunner.query( + `INSERT INTO library (id, createdDate, updatedDate, version, authorizationId) VALUES ('${libraryID}', NOW(), NOW(), 1, '${libraryAuthID}')` + ); + + // create platform instance with authorization + const platformAuthID = randomUUID(); + const platformID = randomUUID(); + const platformStorageAggregatorID = + await this.createStorageAggregator(queryRunner); + + await queryRunner.query( + `INSERT INTO authorization_policy VALUES ('${platformAuthID}', NOW(), NOW(), 1, '', '', '', 0, 'platform')` + ); + await queryRunner.query( + `INSERT INTO platform (id, createdDate, updatedDate, version, authorizationId, libraryId, storageAggregatorId) VALUES ('${platformID}', NOW(), NOW(), 1, '${platformAuthID}', '${libraryID}', '${platformStorageAggregatorID}')` + ); + + await queryRunner.query( + `ALTER TABLE \`storage_bucket\` ADD CONSTRAINT \`FK_11d0ed50a26da5513f7e4347847\` FOREIGN KEY (\`storageAggregatorId\`) REFERENCES \`storage_aggregator\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + + await queryRunner.query( + 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_0647707288c243e60091c8d8620` FOREIGN KEY (`directStorageId`) REFERENCES `storage_bucket`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' + ); + + var preferenceDefinitionIds = [...Array(42)].map(id => randomUUID()); + + await queryRunner.query( + `INSERT INTO preference_definition (id, version, groupName, displayName, description, valueType, type, definitionSet) + VALUES + ('${preferenceDefinitionIds[0]}',1,'NotificationGlobalAdmin','[Admin] User profile deleted','Receive a notification when a user profile is removed','boolean','NotificationUserRemoved','user'), + ('${preferenceDefinitionIds[1]}',1,'Notification','Community Application','Receive notification when I apply to join a community','boolean','NotificationApplicationSubmitted','user'), + ('${preferenceDefinitionIds[2]}',1,'Notification','Community Updates','Receive notification when a new update is shared with a community I am a member of','boolean','NotificationCommunityUpdates','user'), + ('${preferenceDefinitionIds[3]}',1,'Notification','Community Discussion created','Receive notification when a new discussion is created on a community I am a member of','boolean','NotificationCommunityDiscussionCreated','user'), + ('${preferenceDefinitionIds[4]}',1,'NotificationForum','Receive a notification when a new comment is added to a Discussion I created in the Forum','Receive a notification when a new comment is added to a Discussion I created in the Forum','boolean','NotificationForumDiscussionComment','user'), + ('${preferenceDefinitionIds[5]}',1,'NotificationCommunityAdmin','[Admin] Community Applications','Receive notification when a new application is received for a community for which I am an administrator','boolean','NotificationApplicationReceived','user'), + ('${preferenceDefinitionIds[6]}',1,'NotificationGlobalAdmin','[Admin] New user sign up','Receive notification when a new user signs up','boolean','NotificationUserSignUp','user'), + ('${preferenceDefinitionIds[7]}',1,'NotificationCommunityAdmin','[Admin] Community Discussion Created','Receive notification when a new discussion is created for a community for which I am an administrator','boolean','NotificationCommunityDiscussionCreatedAdmin','user'), + ('${preferenceDefinitionIds[8]}',1,'NotificationCommunityAdmin','[Admin] Community Updates','Receive notification when a new update is shared with a community for which I am an administrator','boolean','NotificationCommunityUpdateSentAdmin','user'), + ('${preferenceDefinitionIds[9]}',1,'MembershipSpace','Applications allowed','Allow applications to this Space','boolean','MembershipApplicationsFromAnyone','space'), + ('${preferenceDefinitionIds[10]}',1,'MembershipSpace','Anyone can join','Allow any registered user to join this Space','boolean','MembershipJoinSpaceFromAnyone','space'), + ('${preferenceDefinitionIds[11]}',1,'MembershipSpace','Host Organization Join','Allow members of the host organization to join','boolean','MembershipJoinSpaceFromHostOrganizationMembers','space'), + ('${preferenceDefinitionIds[12]}',1,'Authorization','Anonymous read access','Allow non-members to read the contents of this Space','boolean','AuthorizationAnonymousReadAccess','space'), + ('${preferenceDefinitionIds[13]}',1,'AuthorizationOrganization','Domain based membership','Automatically add new users with emails matching the domain of the Organization','boolean','AuthorizationOrganizationMatchDomain','organization'), + ('${preferenceDefinitionIds[14]}',1,'Notification','Invitations to a community','Receive a notification when someone invites you to join a community','boolean','NotificationCommunityInvitationUser','user'), + ('${preferenceDefinitionIds[15]}',1,'NotificationCommunityAdmin','[Admin] Community review submitted','Receive notification when a new community review is submitted by a member','boolean','NotificationCommunityReviewSubmittedAdmin','user'), + ('${preferenceDefinitionIds[16]}',1,'NotificationCommunication','Mentions or tags of you in posts or comments','Receive a notification when a user tags you in a post or a comment','boolean','NotificationCommunicationMention','user'), + ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), + ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), + ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), + ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when an Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), + ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), + ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), + ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), + ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), + ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when an Post is created in community i am a member of','boolean','NotificationPostCreated','user'), + ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), + ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), + ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), + ('${preferenceDefinitionIds[29]}',1,'Privileges','Allow members to create Callouts.','Allow members to create Callouts.','boolean','AllowMembersToCreateCallouts','space'), + ('${preferenceDefinitionIds[30]}',1,'MembershipChallenge','Allow Space members to apply','Allow members of the parent Space to apply to this Challenge','boolean','MembershipApplyChallengeFromSpaceMembers','challenge'), + ('${preferenceDefinitionIds[31]}',1,'MembershipChallenge','Allow Space members to provide feedback on Context','Allow members of the parent Space to give feedback on the Challenge Context','boolean','MembershipFeedbackOnChallengeContext','challenge'), + ('${preferenceDefinitionIds[32]}',1,'Privileges','Allow Space members to create Challenges','Allow members of the Space to create Challenges.','boolean','AllowMembersToCreateChallenges','space'), + ('${preferenceDefinitionIds[33]}',1,'NotificationCommunication','Allow direct messages from other users','Receive a notification when a user wants to directly send you a message or shares with you','boolean','NotificationCommunicationMessage','user'), + ('${preferenceDefinitionIds[34]}',1,'Notification','Community review submitted','Receive notification when you submit a new community review','boolean','NotificationCommunityReviewSubmitted','user'), + ('${preferenceDefinitionIds[35]}',1,'Notification','Comment replies','Receive a notification when someone replies to your comment','boolean','NotificationCommentReply','user'), + ('${preferenceDefinitionIds[36]}',1,'Notification','New comment on Discssion','Receive a notification when a new comment is added to a Discussion in a community I am a member of','boolean','NotificationDiscussionCommentCreated','user'), + ('${preferenceDefinitionIds[37]}',1,'NotificationOrganizationAdmin','Mentions or tags of an organization you manage','Receive a notification when the organization you are admin of is mentioned','boolean','NotificationOrganizationMention','user'), + ('${preferenceDefinitionIds[38]}',1,'MembershipChallenge','Allow Space members to join','Allow members of the parent Space to join this Challenge','boolean','MembershipJoinChallengeFromSpaceMembers','challenge'), + ('${preferenceDefinitionIds[39]}',1,'Notification','Community new member','Receiver notification when I join a community','boolean','NotificationCommunityNewMember','user'), + ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), + ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` + ); + } + + public async down(queryRunner: QueryRunner): Promise {} + + private async createStorageAggregator( + queryRunner: QueryRunner + ): Promise { + const storageAggregatorID = randomUUID(); + const storageAggregatorAuthID = randomUUID(); + const directStorageID = randomUUID(); + const directStorageAuthID = randomUUID(); + + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) + VALUES ('${storageAggregatorAuthID}', 1, '', '', 0, '', 'storage-aggregator')` + ); + + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) + VALUES ('${directStorageAuthID}', 1, '', '', 0, '', 'storage-bucket')` + ); + + await queryRunner.query( + `INSERT INTO storage_aggregator (id, version, authorizationId, directStorageId) + VALUES ('${storageAggregatorID}', 1, '${storageAggregatorAuthID}', '${directStorageID}')` + ); + + await queryRunner.query( + `INSERT INTO storage_bucket (id, version, authorizationId, allowedMimeTypes, maxFileSize, storageAggregatorId) + VALUES ('${directStorageID}', '1', '${directStorageAuthID}', '${allowedTypes}', ${maxAllowedFileSize}, '${storageAggregatorID}')` + ); + + return storageAggregatorID; + } +} From c59801b83aa335a23ae9c14db820f087fd142b84 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Wed, 6 Nov 2024 18:35:20 +0200 Subject: [PATCH 25/42] Add ai server to migration --- src/migrations/1730906666882-initialData.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index 99a117ee7d..6a40dc30e8 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -88,6 +88,21 @@ export class InitialData1730906666882 implements MigrationInterface { ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` ); + + // Create the AI Server entity + const aiServerID = randomUUID(); + const aiServerAuthID = randomUUID(); + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES + ('${aiServerAuthID}', + 1, '', '', 0, '', 'ai-server')` + ); + await queryRunner.query( + `INSERT INTO ai_server (id, version, authorizationId) VALUES + ('${aiServerID}', + 1, + '${aiServerAuthID}')` + ); } public async down(queryRunner: QueryRunner): Promise {} From 2b8a26e271f859d992da04da04fca64a738ac695 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Wed, 6 Nov 2024 18:37:14 +0200 Subject: [PATCH 26/42] Grammar fix --- src/migrations/1730906666882-initialData.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index 6a40dc30e8..d78baad831 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -65,12 +65,12 @@ export class InitialData1730906666882 implements MigrationInterface { ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), - ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when an Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), + ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when a Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), - ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when an Post is created in community i am a member of','boolean','NotificationPostCreated','user'), + ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when a Post is created in community i am a member of','boolean','NotificationPostCreated','user'), ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), From 705c8f57c5ae20440981fb7f800d6e5d829ca4ae Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 14:13:22 +0200 Subject: [PATCH 27/42] Add licensing --- src/migrations/1730906666882-initialData.ts | 106 ++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index d78baad831..01d5c77b50 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -103,6 +103,45 @@ export class InitialData1730906666882 implements MigrationInterface { 1, '${aiServerAuthID}')` ); + + const licensePolicyID = randomUUID(); + const licensePolicyAuthID = randomUUID(); + + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES + ('${licensePolicyAuthID}', + 1, '', '', 0, '', 'license-policy')` + ); + await queryRunner.query( + `INSERT INTO license_policy (id, version, authorizationId, credentialRulesStr) VALUES + ('${licensePolicyID}', + 1, + '${licensePolicyAuthID}', + '${JSON.stringify(licenseCredentialRules)}' + )` + ); + + // // Create the agent on each account + const [platform]: { id: string; licensePolicyId: string }[] = + await queryRunner.query('SELECT id FROM platform LIMIT 1; '); + const licensingID = randomUUID(); + const licensingAuthID = randomUUID(); + + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES + ('${licensingAuthID}', + 1, '', '', 0, '', 'licensing')` + ); + await queryRunner.query( + `INSERT INTO licensing (id, version, authorizationId, licensePolicyId) VALUES + ('${licensingID}', + 1, + '${licensingAuthID}', + '${licensePolicyID}')` + ); + await queryRunner.query( + `UPDATE platform SET licensingId = '${licensingID}' WHERE id = '${platform.id}'` + ); } public async down(queryRunner: QueryRunner): Promise {} @@ -138,3 +177,70 @@ export class InitialData1730906666882 implements MigrationInterface { return storageAggregatorID; } } + +type CredentialRule = { + credentialType: LicenseCredential; + grantedPrivileges: LicensePrivilege[]; + name: string; +}; + +enum LicenseCredential { + FEATURE_VIRTUAL_CONTRIBUTORS = 'space-feature-virtual-contributors', + FEATURE_WHITEBOARD_MULTI_USER = 'space-feature-whiteboard-multi-user', + FEATURE_SAVE_AS_TEMPLATE = 'space-feature-save-as-template', + LICENSE_PLUS = 'space-license-plus', + LICENSE_PREMIUM = 'space-license-premium', + ACCOUNT_LICENSE_PLUS = 'account-license-plus', +} + +enum LicensePrivilege { + VIRTUAL_CONTRIBUTOR_ACCESS = 'space-virtual-contributor-access', + WHITEBOARD_MULTI_USER = 'space-whiteboard-multi-user', + SAVE_AS_TEMPLATE = 'space-save-as-template', + CREATE_SPACE = 'account-create-space', + CREATE_VIRTUAL_CONTRIBUTOR = 'account-create-virtual-contributor', + CREATE_INNOVATION_PACK = 'account-create-innovation-pack', +} + +const licenseCredentialRules: CredentialRule[] = [ + { + credentialType: LicenseCredential.FEATURE_VIRTUAL_CONTRIBUTORS, + grantedPrivileges: [LicensePrivilege.VIRTUAL_CONTRIBUTOR_ACCESS], + name: 'Space Virtual Contributors', + }, + { + credentialType: LicenseCredential.FEATURE_WHITEBOARD_MULTI_USER, + grantedPrivileges: [LicensePrivilege.WHITEBOARD_MULTI_USER], + name: 'Space Multi-user whiteboards', + }, + { + credentialType: LicenseCredential.FEATURE_SAVE_AS_TEMPLATE, + grantedPrivileges: [LicensePrivilege.SAVE_AS_TEMPLATE], + name: 'Space Save As Template', + }, + { + credentialType: LicenseCredential.LICENSE_PLUS, + grantedPrivileges: [ + LicensePrivilege.WHITEBOARD_MULTI_USER, + LicensePrivilege.SAVE_AS_TEMPLATE, + ], + name: 'Space License Plus', + }, + { + credentialType: LicenseCredential.LICENSE_PREMIUM, + grantedPrivileges: [ + LicensePrivilege.WHITEBOARD_MULTI_USER, + LicensePrivilege.SAVE_AS_TEMPLATE, + ], + name: 'Space License Premium', + }, + { + credentialType: LicenseCredential.ACCOUNT_LICENSE_PLUS, + grantedPrivileges: [ + LicensePrivilege.CREATE_SPACE, + LicensePrivilege.CREATE_VIRTUAL_CONTRIBUTOR, + LicensePrivilege.CREATE_INNOVATION_PACK, + ], + name: 'Account License Plus', + }, +]; From f28c379a8b7e7be340f48e8df60acc8f61733e56 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 14:23:16 +0200 Subject: [PATCH 28/42] Add license plans json --- .../templates/license-plans.json | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/platform/configuration/templates/license-plans.json diff --git a/src/platform/configuration/templates/license-plans.json b/src/platform/configuration/templates/license-plans.json new file mode 100644 index 0000000000..26929781c0 --- /dev/null +++ b/src/platform/configuration/templates/license-plans.json @@ -0,0 +1,122 @@ +[ + { + "version": "1", + "licenseType": "SPACE_LICENSE_PREMIUM", + "status": "1", + "priority": "30", + "price": "749.00", + "isTrial": "0", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "space-license-premium", + "isFree": "0", + "isFeatured": "0", + "planType": "space-plan" + }, + { + "version": "1", + "licenseType": "SPACE_LICENSE_PLUS", + "status": "1", + "priority": "20", + "price": "249.00", + "isTrial": "0", + "isUpgrade": "1", + "isRenewal": "0", + "isActive": "0", + "code": "space-license-plus", + "isFree": "0", + "isFeatured": "0", + "planType": "space-plan" + }, + { + "version": "1", + "licenseType": "SPACE_LICENSE_FREE", + "status": "1", + "priority": "10", + "price": "0.00", + "isTrial": "1", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "0", + "code": "space-license-free", + "isFree": "1", + "isFeatured": "1", + "planType": "space-plan" + }, + { + "version": "1", + "licenseType": "SPACE_FEATURE_WHITEBOARD_MULTI_USER", + "status": "1", + "priority": "50", + "price": "0.00", + "isTrial": "1", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "space-feature-whiteboard-multi-user", + "isFree": "0", + "isFeatured": "0", + "planType": "space-feature-flag" + }, + { + "version": "1", + "licenseType": "ACCOUNT_LICENSE_PLUS", + "status": "1", + "priority": "50", + "price": "0.00", + "isTrial": "0", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "account-license-plus", + "isFree": "0", + "isFeatured": "0", + "planType": "account-plan" + }, + { + "version": "1", + "licenseType": "SPACE_FEATURE_VIRTUAL_CONTRIBUTORS", + "status": "1", + "priority": "70", + "price": "0.00", + "isTrial": "1", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "space-feature-virtual-contributors", + "isFree": "1", + "isFeatured": "1", + "planType": "space-feature-flag" + }, + { + "version": "1", + "licenseType": "SPACE_LICENSE_ENTERPRISE", + "status": "1", + "priority": "40", + "price": null, + "isTrial": "0", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "space-license-enterprise", + "isFree": "0", + "isFeatured": "0", + "planType": "space-plan" + }, + { + "version": "1", + "licenseType": "SPACE_FEATURE_SAVE_AS_TEMPLATE", + "status": "1", + "priority": "60", + "price": "0.00", + "isTrial": "1", + "isUpgrade": "0", + "isRenewal": "0", + "isActive": "1", + "code": "space-feature-save-as-template", + "isFree": "1", + "isFeatured": "1", + "planType": "space-feature-flag" + } +] From edb569d5565bebcfa3dccc49a2ff5df3dcb38a4c Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 15:23:30 +0200 Subject: [PATCH 29/42] LicensePlan generation added to bootstrap Working licensing setup --- src/core/bootstrap/bootstrap.module.ts | 4 + src/core/bootstrap/bootstrap.service.ts | 52 +++- .../templates/license-plans.json | 230 ++++++++---------- .../license-plan/license.plan.service.ts | 23 +- 4 files changed, 178 insertions(+), 131 deletions(-) diff --git a/src/core/bootstrap/bootstrap.module.ts b/src/core/bootstrap/bootstrap.module.ts index a41197c058..2e91a8f094 100644 --- a/src/core/bootstrap/bootstrap.module.ts +++ b/src/core/bootstrap/bootstrap.module.ts @@ -19,6 +19,8 @@ import { ContributorModule } from '@domain/community/contributor/contributor.mod import { TemplatesSetModule } from '@domain/template/templates-set/templates.set.module'; import { TemplatesManagerModule } from '@domain/template/templates-manager/templates.manager.module'; import { TemplateDefaultModule } from '@domain/template/template-default/template.default.module'; +import { LicensingModule } from '@platform/licensing/licensing.module'; +import { LicensePlanModule } from '@platform/license-plan/license.plan.module'; @Module({ imports: [ @@ -41,6 +43,8 @@ import { TemplateDefaultModule } from '@domain/template/template-default/templat TemplatesSetModule, TemplatesManagerModule, TemplateDefaultModule, + LicensingModule, + LicensePlanModule, ], providers: [BootstrapService], exports: [BootstrapService], diff --git a/src/core/bootstrap/bootstrap.service.ts b/src/core/bootstrap/bootstrap.service.ts index 25a0e3616e..7793a504cb 100644 --- a/src/core/bootstrap/bootstrap.service.ts +++ b/src/core/bootstrap/bootstrap.service.ts @@ -6,6 +6,7 @@ import { UserService } from '@domain/community/user/user.service'; import { Repository } from 'typeorm'; import fs from 'fs'; import * as defaultRoles from '@templates/authorization-bootstrap.json'; +import * as defaultLicensePlan from '@templates/license-plans.json'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; import { Profiling } from '@common/decorators'; import { LogContext } from '@common/enums'; @@ -55,6 +56,8 @@ import { bootstrapSpaceCallouts } from './platform-template-definitions/space/bo import { bootstrapSpaceTutorialsInnovationFlowStates } from './platform-template-definitions/space-tutorials/bootstrap.space.tutorials.innovation.flow.states'; import { bootstrapSpaceTutorialsCalloutGroups } from './platform-template-definitions/space-tutorials/bootstrap.space.tutorials.callout.groups'; import { bootstrapSpaceTutorialsCallouts } from './platform-template-definitions/space-tutorials/bootstrap.space.tutorials.callouts'; +import { LicensingService } from '@platform/licensing/licensing.service'; +import { LicensePlanService } from '@platform/license-plan/license.plan.service'; @Injectable() export class BootstrapService { @@ -81,7 +84,9 @@ export class BootstrapService { private aiServerAuthorizationService: AiServerAuthorizationService, private templatesManagerService: TemplatesManagerService, private templatesSetService: TemplatesSetService, - private templateDefaultService: TemplateDefaultService + private templateDefaultService: TemplateDefaultService, + private licensingService: LicensingService, + private licensePlanService: LicensePlanService ) {} async bootstrap() { @@ -99,6 +104,7 @@ export class BootstrapService { } await this.bootstrapUserProfiles(); + await this.bootstrapLicensePlans(); await this.platformService.ensureForumCreated(); await this.ensureAuthorizationsPopulated(); await this.ensurePlatformTemplatesArePresent(); @@ -247,7 +253,7 @@ export class BootstrapService { { infer: true } ); - let bootstrapJson = { + let bootstrapAuthorizationRolesJson = { ...defaultRoles, }; @@ -267,7 +273,7 @@ export class BootstrapService { 'Specified authorization bootstrap file not found!' ); } - bootstrapJson = JSON.parse(bootstratDataStr); + bootstrapAuthorizationRolesJson = JSON.parse(bootstratDataStr); } else { this.logger.verbose?.( 'Authorization bootstrap: default configuration being loaded', @@ -275,7 +281,7 @@ export class BootstrapService { ); } - const users = bootstrapJson.users; + const users = bootstrapAuthorizationRolesJson.users; if (!users) { this.logger.verbose?.( 'No users section in the authorization bootstrap file!', @@ -286,6 +292,44 @@ export class BootstrapService { } } + async bootstrapLicensePlans() { + const bootstrapLicensePlans = { + ...defaultLicensePlan, + }; + + const licensePlans = bootstrapLicensePlans.licensePlans; + if (!licensePlans) { + this.logger.verbose?.( + 'No licensePlans section in the license plans bootstrap file!', + LogContext.BOOTSTRAP + ); + } else { + await this.createLicensePlans(licensePlans); + } + } + + async createLicensePlans(licensePlansData: any[]) { + try { + const licensing = await this.licensingService.getDefaultLicensingOrFail(); + for (const licensePlanData of licensePlansData) { + const planExists = + await this.licensePlanService.licensePlanByNameExists( + licensePlanData.type + ); + if (!planExists) { + await this.licensingService.createLicensePlan({ + ...licensePlanData, + licensingID: licensing.id, + }); + } + } + } catch (error: any) { + throw new BootstrapException( + `Unable to create license plans ${error.message}` + ); + } + } + @Profiling.api async createUserProfiles(usersData: any[]) { try { diff --git a/src/platform/configuration/templates/license-plans.json b/src/platform/configuration/templates/license-plans.json index 26929781c0..6c7ec8fc17 100644 --- a/src/platform/configuration/templates/license-plans.json +++ b/src/platform/configuration/templates/license-plans.json @@ -1,122 +1,108 @@ -[ - { - "version": "1", - "licenseType": "SPACE_LICENSE_PREMIUM", - "status": "1", - "priority": "30", - "price": "749.00", - "isTrial": "0", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "space-license-premium", - "isFree": "0", - "isFeatured": "0", - "planType": "space-plan" - }, - { - "version": "1", - "licenseType": "SPACE_LICENSE_PLUS", - "status": "1", - "priority": "20", - "price": "249.00", - "isTrial": "0", - "isUpgrade": "1", - "isRenewal": "0", - "isActive": "0", - "code": "space-license-plus", - "isFree": "0", - "isFeatured": "0", - "planType": "space-plan" - }, - { - "version": "1", - "licenseType": "SPACE_LICENSE_FREE", - "status": "1", - "priority": "10", - "price": "0.00", - "isTrial": "1", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "0", - "code": "space-license-free", - "isFree": "1", - "isFeatured": "1", - "planType": "space-plan" - }, - { - "version": "1", - "licenseType": "SPACE_FEATURE_WHITEBOARD_MULTI_USER", - "status": "1", - "priority": "50", - "price": "0.00", - "isTrial": "1", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "space-feature-whiteboard-multi-user", - "isFree": "0", - "isFeatured": "0", - "planType": "space-feature-flag" - }, - { - "version": "1", - "licenseType": "ACCOUNT_LICENSE_PLUS", - "status": "1", - "priority": "50", - "price": "0.00", - "isTrial": "0", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "account-license-plus", - "isFree": "0", - "isFeatured": "0", - "planType": "account-plan" - }, - { - "version": "1", - "licenseType": "SPACE_FEATURE_VIRTUAL_CONTRIBUTORS", - "status": "1", - "priority": "70", - "price": "0.00", - "isTrial": "1", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "space-feature-virtual-contributors", - "isFree": "1", - "isFeatured": "1", - "planType": "space-feature-flag" - }, - { - "version": "1", - "licenseType": "SPACE_LICENSE_ENTERPRISE", - "status": "1", - "priority": "40", - "price": null, - "isTrial": "0", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "space-license-enterprise", - "isFree": "0", - "isFeatured": "0", - "planType": "space-plan" - }, - { - "version": "1", - "licenseType": "SPACE_FEATURE_SAVE_AS_TEMPLATE", - "status": "1", - "priority": "60", - "price": "0.00", - "isTrial": "1", - "isUpgrade": "0", - "isRenewal": "0", - "isActive": "1", - "code": "space-feature-save-as-template", - "isFree": "1", - "isFeatured": "1", - "planType": "space-feature-flag" - } -] +{ + "licensePlans": [ + { + "name": "SPACE_LICENSE_PREMIUM", + "enabled": "1", + "sortOrder": "30", + "pricePerMonth": "749.00", + "isFree": "0", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "space-license-premium", + "assignToNewOrganizationAccount": "0", + "type": "space-plan" + }, + { + "name": "SPACE_LICENSE_PLUS", + "enabled": "1", + "sortOrder": "20", + "pricePerMonth": "249.00", + "isFree": "0", + "trialEnabled": "1", + "requiresPaymentMethod": "0", + "requiresContactSupport": "0", + "licenseCredential": "space-license-plus", + "assignToNewOrganizationAccount": "0", + "type": "space-plan" + }, + { + "name": "SPACE_LICENSE_FREE", + "enabled": "1", + "sortOrder": "10", + "pricePerMonth": "0.00", + "isFree": "1", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "0", + "licenseCredential": "space-license-free", + "assignToNewOrganizationAccount": "1", + "type": "space-plan" + }, + { + "name": "SPACE_FEATURE_WHITEBOARD_MULTI_USER", + "enabled": "1", + "sortOrder": "50", + "pricePerMonth": "0.00", + "isFree": "1", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "space-feature-whiteboard-multi-user", + "assignToNewOrganizationAccount": "0", + "type": "space-feature-flag" + }, + { + "name": "ACCOUNT_LICENSE_PLUS", + "enabled": "1", + "sortOrder": "50", + "pricePerMonth": "0.00", + "isFree": "0", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "account-license-plus", + "assignToNewOrganizationAccount": "0", + "type": "account-plan" + }, + { + "name": "SPACE_FEATURE_VIRTUAL_CONTIBUTORS", + "enabled": "1", + "sortOrder": "70", + "pricePerMonth": "0.00", + "isFree": "1", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "space-feature-virtual-contributors", + "assignToNewOrganizationAccount": "1", + "type": "space-feature-flag" + }, + { + "name": "SPACE_LICENSE_ENTERPRISE", + "enabled": "1", + "sortOrder": "40", + "pricePerMonth": null, + "isFree": "0", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "space-license-enterprise", + "assignToNewOrganizationAccount": "0", + "type": "space-plan" + }, + { + "name": "SPACE_FEATURE_SAVE_AS_TEMPLATE", + "enabled": "1", + "sortOrder": "60", + "pricePerMonth": "0.00", + "isFree": "1", + "trialEnabled": "0", + "requiresPaymentMethod": "0", + "requiresContactSupport": "1", + "licenseCredential": "space-feature-save-as-template", + "assignToNewOrganizationAccount": "1", + "type": "space-feature-flag" + } + ] +} diff --git a/src/platform/license-plan/license.plan.service.ts b/src/platform/license-plan/license.plan.service.ts index 9371e4e012..9287b6b12d 100644 --- a/src/platform/license-plan/license.plan.service.ts +++ b/src/platform/license-plan/license.plan.service.ts @@ -18,7 +18,7 @@ export class LicensePlanService { @Inject(WINSTON_MODULE_NEST_PROVIDER) private readonly logger: LoggerService ) {} - async createLicensePlan( + public async createLicensePlan( licensePlanData: CreateLicensePlanInput ): Promise { const licensePlan: ILicensePlan = LicensePlan.create(); @@ -40,17 +40,19 @@ export class LicensePlanService { return await this.save(licensePlan); } - async save(licensePlan: ILicensePlan): Promise { + public async save(licensePlan: ILicensePlan): Promise { return await this.licensePlanRepository.save(licensePlan); } - async update(licensePlanData: UpdateLicensePlanInput): Promise { + public async update( + licensePlanData: UpdateLicensePlanInput + ): Promise { const licensePlan = await this.getLicensePlanOrFail(licensePlanData.ID); return await this.licensePlanRepository.save(licensePlan); } - async deleteLicensePlan( + public async deleteLicensePlan( deleteData: DeleteLicensePlanInput ): Promise { const licensePlan = await this.getLicensePlanOrFail(deleteData.ID); @@ -62,7 +64,7 @@ export class LicensePlanService { return result; } - async getLicensePlanOrFail( + public async getLicensePlanOrFail( licensePlanID: string, options?: FindOneOptions ): Promise { @@ -79,4 +81,15 @@ export class LicensePlanService { } return licensePlan; } + + public async licensePlanByNameExists(name: string): Promise { + const licensePlan = await this.licensePlanRepository.findOne({ + where: { name }, + }); + + if (!licensePlan) { + return false; + } + return true; + } } From fbc23c7560e60bc87f5b6f35a00994dd85faf59b Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 15:33:44 +0200 Subject: [PATCH 30/42] Add platform templates manager --- src/migrations/1730906666882-initialData.ts | 131 +++++++++++++++++++- 1 file changed, 130 insertions(+), 1 deletion(-) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index 01d5c77b50..781a0382f2 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -121,7 +121,6 @@ export class InitialData1730906666882 implements MigrationInterface { )` ); - // // Create the agent on each account const [platform]: { id: string; licensePolicyId: string }[] = await queryRunner.query('SELECT id FROM platform LIMIT 1; '); const licensingID = randomUUID(); @@ -142,6 +141,38 @@ export class InitialData1730906666882 implements MigrationInterface { await queryRunner.query( `UPDATE platform SET licensingId = '${licensingID}' WHERE id = '${platform.id}'` ); + + const platformTemplatesManagerID = await this.createTemplatesManager( + queryRunner, + undefined + ); + await queryRunner.query( + `UPDATE \`platform\` SET templatesManagerId = '${platformTemplatesManagerID}'` + ); + await this.createTemplateDefault( + queryRunner, + platformTemplatesManagerID, + TemplateDefaultType.PLATFORM_SPACE, + TemplateType.COLLABORATION + ); + await this.createTemplateDefault( + queryRunner, + platformTemplatesManagerID, + TemplateDefaultType.PLATFORM_SUBSPACE, + TemplateType.COLLABORATION + ); + await this.createTemplateDefault( + queryRunner, + platformTemplatesManagerID, + TemplateDefaultType.PLATFORM_SPACE_TUTORIALS, + TemplateType.COLLABORATION + ); + await this.createTemplateDefault( + queryRunner, + platformTemplatesManagerID, + TemplateDefaultType.PLATFORM_SUBSPACE_KNOWLEDGE, + TemplateType.COLLABORATION + ); } public async down(queryRunner: QueryRunner): Promise {} @@ -176,6 +207,87 @@ export class InitialData1730906666882 implements MigrationInterface { return storageAggregatorID; } + + private async createTemplatesManager( + queryRunner: QueryRunner, + templatesSetInputId: string | undefined + ): Promise { + const templatesManagerID = randomUUID(); + const templatesManagerAuthID = await this.createAuthorizationPolicy( + queryRunner, + 'templates_manager' + ); + let templatesSetID = templatesSetInputId; + if (!templatesSetID) { + templatesSetID = await this.createTemplatesSet(queryRunner); + } + + // create the new templates manager + await queryRunner.query( + `INSERT INTO templates_manager (id, version, authorizationId, templatesSetId) VALUES + ( + '${templatesManagerID}', + 1, + '${templatesManagerAuthID}', + '${templatesSetID}')` + ); + + return templatesManagerID; + } + + private async createTemplatesSet(queryRunner: QueryRunner): Promise { + const templatesSetID = randomUUID(); + const templatesSetAuthID = await this.createAuthorizationPolicy( + queryRunner, + 'templates_set' + ); + // create the new templates set + await queryRunner.query( + `INSERT INTO templates_set (id, version, authorizationId) VALUES + ( + '${templatesSetID}', + 1, + '${templatesSetAuthID}')` + ); + return templatesSetID; + } + + private async createAuthorizationPolicy( + queryRunner: QueryRunner, + policyType: string + ): Promise { + const authID = randomUUID(); + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES + ('${authID}', + 1, '', '', 0, '', '${policyType}')` + ); + return authID; + } + + private async createTemplateDefault( + queryRunner: QueryRunner, + templatesManagerID: string, + templateDefaultType: TemplateDefaultType, + allowedTemplateType: TemplateType + ): Promise { + const templateDefaultID = randomUUID(); + const templateDefaultAuthID = await this.createAuthorizationPolicy( + queryRunner, + 'template_default' + ); + await queryRunner.query( + `INSERT INTO template_default (id, version, type, allowedTemplateType, authorizationId, templatesManagerId) VALUES + ( + '${templateDefaultID}', + 1, + '${templateDefaultType}', + '${allowedTemplateType}', + '${templateDefaultAuthID}', + '${templatesManagerID}')` + ); + return templateDefaultID; + } } type CredentialRule = { @@ -244,3 +356,20 @@ const licenseCredentialRules: CredentialRule[] = [ name: 'Account License Plus', }, ]; + +enum TemplateDefaultType { + PLATFORM_SPACE = 'platform-space', + PLATFORM_SPACE_TUTORIALS = 'platform-space-tutorials', + PLATFORM_SUBSPACE = 'platform-subspace', + PLATFORM_SUBSPACE_KNOWLEDGE = 'platform-subspace-knowledge', + SPACE_SUBSPACE = 'space-subspace', +} + +enum TemplateType { + CALLOUT = 'callout', + POST = 'post', + WHITEBOARD = 'whiteboard', + COMMUNITY_GUIDELINES = 'community-guidelines', + INNOVATION_FLOW = 'innovation-flow', + COLLABORATION = 'collaboration', +} From b70636ad126bca3203221e5e3d3ebc25696f259e Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 15:39:50 +0200 Subject: [PATCH 31/42] Fixed prior migration execution logic / order --- src/migrations/1730906666882-initialData.ts | 8 ++++++++ ...tionPolicy.ts => 1730986509540-authorizationPolicy.ts} | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) rename src/migrations/{1730877510629-authorizationPolicy.ts => 1730986509540-authorizationPolicy.ts} (95%) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index 781a0382f2..d04287f584 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -7,6 +7,14 @@ import { export class InitialData1730906666882 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { + const migrations = await queryRunner.query( + 'SELECT name FROM migrations_typeorm;' + ); + + if (migrations.length > 1) { + return; + } + // create library instance with authorization const libraryAuthID = randomUUID(); const libraryID = randomUUID(); diff --git a/src/migrations/1730877510629-authorizationPolicy.ts b/src/migrations/1730986509540-authorizationPolicy.ts similarity index 95% rename from src/migrations/1730877510629-authorizationPolicy.ts rename to src/migrations/1730986509540-authorizationPolicy.ts index de6d28c718..6f63a81795 100644 --- a/src/migrations/1730877510629-authorizationPolicy.ts +++ b/src/migrations/1730986509540-authorizationPolicy.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; -export class AuthorizationPolicy1730877510629 implements MigrationInterface { +export class AuthorizationPolicy1730986509540 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { // Get the authorization ID on the ai_server table await this.updateAuthorizationPolicyTypeOnSingleton( From 12e331bd35aefd1ff37b71ce2694917fafff8a29 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 16:00:41 +0200 Subject: [PATCH 32/42] Refactored migration for better readability --- src/migrations/1730906666882-initialData.ts | 168 +++++++++++--------- 1 file changed, 96 insertions(+), 72 deletions(-) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index d04287f584..725f1d3a9c 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -15,19 +15,15 @@ export class InitialData1730906666882 implements MigrationInterface { return; } - // create library instance with authorization - const libraryAuthID = randomUUID(); - const libraryID = randomUUID(); - const libraryAuthPolicy = `[{"type":"global-admin","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true},{"type":"global-admin-hubs","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true}]`; + await this.initializePlatform(queryRunner); + await this.initializePreferenceDefinitions(queryRunner); + await this.initializeAiServer(queryRunner); + } - await queryRunner.query( - `INSERT INTO authorization_policy VALUES ('${libraryAuthID}', NOW(), NOW(), 1, '${libraryAuthPolicy}', '', '', 0, 'library')` - ); - await queryRunner.query( - `INSERT INTO library (id, createdDate, updatedDate, version, authorizationId) VALUES ('${libraryID}', NOW(), NOW(), 1, '${libraryAuthID}')` - ); + public async down(queryRunner: QueryRunner): Promise {} - // create platform instance with authorization + private async initializePlatform(queryRunner: QueryRunner): Promise { + const libraryID = await this.initializeLibrary(queryRunner); const platformAuthID = randomUUID(); const platformID = randomUUID(); const platformStorageAggregatorID = @@ -48,70 +44,29 @@ export class InitialData1730906666882 implements MigrationInterface { 'ALTER TABLE `storage_aggregator` ADD CONSTRAINT `FK_0647707288c243e60091c8d8620` FOREIGN KEY (`directStorageId`) REFERENCES `storage_bucket`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION' ); - var preferenceDefinitionIds = [...Array(42)].map(id => randomUUID()); + await this.initializePlatformLicensing(queryRunner, platformID); + await this.initializePlatformTemplatesManager(queryRunner); + } - await queryRunner.query( - `INSERT INTO preference_definition (id, version, groupName, displayName, description, valueType, type, definitionSet) - VALUES - ('${preferenceDefinitionIds[0]}',1,'NotificationGlobalAdmin','[Admin] User profile deleted','Receive a notification when a user profile is removed','boolean','NotificationUserRemoved','user'), - ('${preferenceDefinitionIds[1]}',1,'Notification','Community Application','Receive notification when I apply to join a community','boolean','NotificationApplicationSubmitted','user'), - ('${preferenceDefinitionIds[2]}',1,'Notification','Community Updates','Receive notification when a new update is shared with a community I am a member of','boolean','NotificationCommunityUpdates','user'), - ('${preferenceDefinitionIds[3]}',1,'Notification','Community Discussion created','Receive notification when a new discussion is created on a community I am a member of','boolean','NotificationCommunityDiscussionCreated','user'), - ('${preferenceDefinitionIds[4]}',1,'NotificationForum','Receive a notification when a new comment is added to a Discussion I created in the Forum','Receive a notification when a new comment is added to a Discussion I created in the Forum','boolean','NotificationForumDiscussionComment','user'), - ('${preferenceDefinitionIds[5]}',1,'NotificationCommunityAdmin','[Admin] Community Applications','Receive notification when a new application is received for a community for which I am an administrator','boolean','NotificationApplicationReceived','user'), - ('${preferenceDefinitionIds[6]}',1,'NotificationGlobalAdmin','[Admin] New user sign up','Receive notification when a new user signs up','boolean','NotificationUserSignUp','user'), - ('${preferenceDefinitionIds[7]}',1,'NotificationCommunityAdmin','[Admin] Community Discussion Created','Receive notification when a new discussion is created for a community for which I am an administrator','boolean','NotificationCommunityDiscussionCreatedAdmin','user'), - ('${preferenceDefinitionIds[8]}',1,'NotificationCommunityAdmin','[Admin] Community Updates','Receive notification when a new update is shared with a community for which I am an administrator','boolean','NotificationCommunityUpdateSentAdmin','user'), - ('${preferenceDefinitionIds[9]}',1,'MembershipSpace','Applications allowed','Allow applications to this Space','boolean','MembershipApplicationsFromAnyone','space'), - ('${preferenceDefinitionIds[10]}',1,'MembershipSpace','Anyone can join','Allow any registered user to join this Space','boolean','MembershipJoinSpaceFromAnyone','space'), - ('${preferenceDefinitionIds[11]}',1,'MembershipSpace','Host Organization Join','Allow members of the host organization to join','boolean','MembershipJoinSpaceFromHostOrganizationMembers','space'), - ('${preferenceDefinitionIds[12]}',1,'Authorization','Anonymous read access','Allow non-members to read the contents of this Space','boolean','AuthorizationAnonymousReadAccess','space'), - ('${preferenceDefinitionIds[13]}',1,'AuthorizationOrganization','Domain based membership','Automatically add new users with emails matching the domain of the Organization','boolean','AuthorizationOrganizationMatchDomain','organization'), - ('${preferenceDefinitionIds[14]}',1,'Notification','Invitations to a community','Receive a notification when someone invites you to join a community','boolean','NotificationCommunityInvitationUser','user'), - ('${preferenceDefinitionIds[15]}',1,'NotificationCommunityAdmin','[Admin] Community review submitted','Receive notification when a new community review is submitted by a member','boolean','NotificationCommunityReviewSubmittedAdmin','user'), - ('${preferenceDefinitionIds[16]}',1,'NotificationCommunication','Mentions or tags of you in posts or comments','Receive a notification when a user tags you in a post or a comment','boolean','NotificationCommunicationMention','user'), - ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), - ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), - ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), - ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when a Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), - ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), - ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), - ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), - ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), - ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when a Post is created in community i am a member of','boolean','NotificationPostCreated','user'), - ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), - ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), - ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), - ('${preferenceDefinitionIds[29]}',1,'Privileges','Allow members to create Callouts.','Allow members to create Callouts.','boolean','AllowMembersToCreateCallouts','space'), - ('${preferenceDefinitionIds[30]}',1,'MembershipChallenge','Allow Space members to apply','Allow members of the parent Space to apply to this Challenge','boolean','MembershipApplyChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[31]}',1,'MembershipChallenge','Allow Space members to provide feedback on Context','Allow members of the parent Space to give feedback on the Challenge Context','boolean','MembershipFeedbackOnChallengeContext','challenge'), - ('${preferenceDefinitionIds[32]}',1,'Privileges','Allow Space members to create Challenges','Allow members of the Space to create Challenges.','boolean','AllowMembersToCreateChallenges','space'), - ('${preferenceDefinitionIds[33]}',1,'NotificationCommunication','Allow direct messages from other users','Receive a notification when a user wants to directly send you a message or shares with you','boolean','NotificationCommunicationMessage','user'), - ('${preferenceDefinitionIds[34]}',1,'Notification','Community review submitted','Receive notification when you submit a new community review','boolean','NotificationCommunityReviewSubmitted','user'), - ('${preferenceDefinitionIds[35]}',1,'Notification','Comment replies','Receive a notification when someone replies to your comment','boolean','NotificationCommentReply','user'), - ('${preferenceDefinitionIds[36]}',1,'Notification','New comment on Discssion','Receive a notification when a new comment is added to a Discussion in a community I am a member of','boolean','NotificationDiscussionCommentCreated','user'), - ('${preferenceDefinitionIds[37]}',1,'NotificationOrganizationAdmin','Mentions or tags of an organization you manage','Receive a notification when the organization you are admin of is mentioned','boolean','NotificationOrganizationMention','user'), - ('${preferenceDefinitionIds[38]}',1,'MembershipChallenge','Allow Space members to join','Allow members of the parent Space to join this Challenge','boolean','MembershipJoinChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[39]}',1,'Notification','Community new member','Receiver notification when I join a community','boolean','NotificationCommunityNewMember','user'), - ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), - ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` - ); + private async initializeLibrary(queryRunner: QueryRunner): Promise { + const libraryAuthID = randomUUID(); + const libraryID = randomUUID(); + const libraryAuthPolicy = `[{"type":"global-admin","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true},{"type":"global-admin-hubs","resourceID":"","grantedPrivileges":["create","read","update","delete"],"inheritable":true}]`; - // Create the AI Server entity - const aiServerID = randomUUID(); - const aiServerAuthID = randomUUID(); await queryRunner.query( - `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES - ('${aiServerAuthID}', - 1, '', '', 0, '', 'ai-server')` + `INSERT INTO authorization_policy VALUES ('${libraryAuthID}', NOW(), NOW(), 1, '${libraryAuthPolicy}', '', '', 0, 'library')` ); await queryRunner.query( - `INSERT INTO ai_server (id, version, authorizationId) VALUES - ('${aiServerID}', - 1, - '${aiServerAuthID}')` + `INSERT INTO library (id, createdDate, updatedDate, version, authorizationId) VALUES ('${libraryID}', NOW(), NOW(), 1, '${libraryAuthID}')` ); + return libraryID; + } + + private async initializePlatformLicensing( + queryRunner: QueryRunner, + platformID: string + ): Promise { const licensePolicyID = randomUUID(); const licensePolicyAuthID = randomUUID(); @@ -129,8 +84,6 @@ export class InitialData1730906666882 implements MigrationInterface { )` ); - const [platform]: { id: string; licensePolicyId: string }[] = - await queryRunner.query('SELECT id FROM platform LIMIT 1; '); const licensingID = randomUUID(); const licensingAuthID = randomUUID(); @@ -147,9 +100,13 @@ export class InitialData1730906666882 implements MigrationInterface { '${licensePolicyID}')` ); await queryRunner.query( - `UPDATE platform SET licensingId = '${licensingID}' WHERE id = '${platform.id}'` + `UPDATE platform SET licensingId = '${licensingID}' WHERE id = '${platformID}'` ); + } + private async initializePlatformTemplatesManager( + queryRunner: QueryRunner + ): Promise { const platformTemplatesManagerID = await this.createTemplatesManager( queryRunner, undefined @@ -183,7 +140,74 @@ export class InitialData1730906666882 implements MigrationInterface { ); } - public async down(queryRunner: QueryRunner): Promise {} + private async initializePreferenceDefinitions( + queryRunner: QueryRunner + ): Promise { + var preferenceDefinitionIds = [...Array(42)].map(id => randomUUID()); + + await queryRunner.query( + `INSERT INTO preference_definition (id, version, groupName, displayName, description, valueType, type, definitionSet) + VALUES + ('${preferenceDefinitionIds[0]}',1,'NotificationGlobalAdmin','[Admin] User profile deleted','Receive a notification when a user profile is removed','boolean','NotificationUserRemoved','user'), + ('${preferenceDefinitionIds[1]}',1,'Notification','Community Application','Receive notification when I apply to join a community','boolean','NotificationApplicationSubmitted','user'), + ('${preferenceDefinitionIds[2]}',1,'Notification','Community Updates','Receive notification when a new update is shared with a community I am a member of','boolean','NotificationCommunityUpdates','user'), + ('${preferenceDefinitionIds[3]}',1,'Notification','Community Discussion created','Receive notification when a new discussion is created on a community I am a member of','boolean','NotificationCommunityDiscussionCreated','user'), + ('${preferenceDefinitionIds[4]}',1,'NotificationForum','Receive a notification when a new comment is added to a Discussion I created in the Forum','Receive a notification when a new comment is added to a Discussion I created in the Forum','boolean','NotificationForumDiscussionComment','user'), + ('${preferenceDefinitionIds[5]}',1,'NotificationCommunityAdmin','[Admin] Community Applications','Receive notification when a new application is received for a community for which I am an administrator','boolean','NotificationApplicationReceived','user'), + ('${preferenceDefinitionIds[6]}',1,'NotificationGlobalAdmin','[Admin] New user sign up','Receive notification when a new user signs up','boolean','NotificationUserSignUp','user'), + ('${preferenceDefinitionIds[7]}',1,'NotificationCommunityAdmin','[Admin] Community Discussion Created','Receive notification when a new discussion is created for a community for which I am an administrator','boolean','NotificationCommunityDiscussionCreatedAdmin','user'), + ('${preferenceDefinitionIds[8]}',1,'NotificationCommunityAdmin','[Admin] Community Updates','Receive notification when a new update is shared with a community for which I am an administrator','boolean','NotificationCommunityUpdateSentAdmin','user'), + ('${preferenceDefinitionIds[9]}',1,'MembershipSpace','Applications allowed','Allow applications to this Space','boolean','MembershipApplicationsFromAnyone','space'), + ('${preferenceDefinitionIds[10]}',1,'MembershipSpace','Anyone can join','Allow any registered user to join this Space','boolean','MembershipJoinSpaceFromAnyone','space'), + ('${preferenceDefinitionIds[11]}',1,'MembershipSpace','Host Organization Join','Allow members of the host organization to join','boolean','MembershipJoinSpaceFromHostOrganizationMembers','space'), + ('${preferenceDefinitionIds[12]}',1,'Authorization','Anonymous read access','Allow non-members to read the contents of this Space','boolean','AuthorizationAnonymousReadAccess','space'), + ('${preferenceDefinitionIds[13]}',1,'AuthorizationOrganization','Domain based membership','Automatically add new users with emails matching the domain of the Organization','boolean','AuthorizationOrganizationMatchDomain','organization'), + ('${preferenceDefinitionIds[14]}',1,'Notification','Invitations to a community','Receive a notification when someone invites you to join a community','boolean','NotificationCommunityInvitationUser','user'), + ('${preferenceDefinitionIds[15]}',1,'NotificationCommunityAdmin','[Admin] Community review submitted','Receive notification when a new community review is submitted by a member','boolean','NotificationCommunityReviewSubmittedAdmin','user'), + ('${preferenceDefinitionIds[16]}',1,'NotificationCommunication','Mentions or tags of you in posts or comments','Receive a notification when a user tags you in a post or a comment','boolean','NotificationCommunicationMention','user'), + ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), + ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), + ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), + ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when a Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), + ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), + ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), + ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), + ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), + ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when a Post is created in community i am a member of','boolean','NotificationPostCreated','user'), + ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), + ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), + ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), + ('${preferenceDefinitionIds[29]}',1,'Privileges','Allow members to create Callouts.','Allow members to create Callouts.','boolean','AllowMembersToCreateCallouts','space'), + ('${preferenceDefinitionIds[30]}',1,'MembershipChallenge','Allow Space members to apply','Allow members of the parent Space to apply to this Challenge','boolean','MembershipApplyChallengeFromSpaceMembers','challenge'), + ('${preferenceDefinitionIds[31]}',1,'MembershipChallenge','Allow Space members to provide feedback on Context','Allow members of the parent Space to give feedback on the Challenge Context','boolean','MembershipFeedbackOnChallengeContext','challenge'), + ('${preferenceDefinitionIds[32]}',1,'Privileges','Allow Space members to create Challenges','Allow members of the Space to create Challenges.','boolean','AllowMembersToCreateChallenges','space'), + ('${preferenceDefinitionIds[33]}',1,'NotificationCommunication','Allow direct messages from other users','Receive a notification when a user wants to directly send you a message or shares with you','boolean','NotificationCommunicationMessage','user'), + ('${preferenceDefinitionIds[34]}',1,'Notification','Community review submitted','Receive notification when you submit a new community review','boolean','NotificationCommunityReviewSubmitted','user'), + ('${preferenceDefinitionIds[35]}',1,'Notification','Comment replies','Receive a notification when someone replies to your comment','boolean','NotificationCommentReply','user'), + ('${preferenceDefinitionIds[36]}',1,'Notification','New comment on Discssion','Receive a notification when a new comment is added to a Discussion in a community I am a member of','boolean','NotificationDiscussionCommentCreated','user'), + ('${preferenceDefinitionIds[37]}',1,'NotificationOrganizationAdmin','Mentions or tags of an organization you manage','Receive a notification when the organization you are admin of is mentioned','boolean','NotificationOrganizationMention','user'), + ('${preferenceDefinitionIds[38]}',1,'MembershipChallenge','Allow Space members to join','Allow members of the parent Space to join this Challenge','boolean','MembershipJoinChallengeFromSpaceMembers','challenge'), + ('${preferenceDefinitionIds[39]}',1,'Notification','Community new member','Receiver notification when I join a community','boolean','NotificationCommunityNewMember','user'), + ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), + ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` + ); + } + + private async initializeAiServer(queryRunner: QueryRunner): Promise { + const aiServerID = randomUUID(); + const aiServerAuthID = randomUUID(); + await queryRunner.query( + `INSERT INTO authorization_policy (id, version, credentialRules, verifiedCredentialRules, anonymousReadAccess, privilegeRules, type) VALUES + ('${aiServerAuthID}', + 1, '', '', 0, '', 'ai-server')` + ); + await queryRunner.query( + `INSERT INTO ai_server (id, version, authorizationId) VALUES + ('${aiServerID}', + 1, + '${aiServerAuthID}')` + ); + } private async createStorageAggregator( queryRunner: QueryRunner From fc4e589b076ad4e5cdc207e73bc3372983e95c57 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Thu, 7 Nov 2024 16:39:49 +0200 Subject: [PATCH 33/42] Update preference definitions, aligning with latest data --- src/migrations/1730906666882-initialData.ts | 73 +++++++++------------ 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/src/migrations/1730906666882-initialData.ts b/src/migrations/1730906666882-initialData.ts index 725f1d3a9c..af10449e9c 100644 --- a/src/migrations/1730906666882-initialData.ts +++ b/src/migrations/1730906666882-initialData.ts @@ -143,53 +143,40 @@ export class InitialData1730906666882 implements MigrationInterface { private async initializePreferenceDefinitions( queryRunner: QueryRunner ): Promise { - var preferenceDefinitionIds = [...Array(42)].map(id => randomUUID()); + const preferenceDefinitionIds = [...Array(29)].map(() => randomUUID()); await queryRunner.query( `INSERT INTO preference_definition (id, version, groupName, displayName, description, valueType, type, definitionSet) VALUES - ('${preferenceDefinitionIds[0]}',1,'NotificationGlobalAdmin','[Admin] User profile deleted','Receive a notification when a user profile is removed','boolean','NotificationUserRemoved','user'), - ('${preferenceDefinitionIds[1]}',1,'Notification','Community Application','Receive notification when I apply to join a community','boolean','NotificationApplicationSubmitted','user'), - ('${preferenceDefinitionIds[2]}',1,'Notification','Community Updates','Receive notification when a new update is shared with a community I am a member of','boolean','NotificationCommunityUpdates','user'), - ('${preferenceDefinitionIds[3]}',1,'Notification','Community Discussion created','Receive notification when a new discussion is created on a community I am a member of','boolean','NotificationCommunityDiscussionCreated','user'), - ('${preferenceDefinitionIds[4]}',1,'NotificationForum','Receive a notification when a new comment is added to a Discussion I created in the Forum','Receive a notification when a new comment is added to a Discussion I created in the Forum','boolean','NotificationForumDiscussionComment','user'), - ('${preferenceDefinitionIds[5]}',1,'NotificationCommunityAdmin','[Admin] Community Applications','Receive notification when a new application is received for a community for which I am an administrator','boolean','NotificationApplicationReceived','user'), - ('${preferenceDefinitionIds[6]}',1,'NotificationGlobalAdmin','[Admin] New user sign up','Receive notification when a new user signs up','boolean','NotificationUserSignUp','user'), - ('${preferenceDefinitionIds[7]}',1,'NotificationCommunityAdmin','[Admin] Community Discussion Created','Receive notification when a new discussion is created for a community for which I am an administrator','boolean','NotificationCommunityDiscussionCreatedAdmin','user'), - ('${preferenceDefinitionIds[8]}',1,'NotificationCommunityAdmin','[Admin] Community Updates','Receive notification when a new update is shared with a community for which I am an administrator','boolean','NotificationCommunityUpdateSentAdmin','user'), - ('${preferenceDefinitionIds[9]}',1,'MembershipSpace','Applications allowed','Allow applications to this Space','boolean','MembershipApplicationsFromAnyone','space'), - ('${preferenceDefinitionIds[10]}',1,'MembershipSpace','Anyone can join','Allow any registered user to join this Space','boolean','MembershipJoinSpaceFromAnyone','space'), - ('${preferenceDefinitionIds[11]}',1,'MembershipSpace','Host Organization Join','Allow members of the host organization to join','boolean','MembershipJoinSpaceFromHostOrganizationMembers','space'), - ('${preferenceDefinitionIds[12]}',1,'Authorization','Anonymous read access','Allow non-members to read the contents of this Space','boolean','AuthorizationAnonymousReadAccess','space'), - ('${preferenceDefinitionIds[13]}',1,'AuthorizationOrganization','Domain based membership','Automatically add new users with emails matching the domain of the Organization','boolean','AuthorizationOrganizationMatchDomain','organization'), - ('${preferenceDefinitionIds[14]}',1,'Notification','Invitations to a community','Receive a notification when someone invites you to join a community','boolean','NotificationCommunityInvitationUser','user'), - ('${preferenceDefinitionIds[15]}',1,'NotificationCommunityAdmin','[Admin] Community review submitted','Receive notification when a new community review is submitted by a member','boolean','NotificationCommunityReviewSubmittedAdmin','user'), - ('${preferenceDefinitionIds[16]}',1,'NotificationCommunication','Mentions or tags of you in posts or comments','Receive a notification when a user tags you in a post or a comment','boolean','NotificationCommunicationMention','user'), - ('${preferenceDefinitionIds[17]}',1,'Notification','Opportunity collaboration interest confirmation','User receives confirmation email when submits interest for collaboration on an opportunity.','boolean','NotificationCommunityCollaborationInterestUser','user'), - ('${preferenceDefinitionIds[18]}',1,'Authorization','Allow non-members to read the contents of this Challenge.','Allow non-members to read the contents of this Challenge.','boolean','AllowNonMembersReadAccess','challenge'), - ('${preferenceDefinitionIds[19]}',1,'Notification','New Callout published','Receive a notification when a Callout is published in a community I am a member of','boolean','NotificationCalloutPublished','user'), - ('${preferenceDefinitionIds[20]}',1,'NotificationCommunityAdmin','[Admin] New Post created','Receive notification when a Post is created in a community I am administrator of','boolean','NotificationPostCreatedAdmin','user'), - ('${preferenceDefinitionIds[21]}',1,'NotificationForum','Receive a notification when a new Discussion is created in the Forum','Receive a notification when a new Discussion is created in the Forum','boolean','NotificationForumDiscussionCreated','user'), - ('${preferenceDefinitionIds[22]}',1,'NotificationOrganizationAdmin','Allow direct messages to organizations you manage','Receive notification when the organization you are admin of is messaged','boolean','NotificationOrganizationMessage','user'), - ('${preferenceDefinitionIds[23]}',1,'Privileges','Allow contributors to create Opportunities.','Allow contributors to the Challenge to create Opportunities.','boolean','AllowContributorsToCreateOpportunities','challenge'), - ('${preferenceDefinitionIds[24]}',1,'NotificationCommunityAdmin','[Admin] New opportunity collaboration interest','Receive notification when a user submits collaboration interest for an opportunity community I am administrator of','boolean','NotificationCommunityCollaborationInterestAdmin','user'), - ('${preferenceDefinitionIds[25]}',1,'Notification','New Post created','Receive notification when a Post is created in community i am a member of','boolean','NotificationPostCreated','user'), - ('${preferenceDefinitionIds[26]}',1,'NotificationCommunityAdmin','[Admin] Community new member','Receiver notification when a new user joins a community for which I am an administrator','boolean','NotificationCommunityNewMemberAdmin','user'), - ('${preferenceDefinitionIds[27]}',1,'Notification','New Whiteboard created','Receive a notification when a Whiteboard is created in a community I am a member of','boolean','NotificationWhiteboardCreated','user'), - ('${preferenceDefinitionIds[28]}',1,'Privileges','Allow Space members to contribute.','Allow Space members to contribute.','boolean','AllowSpaceMembersToContribute','challenge'), - ('${preferenceDefinitionIds[29]}',1,'Privileges','Allow members to create Callouts.','Allow members to create Callouts.','boolean','AllowMembersToCreateCallouts','space'), - ('${preferenceDefinitionIds[30]}',1,'MembershipChallenge','Allow Space members to apply','Allow members of the parent Space to apply to this Challenge','boolean','MembershipApplyChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[31]}',1,'MembershipChallenge','Allow Space members to provide feedback on Context','Allow members of the parent Space to give feedback on the Challenge Context','boolean','MembershipFeedbackOnChallengeContext','challenge'), - ('${preferenceDefinitionIds[32]}',1,'Privileges','Allow Space members to create Challenges','Allow members of the Space to create Challenges.','boolean','AllowMembersToCreateChallenges','space'), - ('${preferenceDefinitionIds[33]}',1,'NotificationCommunication','Allow direct messages from other users','Receive a notification when a user wants to directly send you a message or shares with you','boolean','NotificationCommunicationMessage','user'), - ('${preferenceDefinitionIds[34]}',1,'Notification','Community review submitted','Receive notification when you submit a new community review','boolean','NotificationCommunityReviewSubmitted','user'), - ('${preferenceDefinitionIds[35]}',1,'Notification','Comment replies','Receive a notification when someone replies to your comment','boolean','NotificationCommentReply','user'), - ('${preferenceDefinitionIds[36]}',1,'Notification','New comment on Discssion','Receive a notification when a new comment is added to a Discussion in a community I am a member of','boolean','NotificationDiscussionCommentCreated','user'), - ('${preferenceDefinitionIds[37]}',1,'NotificationOrganizationAdmin','Mentions or tags of an organization you manage','Receive a notification when the organization you are admin of is mentioned','boolean','NotificationOrganizationMention','user'), - ('${preferenceDefinitionIds[38]}',1,'MembershipChallenge','Allow Space members to join','Allow members of the parent Space to join this Challenge','boolean','MembershipJoinChallengeFromSpaceMembers','challenge'), - ('${preferenceDefinitionIds[39]}',1,'Notification','Community new member','Receiver notification when I join a community','boolean','NotificationCommunityNewMember','user'), - ('${preferenceDefinitionIds[40]}',1,'Privileges','Allow contributors to create Callouts.','Allow contributors to create Callouts.','boolean','AllowContributorsToCreateCallouts','challenge'), - ('${preferenceDefinitionIds[41]}',1,'Notification','New comment on my Post','Receive notification when a comment is created on my Post','boolean','NotificationPostCommentCreated','user')` + ('${preferenceDefinitionIds[0]}', 1, 'Notification', 'Community Application', 'Receive notification when I apply to join a community', 'boolean', 'NotificationApplicationSubmitted', 'user'), + ('${preferenceDefinitionIds[1]}', 1, 'Notification', 'Community Updates', 'Receive notification when a new update is shared with a community I am a member of', 'boolean', 'NotificationCommunityUpdates', 'user'), + ('${preferenceDefinitionIds[2]}', 1, 'Notification', 'Community Discussion created', 'Receive notification when a new discussion is created on a community I am a member of', 'boolean', 'NotificationCommunityDiscussionCreated', 'user'), + ('${preferenceDefinitionIds[3]}', 1, 'NotificationForum', 'Receive a notification when a new comment is added to a Discussion I created in the Forum', 'Receive a notification when a new comment is added to a Discussion I created in the Forum', 'boolean', 'NotificationForumDiscussionComment', 'user'), + ('${preferenceDefinitionIds[4]}', 1, 'NotificationCommunityAdmin', '[Admin] Community Applications', 'Receive notification when a new application is received for a community for which I am an administrator', 'boolean', 'NotificationApplicationReceived', 'user'), + ('${preferenceDefinitionIds[5]}', 1, 'NotificationGlobalAdmin', '[Admin] New user sign up', 'Receive notification when a new user signs up', 'boolean', 'NotificationUserSignUp', 'user'), + ('${preferenceDefinitionIds[6]}', 1, 'NotificationCommunication', 'Allow direct messages from other users', 'Receive a notification when a user wants to directly send you a message or shares with you', 'boolean', 'NotificationCommunicationMessage', 'user'), + ('${preferenceDefinitionIds[7]}', 1, 'Notification', 'Community new member', 'Receive notification when I join a community', 'boolean', 'NotificationCommunityNewMember', 'user'), + ('${preferenceDefinitionIds[8]}', 1, 'Notification', 'New Callout published', 'Receive a notification when a Callout is published in a community I am a member of', 'boolean', 'NotificationCalloutPublished', 'user'), + ('${preferenceDefinitionIds[9]}', 1, 'NotificationCommunityAdmin', '[Admin] Community Discussion Created', 'Receive notification when a new discussion is created for a community for which I am an administrator', 'boolean', 'NotificationCommunityDiscussionCreatedAdmin', 'user'), + ('${preferenceDefinitionIds[10]}', 1, 'NotificationCommunityAdmin', '[Admin] Community Updates', 'Receive notification when a new update is shared with a community for which I am an administrator', 'boolean', 'NotificationCommunityUpdateSentAdmin', 'user'), + ('${preferenceDefinitionIds[11]}', 1, 'Notification', 'Comment replies', 'Receive a notification when someone replies to your comment', 'boolean', 'NotificationCommentReply', 'user'), + ('${preferenceDefinitionIds[12]}', 1, 'NotificationCommunication', 'Mentions or tags of you in posts or comments', 'Receive a notification when a user tags you in a post or a comment', 'boolean', 'NotificationCommunicationMention', 'user'), + ('${preferenceDefinitionIds[13]}', 1, 'Notification', 'New Post created', 'Receive notification when a Post is created in community I am a member of', 'boolean', 'NotificationPostCreated', 'user'), + ('${preferenceDefinitionIds[14]}', 1, 'NotificationCommunityAdmin', '[Admin] New opportunity collaboration interest', 'Receive notification when a user submits collaboration interest for an opportunity community I am administrator of', 'boolean', 'NotificationCommunityCollaborationInterestAdmin', 'user'), + ('${preferenceDefinitionIds[15]}', 1, 'NotificationOrganizationAdmin', 'Mentions or tags of an organization you manage', 'Receive a notification when the organization you are admin of is mentioned', 'boolean', 'NotificationOrganizationMention', 'user'), + ('${preferenceDefinitionIds[16]}', 1, 'Notification', 'New comment on my Post', 'Receive notification when a comment is created on my Post', 'boolean', 'NotificationPostCommentCreated', 'user'), + ('${preferenceDefinitionIds[17]}', 1, 'NotificationForum', 'Receive a notification when a new Discussion is created in the Forum', 'Receive a notification when a new Discussion is created in the Forum', 'boolean', 'NotificationForumDiscussionCreated', 'user'), + ('${preferenceDefinitionIds[18]}', 1, 'Notification', 'Community review submitted', 'Receive notification when you submit a new community review', 'boolean', 'NotificationCommunityReviewSubmitted', 'user'), + ('${preferenceDefinitionIds[19]}', 1, 'Notification', 'New Whiteboard created', 'Receive a notification when a Whiteboard is created in a community I am a member of', 'boolean', 'NotificationWhiteboardCreated', 'user'), + ('${preferenceDefinitionIds[20]}', 1, 'NotificationCommunityAdmin', '[Admin] New Post created', 'Receive notification when a Post is created in a community I am administrator of', 'boolean', 'NotificationPostCreatedAdmin', 'user'), + ('${preferenceDefinitionIds[21]}', 1, 'Notification', 'Invitations to a community', 'Receive a notification when someone invites you to join a community', 'boolean', 'NotificationCommunityInvitationUser', 'user'), + ('${preferenceDefinitionIds[22]}', 1, 'Notification', 'Opportunity collaboration interest confirmation', 'User receives confirmation email when submits interest for collaboration on an opportunity.', 'boolean', 'NotificationCommunityCollaborationInterestUser', 'user'), + ('${preferenceDefinitionIds[23]}', 1, 'NotificationGlobalAdmin', '[Admin] User profile deleted', 'Receive a notification when a user profile is removed', 'boolean', 'NotificationUserRemoved', 'user'), + ('${preferenceDefinitionIds[24]}', 1, 'NotificationCommunityAdmin', '[Admin] Community new member', 'Receive notification when a new user joins a community for which I am an administrator', 'boolean', 'NotificationCommunityNewMemberAdmin', 'user'), + ('${preferenceDefinitionIds[25]}', 1, 'Notification', 'New comment on Discussion', 'Receive a notification when a new comment is added to a Discussion in a community I am a member of', 'boolean', 'NotificationDiscussionCommentCreated', 'user'), + ('${preferenceDefinitionIds[26]}', 1, 'AuthorizationOrganization', 'Domain based membership', 'Automatically add new users with emails matching the domain of the Organization', 'boolean', 'AuthorizationOrganizationMatchDomain', 'organization'), + ('${preferenceDefinitionIds[27]}', 1, 'NotificationOrganizationAdmin', 'Allow direct messages to organizations you manage', 'Receive notification when the organization you are admin of is messaged', 'boolean', 'NotificationOrganizationMessage', 'user'), + ('${preferenceDefinitionIds[28]}', 1, 'NotificationCommunityAdmin', '[Admin] Community review submitted', 'Receive notification when a new community review is submitted by a member', 'boolean', 'NotificationCommunityReviewSubmittedAdmin', 'user')` ); } From 67177c70cbe9a4863fc0ac83227382e5b81f63ad Mon Sep 17 00:00:00 2001 From: Bobby Kolev Date: Thu, 7 Nov 2024 18:28:51 +0200 Subject: [PATCH 34/42] Remove unused privileges from AuthorizationPrivilege (#4685) --- src/common/enums/authorization.privilege.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/common/enums/authorization.privilege.ts b/src/common/enums/authorization.privilege.ts index 9a97b27fa5..dc815a203e 100644 --- a/src/common/enums/authorization.privilege.ts +++ b/src/common/enums/authorization.privilege.ts @@ -26,11 +26,9 @@ export enum AuthorizationPrivilege { CREATE_INNOVATION_HUB = 'create-innovation-hub', FILE_UPLOAD = 'file-upload', FILE_DELETE = 'file-delete', - UPDATE_WHITEBOARD = 'update-whiteboard', UPDATE_INNOVATION_FLOW = 'update-innovation-flow', COMMUNITY_JOIN = 'community-join', COMMUNITY_APPLY = 'community-apply', - COMMUNITY_APPLY_ACCEPT = 'community-apply-accept', COMMUNITY_INVITE = 'community-invite', COMMUNITY_INVITE_ACCEPT = 'community-invite-accept', COMMUNITY_ADD_MEMBER = 'community-add-member', // only for global admins @@ -43,7 +41,6 @@ export enum AuthorizationPrivilege { MOVE_CONTRIBUTION = 'move-contribution', ACCESS_INTERACTIVE_GUIDANCE = 'access-interactive-guidance', ACCESS_VIRTUAL_CONTRIBUTOR = 'access-virtual-contributor', - ACCESS_DASHBOARD_REFRESH = 'access-dashboard-refresh', UPDATE_CONTENT = 'update-content', SAVE_AS_TEMPLATE = 'save-as-template', TRANSFER_RESOURCE = 'transfer-resource', From 58609e98ba4959178b4387eda76535df68215aae Mon Sep 17 00:00:00 2001 From: Carlos Cano Date: Fri, 8 Nov 2024 10:19:05 +0200 Subject: [PATCH 35/42] Bugfix #7122-2 Post callouts coming from a template that had the comments disable cannot have comments enabled (#4681) --- .../collaboration/collaboration/collaboration.service.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/domain/collaboration/collaboration/collaboration.service.ts b/src/domain/collaboration/collaboration/collaboration.service.ts index 5eef75fa69..a57c9656ad 100644 --- a/src/domain/collaboration/collaboration/collaboration.service.ts +++ b/src/domain/collaboration/collaboration/collaboration.service.ts @@ -54,7 +54,6 @@ import { Callout } from '@domain/collaboration/callout'; import { AuthorizationPolicyType } from '@common/enums/authorization.policy.type'; import { CreateInnovationFlowInput } from '../innovation-flow/dto/innovation.flow.dto.create'; import { IRoleSet } from '@domain/access/role-set'; -import { CalloutState } from '@common/enums/callout.state'; @Injectable() export class CollaborationService { @@ -227,9 +226,8 @@ export class CollaborationService { calloutNameIds.push(calloutDefault.nameID); } if ( - calloutDefault.isTemplate === false && - calloutDefault.type === CalloutType.POST && - calloutDefault.contributionPolicy?.state === CalloutState.OPEN + !calloutDefault.isTemplate && + calloutDefault.type === CalloutType.POST ) { calloutDefault.enableComments = true; } From cb85731fb8d9075830d3916a1c0ff198b21d8903 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Fri, 8 Nov 2024 17:22:43 +0200 Subject: [PATCH 36/42] Addressing PR comments (#4689) --- alkemio.yml | 10 ---- src/core/bootstrap/bootstrap.service.ts | 51 +++---------------- .../license-plan}/license-plans.json | 0 .../user/users.json} | 0 src/types/alkemio.config.ts | 6 --- 5 files changed, 7 insertions(+), 60 deletions(-) rename src/{platform/configuration/templates => core/bootstrap/platform-template-definitions/license-plan}/license-plans.json (100%) rename src/{platform/configuration/templates/authorization-bootstrap.json => core/bootstrap/platform-template-definitions/user/users.json} (100%) diff --git a/alkemio.yml b/alkemio.yml index 1f33204b8b..d83e2e9a07 100644 --- a/alkemio.yml +++ b/alkemio.yml @@ -43,16 +43,6 @@ hosting: port: ${WHITEBOARD_RT_PORT}:4001 max_json_payload_size: ${HOSTING_MAX_JSON_PAYLOAD_SIZE}:64mb -## bootstrap ## -# Used to determine the the information that is used to to initialize a functional Alkemio instance. -bootstrap: - # The bootstrap authorization file specifies the minimum set of users and their associated credentials that are always available - # in the Alkemio instance. - # - # Default: the default file that is picked up is: src/services/configuraiton/templates/authorization-bootstrap.json. - authorization: - enabled: ${BOOTSTRAP_AUTHORIZATION_ENABLED}:true - file: ${BOOTSTRAP_AUTHORIZATION_FILE} # Settings related to the authorization framework authorization: # amount of authorization policies saved in a single chunk diff --git a/src/core/bootstrap/bootstrap.service.ts b/src/core/bootstrap/bootstrap.service.ts index 7793a504cb..6a9c3881d7 100644 --- a/src/core/bootstrap/bootstrap.service.ts +++ b/src/core/bootstrap/bootstrap.service.ts @@ -4,9 +4,8 @@ import { InjectRepository } from '@nestjs/typeorm'; import { SpaceService } from '@domain/space/space/space.service'; import { UserService } from '@domain/community/user/user.service'; import { Repository } from 'typeorm'; -import fs from 'fs'; -import * as defaultRoles from '@templates/authorization-bootstrap.json'; -import * as defaultLicensePlan from '@templates/license-plans.json'; +import * as defaultRoles from './platform-template-definitions/user/users.json'; +import * as defaultLicensePlan from './platform-template-definitions/license-plan/license-plans.json'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; import { Profiling } from '@common/decorators'; import { LogContext } from '@common/enums'; @@ -236,50 +235,14 @@ export class BootstrapService { } async bootstrapUserProfiles() { - const bootstrapAuthorizationEnabled = this.configService.get( - 'bootstrap.authorization.enabled', - { infer: true } - ); - if (!bootstrapAuthorizationEnabled) { - this.logger.verbose?.( - `Authorization Profile Loading: ${bootstrapAuthorizationEnabled}`, - LogContext.BOOTSTRAP - ); - return; - } - - const bootstrapFilePath = this.configService.get( - 'bootstrap.authorization.file', - { infer: true } - ); - - let bootstrapAuthorizationRolesJson = { + const bootstrapAuthorizationRolesJson = { ...defaultRoles, }; - if ( - bootstrapFilePath && - fs.existsSync(bootstrapFilePath) && - fs.statSync(bootstrapFilePath).isFile() - ) { - this.logger.verbose?.( - `Authorization bootstrap: configuration being loaded from '${bootstrapFilePath}'`, - LogContext.BOOTSTRAP - ); - const bootstratDataStr = fs.readFileSync(bootstrapFilePath).toString(); - this.logger.verbose?.(bootstratDataStr); - if (!bootstratDataStr) { - throw new BootstrapException( - 'Specified authorization bootstrap file not found!' - ); - } - bootstrapAuthorizationRolesJson = JSON.parse(bootstratDataStr); - } else { - this.logger.verbose?.( - 'Authorization bootstrap: default configuration being loaded', - LogContext.BOOTSTRAP - ); - } + this.logger.verbose?.( + 'Authorization bootstrap: default configuration being loaded', + LogContext.BOOTSTRAP + ); const users = bootstrapAuthorizationRolesJson.users; if (!users) { diff --git a/src/platform/configuration/templates/license-plans.json b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json similarity index 100% rename from src/platform/configuration/templates/license-plans.json rename to src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json diff --git a/src/platform/configuration/templates/authorization-bootstrap.json b/src/core/bootstrap/platform-template-definitions/user/users.json similarity index 100% rename from src/platform/configuration/templates/authorization-bootstrap.json rename to src/core/bootstrap/platform-template-definitions/user/users.json diff --git a/src/types/alkemio.config.ts b/src/types/alkemio.config.ts index 23b262e772..50d280cfcd 100644 --- a/src/types/alkemio.config.ts +++ b/src/types/alkemio.config.ts @@ -16,12 +16,6 @@ export type AlkemioConfig = { }; max_json_payload_size: string; }; - bootstrap: { - authorization: { - enabled: string; - file: string; - }; - }; security: { cors: { enabled: boolean; From fbe1988ae29569ae3df93f8848a2c9bb7f363a59 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Fri, 8 Nov 2024 17:27:26 +0200 Subject: [PATCH 37/42] Fixed license plans defaults --- .../license-plan/license-plans.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json index 6c7ec8fc17..1ada23c6b7 100644 --- a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json +++ b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json @@ -11,6 +11,7 @@ "requiresContactSupport": "1", "licenseCredential": "space-license-premium", "assignToNewOrganizationAccount": "0", + "assignToNewUserAccount": "0", "type": "space-plan" }, { @@ -24,6 +25,7 @@ "requiresContactSupport": "0", "licenseCredential": "space-license-plus", "assignToNewOrganizationAccount": "0", + "assignToNewUserAccount": "0", "type": "space-plan" }, { @@ -37,6 +39,7 @@ "requiresContactSupport": "0", "licenseCredential": "space-license-free", "assignToNewOrganizationAccount": "1", + "assignToNewUserAccount": "1", "type": "space-plan" }, { @@ -50,6 +53,7 @@ "requiresContactSupport": "1", "licenseCredential": "space-feature-whiteboard-multi-user", "assignToNewOrganizationAccount": "0", + "assignToNewUserAccount": "0", "type": "space-feature-flag" }, { @@ -63,6 +67,7 @@ "requiresContactSupport": "1", "licenseCredential": "account-license-plus", "assignToNewOrganizationAccount": "0", + "assignToNewUserAccount": "0", "type": "account-plan" }, { @@ -76,6 +81,7 @@ "requiresContactSupport": "1", "licenseCredential": "space-feature-virtual-contributors", "assignToNewOrganizationAccount": "1", + "assignToNewUserAccount": "1", "type": "space-feature-flag" }, { @@ -89,6 +95,7 @@ "requiresContactSupport": "1", "licenseCredential": "space-license-enterprise", "assignToNewOrganizationAccount": "0", + "assignToNewUserAccount": "0", "type": "space-plan" }, { @@ -102,6 +109,7 @@ "requiresContactSupport": "1", "licenseCredential": "space-feature-save-as-template", "assignToNewOrganizationAccount": "1", + "assignToNewUserAccount": "1", "type": "space-feature-flag" } ] From a6855b3952977b3ecd4d3d20969e5049c2f124fe Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Fri, 8 Nov 2024 18:16:41 +0200 Subject: [PATCH 38/42] proper license plans bootstrap --- .../license-plan/license-plans.json | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json index 1ada23c6b7..b1e2d61a0b 100644 --- a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json +++ b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json @@ -10,8 +10,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "space-license-premium", - "assignToNewOrganizationAccount": "0", - "assignToNewUserAccount": "0", + "assignToNewOrganizationAccounts": "0", + "assignToNewUserAccounts": "0", "type": "space-plan" }, { @@ -24,8 +24,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "0", "licenseCredential": "space-license-plus", - "assignToNewOrganizationAccount": "0", - "assignToNewUserAccount": "0", + "assignToNewOrganizationAccounts": "0", + "assignToNewUserAccounts": "0", "type": "space-plan" }, { @@ -38,8 +38,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "0", "licenseCredential": "space-license-free", - "assignToNewOrganizationAccount": "1", - "assignToNewUserAccount": "1", + "assignToNewOrganizationAccounts": "1", + "assignToNewUserAccounts": "1", "type": "space-plan" }, { @@ -52,8 +52,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "space-feature-whiteboard-multi-user", - "assignToNewOrganizationAccount": "0", - "assignToNewUserAccount": "0", + "assignToNewOrganizationAccounts": "0", + "assignToNewUserAccounts": "0", "type": "space-feature-flag" }, { @@ -66,8 +66,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "account-license-plus", - "assignToNewOrganizationAccount": "0", - "assignToNewUserAccount": "0", + "assignToNewOrganizationAccounts": "0", + "assignToNewUserAccounts": "0", "type": "account-plan" }, { @@ -80,8 +80,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "space-feature-virtual-contributors", - "assignToNewOrganizationAccount": "1", - "assignToNewUserAccount": "1", + "assignToNewOrganizationAccounts": "1", + "assignToNewUserAccounts": "1", "type": "space-feature-flag" }, { @@ -94,8 +94,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "space-license-enterprise", - "assignToNewOrganizationAccount": "0", - "assignToNewUserAccount": "0", + "assignToNewOrganizationAccounts": "0", + "assignToNewUserAccounts": "0", "type": "space-plan" }, { @@ -108,8 +108,8 @@ "requiresPaymentMethod": "0", "requiresContactSupport": "1", "licenseCredential": "space-feature-save-as-template", - "assignToNewOrganizationAccount": "1", - "assignToNewUserAccount": "1", + "assignToNewOrganizationAccounts": "1", + "assignToNewUserAccounts": "1", "type": "space-feature-flag" } ] From 5b991ba8a3384f90880112ea2da1d5789dc60526 Mon Sep 17 00:00:00 2001 From: Svetoslav Petkov Date: Mon, 11 Nov 2024 11:02:04 +0200 Subject: [PATCH 39/42] Show subspace events in Space (#4687) --- .../convert-to-entity/convert.to.entity.ts | 39 +++ src/common/utils/convert-to-entity/index.ts | 1 + .../utils/get-differences/get.diff.spec.ts | 46 ++++ src/common/utils/get-differences/get.diff.ts | 39 +++ src/common/utils/get-differences/index.ts | 1 + .../has.only.allowed.fields.spec.ts | 45 ++++ .../has.only.allowed.fields.ts | 24 ++ .../utils/has-allowed-allowed-fields/index.ts | 1 + src/common/utils/index.ts | 3 + .../space.defaults.settings.blank.slate.ts | 1 + .../space.defaults.settings.challenge.ts | 1 + .../space.defaults.settings.knowledge.ts | 1 + .../space.defaults.settings.opportunity.ts | 1 + .../space.defaults.settings.root.space.ts | 1 + ...space.settings.collaboration.dto.update.ts | 7 + .../space.settings.collaboration.interface.ts | 7 + .../space.settings/space.settings.module.ts | 2 +- src/domain/space/space/space.module.ts | 4 +- .../space/space/space.resolver.mutations.ts | 18 +- src/domain/space/space/space.service.spec.ts | 244 ++++++++++++------ src/domain/space/space/space.service.ts | 41 ++- .../timeline/calendar/calendar.module.ts | 2 + .../calendar/calendar.resolver.fields.ts | 45 ++-- .../timeline/calendar/calendar.service.ts | 138 +++++++--- .../calendar/dto/calendar.args.events.ts | 18 -- .../timeline/event/dto/event.dto.create.ts | 6 + .../timeline/event/dto/event.dto.update.ts | 6 + src/domain/timeline/event/event.entity.ts | 3 + src/domain/timeline/event/event.interface.ts | 14 + .../timeline/event/event.resolver.fields.ts | 12 +- .../event/event.resolver.mutations.ts | 8 +- src/domain/timeline/event/event.service.ts | 69 ++++- .../1731077703010-allowEventsFromSubspaces.ts | 75 ++++++ src/types/deep.select.properties.ts | 27 ++ src/types/index.ts | 2 + src/types/prefixed.type.ts | 21 ++ test/utils/repository.mock.factory.ts | 1 + 37 files changed, 803 insertions(+), 171 deletions(-) create mode 100644 src/common/utils/convert-to-entity/convert.to.entity.ts create mode 100644 src/common/utils/convert-to-entity/index.ts create mode 100644 src/common/utils/get-differences/get.diff.spec.ts create mode 100644 src/common/utils/get-differences/get.diff.ts create mode 100644 src/common/utils/get-differences/index.ts create mode 100644 src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.spec.ts create mode 100644 src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.ts create mode 100644 src/common/utils/has-allowed-allowed-fields/index.ts delete mode 100644 src/domain/timeline/calendar/dto/calendar.args.events.ts create mode 100644 src/migrations/1731077703010-allowEventsFromSubspaces.ts create mode 100644 src/types/deep.select.properties.ts create mode 100644 src/types/prefixed.type.ts diff --git a/src/common/utils/convert-to-entity/convert.to.entity.ts b/src/common/utils/convert-to-entity/convert.to.entity.ts new file mode 100644 index 0000000000..909d1aff05 --- /dev/null +++ b/src/common/utils/convert-to-entity/convert.to.entity.ts @@ -0,0 +1,39 @@ +import { PrefixKeys } from '@src/types'; + +/** + * Expects a raw entity as input and converts it to a full typeorm entity. + * The raw input is returned as a result from building typerom queries + * and returned the result as raw data. + * The entity usually is prefixed with the alias of the joined table. + * + * Example: + * await this.calendarRepository + * .createQueryBuilder('calendar') + * .where({ id: calendarId }) + * .leftJoinAndSelect( + * 'space', + * 'space', + * 'space.collaborationId = collaboration.id' + * ) + * .getRawOne>(); + * + * const space = convertToEntity(rawSpace, 'space_'); + * + * @param prefixedEntity + * @param prefix + */ +export const convertToEntity = < + T extends Record, + P extends string, +>( + prefixedEntity: PrefixKeys, + prefix: P +): T => { + return Object.keys(prefixedEntity).reduce((acc, key) => { + const newKey = key.replace(prefix, '') as keyof T; + acc[newKey] = prefixedEntity[ + key as keyof PrefixKeys + ] as unknown as T[keyof T]; + return acc; + }, {} as T); +}; diff --git a/src/common/utils/convert-to-entity/index.ts b/src/common/utils/convert-to-entity/index.ts new file mode 100644 index 0000000000..24bf7c407a --- /dev/null +++ b/src/common/utils/convert-to-entity/index.ts @@ -0,0 +1 @@ +export * from './convert.to.entity'; diff --git a/src/common/utils/get-differences/get.diff.spec.ts b/src/common/utils/get-differences/get.diff.spec.ts new file mode 100644 index 0000000000..e23a799d12 --- /dev/null +++ b/src/common/utils/get-differences/get.diff.spec.ts @@ -0,0 +1,46 @@ +import { getDiff } from './get.diff'; + +describe('getDiff', () => { + it('returns null when objects are identical', () => { + const obj1 = { a: 1, b: 2 }; + const obj2 = { a: 1, b: 2 }; + const result = getDiff(obj1, obj2); + expect(result).toBeNull(); + }); + + it('returns differences when objects have different values', () => { + const obj1 = { a: 1, b: 2 }; + const obj2 = { a: 1, b: 3 }; + const result = getDiff(obj1, obj2); + expect(result).toEqual({ b: 3 }); + }); + + it('returns differences when objects have some different nested values', () => { + const obj1 = { a: 1, b: { c: 2, d: 3 } }; + const obj2 = { a: 1, b: { c: 2, d: 4 } }; + const result = getDiff(obj1, obj2); + expect(result).toEqual({ b: { d: 4 } }); + }); + + it('returns differences when objects have all different nested values', () => { + const obj1 = { a: 1, b: { c: 2, d: 3 } }; + const obj2 = { a: 1, b: { c: 4, d: 5 } }; + const result = getDiff(obj1, obj2); + expect(result).toEqual({ b: { c: 4, d: 5 } }); + }); + + it('returns null when nested objects are identical', () => { + const obj1 = { a: 1, b: { c: 2, d: 3 } }; + const obj2 = { a: 1, b: { c: 2, d: 3 } }; + const result = getDiff(obj1, obj2); + expect(result).toBeNull(); + }); + + it('returns null when objects have different keys', () => { + type Type = { a: number; b?: number; c?: number }; + const obj1: Type = { a: 1, b: 2 }; + const obj2: Type = { a: 1, c: 3 }; + const result = getDiff(obj1, obj2); + expect(result).toBeNull(); + }); +}); diff --git a/src/common/utils/get-differences/get.diff.ts b/src/common/utils/get-differences/get.diff.ts new file mode 100644 index 0000000000..55dba00319 --- /dev/null +++ b/src/common/utils/get-differences/get.diff.ts @@ -0,0 +1,39 @@ +/** + * Compares the first object to the second and returns the differences. + * Comparison is done against the keys in obj1. + * Return __null__ if no differences are found. + * + * @template T - The type of the objects being compared. + * @param {T} obj1 - The first object to compare. + * @param {T} obj2 - The second object to compare. + * @returns {Partial | null} - A partial object containing the differences, or null if no differences are found. + */ +export const getDiff = >( + obj1: T, + obj2: T +): Partial | null => { + const result: Partial = {}; + + for (const key in obj1) { + if (obj1.hasOwnProperty(key) && obj2.hasOwnProperty(key)) { + const value1 = obj1[key]; + const value2 = obj2[key]; + + if ( + typeof value1 === 'object' && + typeof value2 === 'object' && + value1 !== null && + value2 !== null + ) { + const nestedDiff = getDiff(value1, value2); + if (nestedDiff !== null) { + result[key] = nestedDiff as T[Extract]; + } + } else if (value1 !== value2) { + result[key] = value2; + } + } + } + + return Object.keys(result).length ? result : null; +}; diff --git a/src/common/utils/get-differences/index.ts b/src/common/utils/get-differences/index.ts new file mode 100644 index 0000000000..192cbe6224 --- /dev/null +++ b/src/common/utils/get-differences/index.ts @@ -0,0 +1 @@ +export * from './get.diff'; diff --git a/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.spec.ts b/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.spec.ts new file mode 100644 index 0000000000..ec60ba226d --- /dev/null +++ b/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.spec.ts @@ -0,0 +1,45 @@ +import { hasOnlyAllowedFields } from './has.only.allowed.fields'; + +describe('hasOnlyAllowedFields', () => { + it('returns true when object contains only allowed fields', () => { + const obj = { a: 1, b: 2 }; + const allowedFields = { a: true, b: true }; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(true); + }); + + it('returns false when object contains disallowed fields', () => { + const obj = { a: 1, b: 2, c: 3 }; + const allowedFields = { a: true, b: true }; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(false); + }); + + it('returns true when nested object contains only allowed fields', () => { + const obj = { a: { b: 2 } }; + const allowedFields = { a: { b: true } }; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(true); + }); + + it('returns false when nested object contains disallowed fields', () => { + const obj = { a: { b: 2, c: 3 } }; + const allowedFields = { a: { b: true } }; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(false); + }); + + it('returns true when object is empty and allowed fields are empty', () => { + const obj = {}; + const allowedFields = {}; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(true); + }); + + it('returns false when object is not empty and allowed fields are empty', () => { + const obj = { a: 1 }; + const allowedFields = {}; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(false); + }); + + it('returns false when object contains disallowed fields with partial structure', () => { + const obj = { a: 1, b: { c: 2, d: 3 } }; + const allowedFields = { a: true, b: {} }; + expect(hasOnlyAllowedFields(obj, allowedFields)).toBe(false); + }); +}); diff --git a/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.ts b/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.ts new file mode 100644 index 0000000000..0e3c25fc44 --- /dev/null +++ b/src/common/utils/has-allowed-allowed-fields/has.only.allowed.fields.ts @@ -0,0 +1,24 @@ +import { DeepSelectProperties } from '@src/types'; + +/** + * Checks if an object contains only the allowed fields. + * + * @template T - The type of the object and allowed fields. + * @param {T} obj - The object to check. + * @param {DeepSelectProperties} allowedFields - The allowed fields, which can be a partial and nested structure. + * @returns {boolean} - Returns true if the object contains only the allowed fields, otherwise false. + */ +export const hasOnlyAllowedFields = >( + obj: T, + allowedFields: DeepSelectProperties +): boolean => { + return Object.keys(obj).every(key => { + const objValue = (obj as any)[key]; + const allowedValue = (allowedFields as any)[key]; + + if (typeof objValue === 'object' && objValue !== null) { + return hasOnlyAllowedFields(objValue, allowedValue || {}); + } + return key in allowedFields; + }); +}; diff --git a/src/common/utils/has-allowed-allowed-fields/index.ts b/src/common/utils/has-allowed-allowed-fields/index.ts new file mode 100644 index 0000000000..2894d2bc1d --- /dev/null +++ b/src/common/utils/has-allowed-allowed-fields/index.ts @@ -0,0 +1 @@ +export * from './has.only.allowed.fields'; diff --git a/src/common/utils/index.ts b/src/common/utils/index.ts index cfbd22fe84..7457d83211 100644 --- a/src/common/utils/index.ts +++ b/src/common/utils/index.ts @@ -13,3 +13,6 @@ export * from './get.session'; export * from './calculate.buffer.hash'; export * from './untildify'; export * from './path.resolve'; +export * from './get-differences'; +export * from './has-allowed-allowed-fields'; +export * from './convert-to-entity'; diff --git a/src/domain/space/space.defaults/definitions/blank-slate/space.defaults.settings.blank.slate.ts b/src/domain/space/space.defaults/definitions/blank-slate/space.defaults.settings.blank.slate.ts index 1224c2befd..92a8548390 100644 --- a/src/domain/space/space.defaults/definitions/blank-slate/space.defaults.settings.blank.slate.ts +++ b/src/domain/space/space.defaults/definitions/blank-slate/space.defaults.settings.blank.slate.ts @@ -16,5 +16,6 @@ export const spaceDefaultsSettingsBlankSlate: ISpaceSettings = { inheritMembershipRights: false, allowMembersToCreateSubspaces: false, allowMembersToCreateCallouts: false, + allowEventsFromSubspaces: true, }, }; diff --git a/src/domain/space/space.defaults/definitions/challenge/space.defaults.settings.challenge.ts b/src/domain/space/space.defaults/definitions/challenge/space.defaults.settings.challenge.ts index 8d7c8dbc2e..586bdd9267 100644 --- a/src/domain/space/space.defaults/definitions/challenge/space.defaults.settings.challenge.ts +++ b/src/domain/space/space.defaults/definitions/challenge/space.defaults.settings.challenge.ts @@ -16,5 +16,6 @@ export const spaceDefaultsSettingsChallenge: ISpaceSettings = { inheritMembershipRights: true, allowMembersToCreateSubspaces: true, allowMembersToCreateCallouts: true, + allowEventsFromSubspaces: true, }, }; diff --git a/src/domain/space/space.defaults/definitions/knowledge/space.defaults.settings.knowledge.ts b/src/domain/space/space.defaults/definitions/knowledge/space.defaults.settings.knowledge.ts index 66575d64f0..e6ab445274 100644 --- a/src/domain/space/space.defaults/definitions/knowledge/space.defaults.settings.knowledge.ts +++ b/src/domain/space/space.defaults/definitions/knowledge/space.defaults.settings.knowledge.ts @@ -16,5 +16,6 @@ export const spaceDefaultsSettingsKnowledge: ISpaceSettings = { inheritMembershipRights: false, allowMembersToCreateSubspaces: true, allowMembersToCreateCallouts: true, + allowEventsFromSubspaces: true, }, }; diff --git a/src/domain/space/space.defaults/definitions/oppportunity/space.defaults.settings.opportunity.ts b/src/domain/space/space.defaults/definitions/oppportunity/space.defaults.settings.opportunity.ts index 41782bc939..13763cb845 100644 --- a/src/domain/space/space.defaults/definitions/oppportunity/space.defaults.settings.opportunity.ts +++ b/src/domain/space/space.defaults/definitions/oppportunity/space.defaults.settings.opportunity.ts @@ -16,5 +16,6 @@ export const spaceDefaultsSettingsOpportunity: ISpaceSettings = { inheritMembershipRights: true, allowMembersToCreateSubspaces: true, allowMembersToCreateCallouts: true, + allowEventsFromSubspaces: true, }, }; diff --git a/src/domain/space/space.defaults/definitions/root-space/space.defaults.settings.root.space.ts b/src/domain/space/space.defaults/definitions/root-space/space.defaults.settings.root.space.ts index 9d391f398e..693e4c83e2 100644 --- a/src/domain/space/space.defaults/definitions/root-space/space.defaults.settings.root.space.ts +++ b/src/domain/space/space.defaults/definitions/root-space/space.defaults.settings.root.space.ts @@ -16,5 +16,6 @@ export const spaceDefaultsSettingsRootSpace: ISpaceSettings = { inheritMembershipRights: false, allowMembersToCreateSubspaces: false, allowMembersToCreateCallouts: false, + allowEventsFromSubspaces: true, }, }; diff --git a/src/domain/space/space.settings/dto/space.settings.collaboration.dto.update.ts b/src/domain/space/space.settings/dto/space.settings.collaboration.dto.update.ts index 952c20a3d8..4fe4fb5a01 100644 --- a/src/domain/space/space.settings/dto/space.settings.collaboration.dto.update.ts +++ b/src/domain/space/space.settings/dto/space.settings.collaboration.dto.update.ts @@ -20,4 +20,11 @@ export class UpdateSpaceSettingsCollaborationInput { 'Flag to control if ability to contribute is inherited from parent Space.', }) inheritMembershipRights!: boolean; + + @Field(() => Boolean, { + nullable: false, + description: + 'Flag to control if events from Subspaces are visible on this Space calendar as well.', + }) + allowEventsFromSubspaces!: boolean; } diff --git a/src/domain/space/space.settings/space.settings.collaboration.interface.ts b/src/domain/space/space.settings/space.settings.collaboration.interface.ts index 575670a107..1a1574bcdc 100644 --- a/src/domain/space/space.settings/space.settings.collaboration.interface.ts +++ b/src/domain/space/space.settings/space.settings.collaboration.interface.ts @@ -20,4 +20,11 @@ export abstract class ISpaceSettingsCollaboration { 'Flag to control if ability to contribute is inherited from parent Space.', }) inheritMembershipRights!: boolean; + + @Field(() => Boolean, { + nullable: false, + description: + 'Flag to control if events from Subspaces are visible on this Space calendar as well.', + }) + allowEventsFromSubspaces!: boolean; } diff --git a/src/domain/space/space.settings/space.settings.module.ts b/src/domain/space/space.settings/space.settings.module.ts index f06df4921a..7c379c4520 100644 --- a/src/domain/space/space.settings/space.settings.module.ts +++ b/src/domain/space/space.settings/space.settings.module.ts @@ -6,4 +6,4 @@ import { SpaceSettingsService } from './space.settings.service'; providers: [SpaceSettingsService], exports: [SpaceSettingsService], }) -export class SpaceSettingssModule {} +export class SpaceSettingsModule {} diff --git a/src/domain/space/space/space.module.ts b/src/domain/space/space/space.module.ts index d528fab4d2..2dcdb33ed1 100644 --- a/src/domain/space/space/space.module.ts +++ b/src/domain/space/space/space.module.ts @@ -22,7 +22,7 @@ import { CommunityModule } from '@domain/community/community/community.module'; import { StorageAggregatorModule } from '@domain/storage/storage-aggregator/storage.aggregator.module'; import { PlatformAuthorizationPolicyModule } from '@platform/authorization/platform.authorization.policy.module'; import { NamingModule } from '@services/infrastructure/naming/naming.module'; -import { SpaceSettingssModule } from '../space.settings/space.settings.module'; +import { SpaceSettingsModule } from '../space.settings/space.settings.module'; import { AccountHostModule } from '../account.host/account.host.module'; import { LicensingModule } from '@platform/licensing/licensing.module'; import { LicenseEngineModule } from '@core/license-engine/license.engine.module'; @@ -47,7 +47,7 @@ import { SpaceDefaultsModule } from '../space.defaults/space.defaults.module'; NamingModule, PlatformAuthorizationPolicyModule, TemplatesManagerModule, - SpaceSettingssModule, + SpaceSettingsModule, StorageAggregatorModule, ContributionReporterModule, CollaborationModule, diff --git a/src/domain/space/space/space.resolver.mutations.ts b/src/domain/space/space/space.resolver.mutations.ts index 02c7625512..3a95dc52a7 100644 --- a/src/domain/space/space/space.resolver.mutations.ts +++ b/src/domain/space/space/space.resolver.mutations.ts @@ -122,15 +122,23 @@ export class SpaceResolverMutations { `space settings update: ${space.id}` ); + const shouldUpdateAuthorization = + await this.spaceService.shouldUpdateAuthorizationPolicy( + space.id, + settingsData.settings + ); + space = await this.spaceService.updateSpaceSettings(space, settingsData); space = await this.spaceService.save(space); - // As the settings may update the authorization for the Space, the authorization policy will need to be reset - const updatedAuthorizations = - await this.spaceAuthorizationService.applyAuthorizationPolicy(space); - await this.authorizationPolicyService.saveAll(updatedAuthorizations); + // but not all settings will require this, so only update if necessary + if (shouldUpdateAuthorization) { + const updatedAuthorizations = + await this.spaceAuthorizationService.applyAuthorizationPolicy(space); + await this.authorizationPolicyService.saveAll(updatedAuthorizations); + } - return await this.spaceService.getSpaceOrFail(space.id); + return this.spaceService.getSpaceOrFail(space.id); } @UseGuards(GraphqlGuard) diff --git a/src/domain/space/space/space.service.spec.ts b/src/domain/space/space/space.service.spec.ts index d870dd0779..0caa8f9ac9 100644 --- a/src/domain/space/space/space.service.spec.ts +++ b/src/domain/space/space/space.service.spec.ts @@ -18,11 +18,15 @@ import { SpaceType } from '@common/enums/space.type'; import { SpaceLevel } from '@common/enums/space.level'; import { AuthorizationPolicyType } from '@common/enums/authorization.policy.type'; import { AccountType } from '@common/enums/account.type'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { ISpaceSettings } from '@domain/space/space.settings/space.settings.interface'; const moduleMocker = new ModuleMocker(global); describe('SpaceService', () => { let service: SpaceService; + let spaceRepository: Repository; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ @@ -37,11 +41,176 @@ describe('SpaceService', () => { .compile(); service = module.get(SpaceService); + spaceRepository = module.get>(getRepositoryToken(Space)); }); it('should be defined', () => { expect(service).toBeDefined(); }); + + describe('shouldUpdateAuthorizationPolicy', () => { + it('returns false if there is no difference in settings', async () => { + const spaceId = '1'; + const settingsData = { + collaboration: { allowEventsFromSubspaces: true }, + } as ISpaceSettings; + const space = { + id: spaceId, + settingsStr: JSON.stringify(settingsData), + } as Space; + + jest.spyOn(spaceRepository, 'findOneOrFail').mockResolvedValue(space); + jest.spyOn(service, 'getSettings').mockReturnValue(settingsData); + + const result = await service.shouldUpdateAuthorizationPolicy( + spaceId, + settingsData + ); + expect(result).toBe(false); + }); + + it('returns true if there is a difference in settings outside allowed fields', async () => { + const spaceId = '1'; + const settingsData = { + collaboration: { + allowEventsFromSubspaces: false, + allowMembersToCreateSubspaces: false, + }, + } as ISpaceSettings; + const originalSettings = { + collaboration: { + allowEventsFromSubspaces: true, + allowMembersToCreateSubspaces: true, + }, + } as ISpaceSettings; + const space = { + id: spaceId, + settingsStr: JSON.stringify(originalSettings), + } as Space; + + jest.spyOn(spaceRepository, 'findOneOrFail').mockResolvedValue(space); + jest.spyOn(service, 'getSettings').mockReturnValue(originalSettings); + + const result = await service.shouldUpdateAuthorizationPolicy( + spaceId, + settingsData + ); + expect(result).toBe(true); + }); + + it('returns false if the difference is only in allowed fields', async () => { + const spaceId = '1'; + const settingsData = { + collaboration: { allowEventsFromSubspaces: false }, + } as ISpaceSettings; + const originalSettings = { + collaboration: { allowEventsFromSubspaces: true }, + } as ISpaceSettings; + const space = { + id: spaceId, + settingsStr: JSON.stringify(originalSettings), + } as Space; + + jest.spyOn(spaceRepository, 'findOneOrFail').mockResolvedValue(space); + jest.spyOn(service, 'getSettings').mockReturnValue(originalSettings); + + const result = await service.shouldUpdateAuthorizationPolicy( + spaceId, + settingsData + ); + expect(result).toBe(false); + }); + + it('throws an error if space is not found', async () => { + const spaceId = '1'; + const settingsData = { + collaboration: { allowEventsFromSubspaces: true }, + } as ISpaceSettings; + + jest + .spyOn(spaceRepository, 'findOneOrFail') + .mockRejectedValue(new Error('Space not found')); + + await expect( + service.shouldUpdateAuthorizationPolicy(spaceId, settingsData) + ).rejects.toThrow('Space not found'); + }); + }); +}); + +/** + * Active spaces go first and then all the Demo spaces + * In those two groups, Public spaces go first + * And then they are sorted by number of challenges and number of opportunities + */ +describe('SpacesSorting', () => { + let service: SpaceService; + let filterService: SpaceFilterService; + + beforeEach(async () => { + const filterModule: TestingModule = await Test.createTestingModule({ + providers: [SpaceFilterService, MockCacheManager, MockWinstonProvider], + }) + .useMocker(defaultMockerFactory) + .compile(); + filterService = filterModule.get(SpaceFilterService); + + const module: TestingModule = await Test.createTestingModule({ + providers: [ + SpaceService, + MockCacheManager, + MockWinstonProvider, + repositoryProviderMockFactory(Space), + ], + }) + .useMocker(injectionToken => { + // SpaceFilterService should be a real one and not mocked. + if (typeof injectionToken === 'function') { + const mockMetadata = moduleMocker.getMetadata( + injectionToken + ) as MockFunctionMetadata; + if (mockMetadata.name === 'SpaceFilterService') { + return filterService; + } + } + // The rest of the dependencies can be mocks + return defaultMockerFactory(injectionToken); + }) + .compile(); + + service = module.get(SpaceService); + }); + + it('Sorting test', () => { + const activeDemoSpaces = getFilteredSpaces(spaceTestData, [ + SpaceVisibility.ACTIVE, + SpaceVisibility.DEMO, + ]); + const result = service['sortSpacesDefault'](activeDemoSpaces); + expect(JSON.stringify(result)).toBe( + '["6","2","1","5","9","3","8","4","10"]' + ); + }); + it('Filtering test 1', () => { + const activeSpaces = getFilteredSpaces(spaceTestData, [ + SpaceVisibility.ACTIVE, + ]); + const result = service['sortSpacesDefault'](activeSpaces); + + expect(JSON.stringify(result)).toBe('["6","2","1","5","9"]'); + }); + it('Filtering test 2', () => { + const demoSpaces = getFilteredSpaces(spaceTestData, [SpaceVisibility.DEMO]); + const result = service['sortSpacesDefault'](demoSpaces); + expect(JSON.stringify(result)).toBe('["3","8","4","10"]'); + }); + it('Filtering test 3', () => { + const archivedSpaces = getFilteredSpaces(spaceTestData, [ + SpaceVisibility.ARCHIVED, + ]); + const result = service['sortSpacesDefault'](archivedSpaces); + expect(JSON.stringify(result)).toBe('["7"]'); + }); }); /** @@ -405,78 +574,3 @@ const spaceTestData: Space[] = [ opportunitiesCounts: [1, 2, 0], }), ]; - -/** - * Active spaces go first and then all the Demo spaces - * In those two groups, Public spaces go first - * And then they are sorted by number of challenges and number of opportunities - */ -describe('SpacesSorting', () => { - let service: SpaceService; - let filterService: SpaceFilterService; - - beforeEach(async () => { - const filterModule: TestingModule = await Test.createTestingModule({ - providers: [SpaceFilterService, MockCacheManager, MockWinstonProvider], - }) - .useMocker(defaultMockerFactory) - .compile(); - filterService = filterModule.get(SpaceFilterService); - - const module: TestingModule = await Test.createTestingModule({ - providers: [ - SpaceService, - MockCacheManager, - MockWinstonProvider, - repositoryProviderMockFactory(Space), - ], - }) - .useMocker(injectionToken => { - // SpaceFilterService should be a real one and not mocked. - if (typeof injectionToken === 'function') { - const mockMetadata = moduleMocker.getMetadata( - injectionToken - ) as MockFunctionMetadata; - if (mockMetadata.name === 'SpaceFilterService') { - return filterService; - } - } - // The rest of the dependencies can be mocks - return defaultMockerFactory(injectionToken); - }) - .compile(); - - service = module.get(SpaceService); - }); - - it('Sorting test', () => { - const activeDemoSpaces = getFilteredSpaces(spaceTestData, [ - SpaceVisibility.ACTIVE, - SpaceVisibility.DEMO, - ]); - const result = service['sortSpacesDefault'](activeDemoSpaces); - expect(JSON.stringify(result)).toBe( - '["6","2","1","5","9","3","8","4","10"]' - ); - }); - it('Filtering test 1', () => { - const activeSpaces = getFilteredSpaces(spaceTestData, [ - SpaceVisibility.ACTIVE, - ]); - const result = service['sortSpacesDefault'](activeSpaces); - - expect(JSON.stringify(result)).toBe('["6","2","1","5","9"]'); - }); - it('Filtering test 2', () => { - const demoSpaces = getFilteredSpaces(spaceTestData, [SpaceVisibility.DEMO]); - const result = service['sortSpacesDefault'](demoSpaces); - expect(JSON.stringify(result)).toBe('["3","8","4","10"]'); - }); - it('Filtering test 3', () => { - const archivedSpaces = getFilteredSpaces(spaceTestData, [ - SpaceVisibility.ARCHIVED, - ]); - const result = service['sortSpacesDefault'](archivedSpaces); - expect(JSON.stringify(result)).toBe('["7"]'); - }); -}); diff --git a/src/domain/space/space/space.service.ts b/src/domain/space/space/space.service.ts index 6d7437813b..5e32f5627b 100644 --- a/src/domain/space/space/space.service.ts +++ b/src/domain/space/space/space.service.ts @@ -14,7 +14,14 @@ import { ICommunity } from '@domain/community/community'; import { IContext } from '@domain/context/context'; import { Inject, Injectable, LoggerService } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { FindManyOptions, FindOneOptions, In, Not, Repository } from 'typeorm'; +import { + DeepPartial, + FindManyOptions, + FindOneOptions, + In, + Not, + Repository, +} from 'typeorm'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; import { Space } from './space.entity'; import { ISpace } from './space.interface'; @@ -79,6 +86,7 @@ import { TemplateDefaultType } from '@common/enums/template.default.type'; import { CreateTemplatesManagerInput } from '@domain/template/templates-manager/dto/templates.manager.dto.create'; import { ITemplatesManager } from '@domain/template/templates-manager'; import { Activity } from '@platform/activity'; +import { getDiff, hasOnlyAllowedFields } from '@common/utils'; const EXPLORE_SPACES_LIMIT = 30; const EXPLORE_SPACES_ACTIVITY_DAYS_OLD = 30; @@ -764,6 +772,37 @@ export class SpaceService { return await this.updateSettings(space, settingsData.settings); } + /** + * Should the authorization policy be updated based on the update settings. + * Some setting do not require an update to the authorization policy. + * @param spaceId + * @param settingsData + */ + public async shouldUpdateAuthorizationPolicy( + spaceId: string, + settingsData: UpdateSpaceSettingsEntityInput + ): Promise { + const space = await this.spaceRepository.findOneOrFail({ + where: { id: spaceId }, + select: { id: true, settingsStr: true }, + }); + + const originalSettings = this.getSettings(space as ISpace); + // compare the new values from the incoming update request with the original settings + const difference = getDiff(settingsData, originalSettings); + // if there is no difference, then no need to update the authorization policy + if (difference === null) { + return false; + } + // if a difference was detected, check if the difference is in the allowed fields + // if another field was updated, outside the allowed list, the auth policy has to be updated + return !hasOnlyAllowedFields(difference, { + collaboration: { + allowEventsFromSubspaces: true, + }, + }); + } + async getSubspaces( space: ISpace, args?: LimitAndShuffleIdsQueryArgs diff --git a/src/domain/timeline/calendar/calendar.module.ts b/src/domain/timeline/calendar/calendar.module.ts index daa47558fd..3268b17839 100644 --- a/src/domain/timeline/calendar/calendar.module.ts +++ b/src/domain/timeline/calendar/calendar.module.ts @@ -13,6 +13,7 @@ import { EntityResolverModule } from '@services/infrastructure/entity-resolver/e import { ActivityAdapterModule } from '@services/adapters/activity-adapter/activity.adapter.module'; import { ContributionReporterModule } from '@services/external/elasticsearch/contribution-reporter'; import { StorageAggregatorResolverModule } from '@services/infrastructure/storage-aggregator-resolver/storage.aggregator.resolver.module'; +import { SpaceSettingsModule } from '@domain/space/space.settings/space.settings.module'; @Module({ imports: [ @@ -24,6 +25,7 @@ import { StorageAggregatorResolverModule } from '@services/infrastructure/storag EntityResolverModule, ActivityAdapterModule, StorageAggregatorResolverModule, + SpaceSettingsModule, TypeOrmModule.forFeature([Calendar]), ], providers: [ diff --git a/src/domain/timeline/calendar/calendar.resolver.fields.ts b/src/domain/timeline/calendar/calendar.resolver.fields.ts index 258d8194f1..335b9a57c2 100644 --- a/src/domain/timeline/calendar/calendar.resolver.fields.ts +++ b/src/domain/timeline/calendar/calendar.resolver.fields.ts @@ -6,16 +6,20 @@ import { AuthorizationAgentPrivilege, CurrentUser, } from '@src/common/decorators'; -import { ICalendar } from './calendar.interface'; -import { ICalendarEvent } from '../event/event.interface'; import { AgentInfo } from '@core/authentication.agent.info/agent.info'; -import { CalendarArgsEvents } from './dto/calendar.args.events'; import { CalendarService } from './calendar.service'; import { UUID_NAMEID } from '@domain/common/scalars'; +import { SpaceLevel } from '@common/enums/space.level'; +import { SpaceSettingsService } from '@domain/space/space.settings/space.settings.service'; +import { ICalendarEvent } from '../event/event.interface'; +import { ICalendar } from './calendar.interface'; @Resolver(() => ICalendar) export class CalendarResolverFields { - constructor(private calendarService: CalendarService) {} + constructor( + private calendarService: CalendarService, + private spaceSettingsService: SpaceSettingsService + ) {} @AuthorizationAgentPrivilege(AuthorizationPrivilege.READ) @ResolveField('event', () => ICalendarEvent, { @@ -32,31 +36,36 @@ export class CalendarResolverFields { type: () => UUID_NAMEID, description: 'The ID or NAMEID of the CalendarEvent', }) - ID: string + idOrNameId: string ): Promise { - const results = await this.calendarService.getCalendarEventsArgs( - calendar, - { IDs: [ID] }, - agentInfo - ); - return results[0]; + return this.calendarService.getCalendarEvent(calendar.id, idOrNameId); } @AuthorizationAgentPrivilege(AuthorizationPrivilege.READ) @UseGuards(GraphqlGuard) @ResolveField('events', () => [ICalendarEvent], { - nullable: true, + nullable: false, description: 'The list of CalendarEvents for this Calendar.', }) - async events( + public async events( @Parent() calendar: ICalendar, - @CurrentUser() agentInfo: AgentInfo, - @Args({ nullable: true }) args: CalendarArgsEvents + @CurrentUser() agentInfo: AgentInfo ) { - return await this.calendarService.getCalendarEventsArgs( + const space = await this.calendarService.getSpaceFromCalendarOrFail( + calendar.id + ); + + const spaceSettings = this.spaceSettingsService.getSettings( + space.settingsStr + ); + + const shouldSubspaceEventsBubble = + spaceSettings.collaboration.allowEventsFromSubspaces; + + return this.calendarService.getCalendarEvents( calendar, - args, - agentInfo + agentInfo, + shouldSubspaceEventsBubble ? space.id : undefined ); } } diff --git a/src/domain/timeline/calendar/calendar.service.ts b/src/domain/timeline/calendar/calendar.service.ts index 1acb0eb01d..46ef7216cb 100644 --- a/src/domain/timeline/calendar/calendar.service.ts +++ b/src/domain/timeline/calendar/calendar.service.ts @@ -2,7 +2,6 @@ import { AuthorizationPrivilege } from '@common/enums/authorization.privilege'; import { LogContext } from '@common/enums/logging.context'; import { EntityNotFoundException } from '@common/exceptions/entity.not.found.exception'; import { ValidationException } from '@common/exceptions/validation.exception'; -import { limitAndShuffle } from '@common/utils/limitAndShuffle'; import { AgentInfo } from '@core/authentication.agent.info/agent.info'; import { AuthorizationService } from '@core/authorization/authorization.service'; import { AuthorizationPolicy } from '@domain/common/authorization-policy/authorization.policy.entity'; @@ -16,7 +15,6 @@ import { ICalendarEvent } from '../event/event.interface'; import { CalendarEventService } from '../event/event.service'; import { Calendar } from './calendar.entity'; import { ICalendar } from './calendar.interface'; -import { CalendarArgsEvents } from './dto/calendar.args.events'; import { CreateCalendarEventOnCalendarInput } from './dto/calendar.dto.create.event'; import { ActivityInputCalendarEventCreated } from '@services/adapters/activity-adapter/dto/activity.dto.input.calendar.event.created'; import { ActivityAdapter } from '@services/adapters/activity-adapter/activity.adapter'; @@ -24,6 +22,14 @@ import { TimelineResolverService } from '@services/infrastructure/entity-resolve import { ContributionReporterService } from '@services/external/elasticsearch/contribution-reporter'; import { StorageAggregatorResolverService } from '@services/infrastructure/storage-aggregator-resolver/storage.aggregator.resolver.service'; import { AuthorizationPolicyType } from '@common/enums/authorization.policy.type'; +import { ISpace } from '@domain/space/space/space.interface'; +import { PrefixKeys } from '@src/types'; +import { Space } from '@domain/space/space/space.entity'; +import { convertToEntity } from '@common/utils/convert-to-entity'; +import { Collaboration } from '@domain/collaboration/collaboration'; +import { Timeline } from '@domain/timeline/timeline/timeline.entity'; +import { CalendarEvent } from '@domain/timeline/event'; +import { SpaceLevel } from '@common/enums/space.level'; @Injectable() export class CalendarService { @@ -86,17 +92,37 @@ export class CalendarService { return calendar; } - public async getCalendarEvents( - calendar: ICalendar + public async getCalendarEventsFromSubspaces( + rootSpaceId: string ): Promise { - const events = calendar.events; - if (!events) - throw new EntityNotFoundException( - `Undefined calendar events found: ${calendar.id}`, - LogContext.CALENDAR - ); + const result = await this.calendarRepository.manager + .createQueryBuilder(Space, 'subspace') + // if all the subspaces must be included change the statement + // to be levelZeroSpace = spaceId and level > space level + .where({ + parentSpace: { id: rootSpaceId }, + level: SpaceLevel.CHALLENGE, + }) + .leftJoin( + Collaboration, + 'collaboration', + 'collaboration.id = subspace.collaborationId' + ) + .leftJoin(Timeline, 'timeline', 'timeline.id = collaboration.timelineId') + .leftJoin(Calendar, 'calendar', 'calendar.id = timeline.calendarId') + .leftJoin( + CalendarEvent, + 'calendarEvent', + 'calendarEvent.calendarId = calendar.id' + ) + // cannot find alias when using relations https://github.com/typeorm/typeorm/issues/2707 + .andWhere('calendarEvent.visibleOnParentCalendar = true') + .andWhere('calendarEvent.id IS NOT NULL') + .select('calendarEvent.id') + .getRawMany>(); - return events; + const ids = result.map(({ calendarEvent_id }) => calendarEvent_id); + return this.calendarEventService.getCalendarEvents(ids); } public async createCalendarEvent( @@ -140,50 +166,49 @@ export class CalendarService { return await this.calendarEventService.save(calendarEvent); } - public async getCalendarEventsArgs( + public async getCalendarEvents( calendar: ICalendar, - args: CalendarArgsEvents, - agentInfo: AgentInfo + agentInfo: AgentInfo, + rootSpaceId?: string ): Promise { const calendarLoaded = await this.getCalendarOrFail(calendar.id, { relations: { events: true }, }); - const allEvents = calendarLoaded.events; - if (!allEvents) + const events = calendarLoaded.events; + if (!events) { throw new EntityNotFoundException( - `Calendar not initialised, no events: ${calendar.id}`, + `Events not initialized on Calendar: ${calendar.id}`, LogContext.CALENDAR ); + } - // First filter the events the current user has READ privilege to - const readableEvents = allEvents.filter(event => - this.hasAgentAccessToEvent(event, agentInfo) - ); - - // (a) by IDs, results in order specified by IDs - if (args.IDs) { - const results: ICalendarEvent[] = []; - for (const eventID of args.IDs) { - const event = readableEvents.find( - e => e.id === eventID || e.nameID === eventID - ); - - if (!event) - throw new EntityNotFoundException( - `Event with requested ID (${eventID}) not located within current Calendar: ${calendar.id}`, - LogContext.CALENDAR - ); - results.push(event); - } - return results; + if (rootSpaceId) { + const subspaceEvents = + await this.getCalendarEventsFromSubspaces(rootSpaceId); + events.push(...subspaceEvents); } - // (b) limit number of results - if (args.limit) { - return limitAndShuffle(readableEvents, args.limit, false); + // First filter the events the current user has READ privilege to + return events.filter(event => this.hasAgentAccessToEvent(event, agentInfo)); + } + + public async getCalendarEvent( + calendarId: string, + idOrNameId: string + ): Promise { + const event = await this.calendarEventService.getCalendarEvent( + calendarId, + idOrNameId + ); + if (!event) { + throw new EntityNotFoundException( + 'Event not found in Calendar', + LogContext.CALENDAR, + { calendarId, eventId: idOrNameId } + ); } - return readableEvents; + return event; } private hasAgentAccessToEvent( @@ -197,6 +222,35 @@ export class CalendarService { ); } + public async getSpaceFromCalendarOrFail(calendarId: string): Promise { + const spaceAlias = 'space'; + const rawSpace = await this.calendarRepository + .createQueryBuilder('calendar') + .where({ id: calendarId }) + .leftJoin('timeline', 'timeline', 'timeline.calendarId = calendar.id') + .leftJoin( + 'collaboration', + 'collaboration', + 'collaboration.timelineId = timeline.id' + ) + .leftJoinAndSelect( + 'space', + spaceAlias, + 'space.collaborationId = collaboration.id' + ) + .getRawOne>(); + + if (!rawSpace) { + throw new EntityNotFoundException( + 'Space not found for Calendar', + LogContext.CALENDAR, + { calendarId } + ); + } + // todo: not needed when using select instead of leftJoinAndSelect + return convertToEntity(rawSpace, 'space_'); + } + public async processActivityCalendarEventCreated( calendar: ICalendar, calendarEvent: ICalendarEvent, diff --git a/src/domain/timeline/calendar/dto/calendar.args.events.ts b/src/domain/timeline/calendar/dto/calendar.args.events.ts deleted file mode 100644 index 75ae44443a..0000000000 --- a/src/domain/timeline/calendar/dto/calendar.args.events.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { UUID_NAMEID } from '@domain/common/scalars'; -import { ArgsType, Field, Float } from '@nestjs/graphql'; - -@ArgsType() -export class CalendarArgsEvents { - @Field(() => [UUID_NAMEID], { - description: 'The IDs or NAMEIDS of the CalendarEvents to return', - nullable: true, - }) - IDs?: string[]; - - @Field(() => Float, { - description: - 'The number of CalendarEvents to return; if omitted return all CalendarEvents.', - nullable: true, - }) - limit?: number; -} diff --git a/src/domain/timeline/event/dto/event.dto.create.ts b/src/domain/timeline/event/dto/event.dto.create.ts index 8d31d79def..f288b1cd05 100644 --- a/src/domain/timeline/event/dto/event.dto.create.ts +++ b/src/domain/timeline/event/dto/event.dto.create.ts @@ -45,4 +45,10 @@ export class CreateCalendarEventInput extends CreateNameableInput { }) @IsOptional() durationDays!: number; + + @Field(() => Boolean, { + nullable: false, + description: 'Is the event visible on the parent calendar.', + }) + visibleOnParentCalendar!: boolean; } diff --git a/src/domain/timeline/event/dto/event.dto.update.ts b/src/domain/timeline/event/dto/event.dto.update.ts index fc3a84a061..95986bb957 100644 --- a/src/domain/timeline/event/dto/event.dto.update.ts +++ b/src/domain/timeline/event/dto/event.dto.update.ts @@ -42,4 +42,10 @@ export class UpdateCalendarEventInput extends UpdateNameableInput { }) @IsOptional() durationDays!: number; + + @Field(() => Boolean, { + nullable: true, + description: 'Is the event visible on the parent calendar.', + }) + visibleOnParentCalendar?: boolean; } diff --git a/src/domain/timeline/event/event.entity.ts b/src/domain/timeline/event/event.entity.ts index e61aec04ec..bc5b84892d 100644 --- a/src/domain/timeline/event/event.entity.ts +++ b/src/domain/timeline/event/event.entity.ts @@ -52,6 +52,9 @@ export class CalendarEvent extends NameableEntity implements ICalendarEvent { @Column('int', { nullable: true }) durationDays?: number; + @Column('boolean', { nullable: false }) + visibleOnParentCalendar!: boolean; + constructor() { super(); } diff --git a/src/domain/timeline/event/event.interface.ts b/src/domain/timeline/event/event.interface.ts index d5b60e1e8a..35a04d532e 100644 --- a/src/domain/timeline/event/event.interface.ts +++ b/src/domain/timeline/event/event.interface.ts @@ -3,6 +3,7 @@ import { ICalendar } from '../calendar/calendar.interface'; import { CalendarEventType } from '@common/enums/calendar.event.type'; import { INameable } from '@domain/common/entity/nameable-entity/nameable.interface'; import { IRoom } from '@domain/communication/room/room.interface'; +import { ISpace } from '@domain/space/space/space.interface'; @ObjectType('CalendarEvent') export abstract class ICalendarEvent extends INameable { @@ -47,4 +48,17 @@ export abstract class ICalendarEvent extends INameable { description: 'The length of the event in days.', }) durationDays?: number; + + @Field(() => Boolean, { + nullable: false, + description: 'Is the event visible on the parent calendar.', + }) + visibleOnParentCalendar!: boolean; + + @Field(() => ISpace, { + nullable: true, + description: + 'Which Subspace is this event part of. Only applicable if the Space has this option enabled.', + }) + subspace?: ISpace; } diff --git a/src/domain/timeline/event/event.resolver.fields.ts b/src/domain/timeline/event/event.resolver.fields.ts index 39887b4b5c..6e6cab9ee7 100644 --- a/src/domain/timeline/event/event.resolver.fields.ts +++ b/src/domain/timeline/event/event.resolver.fields.ts @@ -10,6 +10,7 @@ import { IUser } from '@domain/community/user/user.interface'; import { ICalendarEvent } from './event.interface'; import { CalendarEventService } from './event.service'; import { ContributorLookupService } from '@services/infrastructure/contributor-lookup/contributor.lookup.service'; +import { ISpace } from '@domain/space/space/space.interface'; @Resolver(() => ICalendarEvent) export class CalendarEventResolverFields { @@ -54,7 +55,7 @@ export class CalendarEventResolverFields { }) @Profiling.api async profile(@Parent() calendarEvent: ICalendarEvent): Promise { - return await this.calendarEventService.getProfile(calendarEvent); + return await this.calendarEventService.getProfileOrFail(calendarEvent); } @ResolveField('startDate', () => Date, { @@ -64,4 +65,13 @@ export class CalendarEventResolverFields { startDate(@Parent() event: ICalendarEvent): Date { return event.startDate; } + + @ResolveField('subspace', () => ISpace, { + nullable: true, + description: + 'The subspace associated with this CalendarEvent. Only applicable if the event is not part of this Space calendar', + }) + subspace(@Parent() event: ICalendarEvent): Promise { + return this.calendarEventService.getSubspace(event); + } } diff --git a/src/domain/timeline/event/event.resolver.mutations.ts b/src/domain/timeline/event/event.resolver.mutations.ts index c057fc781f..81fb22adb4 100644 --- a/src/domain/timeline/event/event.resolver.mutations.ts +++ b/src/domain/timeline/event/event.resolver.mutations.ts @@ -27,13 +27,13 @@ export class CalendarEventResolverMutations { ): Promise { const calendarEvent = await this.calendarEventService.getCalendarEventOrFail(deleteData.ID); - await this.authorizationService.grantAccessOrFail( + this.authorizationService.grantAccessOrFail( agentInfo, calendarEvent.authorization, AuthorizationPrivilege.DELETE, `delete calendarEvent: ${calendarEvent.id}` ); - return await this.calendarEventService.deleteCalendarEvent(deleteData); + return this.calendarEventService.deleteCalendarEvent(deleteData); } @UseGuards(GraphqlGuard) @@ -46,12 +46,12 @@ export class CalendarEventResolverMutations { ): Promise { const calendarEvent = await this.calendarEventService.getCalendarEventOrFail(eventData.ID); - await this.authorizationService.grantAccessOrFail( + this.authorizationService.grantAccessOrFail( agentInfo, calendarEvent.authorization, AuthorizationPrivilege.UPDATE, `update calendarEvent: ${calendarEvent.id}` ); - return await this.calendarEventService.updateCalendarEvent(eventData); + return this.calendarEventService.updateCalendarEvent(eventData); } } diff --git a/src/domain/timeline/event/event.service.ts b/src/domain/timeline/event/event.service.ts index 09712d958d..0aff68fa4b 100644 --- a/src/domain/timeline/event/event.service.ts +++ b/src/domain/timeline/event/event.service.ts @@ -1,7 +1,7 @@ import { Inject, Injectable, LoggerService } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; -import { FindOneOptions, Repository } from 'typeorm'; +import { FindOneOptions, In, Repository } from 'typeorm'; import { EntityNotFoundException } from '@common/exceptions'; import { LogContext, ProfileType } from '@common/enums'; import { AuthorizationPolicy } from '@domain/common/authorization-policy'; @@ -18,6 +18,12 @@ import { RoomType } from '@common/enums/room.type'; import { TagsetReservedName } from '@common/enums/tagset.reserved.name'; import { IStorageAggregator } from '@domain/storage/storage-aggregator/storage.aggregator.interface'; import { AuthorizationPolicyType } from '@common/enums/authorization.policy.type'; +import { ISpace } from '@domain/space/space/space.interface'; +import { Calendar } from '@domain/timeline/calendar/calendar.entity'; +import { Timeline } from '@domain/timeline/timeline/timeline.entity'; +import { Collaboration } from '@domain/collaboration/collaboration'; +import { Space } from '@domain/space/space/space.entity'; +import { SpaceLevel } from '@common/enums/space.level'; @Injectable() export class CalendarEventService { @@ -140,9 +146,11 @@ export class CalendarEventService { calendarEvent.type = calendarEventData.type; } - await this.calendarEventRepository.save(calendarEvent); + calendarEvent.visibleOnParentCalendar = + calendarEventData.visibleOnParentCalendar ?? + calendarEvent.visibleOnParentCalendar; - return calendarEvent; + return this.calendarEventRepository.save(calendarEvent); } public async saveCalendarEvent( @@ -151,7 +159,37 @@ export class CalendarEventService { return await this.calendarEventRepository.save(calendarEvent); } - public async getProfile(calendarEvent: ICalendarEvent): Promise { + public getCalendarEvent( + calendarId: string, + idOrNameId: string + ): Promise { + return this.calendarEventRepository.findOneOrFail({ + where: [ + { + id: idOrNameId, + calendar: { + id: calendarId, + }, + }, + { + nameID: idOrNameId, + calendar: { + id: calendarId, + }, + }, + ], + }); + } + + public getCalendarEvents(eventIds: string[]): Promise { + return this.calendarEventRepository.findBy({ + id: In(eventIds), + }); + } + + public async getProfileOrFail( + calendarEvent: ICalendarEvent + ): Promise { const calendarEventLoaded = await this.getCalendarEventOrFail( calendarEvent.id, { @@ -167,6 +205,29 @@ export class CalendarEventService { return calendarEventLoaded.profile; } + public getSubspace( + calendarEvent: ICalendarEvent + ): Promise { + return this.calendarEventRepository + .createQueryBuilder('calendarEvent') + .leftJoin(Calendar, 'calendar', 'calendar.id = calendarEvent.calendarId') + .leftJoin(Timeline, 'timeline', 'timeline.calendarId = calendar.id') + .leftJoin( + Collaboration, + 'collaboration', + 'collaboration.timelineId = timeline.id' + ) + .leftJoin( + Space, + 'subspace', + 'subspace.collaborationId = collaboration.id' + ) + .where('calendarEvent.id = :id', { id: calendarEvent.id }) + .andWhere('subspace.level != :level', { level: SpaceLevel.SPACE }) + .select('subspace.*') + .getRawOne(); + } + public async getComments(calendarEventID: string) { const calendarEventLoaded = await this.getCalendarEventOrFail( calendarEventID, diff --git a/src/migrations/1731077703010-allowEventsFromSubspaces.ts b/src/migrations/1731077703010-allowEventsFromSubspaces.ts new file mode 100644 index 0000000000..e8428c0750 --- /dev/null +++ b/src/migrations/1731077703010-allowEventsFromSubspaces.ts @@ -0,0 +1,75 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AllowEventsFromSubspaces1731077703010 implements MigrationInterface { + name = 'AllowEventsFromSubspaces1731077703010' + + public async up(queryRunner: QueryRunner): Promise { + // add setting to calendar event to allow events from subspaces + // defaults to false per requirements + await queryRunner.query(`ALTER TABLE \`calendar_event\` ADD \`visibleOnParentCalendar\` tinyint NOT NULL`); + // add setting to space to allow events from subspaces + const spaceSettings: { id: string, settingsStr: string }[] = await queryRunner.query(`SELECT id, settingsStr FROM alkemio.space;`); + // iterate over all spaces and update settings + for (const { id, settingsStr } of spaceSettings) { + const newSettings = addEventsFromSubspacesSetting(settingsStr); + await queryRunner.query(`UPDATE alkemio.space SET settingsStr = ? WHERE id = ?`, [newSettings, id]); + } + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`calendar_event\` DROP COLUMN \`visibleOnParentCalendar\``); + + const spaceSettings: { id: string, settingsStr: string }[] = await queryRunner.query(`SELECT id, settingsStr FROM alkemio.space;`); + + for (const { id, settingsStr } of spaceSettings) { + const newSettings = removeEventsFromSubspacesSetting(settingsStr); + await queryRunner.query(`UPDATE alkemio.space SET settingsStr = ? WHERE id = ?`, [newSettings, id]); + } + } +} + +const addEventsFromSubspacesSetting = (existingSettings: string): string => { + let settings: ISpaceSettings | undefined; + try { + settings = JSON.parse(existingSettings); + } catch (e) { + console.error('Error parsing settings JSON:', e); + } + + if (!settings) { + return existingSettings; + } + // default is true per requirements + settings.collaboration.allowEventsFromSubspaces = true; + + return JSON.stringify(settings); +} + +const removeEventsFromSubspacesSetting = (existingSettings: string): string => { + let settings: ISpaceSettings | undefined; + try { + settings = JSON.parse(existingSettings); + } catch (e) { + console.error('Error parsing settings JSON:', e); + } + + if (!settings) { + return existingSettings; + } + + const { allowEventsFromSubspaces, ...rest } = settings.collaboration; + (settings.collaboration as Omit) = rest; + + return JSON.stringify(settings); +} + +type ISpaceSettings = { + // ...rest are not important for this migration + collaboration: ISpaceSettingsCollaboration; +} + + +type ISpaceSettingsCollaboration = { + // ...rest are not important for this migration + allowEventsFromSubspaces: boolean; +} diff --git a/src/types/deep.select.properties.ts b/src/types/deep.select.properties.ts new file mode 100644 index 0000000000..94ed818379 --- /dev/null +++ b/src/types/deep.select.properties.ts @@ -0,0 +1,27 @@ +// typeorm FindOptionsSelect +export type DeepSelectProperty = + Property extends Promise + ? DeepSelectProperty | boolean + : Property extends Array + ? DeepSelectProperty | boolean + : Property extends string + ? boolean + : Property extends number + ? boolean + : Property extends boolean + ? boolean + : Property extends (...args: any[]) => any + ? never + : Property extends Buffer + ? boolean + : Property extends Date + ? boolean + : Property extends object + ? DeepSelectProperties + : boolean; + +export type DeepSelectProperties = { + [P in keyof Entity]?: P extends 'toString' + ? unknown + : DeepSelectProperty>; +}; diff --git a/src/types/index.ts b/src/types/index.ts index c4784a4a13..552eabd75d 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,5 @@ export * from './graphql'; export * from './entity.relations'; export * from './alkemio.config'; +export * from './deep.select.properties'; +export * from './prefixed.type'; diff --git a/src/types/prefixed.type.ts b/src/types/prefixed.type.ts new file mode 100644 index 0000000000..13de26eb03 --- /dev/null +++ b/src/types/prefixed.type.ts @@ -0,0 +1,21 @@ +/** + * A utility type that takes a type T, and a string prefix as inputs + * and returns a new type with the T keys prefixed with the given string. + * + * Very helpful when building typeorm queries using getRawOne or getRawMany + * Note: Typeorm prefixes the keys with `alias_`, be sure to add the underscore + * + * Example: + * await this.calendarRepository + * .createQueryBuilder('calendar') + * .where({ id: calendarId }) + * .leftJoinAndSelect( + * 'space', + * 'space', + * 'space.collaborationId = collaboration.id' + * ) + * .getRawOne>(); + */ +export type PrefixKeys = { + [K in keyof T as `${P}${string & K}`]: T[K]; +}; diff --git a/test/utils/repository.mock.factory.ts b/test/utils/repository.mock.factory.ts index d899889cf9..fe7f3de219 100644 --- a/test/utils/repository.mock.factory.ts +++ b/test/utils/repository.mock.factory.ts @@ -6,6 +6,7 @@ export const repositoryMockFactory: () => MockType< Repository > = jest.fn(() => ({ findOne: jest.fn(entity => entity), + findOneOrFail: jest.fn(entity => entity), find: jest.fn(entity => entity), save: jest.fn(), remove: jest.fn(), From 34dbf6a8ce9177909fb61a916d361cdd7e1b61a3 Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Mon, 11 Nov 2024 11:11:56 +0200 Subject: [PATCH 40/42] fixed license plans bootstrap --- src/core/bootstrap/bootstrap.service.ts | 2 +- .../license-plan/license-plans.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/bootstrap/bootstrap.service.ts b/src/core/bootstrap/bootstrap.service.ts index 6a9c3881d7..ddbd2e37d3 100644 --- a/src/core/bootstrap/bootstrap.service.ts +++ b/src/core/bootstrap/bootstrap.service.ts @@ -277,7 +277,7 @@ export class BootstrapService { for (const licensePlanData of licensePlansData) { const planExists = await this.licensePlanService.licensePlanByNameExists( - licensePlanData.type + licensePlanData.name ); if (!planExists) { await this.licensingService.createLicensePlan({ diff --git a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json index b1e2d61a0b..1702c17c57 100644 --- a/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json +++ b/src/core/bootstrap/platform-template-definitions/license-plan/license-plans.json @@ -71,7 +71,7 @@ "type": "account-plan" }, { - "name": "SPACE_FEATURE_VIRTUAL_CONTIBUTORS", + "name": "SPACE_FEATURE_VIRTUAL_CONTRIBUTORS", "enabled": "1", "sortOrder": "70", "pricePerMonth": "0.00", From 461613eaa018dd978820e8804778c5e95853a505 Mon Sep 17 00:00:00 2001 From: Neil Smyth <30729240+techsmyth@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:42:35 +0100 Subject: [PATCH 41/42] fix issue with agent auth without cred rules when assigning member credential (#4691) Co-authored-by: Valentin Yanakiev --- src/domain/access/role-set/role.set.service.ts | 4 ++-- src/domain/agent/agent/agent.service.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/domain/access/role-set/role.set.service.ts b/src/domain/access/role-set/role.set.service.ts index 0a0610e532..66cfa3a63e 100644 --- a/src/domain/access/role-set/role.set.service.ts +++ b/src/domain/access/role-set/role.set.service.ts @@ -495,7 +495,7 @@ export class RoleSetService { return user; } - user.agent = await this.assignContributorAgentToRole( + await this.assignContributorAgentToRole( roleSet, roleType, agent, @@ -526,7 +526,7 @@ export class RoleSetService { triggerNewMemberEvents ); - return user; + return await this.userService.getUserOrFail(userID); } public async acceptInvitationToRoleSet( diff --git a/src/domain/agent/agent/agent.service.ts b/src/domain/agent/agent/agent.service.ts index f762b84e07..06748672e7 100644 --- a/src/domain/agent/agent/agent.service.ts +++ b/src/domain/agent/agent/agent.service.ts @@ -206,12 +206,13 @@ export class AgentService { const credential = await this.credentialService.createCredential(grantCredentialData); + credential.agent = agent; + await this.credentialService.save(credential); + const agentWithCredential = await this.getAgentOrFail(agent.id); + await this.agentInfoCacheService.updateAgentInfoCache(agentWithCredential); + await this.setAgentCache(agentWithCredential); - agent.credentials?.push(credential); - await this.agentInfoCacheService.updateAgentInfoCache(agent); - await this.setAgentCache(agent); - - return await this.saveAgent(agent); + return agentWithCredential; } async revokeCredential( From 5094adafd7ed72fadabad02936429e71c7d592ec Mon Sep 17 00:00:00 2001 From: Valentin Yanakiev Date: Mon, 11 Nov 2024 11:52:29 +0200 Subject: [PATCH 42/42] Minor version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8817eb5184..4a4e04c71d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "alkemio-server", - "version": "0.95.2", + "version": "0.95.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "alkemio-server", - "version": "0.95.2", + "version": "0.95.3", "license": "EUPL-1.2", "dependencies": { "@alkemio/matrix-adapter-lib": "^0.4.1", diff --git a/package.json b/package.json index f810c42b79..db9f82ff95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alkemio-server", - "version": "0.95.2", + "version": "0.95.3", "description": "Alkemio server, responsible for managing the shared Alkemio platform", "author": "Alkemio Foundation", "private": false,