refactor(database): remove defaultWorkspaceId and fix imports

Removed the defaultWorkspaceId column and its associated constraints from database migrations. Additionally, added an import in workspace.entity.ts to address circular dependency issues.
This commit is contained in:
Antoine Moreaux 2024-12-20 17:51:39 +01:00
parent 97fd18506f
commit bef51323fb
2 changed files with 3 additions and 6 deletions

View File

@ -12,15 +12,9 @@ export class RemoveDefaultWorkspaceId1734544295083
await queryRunner.query( await queryRunner.query(
`ALTER TABLE "core"."user" DROP COLUMN "defaultWorkspaceId"`, `ALTER TABLE "core"."user" DROP COLUMN "defaultWorkspaceId"`,
); );
await queryRunner.query(
`ALTER TABLE "core"."workspace" DROP CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0"`,
);
} }
public async down(queryRunner: QueryRunner): Promise<void> { public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."workspace" ADD CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0" UNIQUE ("domainName")`,
);
await queryRunner.query( await queryRunner.query(
`ALTER TABLE "core"."user" ADD "defaultWorkspaceId" uuid NOT NULL`, `ALTER TABLE "core"."user" ADD "defaultWorkspaceId" uuid NOT NULL`,
); );

View File

@ -21,6 +21,9 @@ import { KeyValuePair } from 'src/engine/core-modules/key-value-pair/key-value-p
import { PostgresCredentials } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.entity'; import { PostgresCredentials } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.entity';
import { WorkspaceSSOIdentityProvider } from 'src/engine/core-modules/sso/workspace-sso-identity-provider.entity'; import { WorkspaceSSOIdentityProvider } from 'src/engine/core-modules/sso/workspace-sso-identity-provider.entity';
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity'; import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
// This line is necessary to avoid a circular dependency issue. Need to deep dive
// eslint-disable-next-line
import { User } from 'src/engine/core-modules/user/user.entity';
export enum WorkspaceActivationStatus { export enum WorkspaceActivationStatus {
ONGOING_CREATION = 'ONGOING_CREATION', ONGOING_CREATION = 'ONGOING_CREATION',