From 624f188a47d75241f1ff62956f9f98bb9a58f01f Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 07:08:00 +0200 Subject: [PATCH 01/47] feat: project entity additional fields --- packages/contracts/src/base-entity.model.ts | 1 + packages/contracts/src/employee.model.ts | 2 + .../src/organization-projects.model.ts | 13 ++++ packages/core/src/employee/employee.entity.ts | 21 +++++ .../organization-project.entity.ts | 76 ++++++++++++++++++- 5 files changed, 111 insertions(+), 2 deletions(-) diff --git a/packages/contracts/src/base-entity.model.ts b/packages/contracts/src/base-entity.model.ts index 1444bb53b32..f72fbcb872d 100644 --- a/packages/contracts/src/base-entity.model.ts +++ b/packages/contracts/src/base-entity.model.ts @@ -29,6 +29,7 @@ export interface IBaseEntityModel extends IBaseSoftDeleteEntityModel { isActive?: boolean; // Indicates if the record is currently active isArchived?: boolean; // Indicates if the record is archived + archivedAt?: Date; // Date when the record was archived } // Common properties for entities associated with a tenant diff --git a/packages/contracts/src/employee.model.ts b/packages/contracts/src/employee.model.ts index b7760cca8b3..1d38dbb21b3 100644 --- a/packages/contracts/src/employee.model.ts +++ b/packages/contracts/src/employee.model.ts @@ -57,6 +57,8 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel { organizationDepartments?: IOrganizationDepartment[]; organizationContacts?: IOrganizationContact[]; projects?: IOrganizationProject[]; + managedProjects?: IOrganizationProject[]; + projectDefaultAssignments?: IOrganizationProject[]; organizationPosition?: IOrganizationPosition; tags?: ITag[]; skills?: ISkill[]; diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index 131f01639d3..63abe63f427 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -12,6 +12,7 @@ import { IRelationalImageAsset } from './image-asset.model'; import { IOrganizationTeam } from './organization-team.model'; import { CustomFieldsObject } from './shared-types'; import { IOrganizationProjectModule } from './organization-project-module.model'; +import { TaskStatusEnum } from './task-status.model'; export interface IRelationalOrganizationProject { project?: IOrganizationProject; @@ -36,6 +37,7 @@ export interface IOrganizationProject currency: CurrenciesEnum; members?: IEmployee[]; public: boolean; + status?: TaskStatusEnum; // Defines the project stage / progession / step tags: ITag[]; owner: ProjectOwnerEnum; tasks?: ITask[]; @@ -50,6 +52,8 @@ export interface IOrganizationProject description?: string; // the color of project which is used in UI color?: string; + // The project icon used on UI + icon?: string; // is project billable? billable?: boolean; // true if the project is flat rate, false if the project is time / materials billable @@ -61,6 +65,15 @@ export interface IOrganizationProject budgetType?: OrganizationProjectBudgetTypeEnum; membersCount?: number; imageUrl?: string; + // Project manager + manager?: IEmployee; + managerId?: ID; + // Default project assignee + defaultAssignee?: IEmployee; + defaultAssigneeId?: ID; + // automations + archiveTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-archived after the period reached + closeTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-closed after the period reached } export enum TaskListTypeEnum { diff --git a/packages/core/src/employee/employee.entity.ts b/packages/core/src/employee/employee.entity.ts index fdd4e064315..5cf6ef317d9 100644 --- a/packages/core/src/employee/employee.entity.ts +++ b/packages/core/src/employee/employee.entity.ts @@ -517,12 +517,33 @@ export class Employee extends TenantOrganizationBaseEntity implements IEmployee, @MultiORMOneToMany(() => EmployeePhone, (it) => it.employee) phoneNumbers?: IEmployeePhone[]; + /** + * Daily Plans + */ @ApiPropertyOptional({ type: () => DailyPlan, isArray: true }) @MultiORMOneToMany(() => DailyPlan, (dailyPlan) => dailyPlan.employee, { cascade: true }) dailyPlans?: IDailyPlan[]; + /** + * Managed projects + */ + @ApiPropertyOptional({ type: () => OrganizationProject, isArray: true }) + @MultiORMOneToMany(() => OrganizationProject, (project) => project.manager, { + cascade: true + }) + managedProjects?: IOrganizationProject[]; + + /** + * Projects for whom employee is default assigned + */ + @ApiPropertyOptional({ type: () => OrganizationProject, isArray: true }) + @MultiORMOneToMany(() => OrganizationProject, (project) => project.defaultAssignee, { + cascade: true + }) + projectDefaultAssignments?: IOrganizationProject[]; + /* |-------------------------------------------------------------------------- | @ManyToMany diff --git a/packages/core/src/organization-project/organization-project.entity.ts b/packages/core/src/organization-project/organization-project.entity.ts index 7d1c959f999..1e870d06498 100644 --- a/packages/core/src/organization-project/organization-project.entity.ts +++ b/packages/core/src/organization-project/organization-project.entity.ts @@ -1,6 +1,6 @@ import { JoinColumn, RelationId, JoinTable } from 'typeorm'; import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsBoolean, IsOptional, IsString, IsUUID } from 'class-validator'; +import { IsBoolean, IsEnum, IsNumber, IsObject, IsOptional, IsString, IsUUID } from 'class-validator'; import { CurrenciesEnum, IActivity, @@ -26,7 +26,8 @@ import { OrganizationProjectBudgetTypeEnum, ProjectBillingEnum, ProjectOwnerEnum, - TaskListTypeEnum + TaskListTypeEnum, + TaskStatusEnum } from '@gauzy/contracts'; import { isMySQL } from '@gauzy/config'; import { @@ -160,6 +161,31 @@ export class OrganizationProject @MultiORMColumn({ nullable: true }) syncTag?: string; + @ApiPropertyOptional({ type: () => String }) + @IsOptional() + @IsEnum(TaskStatusEnum) + @ColumnIndex() + @MultiORMColumn({ nullable: true }) + status?: TaskStatusEnum; + + @ApiPropertyOptional({ type: () => String }) + @IsOptional() + @IsString() + @MultiORMColumn({ nullable: true }) + icon?: string; + + @ApiPropertyOptional({ type: () => Number }) + @IsOptional() + @IsNumber() + @MultiORMColumn({ nullable: true, type: 'decimal' }) + archiveTasksIn?: number; + + @ApiPropertyOptional({ type: () => Number }) + @IsOptional() + @IsNumber() + @MultiORMColumn({ nullable: true, type: 'decimal' }) + closeTasksIn?: number; + /* |-------------------------------------------------------------------------- | @ManyToOne @@ -220,6 +246,52 @@ export class OrganizationProject @MultiORMColumn({ nullable: true, relationId: true }) imageId?: ID; + /** + * Project Manager + */ + @ApiPropertyOptional({ type: () => Object }) + @IsOptional() + @IsObject() + @MultiORMManyToOne(() => Employee, (it) => it.managedProjects, { + /** Indicates if the relation column value can be nullable or not. */ + nullable: true, + + /** Defines the database cascade action on delete. */ + onDelete: 'CASCADE' + }) + manager?: IEmployee; + + @ApiPropertyOptional({ type: () => String }) + @IsOptional() + @IsUUID() + @RelationId((it: OrganizationProject) => it.manager) + @ColumnIndex() + @MultiORMColumn({ nullable: true, relationId: true }) + managerId?: ID; + + /** + * Project default member assignee + */ + @ApiPropertyOptional({ type: () => Object }) + @IsOptional() + @IsObject() + @MultiORMManyToOne(() => Employee, (it) => it.projectDefaultAssignments, { + /** Indicates if the relation column value can be nullable or not. */ + nullable: true, + + /** Defines the database cascade action on delete. */ + onDelete: 'CASCADE' + }) + defaultAssignee?: IEmployee; + + @ApiPropertyOptional({ type: () => String }) + @IsOptional() + @IsUUID() + @RelationId((it: OrganizationProject) => it.defaultAssignee) + @ColumnIndex() + @MultiORMColumn({ nullable: true, relationId: true }) + defaultAssigneeId?: ID; + /* |-------------------------------------------------------------------------- | @OneToMany From dd4ea4627e8da5d5c4b672bf36610655958df4dc Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 07:37:24 +0200 Subject: [PATCH 02/47] fix: update project create input --- .../src/organization-projects.model.ts | 9 +- .../organization-project.seed.ts | 97 ++++++++----------- 2 files changed, 47 insertions(+), 59 deletions(-) diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index 63abe63f427..c2db639b973 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -108,6 +108,7 @@ export interface IOrganizationProjectCreateInput currency?: CurrenciesEnum; members?: IEmployee[]; public?: boolean; + icon?: string; tags?: ITag[]; owner?: ProjectOwnerEnum; code?: string; @@ -115,11 +116,17 @@ export interface IOrganizationProjectCreateInput color?: string; billable?: boolean; billingFlat?: boolean; - status?: string; + status?: TaskStatusEnum; openSource?: boolean; projectUrl?: string; openSourceProjectUrl?: string; taskListType?: TaskListTypeEnum; + manager?: IEmployee; + managerId?: ID; + defaultAssignee?: IEmployee; + defaultAssigneeId?: ID; + archiveTasksIn?: number; + closeTasksIn?: number; } export interface IOrganizationProjectUpdateInput extends IOrganizationProjectCreateInput, IOrganizationProjectSetting { diff --git a/packages/core/src/organization-project/organization-project.seed.ts b/packages/core/src/organization-project/organization-project.seed.ts index 6088acb4502..6a6f59336c1 100644 --- a/packages/core/src/organization-project/organization-project.seed.ts +++ b/packages/core/src/organization-project/organization-project.seed.ts @@ -1,6 +1,3 @@ - - - import { DataSource } from 'typeorm'; import { faker } from '@faker-js/faker'; import { chain } from 'underscore'; @@ -11,7 +8,8 @@ import { ITag, ITenant, OrganizationProjectBudgetTypeEnum, - TaskListTypeEnum + TaskListTypeEnum, + TaskStatusEnum } from '@gauzy/contracts'; import { DEFAULT_ORGANIZATION_PROJECTS } from './default-organization-projects'; import { Employee, OrganizationContact, Tag } from './../core/entities/internal'; @@ -41,40 +39,30 @@ export const createDefaultOrganizationProjects = async ( const project = new OrganizationProject(); project.tags = [tag]; project.name = name; + project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); project.organizationContact = faker.helpers.arrayElement(organizationContacts); project.organization = organization; project.tenant = tenant; - project.budgetType = faker.helpers.arrayElement( - Object.values(OrganizationProjectBudgetTypeEnum) - ); + project.budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); project.budget = project.budgetType == OrganizationProjectBudgetTypeEnum.COST ? faker.number.int({ min: 500, max: 5000 }) : faker.number.int({ min: 40, max: 400 }); - project.taskListType = faker.helpers.arrayElement( - Object.values(TaskListTypeEnum) - ); + project.taskListType = faker.helpers.arrayElement(Object.values(TaskListTypeEnum)); // TODO: this seed creates default projects without tenantId. projects.push(project); } await dataSource.manager.save(projects); /** - * Seeder for assign organization project to the employee of the specific organization - */ - await assignOrganizationProjectToEmployee( - dataSource, - tenant, - organization - ); + * Seeder for assign organization project to the employee of the specific organization + */ + await assignOrganizationProjectToEmployee(dataSource, tenant, organization); /** - * Seeder for update project member count for specific tenant - */ - await seedProjectMembersCount( - dataSource, - [tenant] - ) + * Seeder for update project member count for specific tenant + */ + await seedProjectMembersCount(dataSource, [tenant]); return projects; }; @@ -86,9 +74,7 @@ export const createRandomOrganizationProjects = async ( maxProjectsPerOrganization ) => { if (!tags) { - console.warn( - 'Warning: tags not found, RandomOrganizationProjects will not be created' - ); + console.warn('Warning: tags not found, RandomOrganizationProjects will not be created'); return; } @@ -111,12 +97,11 @@ export const createRandomOrganizationProjects = async ( const project = new OrganizationProject(); project.tags = [tags[Math.floor(Math.random() * tags.length)]]; project.name = faker.company.name(); + project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); project.organizationContact = organizationContact; project.organization = organization; project.tenant = tenant; - project.budgetType = faker.helpers.arrayElement( - Object.values(OrganizationProjectBudgetTypeEnum) - ); + project.budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); if (project.budgetType === OrganizationProjectBudgetTypeEnum.COST) { // Set budget for COST type @@ -127,40 +112,32 @@ export const createRandomOrganizationProjects = async ( } project.startDate = faker.date.past({ years: 5 }); // Generate endDate as a date in the future - faker.date.between({ from: project.startDate, to: new Date() }) + faker.date.between({ from: project.startDate, to: new Date() }); projects.push(project); } await dataSource.manager.save(projects); /** - * Seeder for assign organization project to the employee of the specific organization - */ - await assignOrganizationProjectToEmployee( - dataSource, - tenant, - organization - ); + * Seeder for assign organization project to the employee of the specific organization + */ + await assignOrganizationProjectToEmployee(dataSource, tenant, organization); } /** - * Seeder for update project member count for specific tenant - */ - await seedProjectMembersCount( - dataSource, - [tenant] - ) + * Seeder for update project member count for specific tenant + */ + await seedProjectMembersCount(dataSource, [tenant]); } }; /* -* Assign Organization Project To Respective Employees -*/ + * Assign Organization Project To Respective Employees + */ export const assignOrganizationProjectToEmployee = async ( dataSource: DataSource, tenant: ITenant, organization: IOrganization ) => { - const { id: tenantId } = tenant; const { id: organizationId } = organization; @@ -183,10 +160,7 @@ export const assignOrganizationProjectToEmployee = async ( await dataSource.manager.save(employees); }; -export async function seedProjectMembersCount( - dataSource: DataSource, - tenants: ITenant[] -) { +export async function seedProjectMembersCount(dataSource: DataSource, tenants: ITenant[]) { const isSqliteOrMysql = ['sqlite', 'better-sqlite3', 'mysql'].includes(dataSource.options.type); /** * GET all tenants in the system @@ -198,20 +172,22 @@ export async function seedProjectMembersCount( * GET all tenant projects for specific tenant */ const projects = await dataSource.manager.query( - p(`SELECT * FROM "organization_project" WHERE "organization_project"."tenantId" = ${ - isSqliteOrMysql ? '?' : '$1' - }`), + p( + `SELECT * FROM "organization_project" WHERE "organization_project"."tenantId" = ${ + isSqliteOrMysql ? '?' : '$1' + }` + ), [tenantId] ); for await (const project of projects) { - const projectId = project.id; /** * GET member counts for organization project */ - const [members] = await dataSource.manager.query(p(` + const [members] = await dataSource.manager.query( + p(` SELECT COUNT("organization_project_employee"."employeeId") AS count FROM "organization_project_employee" @@ -221,13 +197,18 @@ export async function seedProjectMembersCount( "organization_project" ON "organization_project"."id"="organization_project_employee"."organizationProjectId" WHERE "organization_project_employee"."organizationProjectId" = ${isSqliteOrMysql ? '?' : '$1'} - `), [projectId]); + `), + [projectId] + ); const count = members['count']; await dataSource.manager.query( - p(`UPDATE "organization_project" SET "membersCount" = ${isSqliteOrMysql ? '?' : '$1' - } WHERE "id" = ${isSqliteOrMysql ? '?' : '$2'}`), + p( + `UPDATE "organization_project" SET "membersCount" = ${isSqliteOrMysql ? '?' : '$1'} WHERE "id" = ${ + isSqliteOrMysql ? '?' : '$2' + }` + ), [count, projectId] ); } From b891d9b0fab65b84b0aa0bc692b2cae80d1c5f22 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 09:09:20 +0200 Subject: [PATCH 03/47] feat: add postgres migration --- .../core/src/core/entities/base.entity.ts | 23 +- ...1-AlterOrganizationProjectAndBaseEntity.ts | 847 ++++++++++++++++++ 2 files changed, 862 insertions(+), 8 deletions(-) create mode 100644 packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts diff --git a/packages/core/src/core/entities/base.entity.ts b/packages/core/src/core/entities/base.entity.ts index 468996a0c2f..47b9344d0e7 100644 --- a/packages/core/src/core/entities/base.entity.ts +++ b/packages/core/src/core/entities/base.entity.ts @@ -2,12 +2,7 @@ // MIT License, see https://github.com/xmlking/ngx-starter-kit/blob/develop/LICENSE // Copyright (c) 2018 Sumanth Chinthagunta -import { - PrimaryGeneratedColumn, - UpdateDateColumn, - CreateDateColumn, - DeleteDateColumn -} from 'typeorm'; +import { PrimaryGeneratedColumn, UpdateDateColumn, CreateDateColumn, DeleteDateColumn } from 'typeorm'; import { ApiPropertyOptional } from '@nestjs/swagger'; import { IsBoolean, IsDateString, IsOptional } from 'class-validator'; import { SoftDeletable } from 'mikro-orm-soft-delete'; @@ -70,7 +65,7 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas @CreateDateColumn() // TypeORM decorator for creation date @Property({ // Automatically set the property value when entity gets created, executed during flush operation. - onCreate: () => new Date(), // Set creation date on record creation + onCreate: () => new Date() // Set creation date on record creation }) createdAt?: Date; @@ -85,7 +80,7 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas // Automatically set the property value when entity gets created, executed during flush operation. onCreate: () => new Date(), // Set at record creation // Automatically update the property value every time entity gets updated, executed during flush operation. - onUpdate: () => new Date(), // Update every time the entity is changed + onUpdate: () => new Date() // Update every time the entity is changed }) updatedAt?: Date; @@ -110,4 +105,16 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas @ColumnIndex() @MultiORMColumn({ nullable: true, default: false }) // TypeORM and Mikro-ORM compatibility isArchived?: boolean; + + // Indicates the date when record was archived + @ApiPropertyOptional({ + type: 'string', + format: 'date-time', + example: '2018-11-21T06:20:32.232Z' + }) + @IsOptional() + @IsDateString() + @ColumnIndex() + @MultiORMColumn({ nullable: true }) + archivedAt?: Date; } diff --git a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts new file mode 100644 index 00000000000..2db32e556dc --- /dev/null +++ b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts @@ -0,0 +1,847 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AlterOrganizationProjectAndBaseEntity1725775971501 implements MigrationInterface { + name = 'AlterOrganizationProjectAndBaseEntity1725775971501'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "accounting_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "appointment_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "approval_policy" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "availability_slot" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "social_account" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_criterion_rating" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_document" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_education" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_experience" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_feedback" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_interview" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_interviewer" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_personal_quality" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_skill" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_source" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate_technology" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "candidate" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "contact" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "country" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "currency" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "custom_smtp" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "deal" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "email_sent" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "email_reset" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "email_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_appointment" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_award" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_level" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_phone" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_recurring_expense" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "equipment_sharing" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "equipment" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "estimate_email" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "event_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "expense_category" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "expense" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "import-history" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "import-record" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "feature_organization" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "feature" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal_general_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal_kpi_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal_kpi" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal_time_frame" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "goal" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "image_asset" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "income" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_entity_setting_tied" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_entity_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_map" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_tenant" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "integration" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "invite" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "invoice_estimate_history" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "invoice_item" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "invoice" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "key_result_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "key_result_update" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "key_result" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "language" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "merchant" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_award" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_contact" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_department" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_document" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_employment_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_language" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_position" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "status" character varying`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "icon" character varying`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "archiveTasksIn" numeric`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "closeTasksIn" numeric`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "managerId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "defaultAssigneeId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_module" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_recurring_expense" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_sprint" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_task_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_team_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_team_join_request" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_team" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_vendor" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "password_reset" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "payment" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "pipeline_stage" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "pipeline" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_category_translation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_category" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_option_group" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_option_group_translation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_option_translation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_option" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_variant_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_type_translation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_variant_price" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_variant" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_translation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "report_category" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "report_organization" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "report" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "request_approval_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "request_approval_team" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "request_approval" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "role_permission" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "role" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "skill" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "tag" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "daily_plan" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_estimation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "issue_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_linked_issues" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_priority" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_related_issue_type" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_size" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_status" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "task_version" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "tenant_setting" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "tenant" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "time_off_policy" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "time_off_request" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "activity" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "screenshot" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "time_log" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "time_slot" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "time_slot_minute" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "timesheet" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "user_organization" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "user" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "warehouse_product" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "warehouse_product_variant" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "warehouse" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "changelog" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_github_repository" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_github_repository_issue" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "proposal" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_proposal_template" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "job_search_occupation" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "job_search_category" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "employee_upwork_job_search_criterion" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "job_preset" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "job_preset_upwork_job_search_criterion" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "knowledge_base" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "knowledge_base_article" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "knowledge_base_author" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "product_review" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query( + `CREATE INDEX "IDX_5d74a3f25e6acfb6caec05ec65" ON "accounting_template" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e0c6443e0d2d5630067bc10ccf" ON "appointment_employee" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_829e02292a572f25476c4e426c" ON "approval_policy" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2ada776a231239b8e99f78bf64" ON "availability_slot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c323aa830e10a871854d0a0408" ON "social_account" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_75bd5526e43c8801085225ffa9" ON "candidate_criterion_rating" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4985a92870282574f6fec8dd98" ON "candidate_document" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_745780f5553e56a3ca19bccf86" ON "candidate_education" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bb09aa3130d0e54007a98523c5" ON "candidate_experience" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_89ff7e0a8c37fdf7770b753776" ON "candidate_feedback" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_09f72a1a309aae91e0cd83949a" ON "candidate_interview" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_54b281d06e1a4e7e6ff640dab4" ON "candidate_interviewer" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fa411cb89c9c6848d192d7f2e6" ON "candidate_personal_quality" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f651e72ab42727f28c29441f1b" ON "candidate_skill" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436" ON "candidate_source" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_5cb080756923318f19f1d2eabe" ON "candidate_technology" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_ac765cfc390ec77d765dd48b61" ON "candidate" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_67a4423093e3c311cb76275659" ON "contact" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_711fd0159178a0102abc4db336" ON "country" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e99bb270f0fa89ea715a457d29" ON "currency" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_36106478339961c8a17674a031" ON "custom_smtp" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_284658fe519bca6048fd73ff72" ON "deal" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_753f4b022ec98a0c8f38b370c0" ON "email_sent" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_35ac91a92c521b68277e780e6e" ON "email_reset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ce96229ae8d1d1af61348730da" ON "email_template" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_e69d60f1adcded4445095c4787" ON "employee_appointment" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_cee87c9b8743f0e81db8152f68" ON "employee_award" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_9dff154a1be222c66c179ad14b" ON "employee_level" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_08e391262cb3d4fbe9db97ecf8" ON "employee_phone" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_185b880550575c61d4212896e2" ON "employee_recurring_expense" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_a8e048dfb4d618068376407c86" ON "employee_setting" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c17e703a7008f6b9c2770a5cba" ON "employee" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_0c5508f4c86446f84d609e3b76" ON "equipment_sharing_policy" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_21bb7aec28dbb12ebc58a41d02" ON "equipment_sharing" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8" ON "equipment" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c029854e57e273cb30445e6417" ON "estimate_email" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc" ON "event_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_0edbfb90f0bc4c28eb57892900" ON "expense_category" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6620af16ccd56e7e52b6ad914d" ON "expense" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ca5fc2af0a26e454779d014a6a" ON "import-history" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_b1669a96371cbdb8fd8d4724d6" ON "import-record" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_c795b7a18f1213b980bcc91ffe" ON "feature_organization" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9" ON "feature" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_03dbd727034c431934185d1d6f" ON "goal_general_setting" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_84a5a399408725b9c8612767e0" ON "goal_kpi_template" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_dae34450bed722e897370e2aec" ON "goal_kpi" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_25e0f8060ed921994873391253" ON "goal_template" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_cc3487eb32dd8baa86a8043540" ON "goal_time_frame" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_265b5cbc3e414bb3bb2facbb22" ON "goal" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2a8cd17a33093bb6afed97e9d3" ON "image_asset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_263e874cebea17ad3f2ba39e11" ON "income" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_2a9f9f6fa9064b328e277063a1" ON "integration_entity_setting_tied" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5053bf22f9e0a5e9e8df7850da" ON "integration_entity_setting" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3907c6f563fc45d824558d239d" ON "integration_map" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_02f667ad727ca0975d5022e695" ON "integration_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b6654519fbad729cdb490069be" ON "integration_tenant" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_842e81def8eef9f71a97496ff1" ON "integration_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_90aec772805c7fd508d71bedfe" ON "integration" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_00a3c849694b6f8be7b193c888" ON "invite" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_599de8ec6ea69550c6d49c4ae1" ON "invoice_estimate_history" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_457cbab434fc9a031f03eb6211" ON "invoice_item" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_40ee7b28c0ea835534a93b54bf" ON "invoice" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_04b8ef5663b40baa58e1b65160" ON "key_result_template" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c5df67196c2aca0a7fb6ffd274" ON "key_result_update" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_30bf8575f0744aa3b68b611985" ON "key_result" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_745828269219870069b3b46a7f" ON "language" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ebff440aec581d4893ad743c7e" ON "merchant" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_20aebc4219b9f9196f5ca2344d" ON "organization_award" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cdf46b38fd75cd7baebce81cc6" ON "organization_contact" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8cf81262c7cddfcf3fedcbc106" ON "organization_department" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bf9a2edebcda9ac2c59e4439cb" ON "organization_document" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a11abe644b2cb5810bb65c8f9" ON "organization_employment_type" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_94330f9121dd1e72fe31fdb3c5" ON "organization_language" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122" ON "organization_position" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_21510dbb86b763f55a8bf4ec93" ON "organization_project_module" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_636a95bda1eaf9fab00849dec2" ON "organization_recurring_expense" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cbb3f1eb241abc47103df48f83" ON "organization_sprint" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_60683da6db3f64a0767d40b291" ON "organization_task_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d109b8470a4cf2662bec0a672b" ON "organization_team_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5deae148453dfaf555b24d151f" ON "organization_team_join_request" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_af48bbfa76f6261a5520e5e90f" ON "organization_team" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_6c41095093c47ac91434a1bdf9" ON "organization_vendor" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94" ON "organization" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_7f8ba01a73690cbabe6c6ab93c" ON "password_reset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_523b77d9dcbace8377fbca05ae" ON "payment" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c5075efc6dab483721af36616f" ON "pipeline_stage" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_8b0d255d8f0ec4ca22e36249a8" ON "pipeline" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_2dce278beac80aebe7e179d7c9" ON "product_category_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_89d6d92ce60b7b6de00449b30d" ON "product_category" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_e69de0d6c91d71407822a95bc9" ON "product_option_group" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fdca637f69b879c6e95525a01f" ON "product_option_group_translation" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_eed2b389448b96ec1118ca38ef" ON "product_option_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_41bff03b05f43a4e22e54cb83e" ON "product_option" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_18a46a61494103f9db1c42285d" ON "product_variant_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7c3776ae0d403baebc8a9387d8" ON "product_type_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_577cfbbd0e9dedad955108df36" ON "product_type" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_3041f4d50857a4bc37dd72f233" ON "product_variant_price" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0eb547a970dfecff424eb2098b" ON "product_variant" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_98c2019d4a108469e30b265972" ON "product" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_12de5ef2de583b2e92a1dfee3d" ON "product_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0ad88d687468141532bef9cc5e" ON "report_category" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_3619176cb8845c5c03803caf9d" ON "report_organization" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_5a453f466165d928a495e158ac" ON "report" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_f6c789158e91e7a6242174aaae" ON "request_approval_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c02d6337074841598e6952fed" ON "request_approval_team" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_aac7b3092d5d02d80deb5808b3" ON "request_approval" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592" ON "role_permission" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6c388c8d50b4238ab077fdc800" ON "role" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_0d379f40301224bfa5043dc7cc" ON "skill" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1ddd19850ad49f4e61ad727018" ON "tag" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1255e02d6dddd4e09a5ddb10d4" ON "daily_plan" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_da2990e3e7d2047d950ab8edea" ON "task_estimation" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2ff61d100d00793724c099b86c" ON "issue_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_93bb4c9fb014dda0d984e9060a" ON "task" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_024d5a6727f6f4804d8cecfe32" ON "task_linked_issues" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f9fdc26bc564bf9f7963489f23" ON "task_priority" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_d1689daf93e2cb6029a9ff96d2" ON "task_related_issue_type" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c364d9cb885e274666950b1afc" ON "task_size" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_259cb3e6d0d59edad2798b0ac3" ON "task_status" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_526e175838190ccc3c350df01a" ON "task_version" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6e8dc5c9992499a05248237e58" ON "tenant_setting" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_10ede978ae7c1b67755932eac6" ON "tenant" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_21aa702abacf7dabe11da12818" ON "time_off_policy" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_a5c6d8b62974fb9e4161e09499" ON "time_off_request" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_83df5ca85dae51ff9341e47785" ON "activity" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_afad5ae421b31768c4232f7224" ON "screenshot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2cbd790171893d994992116f19" ON "time_log" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_b520b83e91a6d3c8ef33675efe" ON "time_slot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_bb9f95f639ced2a5b71395169e" ON "time_slot_minute" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_43f3709ff2b8dcc90c1809b023" ON "timesheet" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6f87e00eb9e37242f01e6e5566" ON "user_organization" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd" ON "user" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_fa9bdc44b90c4f32e658938a2d" ON "warehouse_product" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_21bba7ad2249260cc9d0022af9" ON "warehouse_product_variant" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_66abaca4fc9c367203403310aa" ON "warehouse" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_888ffe5a395d1cf7afb001dc3a" ON "changelog" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_55dbb0b04712921d3c5dd7664e" ON "organization_github_repository" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_290ccd540d1e1f450c408539a1" ON "organization_github_repository_issue" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_811cc78a6e4df2ae75d237e40e" ON "proposal" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_6b73b978dcd27856a83df0d23c" ON "employee_proposal_template" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_551be2742a129d5d8ff461e9fe" ON "job_search_occupation" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b69eac7a9f1b9e93eebe3a850" ON "job_search_category" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0d66c27013f4c34b339738f210" ON "employee_upwork_job_search_criterion" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c271c2698e24de252f1fd148f0" ON "job_preset" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_84a641af24ce125f296142216b" ON "job_preset_upwork_job_search_criterion" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_407463aef81b89c8bc5943ac8a" ON "knowledge_base" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_bd8360d2c539ae6b351129c86d" ON "knowledge_base_article" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_eb418dd0f3234df01222bcf438" ON "knowledge_base_author" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c94775caea731394d690d67db1" ON "product_review" ("archivedAt") `); + await queryRunner.query( + `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_489012234f53089d4b508f4aa12"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_05edb214d298384f9f918d6b5d2"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c94775caea731394d690d67db1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_eb418dd0f3234df01222bcf438"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bd8360d2c539ae6b351129c86d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_407463aef81b89c8bc5943ac8a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_84a641af24ce125f296142216b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c271c2698e24de252f1fd148f0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0d66c27013f4c34b339738f210"`); + await queryRunner.query(`DROP INDEX "public"."IDX_4b69eac7a9f1b9e93eebe3a850"`); + await queryRunner.query(`DROP INDEX "public"."IDX_551be2742a129d5d8ff461e9fe"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6b73b978dcd27856a83df0d23c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_811cc78a6e4df2ae75d237e40e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_290ccd540d1e1f450c408539a1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_55dbb0b04712921d3c5dd7664e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_888ffe5a395d1cf7afb001dc3a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_66abaca4fc9c367203403310aa"`); + await queryRunner.query(`DROP INDEX "public"."IDX_21bba7ad2249260cc9d0022af9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_fa9bdc44b90c4f32e658938a2d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e49cb4b6b256bd4a5edab1e4dd"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6f87e00eb9e37242f01e6e5566"`); + await queryRunner.query(`DROP INDEX "public"."IDX_43f3709ff2b8dcc90c1809b023"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bb9f95f639ced2a5b71395169e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_b520b83e91a6d3c8ef33675efe"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2cbd790171893d994992116f19"`); + await queryRunner.query(`DROP INDEX "public"."IDX_afad5ae421b31768c4232f7224"`); + await queryRunner.query(`DROP INDEX "public"."IDX_83df5ca85dae51ff9341e47785"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a5c6d8b62974fb9e4161e09499"`); + await queryRunner.query(`DROP INDEX "public"."IDX_21aa702abacf7dabe11da12818"`); + await queryRunner.query(`DROP INDEX "public"."IDX_10ede978ae7c1b67755932eac6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6e8dc5c9992499a05248237e58"`); + await queryRunner.query(`DROP INDEX "public"."IDX_526e175838190ccc3c350df01a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_259cb3e6d0d59edad2798b0ac3"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c364d9cb885e274666950b1afc"`); + await queryRunner.query(`DROP INDEX "public"."IDX_d1689daf93e2cb6029a9ff96d2"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f9fdc26bc564bf9f7963489f23"`); + await queryRunner.query(`DROP INDEX "public"."IDX_024d5a6727f6f4804d8cecfe32"`); + await queryRunner.query(`DROP INDEX "public"."IDX_93bb4c9fb014dda0d984e9060a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2ff61d100d00793724c099b86c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_da2990e3e7d2047d950ab8edea"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1255e02d6dddd4e09a5ddb10d4"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1ddd19850ad49f4e61ad727018"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0d379f40301224bfa5043dc7cc"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6c388c8d50b4238ab077fdc800"`); + await queryRunner.query(`DROP INDEX "public"."IDX_8cdc64dbd7f2ed3f8850bd2592"`); + await queryRunner.query(`DROP INDEX "public"."IDX_aac7b3092d5d02d80deb5808b3"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1c02d6337074841598e6952fed"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f6c789158e91e7a6242174aaae"`); + await queryRunner.query(`DROP INDEX "public"."IDX_5a453f466165d928a495e158ac"`); + await queryRunner.query(`DROP INDEX "public"."IDX_3619176cb8845c5c03803caf9d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0ad88d687468141532bef9cc5e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_12de5ef2de583b2e92a1dfee3d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_98c2019d4a108469e30b265972"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0eb547a970dfecff424eb2098b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_3041f4d50857a4bc37dd72f233"`); + await queryRunner.query(`DROP INDEX "public"."IDX_577cfbbd0e9dedad955108df36"`); + await queryRunner.query(`DROP INDEX "public"."IDX_7c3776ae0d403baebc8a9387d8"`); + await queryRunner.query(`DROP INDEX "public"."IDX_18a46a61494103f9db1c42285d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_41bff03b05f43a4e22e54cb83e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_eed2b389448b96ec1118ca38ef"`); + await queryRunner.query(`DROP INDEX "public"."IDX_fdca637f69b879c6e95525a01f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e69de0d6c91d71407822a95bc9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_89d6d92ce60b7b6de00449b30d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2dce278beac80aebe7e179d7c9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_8b0d255d8f0ec4ca22e36249a8"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c5075efc6dab483721af36616f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_523b77d9dcbace8377fbca05ae"`); + await queryRunner.query(`DROP INDEX "public"."IDX_7f8ba01a73690cbabe6c6ab93c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_3c5fdf6c34ed7a20fae6c9ae94"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6c41095093c47ac91434a1bdf9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_af48bbfa76f6261a5520e5e90f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_5deae148453dfaf555b24d151f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_d109b8470a4cf2662bec0a672b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_60683da6db3f64a0767d40b291"`); + await queryRunner.query(`DROP INDEX "public"."IDX_cbb3f1eb241abc47103df48f83"`); + await queryRunner.query(`DROP INDEX "public"."IDX_636a95bda1eaf9fab00849dec2"`); + await queryRunner.query(`DROP INDEX "public"."IDX_21510dbb86b763f55a8bf4ec93"`); + await queryRunner.query(`DROP INDEX "public"."IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_05edb214d298384f9f918d6b5d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "public"."IDX_fdd58e4f13a3f4a92c70bcdb30"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1bff92d7a3b4b1f1a0e62a5122"`); + await queryRunner.query(`DROP INDEX "public"."IDX_94330f9121dd1e72fe31fdb3c5"`); + await queryRunner.query(`DROP INDEX "public"."IDX_8a11abe644b2cb5810bb65c8f9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bf9a2edebcda9ac2c59e4439cb"`); + await queryRunner.query(`DROP INDEX "public"."IDX_8cf81262c7cddfcf3fedcbc106"`); + await queryRunner.query(`DROP INDEX "public"."IDX_cdf46b38fd75cd7baebce81cc6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_20aebc4219b9f9196f5ca2344d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_ebff440aec581d4893ad743c7e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_745828269219870069b3b46a7f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_30bf8575f0744aa3b68b611985"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c5df67196c2aca0a7fb6ffd274"`); + await queryRunner.query(`DROP INDEX "public"."IDX_04b8ef5663b40baa58e1b65160"`); + await queryRunner.query(`DROP INDEX "public"."IDX_40ee7b28c0ea835534a93b54bf"`); + await queryRunner.query(`DROP INDEX "public"."IDX_457cbab434fc9a031f03eb6211"`); + await queryRunner.query(`DROP INDEX "public"."IDX_599de8ec6ea69550c6d49c4ae1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_00a3c849694b6f8be7b193c888"`); + await queryRunner.query(`DROP INDEX "public"."IDX_90aec772805c7fd508d71bedfe"`); + await queryRunner.query(`DROP INDEX "public"."IDX_842e81def8eef9f71a97496ff1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_b6654519fbad729cdb490069be"`); + await queryRunner.query(`DROP INDEX "public"."IDX_02f667ad727ca0975d5022e695"`); + await queryRunner.query(`DROP INDEX "public"."IDX_3907c6f563fc45d824558d239d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_5053bf22f9e0a5e9e8df7850da"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2a9f9f6fa9064b328e277063a1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_263e874cebea17ad3f2ba39e11"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2a8cd17a33093bb6afed97e9d3"`); + await queryRunner.query(`DROP INDEX "public"."IDX_265b5cbc3e414bb3bb2facbb22"`); + await queryRunner.query(`DROP INDEX "public"."IDX_cc3487eb32dd8baa86a8043540"`); + await queryRunner.query(`DROP INDEX "public"."IDX_25e0f8060ed921994873391253"`); + await queryRunner.query(`DROP INDEX "public"."IDX_dae34450bed722e897370e2aec"`); + await queryRunner.query(`DROP INDEX "public"."IDX_84a5a399408725b9c8612767e0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_03dbd727034c431934185d1d6f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_3c0aa9d1eabc26757fbddc2bb9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c795b7a18f1213b980bcc91ffe"`); + await queryRunner.query(`DROP INDEX "public"."IDX_b1669a96371cbdb8fd8d4724d6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_ca5fc2af0a26e454779d014a6a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6620af16ccd56e7e52b6ad914d"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0edbfb90f0bc4c28eb57892900"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e261b3b6ed4c6e79901fb3e1bc"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c029854e57e273cb30445e6417"`); + await queryRunner.query(`DROP INDEX "public"."IDX_7ed01d2a28f6cc9acb72c5fcf8"`); + await queryRunner.query(`DROP INDEX "public"."IDX_21bb7aec28dbb12ebc58a41d02"`); + await queryRunner.query(`DROP INDEX "public"."IDX_0c5508f4c86446f84d609e3b76"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c17e703a7008f6b9c2770a5cba"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a8e048dfb4d618068376407c86"`); + await queryRunner.query(`DROP INDEX "public"."IDX_185b880550575c61d4212896e2"`); + await queryRunner.query(`DROP INDEX "public"."IDX_08e391262cb3d4fbe9db97ecf8"`); + await queryRunner.query(`DROP INDEX "public"."IDX_9dff154a1be222c66c179ad14b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_cee87c9b8743f0e81db8152f68"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e69d60f1adcded4445095c4787"`); + await queryRunner.query(`DROP INDEX "public"."IDX_ce96229ae8d1d1af61348730da"`); + await queryRunner.query(`DROP INDEX "public"."IDX_35ac91a92c521b68277e780e6e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_753f4b022ec98a0c8f38b370c0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_284658fe519bca6048fd73ff72"`); + await queryRunner.query(`DROP INDEX "public"."IDX_36106478339961c8a17674a031"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e99bb270f0fa89ea715a457d29"`); + await queryRunner.query(`DROP INDEX "public"."IDX_711fd0159178a0102abc4db336"`); + await queryRunner.query(`DROP INDEX "public"."IDX_67a4423093e3c311cb76275659"`); + await queryRunner.query(`DROP INDEX "public"."IDX_ac765cfc390ec77d765dd48b61"`); + await queryRunner.query(`DROP INDEX "public"."IDX_5cb080756923318f19f1d2eabe"`); + await queryRunner.query(`DROP INDEX "public"."IDX_df0a9a4b6ae0e3cab9c4f35436"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f651e72ab42727f28c29441f1b"`); + await queryRunner.query(`DROP INDEX "public"."IDX_fa411cb89c9c6848d192d7f2e6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_54b281d06e1a4e7e6ff640dab4"`); + await queryRunner.query(`DROP INDEX "public"."IDX_09f72a1a309aae91e0cd83949a"`); + await queryRunner.query(`DROP INDEX "public"."IDX_89ff7e0a8c37fdf7770b753776"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bb09aa3130d0e54007a98523c5"`); + await queryRunner.query(`DROP INDEX "public"."IDX_745780f5553e56a3ca19bccf86"`); + await queryRunner.query(`DROP INDEX "public"."IDX_4985a92870282574f6fec8dd98"`); + await queryRunner.query(`DROP INDEX "public"."IDX_75bd5526e43c8801085225ffa9"`); + await queryRunner.query(`DROP INDEX "public"."IDX_c323aa830e10a871854d0a0408"`); + await queryRunner.query(`DROP INDEX "public"."IDX_2ada776a231239b8e99f78bf64"`); + await queryRunner.query(`DROP INDEX "public"."IDX_829e02292a572f25476c4e426c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e0c6443e0d2d5630067bc10ccf"`); + await queryRunner.query(`DROP INDEX "public"."IDX_5d74a3f25e6acfb6caec05ec65"`); + await queryRunner.query(`ALTER TABLE "product_review" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "knowledge_base_author" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "knowledge_base_article" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "knowledge_base" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "job_preset_upwork_job_search_criterion" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "job_preset" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_upwork_job_search_criterion" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "job_search_category" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "job_search_occupation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_proposal_template" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "proposal" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_github_repository_issue" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_github_repository" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "changelog" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "warehouse" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "warehouse_product_variant" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "warehouse_product" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "user_organization" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "timesheet" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "time_slot_minute" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "time_slot" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "time_log" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "screenshot" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "activity" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "time_off_request" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "time_off_policy" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "tenant" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "tenant_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_version" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_status" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_size" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_related_issue_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_priority" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_linked_issues" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "issue_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "task_estimation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "daily_plan" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "tag" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "skill" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "role_permission" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "request_approval" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "request_approval_team" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "request_approval_employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "report" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "report_organization" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "report_category" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_translation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_variant" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_variant_price" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_type_translation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_variant_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_option" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_option_translation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_option_group_translation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_option_group" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_category" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "product_category_translation" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "pipeline" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "pipeline_stage" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "payment" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "password_reset" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_vendor" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_team" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_team_join_request" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_team_employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_task_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_sprint" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_recurring_expense" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_module" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "defaultAssigneeId"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "managerId"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "closeTasksIn"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archiveTasksIn"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "icon"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "status"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_position" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_language" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_employment_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_document" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_department" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_contact" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_award" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "merchant" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "language" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "key_result" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "key_result_update" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "key_result_template" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "invoice" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "invoice_item" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "invoice_estimate_history" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "invite" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_tenant" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_map" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_entity_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "integration_entity_setting_tied" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "income" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "image_asset" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal_time_frame" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal_template" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal_kpi" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal_kpi_template" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "goal_general_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "feature" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "feature_organization" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "import-record" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "import-history" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "expense" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "expense_category" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "event_type" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "estimate_email" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "equipment" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "equipment_sharing" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_setting" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_recurring_expense" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_phone" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_level" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_award" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "employee_appointment" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "email_template" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "email_reset" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "email_sent" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "deal" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "custom_smtp" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "currency" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "country" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "contact" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_technology" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_source" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_skill" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_personal_quality" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_interviewer" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_interview" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_feedback" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_experience" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_education" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_document" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "candidate_criterion_rating" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "social_account" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "availability_slot" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "approval_policy" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "appointment_employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "accounting_template" DROP COLUMN "archivedAt"`); + } + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} +} From e62256b2adb712b7df99a17d7a05b55aef731834 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 10:21:41 +0200 Subject: [PATCH 04/47] feat: add sqlite migration --- .../src/organization-projects.model.ts | 4 +- ...1-AlterOrganizationProjectAndBaseEntity.ts | 8096 ++++++++++++++++- 2 files changed, 8096 insertions(+), 4 deletions(-) diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index c2db639b973..8e484a5ff4f 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -37,7 +37,7 @@ export interface IOrganizationProject currency: CurrenciesEnum; members?: IEmployee[]; public: boolean; - status?: TaskStatusEnum; // Defines the project stage / progession / step + status?: TaskStatusEnum; // Defines the project stage / progression / step tags: ITag[]; owner: ProjectOwnerEnum; tasks?: ITask[]; @@ -71,7 +71,7 @@ export interface IOrganizationProject // Default project assignee defaultAssignee?: IEmployee; defaultAssigneeId?: ID; - // automations + // automation archiveTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-archived after the period reached closeTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-closed after the period reached } diff --git a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts index 2db32e556dc..b948b2aaceb 100644 --- a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts +++ b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts @@ -822,14 +822,8106 @@ export class AlterOrganizationProjectAndBaseEntity1725775971501 implements Migra * * @param queryRunner */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_a841eabc6b656c965d8846223e"`); + await queryRunner.query(`DROP INDEX "IDX_968c1c9a131a61a3720b3a72f6"`); + await queryRunner.query(`DROP INDEX "IDX_e66511b175393255c6c4e7b007"`); + await queryRunner.query(`DROP INDEX "IDX_2ca6a49062a4ed884e413bf572"`); + await queryRunner.query(`DROP INDEX "IDX_5cf7c007fc9c83bee748f08806"`); + await queryRunner.query(`DROP INDEX "IDX_7ac2c1c487dd77fe38c2d571ea"`); + await queryRunner.query( + `CREATE TABLE "temporary_accounting_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "templateType" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e66511b175393255c6c4e7b007f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ca6a49062a4ed884e413bf572e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_accounting_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt" FROM "accounting_template"` + ); + await queryRunner.query(`DROP TABLE "accounting_template"`); + await queryRunner.query(`ALTER TABLE "temporary_accounting_template" RENAME TO "accounting_template"`); + await queryRunner.query( + `CREATE INDEX "IDX_a841eabc6b656c965d8846223e" ON "accounting_template" ("languageCode") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_968c1c9a131a61a3720b3a72f6" ON "accounting_template" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_e66511b175393255c6c4e7b007" ON "accounting_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_2ca6a49062a4ed884e413bf572" ON "accounting_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_5cf7c007fc9c83bee748f08806" ON "accounting_template" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_7ac2c1c487dd77fe38c2d571ea" ON "accounting_template" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e9ca170a0fae05e44a9bd137d8"`); + await queryRunner.query(`DROP INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba"`); + await queryRunner.query(`DROP INDEX "IDX_3c3a62226896345c4716bfe1d9"`); + await queryRunner.query(`DROP INDEX "IDX_2c0494466d5a7e1165cea3dca9"`); + await queryRunner.query(`DROP INDEX "IDX_379af16b0aeed6a4d8f15c53bc"`); + await queryRunner.query(`DROP INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3"`); + await queryRunner.query( + `CREATE TABLE "temporary_appointment_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "appointmentId" varchar NOT NULL, "employeeId" varchar NOT NULL, "employeeAppointmentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e9ca170a0fae05e44a9bd137d8b" FOREIGN KEY ("employeeAppointmentId") REFERENCES "employee_appointment" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0ddc50b7521b9a905d9ca8c8ba3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3c3a62226896345c4716bfe1d96" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2c0494466d5a7e1165cea3dca98" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_appointment_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt" FROM "appointment_employee"` + ); + await queryRunner.query(`DROP TABLE "appointment_employee"`); + await queryRunner.query(`ALTER TABLE "temporary_appointment_employee" RENAME TO "appointment_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_e9ca170a0fae05e44a9bd137d8" ON "appointment_employee" ("employeeAppointmentId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba" ON "appointment_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3c3a62226896345c4716bfe1d9" ON "appointment_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2c0494466d5a7e1165cea3dca9" ON "appointment_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_379af16b0aeed6a4d8f15c53bc" ON "appointment_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3" ON "appointment_employee" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_45f32a5a12d42fba17fe62a279"`); + await queryRunner.query(`DROP INDEX "IDX_dfe3b357df3ce136917b1f0984"`); + await queryRunner.query(`DROP INDEX "IDX_1462391059ebe137645098d727"`); + await queryRunner.query(`DROP INDEX "IDX_338364927c68961167606e989c"`); + await queryRunner.query(`DROP INDEX "IDX_f50ce5a39d610cfcd9da9652b1"`); + await queryRunner.query( + `CREATE TABLE "temporary_approval_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "approvalType" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_dfe3b357df3ce136917b1f09843" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1462391059ebe137645098d7276" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_approval_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt" FROM "approval_policy"` + ); + await queryRunner.query(`DROP TABLE "approval_policy"`); + await queryRunner.query(`ALTER TABLE "temporary_approval_policy" RENAME TO "approval_policy"`); + await queryRunner.query(`CREATE INDEX "IDX_45f32a5a12d42fba17fe62a279" ON "approval_policy" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_dfe3b357df3ce136917b1f0984" ON "approval_policy" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1462391059ebe137645098d727" ON "approval_policy" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_338364927c68961167606e989c" ON "approval_policy" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f50ce5a39d610cfcd9da9652b1" ON "approval_policy" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_46ed3c2287423f5dc089100fee"`); + await queryRunner.query(`DROP INDEX "IDX_d544bd3a63634a4438509ac958"`); + await queryRunner.query(`DROP INDEX "IDX_f008a481cb4eed547704bb9d83"`); + await queryRunner.query(`DROP INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe"`); + await queryRunner.query(`DROP INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca"`); + await queryRunner.query( + `CREATE TABLE "temporary_availability_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startTime" datetime NOT NULL, "endTime" datetime NOT NULL, "allDay" boolean NOT NULL, "type" text, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_46ed3c2287423f5dc089100feeb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d544bd3a63634a4438509ac958d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f008a481cb4eed547704bb9d839" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_availability_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt" FROM "availability_slot"` + ); + await queryRunner.query(`DROP TABLE "availability_slot"`); + await queryRunner.query(`ALTER TABLE "temporary_availability_slot" RENAME TO "availability_slot"`); + await queryRunner.query(`CREATE INDEX "IDX_46ed3c2287423f5dc089100fee" ON "availability_slot" ("employeeId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d544bd3a63634a4438509ac958" ON "availability_slot" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f008a481cb4eed547704bb9d83" ON "availability_slot" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe" ON "availability_slot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca" ON "availability_slot" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_e8b7694e86fe9534778832f90c"`); + await queryRunner.query(`DROP INDEX "IDX_a3b32d609a4c884a776ab883be"`); + await queryRunner.query(`DROP INDEX "IDX_1d8e3566b66fbad38b6e2290a2"`); + await queryRunner.query(`DROP INDEX "IDX_a2eb41b1d6ee72de9486558199"`); + await queryRunner.query( + `CREATE TABLE "temporary_social_account" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "provider" varchar NOT NULL, "providerAccountId" varchar NOT NULL, "userId" varchar NOT NULL, "archivedAt" datetime, CONSTRAINT "FK_e8b7694e86fe9534778832f90c0" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a3b32d609a4c884a776ab883be3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_social_account"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId" FROM "social_account"` + ); + await queryRunner.query(`DROP TABLE "social_account"`); + await queryRunner.query(`ALTER TABLE "temporary_social_account" RENAME TO "social_account"`); + await queryRunner.query(`CREATE INDEX "IDX_e8b7694e86fe9534778832f90c" ON "social_account" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_a3b32d609a4c884a776ab883be" ON "social_account" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_1d8e3566b66fbad38b6e2290a2" ON "social_account" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_a2eb41b1d6ee72de9486558199" ON "social_account" ("isActive") `); + await queryRunner.query(`DROP INDEX "IDX_159f821dd214792f1d2ad9cff7"`); + await queryRunner.query(`DROP INDEX "IDX_ba4c376b2069aa82745d4e9682"`); + await queryRunner.query(`DROP INDEX "IDX_d1d16bc87d3afaf387f34cdceb"`); + await queryRunner.query(`DROP INDEX "IDX_b106406e94bb7317493efc2c98"`); + await queryRunner.query(`DROP INDEX "IDX_9d5bd131452ef689df2b46551b"`); + await queryRunner.query(`DROP INDEX "IDX_0a417dafb1dd14eb92a69fa641"`); + await queryRunner.query(`DROP INDEX "IDX_fcab96cef60fd8bccac610ccef"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_criterion_rating" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" integer NOT NULL, "technologyId" varchar, "personalQualityId" varchar, "feedbackId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_159f821dd214792f1d2ad9cff7c" FOREIGN KEY ("feedbackId") REFERENCES "candidate_feedback" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ba4c376b2069aa82745d4e96822" FOREIGN KEY ("personalQualityId") REFERENCES "candidate_personal_quality" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d1d16bc87d3afaf387f34cdceb7" FOREIGN KEY ("technologyId") REFERENCES "candidate_technology" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b106406e94bb7317493efc2c989" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9d5bd131452ef689df2b46551b4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_criterion_rating"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt" FROM "candidate_criterion_rating"` + ); + await queryRunner.query(`DROP TABLE "candidate_criterion_rating"`); + await queryRunner.query( + `ALTER TABLE "temporary_candidate_criterion_rating" RENAME TO "candidate_criterion_rating"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_159f821dd214792f1d2ad9cff7" ON "candidate_criterion_rating" ("feedbackId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ba4c376b2069aa82745d4e9682" ON "candidate_criterion_rating" ("personalQualityId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d1d16bc87d3afaf387f34cdceb" ON "candidate_criterion_rating" ("technologyId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b106406e94bb7317493efc2c98" ON "candidate_criterion_rating" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d5bd131452ef689df2b46551b" ON "candidate_criterion_rating" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0a417dafb1dd14eb92a69fa641" ON "candidate_criterion_rating" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fcab96cef60fd8bccac610ccef" ON "candidate_criterion_rating" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3f9053719c9d11ebdea03e5a2d"`); + await queryRunner.query(`DROP INDEX "IDX_d108a827199fda86a9ec216989"`); + await queryRunner.query(`DROP INDEX "IDX_4d9b7ab09f9f9517d488b5fed1"`); + await queryRunner.query(`DROP INDEX "IDX_bf8070715e42b3afe9730e7b30"`); + await queryRunner.query(`DROP INDEX "IDX_3ed4bac12d0ca32eada4ea5a49"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3f9053719c9d11ebdea03e5a2d4" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d108a827199fda86a9ec216989a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4d9b7ab09f9f9517d488b5fed1e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_document"` + ); + await queryRunner.query(`DROP TABLE "candidate_document"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_document" RENAME TO "candidate_document"`); + await queryRunner.query( + `CREATE INDEX "IDX_3f9053719c9d11ebdea03e5a2d" ON "candidate_document" ("candidateId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d108a827199fda86a9ec216989" ON "candidate_document" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_4d9b7ab09f9f9517d488b5fed1" ON "candidate_document" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_bf8070715e42b3afe9730e7b30" ON "candidate_document" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_3ed4bac12d0ca32eada4ea5a49" ON "candidate_document" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f660af89b2c69fea2334508cbb"`); + await queryRunner.query(`DROP INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd"`); + await queryRunner.query(`DROP INDEX "IDX_336eb14606016757d2302efa4d"`); + await queryRunner.query(`DROP INDEX "IDX_b443c78c3796f2e9aab05a2bb9"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_education" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "schoolName" varchar NOT NULL, "degree" varchar NOT NULL, "field" varchar NOT NULL, "completionDate" datetime NOT NULL, "notes" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_59b61ba52a58851cfc85b1e6c66" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f660af89b2c69fea2334508cbbd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_00cdd9ed7571be8e2c8d09e7cd4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_education"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_education"` + ); + await queryRunner.query(`DROP TABLE "candidate_education"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_education" RENAME TO "candidate_education"`); + await queryRunner.query( + `CREATE INDEX "IDX_f660af89b2c69fea2334508cbb" ON "candidate_education" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd" ON "candidate_education" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_336eb14606016757d2302efa4d" ON "candidate_education" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_b443c78c3796f2e9aab05a2bb9" ON "candidate_education" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a50eb955f940ca93e044d175c6"`); + await queryRunner.query(`DROP INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf"`); + await queryRunner.query(`DROP INDEX "IDX_dafa68d060cf401d5f62a57ad4"`); + await queryRunner.query(`DROP INDEX "IDX_c24bce6dd33e56ef8e8dacef1a"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_experience" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "occupation" varchar NOT NULL, "duration" varchar NOT NULL, "description" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cf75465b3663652a28cf1841ce2" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a50eb955f940ca93e044d175c62" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dcf5fc8bc7f77a80b0fc648bfc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_experience"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_experience"` + ); + await queryRunner.query(`DROP TABLE "candidate_experience"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_experience" RENAME TO "candidate_experience"`); + await queryRunner.query( + `CREATE INDEX "IDX_a50eb955f940ca93e044d175c6" ON "candidate_experience" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf" ON "candidate_experience" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_dafa68d060cf401d5f62a57ad4" ON "candidate_experience" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c24bce6dd33e56ef8e8dacef1a" ON "candidate_experience" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_0862c274d336126b951bfe009a"`); + await queryRunner.query(`DROP INDEX "IDX_98c008fd8cf597e83dcdccfd16"`); + await queryRunner.query(`DROP INDEX "IDX_3a6928f8501fce33820721a8fe"`); + await queryRunner.query(`DROP INDEX "IDX_6cb21fa0f65ff69679966c836f"`); + await queryRunner.query(`DROP INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb"`); + await queryRunner.query(`DROP INDEX "IDX_05ed49a5ebdd5ec533f913b620"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_feedback" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "rating" numeric, "status" varchar, "candidateId" varchar, "interviewId" varchar, "interviewerId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_44f3d80c3293e1de038c87f115" UNIQUE ("interviewerId"), CONSTRAINT "FK_44f3d80c3293e1de038c87f115d" FOREIGN KEY ("interviewerId") REFERENCES "candidate_interviewer" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0862c274d336126b951bfe009a7" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_98c008fd8cf597e83dcdccfd161" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3a6928f8501fce33820721a8fe8" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6cb21fa0f65ff69679966c836f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_feedback"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt" FROM "candidate_feedback"` + ); + await queryRunner.query(`DROP TABLE "candidate_feedback"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_feedback" RENAME TO "candidate_feedback"`); + await queryRunner.query( + `CREATE INDEX "IDX_0862c274d336126b951bfe009a" ON "candidate_feedback" ("interviewId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_98c008fd8cf597e83dcdccfd16" ON "candidate_feedback" ("candidateId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3a6928f8501fce33820721a8fe" ON "candidate_feedback" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_6cb21fa0f65ff69679966c836f" ON "candidate_feedback" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb" ON "candidate_feedback" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_05ed49a5ebdd5ec533f913b620" ON "candidate_feedback" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_59b765e6d13d83dba4852a43eb"`); + await queryRunner.query(`DROP INDEX "IDX_03be41e88b1fecfe4e24d6b04b"`); + await queryRunner.query(`DROP INDEX "IDX_91996439c4baafee8395d3df15"`); + await queryRunner.query(`DROP INDEX "IDX_b9191cf49f8cd1f192cb74233c"`); + await queryRunner.query(`DROP INDEX "IDX_7b49ce2928b327213f2de66b95"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_interview" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "startTime" datetime, "endTime" datetime, "location" varchar, "note" varchar, "isArchived" boolean DEFAULT (0), "rating" numeric, "candidateId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_59b765e6d13d83dba4852a43eb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_03be41e88b1fecfe4e24d6b04b2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91996439c4baafee8395d3df153" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_interview"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt" FROM "candidate_interview"` + ); + await queryRunner.query(`DROP TABLE "candidate_interview"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_interview" RENAME TO "candidate_interview"`); + await queryRunner.query(`CREATE INDEX "IDX_59b765e6d13d83dba4852a43eb" ON "candidate_interview" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_03be41e88b1fecfe4e24d6b04b" ON "candidate_interview" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_91996439c4baafee8395d3df15" ON "candidate_interview" ("candidateId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b9191cf49f8cd1f192cb74233c" ON "candidate_interview" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_7b49ce2928b327213f2de66b95" ON "candidate_interview" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_9e7b20eb3dfa082b83b198fdad"`); + await queryRunner.query(`DROP INDEX "IDX_ecb65075e94b47bbab11cfa5a1"`); + await queryRunner.query(`DROP INDEX "IDX_5f1e315db848990dfffa72817c"`); + await queryRunner.query(`DROP INDEX "IDX_f0ca69c78eea92c95d9044764a"`); + await queryRunner.query(`DROP INDEX "IDX_b9132118c3a98c4c48e417c0c5"`); + await queryRunner.query(`DROP INDEX "IDX_2043abff09f084fb8690009fb8"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_interviewer" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "interviewId" varchar NOT NULL, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9e7b20eb3dfa082b83b198fdad4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb65075e94b47bbab11cfa5a1e" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5f1e315db848990dfffa72817ca" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f0ca69c78eea92c95d9044764a2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_interviewer"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "candidate_interviewer"` + ); + await queryRunner.query(`DROP TABLE "candidate_interviewer"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_interviewer" RENAME TO "candidate_interviewer"`); + await queryRunner.query( + `CREATE INDEX "IDX_9e7b20eb3dfa082b83b198fdad" ON "candidate_interviewer" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ecb65075e94b47bbab11cfa5a1" ON "candidate_interviewer" ("interviewId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f1e315db848990dfffa72817c" ON "candidate_interviewer" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f0ca69c78eea92c95d9044764a" ON "candidate_interviewer" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b9132118c3a98c4c48e417c0c5" ON "candidate_interviewer" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2043abff09f084fb8690009fb8" ON "candidate_interviewer" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a0d171f45bdbcf2b990c0c37c3"`); + await queryRunner.query(`DROP INDEX "IDX_d321f4547ed467d07cce1e7d9a"`); + await queryRunner.query(`DROP INDEX "IDX_045de7c208adcd0c68c0a65174"`); + await queryRunner.query(`DROP INDEX "IDX_afe01503d4337c9623c06f22df"`); + await queryRunner.query(`DROP INDEX "IDX_ff6776d92db4ef71edbfba9903"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_personal_quality" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a0d171f45bdbcf2b990c0c37c32" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d321f4547ed467d07cce1e7d9a5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_045de7c208adcd0c68c0a651748" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_personal_quality"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "candidate_personal_quality"` + ); + await queryRunner.query(`DROP TABLE "candidate_personal_quality"`); + await queryRunner.query( + `ALTER TABLE "temporary_candidate_personal_quality" RENAME TO "candidate_personal_quality"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a0d171f45bdbcf2b990c0c37c3" ON "candidate_personal_quality" ("interviewId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d321f4547ed467d07cce1e7d9a" ON "candidate_personal_quality" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_045de7c208adcd0c68c0a65174" ON "candidate_personal_quality" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_afe01503d4337c9623c06f22df" ON "candidate_personal_quality" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ff6776d92db4ef71edbfba9903" ON "candidate_personal_quality" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_d7986743e7f11720349a6c9557"`); + await queryRunner.query(`DROP INDEX "IDX_8a07f780c6fce2b82830ab0687"`); + await queryRunner.query(`DROP INDEX "IDX_6907163d0bb8e9f0440b9bf2a7"`); + await queryRunner.query(`DROP INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_492548e6c176f5655adfae9f5ea" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d7986743e7f11720349a6c95572" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a07f780c6fce2b82830ab06877" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_skill"` + ); + await queryRunner.query(`DROP TABLE "candidate_skill"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_skill" RENAME TO "candidate_skill"`); + await queryRunner.query( + `CREATE INDEX "IDX_d7986743e7f11720349a6c9557" ON "candidate_skill" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_8a07f780c6fce2b82830ab0687" ON "candidate_skill" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_6907163d0bb8e9f0440b9bf2a7" ON "candidate_skill" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347" ON "candidate_skill" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_e92027b5280828cadd7cd6ea71"`); + await queryRunner.query(`DROP INDEX "IDX_b2a1ba27a76dd819cd8294cce3"`); + await queryRunner.query(`DROP INDEX "IDX_2be9182096747fb18cb8afb1f0"`); + await queryRunner.query(`DROP INDEX "IDX_509101ab1a46a5934ee278d447"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_source" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e92027b5280828cadd7cd6ea719" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b2a1ba27a76dd819cd8294cce38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_source"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "candidate_source"` + ); + await queryRunner.query(`DROP TABLE "candidate_source"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_source" RENAME TO "candidate_source"`); + await queryRunner.query( + `CREATE INDEX "IDX_e92027b5280828cadd7cd6ea71" ON "candidate_source" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b2a1ba27a76dd819cd8294cce3" ON "candidate_source" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_2be9182096747fb18cb8afb1f0" ON "candidate_source" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_509101ab1a46a5934ee278d447" ON "candidate_source" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_063663c7e61e45d172d1b83265"`); + await queryRunner.query(`DROP INDEX "IDX_9d46b8c5382acd4d4514bc5c62"`); + await queryRunner.query(`DROP INDEX "IDX_a6fecb615b07987b480defac64"`); + await queryRunner.query(`DROP INDEX "IDX_199ca43300fa4e64239656a677"`); + await queryRunner.query(`DROP INDEX "IDX_97aa0328b72e1bf919e61bccdc"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate_technology" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_063663c7e61e45d172d1b832656" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9d46b8c5382acd4d4514bc5c62e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a6fecb615b07987b480defac647" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate_technology"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "candidate_technology"` + ); + await queryRunner.query(`DROP TABLE "candidate_technology"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate_technology" RENAME TO "candidate_technology"`); + await queryRunner.query( + `CREATE INDEX "IDX_063663c7e61e45d172d1b83265" ON "candidate_technology" ("interviewId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d46b8c5382acd4d4514bc5c62" ON "candidate_technology" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a6fecb615b07987b480defac64" ON "candidate_technology" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_199ca43300fa4e64239656a677" ON "candidate_technology" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_97aa0328b72e1bf919e61bccdc" ON "candidate_technology" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3930aa71e0fa24f09201811b1b"`); + await queryRunner.query(`DROP INDEX "IDX_4ea108fd8b089237964d5f98fb"`); + await queryRunner.query(`DROP INDEX "IDX_1e3e8228e7df634fa4cec6322c"`); + await queryRunner.query(`DROP INDEX "IDX_b674793a804b7d69d74c8f6c5b"`); + await queryRunner.query(`DROP INDEX "IDX_16fb27ffd1a99c6506c92ad57a"`); + await queryRunner.query(`DROP INDEX "IDX_77ac426e04553ff1654421bce4"`); + await queryRunner.query(`DROP INDEX "IDX_8b900e8a39f76125e610ab30c0"`); + await queryRunner.query(`DROP INDEX "IDX_2b8091376a529383e23ba3356a"`); + await queryRunner.query(`DROP INDEX "IDX_af835b66fa10279103bd89e225"`); + await queryRunner.query( + `CREATE TABLE "temporary_candidate" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" numeric, "valueDate" datetime, "appliedDate" datetime, "hiredDate" datetime, "status" varchar DEFAULT ('APPLIED'), "rejectDate" datetime, "candidateLevel" varchar(500), "reWeeklyLimit" integer, "billRateCurrency" varchar(255), "billRateValue" integer, "payPeriod" varchar, "cvUrl" varchar, "isArchived" boolean DEFAULT (0), "contactId" varchar, "organizationPositionId" varchar, "sourceId" varchar, "userId" varchar NOT NULL, "employeeId" varchar, "minimumBillingRate" integer, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_3930aa71e0fa24f09201811b1b" UNIQUE ("userId"), CONSTRAINT "REL_4ea108fd8b089237964d5f98fb" UNIQUE ("sourceId"), CONSTRAINT "REL_b674793a804b7d69d74c8f6c5b" UNIQUE ("contactId"), CONSTRAINT "UQ_91b20077aa92f9115764033cd06" UNIQUE ("employeeId"), CONSTRAINT "FK_3930aa71e0fa24f09201811b1bb" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4ea108fd8b089237964d5f98fba" FOREIGN KEY ("sourceId") REFERENCES "candidate_source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1e3e8228e7df634fa4cec6322c7" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b674793a804b7d69d74c8f6c5ba" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16fb27ffd1a99c6506c92ad57a7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_77ac426e04553ff1654421bce4d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_candidate"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt" FROM "candidate"` + ); + await queryRunner.query(`DROP TABLE "candidate"`); + await queryRunner.query(`ALTER TABLE "temporary_candidate" RENAME TO "candidate"`); + await queryRunner.query(`CREATE INDEX "IDX_3930aa71e0fa24f09201811b1b" ON "candidate" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_4ea108fd8b089237964d5f98fb" ON "candidate" ("sourceId") `); + await queryRunner.query( + `CREATE INDEX "IDX_1e3e8228e7df634fa4cec6322c" ON "candidate" ("organizationPositionId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b674793a804b7d69d74c8f6c5b" ON "candidate" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_16fb27ffd1a99c6506c92ad57a" ON "candidate" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_77ac426e04553ff1654421bce4" ON "candidate" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_8b900e8a39f76125e610ab30c0" ON "candidate" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_2b8091376a529383e23ba3356a" ON "candidate" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_af835b66fa10279103bd89e225" ON "candidate" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_60468af1ce34043a900809c84f"`); + await queryRunner.query(`DROP INDEX "IDX_7719d73cd16a9f57ecc6ac24b3"`); + await queryRunner.query(`DROP INDEX "IDX_05831d37eabeb6150f99c69784"`); + await queryRunner.query(`DROP INDEX "IDX_4164bd34bdcce8754641f0e567"`); + await queryRunner.query( + `CREATE TABLE "temporary_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "firstName" varchar, "lastName" varchar, "country" varchar, "city" varchar, "address" varchar, "address2" varchar, "postcode" varchar, "latitude" numeric, "longitude" numeric, "regionCode" varchar, "fax" varchar, "fiscalInformation" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_60468af1ce34043a900809c84f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7719d73cd16a9f57ecc6ac24b3d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt" FROM "contact"` + ); + await queryRunner.query(`DROP TABLE "contact"`); + await queryRunner.query(`ALTER TABLE "temporary_contact" RENAME TO "contact"`); + await queryRunner.query(`CREATE INDEX "IDX_60468af1ce34043a900809c84f" ON "contact" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_7719d73cd16a9f57ecc6ac24b3" ON "contact" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_05831d37eabeb6150f99c69784" ON "contact" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4164bd34bdcce8754641f0e567" ON "contact" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_6eba1a52ee121d100c8a0a6510"`); + await queryRunner.query(`DROP INDEX "IDX_97ebcd8db30a408b5f907d6ff4"`); + await queryRunner.query(`DROP INDEX "IDX_6cd9b7ea6818e862217035436c"`); + await queryRunner.query( + `CREATE TABLE "temporary_country" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "country" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "temporary_country"("id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt" FROM "country"` + ); + await queryRunner.query(`DROP TABLE "country"`); + await queryRunner.query(`ALTER TABLE "temporary_country" RENAME TO "country"`); + await queryRunner.query(`CREATE INDEX "IDX_6eba1a52ee121d100c8a0a6510" ON "country" ("isoCode") `); + await queryRunner.query(`CREATE INDEX "IDX_97ebcd8db30a408b5f907d6ff4" ON "country" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6cd9b7ea6818e862217035436c" ON "country" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_0b0fbda74f6c82c943e706a3cc"`); + await queryRunner.query(`DROP INDEX "IDX_03cc024ddc2f196dca7fead7cb"`); + await queryRunner.query(`DROP INDEX "IDX_8203f1410475748bbbc6d3029d"`); + await queryRunner.query( + `CREATE TABLE "temporary_currency" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "currency" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "temporary_currency"("id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt" FROM "currency"` + ); + await queryRunner.query(`DROP TABLE "currency"`); + await queryRunner.query(`ALTER TABLE "temporary_currency" RENAME TO "currency"`); + await queryRunner.query(`CREATE INDEX "IDX_0b0fbda74f6c82c943e706a3cc" ON "currency" ("isoCode") `); + await queryRunner.query(`CREATE INDEX "IDX_03cc024ddc2f196dca7fead7cb" ON "currency" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8203f1410475748bbbc6d3029d" ON "currency" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_2aa3fc8daa25beec4788d2be26"`); + await queryRunner.query(`DROP INDEX "IDX_15a1306132d66c63ef31f7288c"`); + await queryRunner.query(`DROP INDEX "IDX_e2c7d28bb07adc915d74437c7b"`); + await queryRunner.query(`DROP INDEX "IDX_f10372f9d038d0954d5b20635a"`); + await queryRunner.query( + `CREATE TABLE "temporary_custom_smtp" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "host" varchar NOT NULL, "port" integer NOT NULL, "secure" boolean NOT NULL, "username" varchar NOT NULL, "password" varchar NOT NULL, "isValidate" boolean NOT NULL DEFAULT (0), "fromAddress" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2aa3fc8daa25beec4788d2be26c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_15a1306132d66c63ef31f7288c1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_custom_smtp"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt" FROM "custom_smtp"` + ); + await queryRunner.query(`DROP TABLE "custom_smtp"`); + await queryRunner.query(`ALTER TABLE "temporary_custom_smtp" RENAME TO "custom_smtp"`); + await queryRunner.query(`CREATE INDEX "IDX_2aa3fc8daa25beec4788d2be26" ON "custom_smtp" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_15a1306132d66c63ef31f7288c" ON "custom_smtp" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_e2c7d28bb07adc915d74437c7b" ON "custom_smtp" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f10372f9d038d0954d5b20635a" ON "custom_smtp" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_9211f5b62988df6e95522be7da"`); + await queryRunner.query(`DROP INDEX "IDX_4b1ff44e6bae5065429dbab554"`); + await queryRunner.query(`DROP INDEX "IDX_38fb85abdf9995efcf217f5955"`); + await queryRunner.query(`DROP INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0"`); + await queryRunner.query(`DROP INDEX "IDX_0d8c964237e5061627de82df80"`); + await queryRunner.query(`DROP INDEX "IDX_443c561d45f6c57f3790a759ba"`); + await queryRunner.query( + `CREATE TABLE "temporary_deal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "probability" integer NOT NULL, "createdByUserId" varchar NOT NULL, "stageId" varchar NOT NULL, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_1ae3abc0ae1dcf6c13f49b62b5" UNIQUE ("clientId"), CONSTRAINT "FK_1ae3abc0ae1dcf6c13f49b62b56" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9211f5b62988df6e95522be7daa" FOREIGN KEY ("stageId") REFERENCES "pipeline_stage" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4b1ff44e6bae5065429dbab554b" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38fb85abdf9995efcf217f59554" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_46a3c00bfc3e36b4412d8bcdb08" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_deal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt" FROM "deal"` + ); + await queryRunner.query(`DROP TABLE "deal"`); + await queryRunner.query(`ALTER TABLE "temporary_deal" RENAME TO "deal"`); + await queryRunner.query(`CREATE INDEX "IDX_9211f5b62988df6e95522be7da" ON "deal" ("stageId") `); + await queryRunner.query(`CREATE INDEX "IDX_4b1ff44e6bae5065429dbab554" ON "deal" ("createdByUserId") `); + await queryRunner.query(`CREATE INDEX "IDX_38fb85abdf9995efcf217f5955" ON "deal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0" ON "deal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_0d8c964237e5061627de82df80" ON "deal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_443c561d45f6c57f3790a759ba" ON "deal" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_9a69f7077e0333d2c848895a1b"`); + await queryRunner.query(`DROP INDEX "IDX_d825bc6da1c52a3900a9373260"`); + await queryRunner.query(`DROP INDEX "IDX_1261c457b3035b77719556995b"`); + await queryRunner.query(`DROP INDEX "IDX_953df0eb0df3035baf140399f6"`); + await queryRunner.query(`DROP INDEX "IDX_525f4873c6edc3d94559f88900"`); + await queryRunner.query(`DROP INDEX "IDX_0af511c44de7a16beb45cc3785"`); + await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); + await queryRunner.query(`DROP INDEX "IDX_9033faf41b23c61ba201c48796"`); + await queryRunner.query(`DROP INDEX "IDX_5956ce758c01ebf8a539e8d4f0"`); + await queryRunner.query( + `CREATE TABLE "temporary_email_sent" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "content" varchar, "email" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "userId" varchar, "emailTemplateId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "status" varchar CHECK( "status" IN ('SENT','FAILED') ), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_1261c457b3035b77719556995bf" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_525f4873c6edc3d94559f88900c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0af511c44de7a16beb45cc37852" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9033faf41b23c61ba201c487969" FOREIGN KEY ("emailTemplateId") REFERENCES "email_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_email_sent"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt" FROM "email_sent"` + ); + await queryRunner.query(`DROP TABLE "email_sent"`); + await queryRunner.query(`ALTER TABLE "temporary_email_sent" RENAME TO "email_sent"`); + await queryRunner.query(`CREATE INDEX "IDX_9a69f7077e0333d2c848895a1b" ON "email_sent" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_d825bc6da1c52a3900a9373260" ON "email_sent" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1261c457b3035b77719556995b" ON "email_sent" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_953df0eb0df3035baf140399f6" ON "email_sent" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_525f4873c6edc3d94559f88900" ON "email_sent" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_0af511c44de7a16beb45cc3785" ON "email_sent" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_a954fda57cca81dc48446e73b8" ON "email_sent" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_9033faf41b23c61ba201c48796" ON "email_sent" ("emailTemplateId") `); + await queryRunner.query(`CREATE INDEX "IDX_5956ce758c01ebf8a539e8d4f0" ON "email_sent" ("status") `); + await queryRunner.query(`DROP INDEX "IDX_e37af4ab2ba0bf268bfd982634"`); + await queryRunner.query(`DROP INDEX "IDX_9e80c9ec749dfda6dbe2cd9704"`); + await queryRunner.query(`DROP INDEX "IDX_4be518a169bbcbfe92025ac574"`); + await queryRunner.query(`DROP INDEX "IDX_03d16a2fd43d7c601743440212"`); + await queryRunner.query(`DROP INDEX "IDX_93799dfaeff51de06f1e02ac41"`); + await queryRunner.query(`DROP INDEX "IDX_4ac734f2a1a3c055dca04fba99"`); + await queryRunner.query(`DROP INDEX "IDX_e3321e3575289b7ee1e8eb1042"`); + await queryRunner.query(`DROP INDEX "IDX_13247a755d17e7905d5bb4cfda"`); + await queryRunner.query( + `CREATE TABLE "temporary_email_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "email" varchar NOT NULL, "oldEmail" varchar NOT NULL, "code" varchar NOT NULL, "userId" varchar, "token" varchar, "expiredAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_93799dfaeff51de06f1e02ac414" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e37af4ab2ba0bf268bfd9826345" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_email_reset"("id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt" FROM "email_reset"` + ); + await queryRunner.query(`DROP TABLE "email_reset"`); + await queryRunner.query(`ALTER TABLE "temporary_email_reset" RENAME TO "email_reset"`); + await queryRunner.query(`CREATE INDEX "IDX_e37af4ab2ba0bf268bfd982634" ON "email_reset" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_9e80c9ec749dfda6dbe2cd9704" ON "email_reset" ("code") `); + await queryRunner.query(`CREATE INDEX "IDX_4be518a169bbcbfe92025ac574" ON "email_reset" ("oldEmail") `); + await queryRunner.query(`CREATE INDEX "IDX_03d16a2fd43d7c601743440212" ON "email_reset" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_93799dfaeff51de06f1e02ac41" ON "email_reset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_4ac734f2a1a3c055dca04fba99" ON "email_reset" ("token") `); + await queryRunner.query(`CREATE INDEX "IDX_e3321e3575289b7ee1e8eb1042" ON "email_reset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_13247a755d17e7905d5bb4cfda" ON "email_reset" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_7e688e6613930ba721b841db43"`); + await queryRunner.query(`DROP INDEX "IDX_274708db64fcce5448f2c4541c"`); + await queryRunner.query(`DROP INDEX "IDX_c160fe6234675fac031aa3e7c5"`); + await queryRunner.query(`DROP INDEX "IDX_753e005a45556b5909e11937aa"`); + await queryRunner.query(`DROP INDEX "IDX_e4932e0a726b9b07d81d8b6905"`); + await queryRunner.query(`DROP INDEX "IDX_29d60114e1968c0cd68a19e3c5"`); + await queryRunner.query( + `CREATE TABLE "temporary_email_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c160fe6234675fac031aa3e7c50" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_753e005a45556b5909e11937aaf" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_email_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt" FROM "email_template"` + ); + await queryRunner.query(`DROP TABLE "email_template"`); + await queryRunner.query(`ALTER TABLE "temporary_email_template" RENAME TO "email_template"`); + await queryRunner.query(`CREATE INDEX "IDX_7e688e6613930ba721b841db43" ON "email_template" ("languageCode") `); + await queryRunner.query(`CREATE INDEX "IDX_274708db64fcce5448f2c4541c" ON "email_template" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c160fe6234675fac031aa3e7c5" ON "email_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_753e005a45556b5909e11937aa" ON "email_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e4932e0a726b9b07d81d8b6905" ON "email_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_29d60114e1968c0cd68a19e3c5" ON "email_template" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_86cf36c137712e779dd7e2301e"`); + await queryRunner.query(`DROP INDEX "IDX_a35637bb659c59e18adb4f38f8"`); + await queryRunner.query(`DROP INDEX "IDX_d0219ada2359ede9e7b0d511ba"`); + await queryRunner.query(`DROP INDEX "IDX_64c83df9d37d9ada96edb66557"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_appointment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar, "agenda" varchar NOT NULL, "description" varchar, "location" varchar, "startDateTime" datetime NOT NULL, "endDateTime" datetime NOT NULL, "bufferTimeStart" boolean, "bufferTimeEnd" boolean, "bufferTimeInMins" integer, "breakTimeInMins" integer, "breakStartTime" datetime, "emails" varchar, "status" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2f58132c57108540887dc3e88eb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86cf36c137712e779dd7e2301e6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a35637bb659c59e18adb4f38f87" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_appointment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt" FROM "employee_appointment"` + ); + await queryRunner.query(`DROP TABLE "employee_appointment"`); + await queryRunner.query(`ALTER TABLE "temporary_employee_appointment" RENAME TO "employee_appointment"`); + await queryRunner.query( + `CREATE INDEX "IDX_86cf36c137712e779dd7e2301e" ON "employee_appointment" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a35637bb659c59e18adb4f38f8" ON "employee_appointment" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0219ada2359ede9e7b0d511ba" ON "employee_appointment" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_64c83df9d37d9ada96edb66557" ON "employee_appointment" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_0c5266f3f488add404f92d56ec"`); + await queryRunner.query(`DROP INDEX "IDX_6912685bbb0e303eab392978d9"`); + await queryRunner.query(`DROP INDEX "IDX_caf8363b0ed7d5f24ae866ba3b"`); + await queryRunner.query(`DROP INDEX "IDX_91e0f7efcd17d20b5029fb1342"`); + await queryRunner.query(`DROP INDEX "IDX_c07390f325c847be7df93d0d17"`); + await queryRunner.query(`DROP INDEX "IDX_8fb47e8bfd26340ddaeabd24e5"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0c5266f3f488add404f92d56ec7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_caf8363b0ed7d5f24ae866ba3bb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91e0f7efcd17d20b5029fb1342d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_award"` + ); + await queryRunner.query(`DROP TABLE "employee_award"`); + await queryRunner.query(`ALTER TABLE "temporary_employee_award" RENAME TO "employee_award"`); + await queryRunner.query(`CREATE INDEX "IDX_0c5266f3f488add404f92d56ec" ON "employee_award" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_6912685bbb0e303eab392978d9" ON "employee_award" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_caf8363b0ed7d5f24ae866ba3b" ON "employee_award" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_91e0f7efcd17d20b5029fb1342" ON "employee_award" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c07390f325c847be7df93d0d17" ON "employee_award" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8fb47e8bfd26340ddaeabd24e5" ON "employee_award" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_c4668533292bf4526e61aedf74"`); + await queryRunner.query(`DROP INDEX "IDX_d3fc52d497bc44d6f493dbedc3"`); + await queryRunner.query(`DROP INDEX "IDX_90bd442869709bae9d1b18e489"`); + await queryRunner.query(`DROP INDEX "IDX_88a58d149404145ed7b3385387"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_level" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c4668533292bf4526e61aedf74a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d3fc52d497bc44d6f493dbedc3a" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_level"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt" FROM "employee_level"` + ); + await queryRunner.query(`DROP TABLE "employee_level"`); + await queryRunner.query(`ALTER TABLE "temporary_employee_level" RENAME TO "employee_level"`); + await queryRunner.query( + `CREATE INDEX "IDX_c4668533292bf4526e61aedf74" ON "employee_level" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_d3fc52d497bc44d6f493dbedc3" ON "employee_level" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_90bd442869709bae9d1b18e489" ON "employee_level" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_88a58d149404145ed7b3385387" ON "employee_level" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_329ebd01a757d1a0c3c4d628e2"`); + await queryRunner.query(`DROP INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef"`); + await queryRunner.query(`DROP INDEX "IDX_0f9cefa604913e1ab322591546"`); + await queryRunner.query(`DROP INDEX "IDX_d543336994b1f764c449e0b1d3"`); + await queryRunner.query(`DROP INDEX "IDX_587d11ffbd87adb6dff367f3cd"`); + await queryRunner.query(`DROP INDEX "IDX_aa98ea786d490db300d3dbbdb6"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_phone" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "type" varchar, "phoneNumber" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_329ebd01a757d1a0c3c4d628e29" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0f9cefa604913e1ab3225915469" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d543336994b1f764c449e0b1d3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_phone"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_phone"` + ); + await queryRunner.query(`DROP TABLE "employee_phone"`); + await queryRunner.query(`ALTER TABLE "temporary_employee_phone" RENAME TO "employee_phone"`); + await queryRunner.query(`CREATE INDEX "IDX_329ebd01a757d1a0c3c4d628e2" ON "employee_phone" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef" ON "employee_phone" ("phoneNumber") `); + await queryRunner.query( + `CREATE INDEX "IDX_0f9cefa604913e1ab322591546" ON "employee_phone" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_d543336994b1f764c449e0b1d3" ON "employee_phone" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_587d11ffbd87adb6dff367f3cd" ON "employee_phone" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_aa98ea786d490db300d3dbbdb6" ON "employee_phone" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6"`); + await queryRunner.query(`DROP INDEX "IDX_3ee5147bb1fde625fa33c0e956"`); + await queryRunner.query(`DROP INDEX "IDX_a4b5a2ea2afecf1ee254f1a704"`); + await queryRunner.query(`DROP INDEX "IDX_739f8cdce21cc72d400559ce00"`); + await queryRunner.query(`DROP INDEX "IDX_6e570174fda71e97616e9d2eea"`); + await queryRunner.query(`DROP INDEX "IDX_0ac8526c48a3daa267c86225fb"`); + await queryRunner.query(`DROP INDEX "IDX_25f8915182128f377d84b60d26"`); + await queryRunner.query(`DROP INDEX "IDX_3980b0fe1e757b092ea5323656"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "parentRecurringExpenseId" varchar, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3ee5147bb1fde625fa33c0e956b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5fde7be40b3c03bc0fdac0c2f66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_recurring_expense"` + ); + await queryRunner.query(`DROP TABLE "employee_recurring_expense"`); + await queryRunner.query( + `ALTER TABLE "temporary_employee_recurring_expense" RENAME TO "employee_recurring_expense"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6" ON "employee_recurring_expense" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3ee5147bb1fde625fa33c0e956" ON "employee_recurring_expense" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a4b5a2ea2afecf1ee254f1a704" ON "employee_recurring_expense" ("categoryName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_739f8cdce21cc72d400559ce00" ON "employee_recurring_expense" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6e570174fda71e97616e9d2eea" ON "employee_recurring_expense" ("parentRecurringExpenseId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ac8526c48a3daa267c86225fb" ON "employee_recurring_expense" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25f8915182128f377d84b60d26" ON "employee_recurring_expense" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3980b0fe1e757b092ea5323656" ON "employee_recurring_expense" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_95ea18af6ef8123503d332240c"`); + await queryRunner.query(`DROP INDEX "IDX_710c71526edb89b2a7033abcdf"`); + await queryRunner.query(`DROP INDEX "IDX_9537fae454ebebc98ee5adb3a2"`); + await queryRunner.query(`DROP INDEX "IDX_56e96cd218a185ed59b5a8e786"`); + await queryRunner.query(`DROP INDEX "IDX_9516a627a131626d2a5738a05a"`); + await queryRunner.query(`DROP INDEX "IDX_48fae30026b4e166a3445fee6d"`); + await queryRunner.query(`DROP INDEX "IDX_01237d04f882cf1ea794678e8d"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "month" integer NOT NULL, "year" integer NOT NULL, "settingType" varchar NOT NULL, "value" integer NOT NULL, "currency" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_95ea18af6ef8123503d332240c2" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_56e96cd218a185ed59b5a8e7869" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9516a627a131626d2a5738a05a8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_setting"` + ); + await queryRunner.query(`DROP TABLE "employee_setting"`); + await queryRunner.query(`ALTER TABLE "temporary_employee_setting" RENAME TO "employee_setting"`); + await queryRunner.query(`CREATE INDEX "IDX_95ea18af6ef8123503d332240c" ON "employee_setting" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_710c71526edb89b2a7033abcdf" ON "employee_setting" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_9537fae454ebebc98ee5adb3a2" ON "employee_setting" ("settingType") `); + await queryRunner.query( + `CREATE INDEX "IDX_56e96cd218a185ed59b5a8e786" ON "employee_setting" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9516a627a131626d2a5738a05a" ON "employee_setting" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_48fae30026b4e166a3445fee6d" ON "employee_setting" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_01237d04f882cf1ea794678e8d" ON "employee_setting" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_175b7be641928a31521224daa8"`); + await queryRunner.query(`DROP INDEX "IDX_510cb87f5da169e57e694d1a5c"`); + await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); + await queryRunner.query(`DROP INDEX "IDX_c6a48286f3aa8ae903bee0d1e7"`); + await queryRunner.query(`DROP INDEX "IDX_96dfbcaa2990df01fe5bb39ccc"`); + await queryRunner.query(`DROP INDEX "IDX_f4b0d329c4a3cf79ffe9d56504"`); + await queryRunner.query(`DROP INDEX "IDX_1c0c1370ecd98040259625e17e"`); + await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "valueDate" datetime, "isActive" boolean DEFAULT (1), "short_description" varchar(200), "description" varchar, "startedWorkOn" datetime, "endWork" datetime, "payPeriod" varchar, "billRateValue" integer, "billRateCurrency" varchar, "reWeeklyLimit" integer, "offerDate" datetime, "acceptDate" datetime, "rejectDate" datetime, "employeeLevel" varchar(500), "anonymousBonus" boolean, "averageIncome" numeric, "averageBonus" numeric, "totalWorkHours" numeric DEFAULT (0), "averageExpenses" numeric, "show_anonymous_bonus" boolean, "show_average_bonus" boolean, "show_average_expenses" boolean, "show_average_income" boolean, "show_billrate" boolean, "show_payperiod" boolean, "show_start_work_on" boolean, "isJobSearchActive" boolean, "linkedInUrl" varchar, "facebookUrl" varchar, "instagramUrl" varchar, "twitterUrl" varchar, "githubUrl" varchar, "gitlabUrl" varchar, "upworkUrl" varchar, "stackoverflowUrl" varchar, "isVerified" boolean, "isVetted" boolean, "totalJobs" numeric, "jobSuccess" numeric, "profile_link" varchar, "userId" varchar NOT NULL, "contactId" varchar, "organizationPositionId" varchar, "isTrackingEnabled" boolean DEFAULT (0), "deletedAt" datetime, "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "upworkId" varchar, "linkedInId" varchar, "isOnline" boolean DEFAULT (0), "isTrackingTime" boolean DEFAULT (0), "minimumBillingRate" integer, "isAway" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "fix_relational_custom_fields" boolean, "archivedAt" datetime, CONSTRAINT "REL_f4b0d329c4a3cf79ffe9d56504" UNIQUE ("userId"), CONSTRAINT "REL_1c0c1370ecd98040259625e17e" UNIQUE ("contactId"), CONSTRAINT "FK_4b3303a6b7eb92d237a4379734e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6a48286f3aa8ae903bee0d1e72" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f4b0d329c4a3cf79ffe9d565047" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c0c1370ecd98040259625e17e2" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields" FROM "employee"` + ); + await queryRunner.query(`DROP TABLE "employee"`); + await queryRunner.query(`ALTER TABLE "temporary_employee" RENAME TO "employee"`); + await queryRunner.query(`CREATE INDEX "IDX_175b7be641928a31521224daa8" ON "employee" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_510cb87f5da169e57e694d1a5c" ON "employee" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_96dfbcaa2990df01fe5bb39ccc" ON "employee" ("profile_link") `); + await queryRunner.query(`CREATE INDEX "IDX_f4b0d329c4a3cf79ffe9d56504" ON "employee" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); + await queryRunner.query( + `CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_04c9e514ed70897f6ad8cadc3c"`); + await queryRunner.query(`DROP INDEX "IDX_5311a833ff255881454bd5b3b5"`); + await queryRunner.query(`DROP INDEX "IDX_5443ca8ed830626656d8cfecef"`); + await queryRunner.query(`DROP INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae"`); + await queryRunner.query(`DROP INDEX "IDX_b0fc293cf47f31ba512fd29bf0"`); + await queryRunner.query( + `CREATE TABLE "temporary_equipment_sharing_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5443ca8ed830626656d8cfecef7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_equipment_sharing_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt" FROM "equipment_sharing_policy"` + ); + await queryRunner.query(`DROP TABLE "equipment_sharing_policy"`); + await queryRunner.query( + `ALTER TABLE "temporary_equipment_sharing_policy" RENAME TO "equipment_sharing_policy"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_04c9e514ed70897f6ad8cadc3c" ON "equipment_sharing_policy" ("name") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5311a833ff255881454bd5b3b5" ON "equipment_sharing_policy" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5443ca8ed830626656d8cfecef" ON "equipment_sharing_policy" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae" ON "equipment_sharing_policy" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b0fc293cf47f31ba512fd29bf0" ON "equipment_sharing_policy" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10"`); + await queryRunner.query(`DROP INDEX "IDX_acad51a6362806fc499e583e40"`); + await queryRunner.query(`DROP INDEX "IDX_ea9254be07ae4a8604f0aaab19"`); + await queryRunner.query(`DROP INDEX "IDX_fa525e61fb3d8d9efec0f364a4"`); + await queryRunner.query(`DROP INDEX "IDX_70ff31cefa0f578f6fa82d2bcc"`); + await queryRunner.query(`DROP INDEX "IDX_a734598f5637cf1501288331e3"`); + await queryRunner.query( + `CREATE TABLE "temporary_equipment_sharing" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "shareRequestDay" datetime, "shareStartDay" datetime, "shareEndDay" datetime, "status" integer NOT NULL, "createdBy" varchar, "createdByName" varchar, "equipmentId" varchar, "equipmentSharingPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ecfe0ce0cd2b197249d5f1c105" FOREIGN KEY ("equipmentSharingPolicyId") REFERENCES "equipment_sharing_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_acad51a6362806fc499e583e402" FOREIGN KEY ("equipmentId") REFERENCES "equipment" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ea9254be07ae4a8604f0aaab196" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa525e61fb3d8d9efec0f364a4b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_equipment_sharing"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt" FROM "equipment_sharing"` + ); + await queryRunner.query(`DROP TABLE "equipment_sharing"`); + await queryRunner.query(`ALTER TABLE "temporary_equipment_sharing" RENAME TO "equipment_sharing"`); + await queryRunner.query( + `CREATE INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10" ON "equipment_sharing" ("equipmentSharingPolicyId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_acad51a6362806fc499e583e40" ON "equipment_sharing" ("equipmentId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ea9254be07ae4a8604f0aaab19" ON "equipment_sharing" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_fa525e61fb3d8d9efec0f364a4" ON "equipment_sharing" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_70ff31cefa0f578f6fa82d2bcc" ON "equipment_sharing" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a734598f5637cf1501288331e3" ON "equipment_sharing" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_f98ce0d210aa9f91b729d44780"`); + await queryRunner.query(`DROP INDEX "IDX_fb6808468066849ab7b7454d5f"`); + await queryRunner.query(`DROP INDEX "IDX_39e1b443404ea7fa42b3d36ccb"`); + await queryRunner.query(`DROP INDEX "IDX_d8452bfe9f18ced4ce76c4b70b"`); + await queryRunner.query( + `CREATE TABLE "temporary_equipment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "serialNumber" varchar NOT NULL, "manufacturedYear" numeric, "initialCost" numeric, "currency" varchar NOT NULL, "maxSharePeriod" numeric, "autoApproveShare" boolean NOT NULL, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ab80a66282582ae8b0282508e7" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f98ce0d210aa9f91b729d447806" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fb6808468066849ab7b7454d5f3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_equipment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt" FROM "equipment"` + ); + await queryRunner.query(`DROP TABLE "equipment"`); + await queryRunner.query(`ALTER TABLE "temporary_equipment" RENAME TO "equipment"`); + await queryRunner.query(`CREATE INDEX "IDX_f98ce0d210aa9f91b729d44780" ON "equipment" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_fb6808468066849ab7b7454d5f" ON "equipment" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_39e1b443404ea7fa42b3d36ccb" ON "equipment" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d8452bfe9f18ced4ce76c4b70b" ON "equipment" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_233c1d351d63441aeb039d1164"`); + await queryRunner.query(`DROP INDEX "IDX_391d3f83244fea73c619aecadd"`); + await queryRunner.query(`DROP INDEX "IDX_1a4bd2a8034bb1309b4ea87882"`); + await queryRunner.query(`DROP INDEX "IDX_f1fac79e17c475f00daa4db3d2"`); + await queryRunner.query( + `CREATE TABLE "temporary_estimate_email" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "expireDate" datetime NOT NULL, "convertAcceptedEstimates" boolean, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_233c1d351d63441aeb039d1164f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_391d3f83244fea73c619aecadd9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_estimate_email"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt" FROM "estimate_email"` + ); + await queryRunner.query(`DROP TABLE "estimate_email"`); + await queryRunner.query(`ALTER TABLE "temporary_estimate_email" RENAME TO "estimate_email"`); + await queryRunner.query( + `CREATE INDEX "IDX_233c1d351d63441aeb039d1164" ON "estimate_email" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_391d3f83244fea73c619aecadd" ON "estimate_email" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_1a4bd2a8034bb1309b4ea87882" ON "estimate_email" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f1fac79e17c475f00daa4db3d2" ON "estimate_email" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_24d905ec9e127ade23754a363d"`); + await queryRunner.query(`DROP INDEX "IDX_5bde7aeb2c7fb3a421b175871e"`); + await queryRunner.query(`DROP INDEX "IDX_43459c650957e478203c738574"`); + await queryRunner.query(`DROP INDEX "IDX_9d5980ff1064e2edb77509d312"`); + await queryRunner.query(`DROP INDEX "IDX_4b02d8616129f39fca2b10e98b"`); + await queryRunner.query(`DROP INDEX "IDX_fc8818d6fde74370ec703a0135"`); + await queryRunner.query(`DROP INDEX "IDX_92fc62260c0c7ff108622850bf"`); + await queryRunner.query(`DROP INDEX "IDX_f14eee32875b112fab1139b332"`); + await queryRunner.query(`DROP INDEX "IDX_613cfa5783e164cad10dc27e58"`); + await queryRunner.query( + `CREATE TABLE "temporary_event_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" numeric NOT NULL, "durationUnit" varchar, "title" varchar, "description" varchar, "isActive" boolean DEFAULT (1), "employeeId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_24d905ec9e127ade23754a363dd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fc8818d6fde74370ec703a01352" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_92fc62260c0c7ff108622850bff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_event_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt" FROM "event_type"` + ); + await queryRunner.query(`DROP TABLE "event_type"`); + await queryRunner.query(`ALTER TABLE "temporary_event_type" RENAME TO "event_type"`); + await queryRunner.query(`CREATE INDEX "IDX_24d905ec9e127ade23754a363d" ON "event_type" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_5bde7aeb2c7fb3a421b175871e" ON "event_type" ("description") `); + await queryRunner.query(`CREATE INDEX "IDX_43459c650957e478203c738574" ON "event_type" ("title") `); + await queryRunner.query(`CREATE INDEX "IDX_9d5980ff1064e2edb77509d312" ON "event_type" ("durationUnit") `); + await queryRunner.query(`CREATE INDEX "IDX_4b02d8616129f39fca2b10e98b" ON "event_type" ("duration") `); + await queryRunner.query(`CREATE INDEX "IDX_fc8818d6fde74370ec703a0135" ON "event_type" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_92fc62260c0c7ff108622850bf" ON "event_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f14eee32875b112fab1139b332" ON "event_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_613cfa5783e164cad10dc27e58" ON "event_type" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_9c9bfe5baaf83f53533ff035fc"`); + await queryRunner.query(`DROP INDEX "IDX_37504e920ee5ca46a4000b89da"`); + await queryRunner.query(`DROP INDEX "IDX_8376e41fd82aba147a433dc097"`); + await queryRunner.query(`DROP INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc"`); + await queryRunner.query( + `CREATE TABLE "temporary_expense_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9c9bfe5baaf83f53533ff035fc0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_37504e920ee5ca46a4000b89da5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_expense_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "expense_category"` + ); + await queryRunner.query(`DROP TABLE "expense_category"`); + await queryRunner.query(`ALTER TABLE "temporary_expense_category" RENAME TO "expense_category"`); + await queryRunner.query( + `CREATE INDEX "IDX_9c9bfe5baaf83f53533ff035fc" ON "expense_category" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37504e920ee5ca46a4000b89da" ON "expense_category" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_8376e41fd82aba147a433dc097" ON "expense_category" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc" ON "expense_category" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_6d171c9d5f81095436b99da5e6"`); + await queryRunner.query(`DROP INDEX "IDX_c5fb146726ff128e600f23d0a1"`); + await queryRunner.query(`DROP INDEX "IDX_846a933af451a33b95b7b198c6"`); + await queryRunner.query(`DROP INDEX "IDX_b5bb8f62d401475fcc8c2ba35e"`); + await queryRunner.query(`DROP INDEX "IDX_3826d6ca74a08a8498fa17d330"`); + await queryRunner.query(`DROP INDEX "IDX_89508d119b1a279c037d9da151"`); + await queryRunner.query(`DROP INDEX "IDX_cbfebdb1419f9b8036a8b0546e"`); + await queryRunner.query(`DROP INDEX "IDX_dd8ab9312fb8d787982b9feebf"`); + await queryRunner.query(`DROP INDEX "IDX_0006d3025b6c92fbd4089b9465"`); + await queryRunner.query(`DROP INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9"`); + await queryRunner.query(`DROP INDEX "IDX_5f57d077c28b378a6c885e81c5"`); + await queryRunner.query(`DROP INDEX "IDX_5e7b197dbac69012dbdb4964f3"`); + await queryRunner.query(`DROP INDEX "IDX_eacb116ab0521ad9b96f2bb53b"`); + await queryRunner.query(`DROP INDEX "IDX_42eea5debc63f4d1bf89881c10"`); + await queryRunner.query(`DROP INDEX "IDX_9971c4171ae051e74b833984a3"`); + await queryRunner.query(`DROP INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4"`); + await queryRunner.query(`DROP INDEX "IDX_1aa0e5fd480214ae4851471e3c"`); + await queryRunner.query(`DROP INDEX "IDX_d77aeb93f2439ebdf4babaab4c"`); + await queryRunner.query( + `CREATE TABLE "temporary_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "typeOfExpense" varchar, "notes" varchar, "currency" varchar NOT NULL, "valueDate" datetime, "purpose" varchar, "taxType" varchar, "taxLabel" varchar, "rateValue" numeric, "receipt" varchar, "splitExpense" boolean, "reference" varchar, "status" varchar, "employeeId" varchar, "vendorId" varchar, "categoryId" varchar, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a" FOREIGN KEY ("categoryId") REFERENCES "expense_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba" FOREIGN KEY ("vendorId") REFERENCES "organization_vendor" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6d171c9d5f81095436b99da5e62" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c5fb146726ff128e600f23d0a1b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5e7b197dbac69012dbdb4964f37" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9971c4171ae051e74b833984a30" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_047b8b5c0782d5a6d4c8bfc1a4e" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "expense"` + ); + await queryRunner.query(`DROP TABLE "expense"`); + await queryRunner.query(`ALTER TABLE "temporary_expense" RENAME TO "expense"`); + await queryRunner.query(`CREATE INDEX "IDX_6d171c9d5f81095436b99da5e6" ON "expense" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c5fb146726ff128e600f23d0a1" ON "expense" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_846a933af451a33b95b7b198c6" ON "expense" ("amount") `); + await queryRunner.query(`CREATE INDEX "IDX_b5bb8f62d401475fcc8c2ba35e" ON "expense" ("typeOfExpense") `); + await queryRunner.query(`CREATE INDEX "IDX_3826d6ca74a08a8498fa17d330" ON "expense" ("notes") `); + await queryRunner.query(`CREATE INDEX "IDX_89508d119b1a279c037d9da151" ON "expense" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_cbfebdb1419f9b8036a8b0546e" ON "expense" ("purpose") `); + await queryRunner.query(`CREATE INDEX "IDX_dd8ab9312fb8d787982b9feebf" ON "expense" ("taxType") `); + await queryRunner.query(`CREATE INDEX "IDX_0006d3025b6c92fbd4089b9465" ON "expense" ("taxLabel") `); + await queryRunner.query(`CREATE INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9" ON "expense" ("rateValue") `); + await queryRunner.query(`CREATE INDEX "IDX_5f57d077c28b378a6c885e81c5" ON "expense" ("receipt") `); + await queryRunner.query(`CREATE INDEX "IDX_5e7b197dbac69012dbdb4964f3" ON "expense" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_eacb116ab0521ad9b96f2bb53b" ON "expense" ("vendorId") `); + await queryRunner.query(`CREATE INDEX "IDX_42eea5debc63f4d1bf89881c10" ON "expense" ("categoryId") `); + await queryRunner.query(`CREATE INDEX "IDX_9971c4171ae051e74b833984a3" ON "expense" ("projectId") `); + await queryRunner.query( + `CREATE INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4" ON "expense" ("organizationContactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1aa0e5fd480214ae4851471e3c" ON "expense" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d77aeb93f2439ebdf4babaab4c" ON "expense" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_54868607115e2fee3b0b764eec"`); + await queryRunner.query(`DROP INDEX "IDX_e339340014a6c4e2f57be00b0c"`); + await queryRunner.query(`DROP INDEX "IDX_d6a626bee6cddf4bc53a493bc3"`); + await queryRunner.query( + `CREATE TABLE "temporary_import-history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "file" varchar NOT NULL, "path" varchar NOT NULL, "size" integer, "status" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_54868607115e2fee3b0b764eec2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_import-history"("id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt" FROM "import-history"` + ); + await queryRunner.query(`DROP TABLE "import-history"`); + await queryRunner.query(`ALTER TABLE "temporary_import-history" RENAME TO "import-history"`); + await queryRunner.query(`CREATE INDEX "IDX_54868607115e2fee3b0b764eec" ON "import-history" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e339340014a6c4e2f57be00b0c" ON "import-history" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d6a626bee6cddf4bc53a493bc3" ON "import-history" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_a43b235c35c2c4d3263ada770c"`); + await queryRunner.query(`DROP INDEX "IDX_b90957ef81e74c43d6ae037560"`); + await queryRunner.query(`DROP INDEX "IDX_339328a7247aa09d061c642ae1"`); + await queryRunner.query( + `CREATE TABLE "temporary_import-record" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "entityType" varchar NOT NULL, "sourceId" varchar NOT NULL, "destinationId" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a43b235c35c2c4d3263ada770c6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_import-record"("id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt" FROM "import-record"` + ); + await queryRunner.query(`DROP TABLE "import-record"`); + await queryRunner.query(`ALTER TABLE "temporary_import-record" RENAME TO "import-record"`); + await queryRunner.query(`CREATE INDEX "IDX_a43b235c35c2c4d3263ada770c" ON "import-record" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_b90957ef81e74c43d6ae037560" ON "import-record" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_339328a7247aa09d061c642ae1" ON "import-record" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_6d413f9fdd5366b1b9add46483"`); + await queryRunner.query(`DROP INDEX "IDX_6a94e6b0a572f591288ac44a42"`); + await queryRunner.query(`DROP INDEX "IDX_8f71803d96dcdbcc6b19bb28d3"`); + await queryRunner.query(`DROP INDEX "IDX_4ee685760ddb60ff71f763d8f6"`); + await queryRunner.query(`DROP INDEX "IDX_e4c142f37091b47056012d34ba"`); + await queryRunner.query( + `CREATE TABLE "temporary_feature_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isEnabled" boolean NOT NULL DEFAULT (1), "featureId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_6d413f9fdd5366b1b9add464836" FOREIGN KEY ("featureId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a94e6b0a572f591288ac44a421" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8f71803d96dcdbcc6b19bb28d38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_feature_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt" FROM "feature_organization"` + ); + await queryRunner.query(`DROP TABLE "feature_organization"`); + await queryRunner.query(`ALTER TABLE "temporary_feature_organization" RENAME TO "feature_organization"`); + await queryRunner.query( + `CREATE INDEX "IDX_6d413f9fdd5366b1b9add46483" ON "feature_organization" ("featureId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6a94e6b0a572f591288ac44a42" ON "feature_organization" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8f71803d96dcdbcc6b19bb28d3" ON "feature_organization" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4ee685760ddb60ff71f763d8f6" ON "feature_organization" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e4c142f37091b47056012d34ba" ON "feature_organization" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_d4a28a8e70d450a412bf0cfb52"`); + await queryRunner.query(`DROP INDEX "IDX_c30465b5a6e0fae1c8ee7e3120"`); + await queryRunner.query(`DROP INDEX "IDX_4832be692a2dc63d67e8e93c75"`); + await queryRunner.query(`DROP INDEX "IDX_5405b67f1df904831a358df7c4"`); + await queryRunner.query(`DROP INDEX "IDX_a26cc341268d22bd55f06e3ef6"`); + await queryRunner.query( + `CREATE TABLE "temporary_feature" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar NOT NULL, "isPaid" boolean NOT NULL DEFAULT (0), "description" varchar, "image" varchar, "link" varchar NOT NULL, "status" varchar, "icon" varchar, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d4a28a8e70d450a412bf0cfb52a" FOREIGN KEY ("parentId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_feature"("id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt" FROM "feature"` + ); + await queryRunner.query(`DROP TABLE "feature"`); + await queryRunner.query(`ALTER TABLE "temporary_feature" RENAME TO "feature"`); + await queryRunner.query(`CREATE INDEX "IDX_d4a28a8e70d450a412bf0cfb52" ON "feature" ("parentId") `); + await queryRunner.query(`CREATE INDEX "IDX_c30465b5a6e0fae1c8ee7e3120" ON "feature" ("code") `); + await queryRunner.query(`CREATE INDEX "IDX_4832be692a2dc63d67e8e93c75" ON "feature" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_5405b67f1df904831a358df7c4" ON "feature" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a26cc341268d22bd55f06e3ef6" ON "feature" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_e35d0f7b794ca8850669d12c78"`); + await queryRunner.query(`DROP INDEX "IDX_d17a5159d888ac6320459eda39"`); + await queryRunner.query(`DROP INDEX "IDX_bdee8704ebeb79368ff6154fc7"`); + await queryRunner.query(`DROP INDEX "IDX_4a44905db4ca1e40b62021fdfb"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal_general_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "maxObjectives" integer NOT NULL, "maxKeyResults" integer NOT NULL, "employeeCanCreateObjective" boolean NOT NULL, "canOwnObjectives" varchar NOT NULL, "canOwnKeyResult" varchar NOT NULL, "krTypeKPI" boolean NOT NULL, "krTypeTask" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e35d0f7b794ca8850669d12c78c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d17a5159d888ac6320459eda392" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal_general_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt" FROM "goal_general_setting"` + ); + await queryRunner.query(`DROP TABLE "goal_general_setting"`); + await queryRunner.query(`ALTER TABLE "temporary_goal_general_setting" RENAME TO "goal_general_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_e35d0f7b794ca8850669d12c78" ON "goal_general_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d17a5159d888ac6320459eda39" ON "goal_general_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bdee8704ebeb79368ff6154fc7" ON "goal_general_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4a44905db4ca1e40b62021fdfb" ON "goal_general_setting" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_df7ab026698c02859ff7540809"`); + await queryRunner.query(`DROP INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf"`); + await queryRunner.query(`DROP INDEX "IDX_b4f4701ddb0e973602445ed1c6"`); + await queryRunner.query(`DROP INDEX "IDX_26311c417ba945c901c65d515d"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal_kpi_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f69e740b066c6469d1c68a4a28b" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_df7ab026698c02859ff75408093" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cc72d4e8e4284dcc8ffbf96caf4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal_kpi_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "goal_kpi_template"` + ); + await queryRunner.query(`DROP TABLE "goal_kpi_template"`); + await queryRunner.query(`ALTER TABLE "temporary_goal_kpi_template" RENAME TO "goal_kpi_template"`); + await queryRunner.query( + `CREATE INDEX "IDX_df7ab026698c02859ff7540809" ON "goal_kpi_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf" ON "goal_kpi_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_b4f4701ddb0e973602445ed1c6" ON "goal_kpi_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_26311c417ba945c901c65d515d" ON "goal_kpi_template" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d4f093ca4eb7c40db68d9a789d"`); + await queryRunner.query(`DROP INDEX "IDX_e49e37fe88a2725a38a3b05849"`); + await queryRunner.query(`DROP INDEX "IDX_43aa2985216560cd9fa93f501e"`); + await queryRunner.query(`DROP INDEX "IDX_cfc393bd9835d8259e73019226"`); + await queryRunner.query(`DROP INDEX "IDX_a96c22c51607f878c8a98bc488"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal_kpi" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d4f093ca4eb7c40db68d9a789d0" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e49e37fe88a2725a38a3b058493" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_43aa2985216560cd9fa93f501e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal_kpi"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "goal_kpi"` + ); + await queryRunner.query(`DROP TABLE "goal_kpi"`); + await queryRunner.query(`ALTER TABLE "temporary_goal_kpi" RENAME TO "goal_kpi"`); + await queryRunner.query(`CREATE INDEX "IDX_d4f093ca4eb7c40db68d9a789d" ON "goal_kpi" ("leadId") `); + await queryRunner.query(`CREATE INDEX "IDX_e49e37fe88a2725a38a3b05849" ON "goal_kpi" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_43aa2985216560cd9fa93f501e" ON "goal_kpi" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_cfc393bd9835d8259e73019226" ON "goal_kpi" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a96c22c51607f878c8a98bc488" ON "goal_kpi" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_5708fe06608c72fc77b65ae651"`); + await queryRunner.query(`DROP INDEX "IDX_774bf82989475befe301fe1bca"`); + await queryRunner.query(`DROP INDEX "IDX_cd91c5925942061527b1bc112c"`); + await queryRunner.query(`DROP INDEX "IDX_056e869152a335f88c38c5b693"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "level" varchar NOT NULL, "category" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5708fe06608c72fc77b65ae6519" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_774bf82989475befe301fe1bca5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt" FROM "goal_template"` + ); + await queryRunner.query(`DROP TABLE "goal_template"`); + await queryRunner.query(`ALTER TABLE "temporary_goal_template" RENAME TO "goal_template"`); + await queryRunner.query(`CREATE INDEX "IDX_5708fe06608c72fc77b65ae651" ON "goal_template" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_774bf82989475befe301fe1bca" ON "goal_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_cd91c5925942061527b1bc112c" ON "goal_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_056e869152a335f88c38c5b693" ON "goal_template" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_405bc5bba9ed71aefef84a29f1"`); + await queryRunner.query(`DROP INDEX "IDX_b56723b53a76ca1c171890c479"`); + await queryRunner.query(`DROP INDEX "IDX_646565982726362cc2ca4fb807"`); + await queryRunner.query(`DROP INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal_time_frame" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" varchar NOT NULL, "startDate" datetime NOT NULL, "endDate" datetime NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_405bc5bba9ed71aefef84a29f10" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b56723b53a76ca1c171890c479b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal_time_frame"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt" FROM "goal_time_frame"` + ); + await queryRunner.query(`DROP TABLE "goal_time_frame"`); + await queryRunner.query(`ALTER TABLE "temporary_goal_time_frame" RENAME TO "goal_time_frame"`); + await queryRunner.query( + `CREATE INDEX "IDX_405bc5bba9ed71aefef84a29f1" ON "goal_time_frame" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b56723b53a76ca1c171890c479" ON "goal_time_frame" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_646565982726362cc2ca4fb807" ON "goal_time_frame" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2" ON "goal_time_frame" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_4c8b4e887a994182fd6132e640"`); + await queryRunner.query(`DROP INDEX "IDX_af0a11734e70412b742ac339c8"`); + await queryRunner.query(`DROP INDEX "IDX_35526ff1063ab5fa2b20e71bd6"`); + await queryRunner.query(`DROP INDEX "IDX_ac161c1a0c0ff8e83554f097e5"`); + await queryRunner.query(`DROP INDEX "IDX_c6e8ae55a4db3584686cbf6afe"`); + await queryRunner.query(`DROP INDEX "IDX_6b4758a5442713070c9a366d0e"`); + await queryRunner.query(`DROP INDEX "IDX_72641ffde44e1a1627aa2d040f"`); + await queryRunner.query(`DROP INDEX "IDX_4a2c00a44350a063d75be80ba9"`); + await queryRunner.query( + `CREATE TABLE "temporary_goal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "deadline" varchar NOT NULL, "level" varchar NOT NULL, "progress" integer NOT NULL, "ownerTeamId" varchar, "ownerEmployeeId" varchar, "leadId" varchar, "alignedKeyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_4c8b4e887a994182fd6132e6400" FOREIGN KEY ("alignedKeyResultId") REFERENCES "key_result" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_af0a11734e70412b742ac339c88" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_35526ff1063ab5fa2b20e71bd66" FOREIGN KEY ("ownerEmployeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ac161c1a0c0ff8e83554f097e5e" FOREIGN KEY ("ownerTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6e8ae55a4db3584686cbf6afe1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b4758a5442713070c9a366d0e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_goal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt" FROM "goal"` + ); + await queryRunner.query(`DROP TABLE "goal"`); + await queryRunner.query(`ALTER TABLE "temporary_goal" RENAME TO "goal"`); + await queryRunner.query(`CREATE INDEX "IDX_4c8b4e887a994182fd6132e640" ON "goal" ("alignedKeyResultId") `); + await queryRunner.query(`CREATE INDEX "IDX_af0a11734e70412b742ac339c8" ON "goal" ("leadId") `); + await queryRunner.query(`CREATE INDEX "IDX_35526ff1063ab5fa2b20e71bd6" ON "goal" ("ownerEmployeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_ac161c1a0c0ff8e83554f097e5" ON "goal" ("ownerTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_c6e8ae55a4db3584686cbf6afe" ON "goal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_6b4758a5442713070c9a366d0e" ON "goal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_72641ffde44e1a1627aa2d040f" ON "goal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4a2c00a44350a063d75be80ba9" ON "goal" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_01856a9a730b7e79d70aa661cb"`); + await queryRunner.query(`DROP INDEX "IDX_d3675304df9971cccf96d9a7c3"`); + await queryRunner.query(`DROP INDEX "IDX_9d44ce9eb8689e578b941a6a54"`); + await queryRunner.query(`DROP INDEX "IDX_af1a212cb378bb0eed51c1b2bc"`); + await queryRunner.query( + `CREATE TABLE "temporary_image_asset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "url" varchar NOT NULL, "width" integer NOT NULL DEFAULT (0), "height" integer NOT NULL DEFAULT (0), "isFeatured" boolean NOT NULL DEFAULT (0), "thumb" varchar, "size" numeric, "externalProviderId" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_01856a9a730b7e79d70aa661cb0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d3675304df9971cccf96d9a7c34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_image_asset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived" FROM "image_asset"` + ); + await queryRunner.query(`DROP TABLE "image_asset"`); + await queryRunner.query(`ALTER TABLE "temporary_image_asset" RENAME TO "image_asset"`); + await queryRunner.query(`CREATE INDEX "IDX_01856a9a730b7e79d70aa661cb" ON "image_asset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d3675304df9971cccf96d9a7c3" ON "image_asset" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_9d44ce9eb8689e578b941a6a54" ON "image_asset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_af1a212cb378bb0eed51c1b2bc" ON "image_asset" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_29fbd3a17710a27e6f856072c0"`); + await queryRunner.query(`DROP INDEX "IDX_a05d52b7ffe89140f9cbcf114b"`); + await queryRunner.query(`DROP INDEX "IDX_20207d9f915066dfbc2210bcf1"`); + await queryRunner.query(`DROP INDEX "IDX_86b5a121b3775a1b0b7fa75680"`); + await queryRunner.query(`DROP INDEX "IDX_bd39a647a2843177723ddf733e"`); + await queryRunner.query(`DROP INDEX "IDX_64409de4711cd14e2c43371cc0"`); + await queryRunner.query(`DROP INDEX "IDX_8608b275644cfc7a0f3f585081"`); + await queryRunner.query(`DROP INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb"`); + await queryRunner.query(`DROP INDEX "IDX_aedb8b1d10c498309bed9edf53"`); + await queryRunner.query( + `CREATE TABLE "temporary_income" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "currency" varchar NOT NULL, "valueDate" datetime, "notes" varchar, "isBonus" boolean, "reference" varchar, "employeeId" varchar, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_29fbd3a17710a27e6f856072c01" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a05d52b7ffe89140f9cbcf114b3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_64409de4711cd14e2c43371cc02" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8608b275644cfc7a0f3f5850814" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_income"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt" FROM "income"` + ); + await queryRunner.query(`DROP TABLE "income"`); + await queryRunner.query(`ALTER TABLE "temporary_income" RENAME TO "income"`); + await queryRunner.query(`CREATE INDEX "IDX_29fbd3a17710a27e6f856072c0" ON "income" ("clientId") `); + await queryRunner.query(`CREATE INDEX "IDX_a05d52b7ffe89140f9cbcf114b" ON "income" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_20207d9f915066dfbc2210bcf1" ON "income" ("notes") `); + await queryRunner.query(`CREATE INDEX "IDX_86b5a121b3775a1b0b7fa75680" ON "income" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_bd39a647a2843177723ddf733e" ON "income" ("amount") `); + await queryRunner.query(`CREATE INDEX "IDX_64409de4711cd14e2c43371cc0" ON "income" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_8608b275644cfc7a0f3f585081" ON "income" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb" ON "income" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_aedb8b1d10c498309bed9edf53" ON "income" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_b208a754c7a538cb3422f39f5b"`); + await queryRunner.query(`DROP INDEX "IDX_d5ac36aa3d5919908414154fca"`); + await queryRunner.query(`DROP INDEX "IDX_3fb863167095805e33f38a0fdc"`); + await queryRunner.query(`DROP INDEX "IDX_6d43cc33c80221dbe4854b38e6"`); + await queryRunner.query(`DROP INDEX "IDX_101cd83aa75949cfb5b8eec084"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_entity_setting_tied" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationEntitySettingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3fb863167095805e33f38a0fdcc" FOREIGN KEY ("integrationEntitySettingId") REFERENCES "integration_entity_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b208a754c7a538cb3422f39f5b9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d5ac36aa3d5919908414154fca0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_entity_setting_tied"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt" FROM "integration_entity_setting_tied"` + ); + await queryRunner.query(`DROP TABLE "integration_entity_setting_tied"`); + await queryRunner.query( + `ALTER TABLE "temporary_integration_entity_setting_tied" RENAME TO "integration_entity_setting_tied"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b208a754c7a538cb3422f39f5b" ON "integration_entity_setting_tied" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5ac36aa3d5919908414154fca" ON "integration_entity_setting_tied" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3fb863167095805e33f38a0fdc" ON "integration_entity_setting_tied" ("integrationEntitySettingId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d43cc33c80221dbe4854b38e6" ON "integration_entity_setting_tied" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_101cd83aa75949cfb5b8eec084" ON "integration_entity_setting_tied" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_23e9cfcf1bfff07dcc3254378d"`); + await queryRunner.query(`DROP INDEX "IDX_c6c01e38eebd8b26b9214b9044"`); + await queryRunner.query(`DROP INDEX "IDX_f80ff4ebbf0b33a67dce598911"`); + await queryRunner.query(`DROP INDEX "IDX_e3d407c5532edaceaa4df34623"`); + await queryRunner.query(`DROP INDEX "IDX_1c653ebceca3b9c8766131db91"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_entity_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f80ff4ebbf0b33a67dce5989117" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_23e9cfcf1bfff07dcc3254378df" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6c01e38eebd8b26b9214b90441" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_entity_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_entity_setting"` + ); + await queryRunner.query(`DROP TABLE "integration_entity_setting"`); + await queryRunner.query( + `ALTER TABLE "temporary_integration_entity_setting" RENAME TO "integration_entity_setting"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_23e9cfcf1bfff07dcc3254378d" ON "integration_entity_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c6c01e38eebd8b26b9214b9044" ON "integration_entity_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f80ff4ebbf0b33a67dce598911" ON "integration_entity_setting" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e3d407c5532edaceaa4df34623" ON "integration_entity_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c653ebceca3b9c8766131db91" ON "integration_entity_setting" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_eec3d6064578610ddc609dd360"`); + await queryRunner.query(`DROP INDEX "IDX_7022dafd72c1b92f7d50691441"`); + await queryRunner.query(`DROP INDEX "IDX_c327ea26bda3d349a1eceb5658"`); + await queryRunner.query(`DROP INDEX "IDX_c79464c4ccf7e5195d69675c15"`); + await queryRunner.query(`DROP INDEX "IDX_e63f4791631e7572ca213ac4a4"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_map" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sourceId" varchar NOT NULL, "gauzyId" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c327ea26bda3d349a1eceb5658e" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eec3d6064578610ddc609dd360e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7022dafd72c1b92f7d506914411" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_map"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_map"` + ); + await queryRunner.query(`DROP TABLE "integration_map"`); + await queryRunner.query(`ALTER TABLE "temporary_integration_map" RENAME TO "integration_map"`); + await queryRunner.query(`CREATE INDEX "IDX_eec3d6064578610ddc609dd360" ON "integration_map" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7022dafd72c1b92f7d50691441" ON "integration_map" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c327ea26bda3d349a1eceb5658" ON "integration_map" ("integrationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c79464c4ccf7e5195d69675c15" ON "integration_map" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e63f4791631e7572ca213ac4a4" ON "integration_map" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_34daf030004ad37b88f1f3d863"`); + await queryRunner.query(`DROP INDEX "IDX_369eaafb13afe9903a170077ed"`); + await queryRunner.query(`DROP INDEX "IDX_954c6b05297814776d9cb66ca7"`); + await queryRunner.query(`DROP INDEX "IDX_97c0d54aae21ccdbb5c3581642"`); + await queryRunner.query(`DROP INDEX "IDX_f515574f1251562c52fe25b6a3"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "settingsName" varchar NOT NULL, "settingsValue" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_34daf030004ad37b88f1f3d863c" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_369eaafb13afe9903a170077edb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_954c6b05297814776d9cb66ca77" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_setting"` + ); + await queryRunner.query(`DROP TABLE "integration_setting"`); + await queryRunner.query(`ALTER TABLE "temporary_integration_setting" RENAME TO "integration_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_34daf030004ad37b88f1f3d863" ON "integration_setting" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_369eaafb13afe9903a170077ed" ON "integration_setting" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_954c6b05297814776d9cb66ca7" ON "integration_setting" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_97c0d54aae21ccdbb5c3581642" ON "integration_setting" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_f515574f1251562c52fe25b6a3" ON "integration_setting" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_5487f9197c106d774bae20991c"`); + await queryRunner.query(`DROP INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46"`); + await queryRunner.query(`DROP INDEX "IDX_33ab224e7755a46fff5bc1e64e"`); + await queryRunner.query(`DROP INDEX "IDX_24e37d03ef224f1a16a35069c2"`); + await queryRunner.query(`DROP INDEX "IDX_0d6ddc27d687ca879042c5f3ce"`); + await queryRunner.query(`DROP INDEX "IDX_d0532ed8020981736b58748de6"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "integrationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "lastSyncedAt" datetime DEFAULT (CURRENT_TIMESTAMP), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_33ab224e7755a46fff5bc1e64e5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_24e37d03ef224f1a16a35069c2c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0d6ddc27d687ca879042c5f3ce3" FOREIGN KEY ("integrationId") REFERENCES "integration" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_tenant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt" FROM "integration_tenant"` + ); + await queryRunner.query(`DROP TABLE "integration_tenant"`); + await queryRunner.query(`ALTER TABLE "temporary_integration_tenant" RENAME TO "integration_tenant"`); + await queryRunner.query( + `CREATE INDEX "IDX_5487f9197c106d774bae20991c" ON "integration_tenant" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46" ON "integration_tenant" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_33ab224e7755a46fff5bc1e64e" ON "integration_tenant" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_24e37d03ef224f1a16a35069c2" ON "integration_tenant" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_0d6ddc27d687ca879042c5f3ce" ON "integration_tenant" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0532ed8020981736b58748de6" ON "integration_tenant" ("lastSyncedAt") ` + ); + await queryRunner.query(`DROP INDEX "IDX_34a49d941459e1031c766b941f"`); + await queryRunner.query(`DROP INDEX "IDX_e7b65ef60492b1c34007736f99"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "groupName" varchar NOT NULL, "order" integer NOT NULL, "description" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_be0d67f4df84f036fab2ed89c47" UNIQUE ("name"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration_type"("id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt" FROM "integration_type"` + ); + await queryRunner.query(`DROP TABLE "integration_type"`); + await queryRunner.query(`ALTER TABLE "temporary_integration_type" RENAME TO "integration_type"`); + await queryRunner.query(`CREATE INDEX "IDX_34a49d941459e1031c766b941f" ON "integration_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e7b65ef60492b1c34007736f99" ON "integration_type" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_24981cd300007cf88601c2d616"`); + await queryRunner.query(`DROP INDEX "IDX_85d7b0f07f3e3707b4586670a9"`); + await queryRunner.query( + `CREATE TABLE "temporary_integration" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "imgSrc" varchar, "isComingSoon" boolean NOT NULL DEFAULT (0), "isPaid" boolean NOT NULL DEFAULT (0), "version" varchar, "docUrl" varchar, "isFreeTrial" boolean NOT NULL DEFAULT (0), "freeTrialPeriod" numeric DEFAULT (0), "order" integer, "provider" varchar, "redirectUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_938c19d92ad3f290ff5fc163531" UNIQUE ("name"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_integration"("id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt" FROM "integration"` + ); + await queryRunner.query(`DROP TABLE "integration"`); + await queryRunner.query(`ALTER TABLE "temporary_integration" RENAME TO "integration"`); + await queryRunner.query(`CREATE INDEX "IDX_24981cd300007cf88601c2d616" ON "integration" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_85d7b0f07f3e3707b4586670a9" ON "integration" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_7c2328f76efb850b8114797247"`); + await queryRunner.query(`DROP INDEX "IDX_68eef4ab86b67747f24f288a16"`); + await queryRunner.query(`DROP INDEX "IDX_5a182e8b3e225b14ddf6df7e6c"`); + await queryRunner.query(`DROP INDEX "IDX_900a3ed40499c79c1c289fec28"`); + await queryRunner.query(`DROP INDEX "IDX_91bfeec7a9574f458e5b592472"`); + await queryRunner.query(`DROP INDEX "IDX_bd44bcb10034bc0c5fe4427b3e"`); + await queryRunner.query(`DROP INDEX "IDX_3cef860504647ccd52d39d7dc2"`); + await queryRunner.query( + `CREATE TABLE "temporary_invite" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "status" varchar NOT NULL, "expireDate" datetime, "actionDate" datetime, "invitedById" varchar, "roleId" varchar, "code" varchar, "fullName" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7c2328f76efb850b81147972476" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_68eef4ab86b67747f24f288a16c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5a182e8b3e225b14ddf6df7e6c3" FOREIGN KEY ("invitedById") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_900a3ed40499c79c1c289fec284" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91bfeec7a9574f458e5b592472d" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_invite"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt" FROM "invite"` + ); + await queryRunner.query(`DROP TABLE "invite"`); + await queryRunner.query(`ALTER TABLE "temporary_invite" RENAME TO "invite"`); + await queryRunner.query(`CREATE INDEX "IDX_7c2328f76efb850b8114797247" ON "invite" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_68eef4ab86b67747f24f288a16" ON "invite" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_5a182e8b3e225b14ddf6df7e6c" ON "invite" ("invitedById") `); + await queryRunner.query(`CREATE INDEX "IDX_900a3ed40499c79c1c289fec28" ON "invite" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_91bfeec7a9574f458e5b592472" ON "invite" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_bd44bcb10034bc0c5fe4427b3e" ON "invite" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_3cef860504647ccd52d39d7dc2" ON "invite" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_8106063f79cce8e67790d79092"`); + await queryRunner.query(`DROP INDEX "IDX_483eb296a94d821ebedb375858"`); + await queryRunner.query(`DROP INDEX "IDX_31ec3d5a6b0985cec544c64217"`); + await queryRunner.query(`DROP INDEX "IDX_da2893697d57368470952a76f6"`); + await queryRunner.query(`DROP INDEX "IDX_856f24297f120604f8ae294276"`); + await queryRunner.query(`DROP INDEX "IDX_cc0ac824ba89deda98bb418e8c"`); + await queryRunner.query( + `CREATE TABLE "temporary_invoice_estimate_history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" varchar NOT NULL, "userId" varchar, "invoiceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "title" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cc0ac824ba89deda98bb418e8ca" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_856f24297f120604f8ae2942769" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da2893697d57368470952a76f65" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_31ec3d5a6b0985cec544c642178" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_invoice_estimate_history"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt" FROM "invoice_estimate_history"` + ); + await queryRunner.query(`DROP TABLE "invoice_estimate_history"`); + await queryRunner.query( + `ALTER TABLE "temporary_invoice_estimate_history" RENAME TO "invoice_estimate_history"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8106063f79cce8e67790d79092" ON "invoice_estimate_history" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_483eb296a94d821ebedb375858" ON "invoice_estimate_history" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_31ec3d5a6b0985cec544c64217" ON "invoice_estimate_history" ("invoiceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_da2893697d57368470952a76f6" ON "invoice_estimate_history" ("userId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_856f24297f120604f8ae294276" ON "invoice_estimate_history" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cc0ac824ba89deda98bb418e8c" ON "invoice_estimate_history" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e89749c8e8258b2ec110c0776f"`); + await queryRunner.query(`DROP INDEX "IDX_f78214cd9de76e80fe8a6305f5"`); + await queryRunner.query(`DROP INDEX "IDX_e2835fd8776ae5d56d892e087e"`); + await queryRunner.query(`DROP INDEX "IDX_b7da14d2b61cf1dd5c65188b9c"`); + await queryRunner.query( + `CREATE TABLE "temporary_invoice_item" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "price" numeric NOT NULL, "quantity" numeric NOT NULL, "totalValue" numeric NOT NULL, "applyTax" boolean, "applyDiscount" boolean, "expenseId" varchar, "invoiceId" varchar, "taskId" varchar, "employeeId" varchar, "projectId" varchar, "productId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e558df60d7d9a3e412ef0bbb844" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16f1d0e74b4d33e59c0eabdaac7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d4d92abde074b3da8054d7cfbc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62d486728b272e3b4d23a6b5db6" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_553d5aac210d22fdca5c8d48ead" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_897c33b49a04cf3db7acd336afc" FOREIGN KEY ("expenseId") REFERENCES "expense" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e89749c8e8258b2ec110c0776ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f78214cd9de76e80fe8a6305f52" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_invoice_item"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt" FROM "invoice_item"` + ); + await queryRunner.query(`DROP TABLE "invoice_item"`); + await queryRunner.query(`ALTER TABLE "temporary_invoice_item" RENAME TO "invoice_item"`); + await queryRunner.query(`CREATE INDEX "IDX_e89749c8e8258b2ec110c0776f" ON "invoice_item" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f78214cd9de76e80fe8a6305f5" ON "invoice_item" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e2835fd8776ae5d56d892e087e" ON "invoice_item" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_b7da14d2b61cf1dd5c65188b9c" ON "invoice_item" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d9e965da0f63c94983d3a1006a"`); + await queryRunner.query(`DROP INDEX "IDX_b5c33892e630b66c65d623baf8"`); + await queryRunner.query(`DROP INDEX "IDX_058ef835f99e28fc6717cd7c80"`); + await queryRunner.query(`DROP INDEX "IDX_7fb52a5f267f53b7d93af3d8c3"`); + await queryRunner.query(`DROP INDEX "IDX_850ca385c1985c1808cd4ea241"`); + await queryRunner.query(`DROP INDEX "IDX_eabacf7474d75e53d7b7046f3e"`); + await queryRunner.query( + `CREATE TABLE "temporary_invoice" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "invoiceDate" datetime, "invoiceNumber" numeric, "dueDate" datetime, "currency" varchar NOT NULL, "discountValue" numeric NOT NULL, "paid" boolean, "tax" numeric, "tax2" numeric, "terms" varchar NOT NULL, "totalValue" numeric, "status" varchar NOT NULL, "isEstimate" boolean, "isAccepted" boolean, "discountType" varchar, "taxType" varchar, "tax2Type" varchar, "invoiceType" varchar, "sentTo" varchar, "organizationContactId" varchar, "internalNote" varchar, "alreadyPaid" numeric, "amountDue" numeric, "hasRemainingAmountInvoiced" boolean, "token" varchar, "isArchived" boolean DEFAULT (0), "fromOrganizationId" varchar NOT NULL, "toContactId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_d7bed97fb47876e03fd7d7c285a" UNIQUE ("invoiceNumber"), CONSTRAINT "FK_d9e965da0f63c94983d3a1006ac" FOREIGN KEY ("toContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b5c33892e630b66c65d623baf8e" FOREIGN KEY ("fromOrganizationId") REFERENCES "organization" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_058ef835f99e28fc6717cd7c80f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7fb52a5f267f53b7d93af3d8c3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_invoice"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt" FROM "invoice"` + ); + await queryRunner.query(`DROP TABLE "invoice"`); + await queryRunner.query(`ALTER TABLE "temporary_invoice" RENAME TO "invoice"`); + await queryRunner.query(`CREATE INDEX "IDX_d9e965da0f63c94983d3a1006a" ON "invoice" ("toContactId") `); + await queryRunner.query(`CREATE INDEX "IDX_b5c33892e630b66c65d623baf8" ON "invoice" ("fromOrganizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_058ef835f99e28fc6717cd7c80" ON "invoice" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_7fb52a5f267f53b7d93af3d8c3" ON "invoice" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_850ca385c1985c1808cd4ea241" ON "invoice" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_eabacf7474d75e53d7b7046f3e" ON "invoice" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_46426ea45456e240a092b73204"`); + await queryRunner.query(`DROP INDEX "IDX_fab6b6200b9ed6fd002c1ff62a"`); + await queryRunner.query(`DROP INDEX "IDX_86c09eb673b0e66129dbdc7211"`); + await queryRunner.query(`DROP INDEX "IDX_f4e813d72dc732f16497ee2c52"`); + await queryRunner.query(`DROP INDEX "IDX_aa0e9b0cfcba1926925b025512"`); + await queryRunner.query( + `CREATE TABLE "temporary_key_result_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "unit" varchar, "targetValue" integer, "initialValue" integer, "deadline" varchar NOT NULL, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_46426ea45456e240a092b732047" FOREIGN KEY ("goalId") REFERENCES "goal_template" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bc62c3d2ffdd6f9c7f8b3dcd1c" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_fab6b6200b9ed6fd002c1ff62ab" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_86c09eb673b0e66129dbdc72111" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_key_result_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "key_result_template"` + ); + await queryRunner.query(`DROP TABLE "key_result_template"`); + await queryRunner.query(`ALTER TABLE "temporary_key_result_template" RENAME TO "key_result_template"`); + await queryRunner.query(`CREATE INDEX "IDX_46426ea45456e240a092b73204" ON "key_result_template" ("goalId") `); + await queryRunner.query( + `CREATE INDEX "IDX_fab6b6200b9ed6fd002c1ff62a" ON "key_result_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_86c09eb673b0e66129dbdc7211" ON "key_result_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f4e813d72dc732f16497ee2c52" ON "key_result_template" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_aa0e9b0cfcba1926925b025512" ON "key_result_template" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_fd4b0cb7a44ed914acdda55e29"`); + await queryRunner.query(`DROP INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65"`); + await queryRunner.query(`DROP INDEX "IDX_12b8b54f416ec9f5ec002f0a83"`); + await queryRunner.query(`DROP INDEX "IDX_94aad97b26aede6545a3226fb3"`); + await queryRunner.query( + `CREATE TABLE "temporary_key_result_update" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "owner" varchar NOT NULL, "status" varchar NOT NULL, "keyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7497a70a581e5f56f792015dd37" FOREIGN KEY ("keyResultId") REFERENCES "key_result" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fd4b0cb7a44ed914acdda55e29c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cd9cbc0d5b6d62dbb63c3b3a65b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_key_result_update"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt" FROM "key_result_update"` + ); + await queryRunner.query(`DROP TABLE "key_result_update"`); + await queryRunner.query(`ALTER TABLE "temporary_key_result_update" RENAME TO "key_result_update"`); + await queryRunner.query( + `CREATE INDEX "IDX_fd4b0cb7a44ed914acdda55e29" ON "key_result_update" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65" ON "key_result_update" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_12b8b54f416ec9f5ec002f0a83" ON "key_result_update" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_94aad97b26aede6545a3226fb3" ON "key_result_update" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_3e1d08761a717c1dd71fe67249"`); + await queryRunner.query(`DROP INDEX "IDX_4e1e975124c1d717814a4bb2ec"`); + await queryRunner.query(`DROP INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a"`); + await queryRunner.query(`DROP INDEX "IDX_38dc003f3484eff4b59918e9ae"`); + await queryRunner.query(`DROP INDEX "IDX_c89adeff0de3aedb2e772a5bf4"`); + await queryRunner.query(`DROP INDEX "IDX_5880347716f9ec5056ec15112c"`); + await queryRunner.query(`DROP INDEX "IDX_d1f45ca98f17bd84a5e430feaf"`); + await queryRunner.query(`DROP INDEX "IDX_8ac2c6b487d03157adda874789"`); + await queryRunner.query(`DROP INDEX "IDX_9b62dd2dddcde032f46a981733"`); + await queryRunner.query(`DROP INDEX "IDX_8889e2618366faefa575a8049b"`); + await queryRunner.query( + `CREATE TABLE "temporary_key_result" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "type" varchar NOT NULL, "targetValue" integer, "initialValue" integer, "unit" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "deadline" varchar NOT NULL, "hardDeadline" datetime, "softDeadline" datetime, "status" varchar NOT NULL, "weight" varchar, "ownerId" varchar NOT NULL, "leadId" varchar, "projectId" varchar, "taskId" varchar, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3e1d08761a717c1dd71fe67249b" FOREIGN KEY ("goalId") REFERENCES "goal" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4e1e975124c1d717814a4bb2ec8" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d8547e21ccb8e37ac9f0d69c1af" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38dc003f3484eff4b59918e9ae3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c89adeff0de3aedb2e772a5bf4c" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_5880347716f9ec5056ec15112cc" FOREIGN KEY ("ownerId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d1f45ca98f17bd84a5e430feaf4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8ac2c6b487d03157adda874789f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_key_result"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "key_result"` + ); + await queryRunner.query(`DROP TABLE "key_result"`); + await queryRunner.query(`ALTER TABLE "temporary_key_result" RENAME TO "key_result"`); + await queryRunner.query(`CREATE INDEX "IDX_3e1d08761a717c1dd71fe67249" ON "key_result" ("goalId") `); + await queryRunner.query(`CREATE INDEX "IDX_4e1e975124c1d717814a4bb2ec" ON "key_result" ("kpiId") `); + await queryRunner.query(`CREATE INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a" ON "key_result" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_38dc003f3484eff4b59918e9ae" ON "key_result" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_c89adeff0de3aedb2e772a5bf4" ON "key_result" ("leadId") `); + await queryRunner.query(`CREATE INDEX "IDX_5880347716f9ec5056ec15112c" ON "key_result" ("ownerId") `); + await queryRunner.query(`CREATE INDEX "IDX_d1f45ca98f17bd84a5e430feaf" ON "key_result" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_8ac2c6b487d03157adda874789" ON "key_result" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9b62dd2dddcde032f46a981733" ON "key_result" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8889e2618366faefa575a8049b" ON "key_result" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_3a7abee35dfa3c90ed491583eb"`); + await queryRunner.query(`DROP INDEX "IDX_15fcb8179bc7b0642ca78da69e"`); + await queryRunner.query( + `CREATE TABLE "temporary_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar, "is_system" boolean DEFAULT (1), "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_language"("id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt" FROM "language"` + ); + await queryRunner.query(`DROP TABLE "language"`); + await queryRunner.query(`ALTER TABLE "temporary_language" RENAME TO "language"`); + await queryRunner.query(`CREATE INDEX "IDX_3a7abee35dfa3c90ed491583eb" ON "language" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_15fcb8179bc7b0642ca78da69e" ON "language" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_20acc3c3a6c900c6ef9fc68199"`); + await queryRunner.query(`DROP INDEX "IDX_e03ddff05652be527e04abdc56"`); + await queryRunner.query(`DROP INDEX "IDX_d306a524b507f72fa8550aeffe"`); + await queryRunner.query(`DROP INDEX "IDX_533144d7ae94180235ea456625"`); + await queryRunner.query(`DROP INDEX "IDX_a03be8a86e528e2720504a041f"`); + await queryRunner.query(`DROP INDEX "IDX_0a0f972564e74c9c4905e3abcb"`); + await queryRunner.query( + `CREATE TABLE "temporary_merchant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "phone" varchar, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "currency" varchar NOT NULL DEFAULT ('USD'), "contactId" varchar, "logoId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_e03ddff05652be527e04abdc56" UNIQUE ("contactId"), CONSTRAINT "FK_20acc3c3a6c900c6ef9fc681996" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e03ddff05652be527e04abdc56f" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d306a524b507f72fa8550aeffe4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_533144d7ae94180235ea456625b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_merchant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt" FROM "merchant"` + ); + await queryRunner.query(`DROP TABLE "merchant"`); + await queryRunner.query(`ALTER TABLE "temporary_merchant" RENAME TO "merchant"`); + await queryRunner.query(`CREATE INDEX "IDX_20acc3c3a6c900c6ef9fc68199" ON "merchant" ("logoId") `); + await queryRunner.query(`CREATE INDEX "IDX_e03ddff05652be527e04abdc56" ON "merchant" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_d306a524b507f72fa8550aeffe" ON "merchant" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_533144d7ae94180235ea456625" ON "merchant" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_a03be8a86e528e2720504a041f" ON "merchant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_0a0f972564e74c9c4905e3abcb" ON "merchant" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_31626e7d39eb95b710d5a2d80f"`); + await queryRunner.query(`DROP INDEX "IDX_2e0d21aab892b5993abaac09bc"`); + await queryRunner.query(`DROP INDEX "IDX_af6423760433da72002a7f369e"`); + await queryRunner.query(`DROP INDEX "IDX_4062b5d54aa740aaff9a6c5fbb"`); + await queryRunner.query(`DROP INDEX "IDX_34c6749e2bc94b2e52e9572f32"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2e0d21aab892b5993abaac09bcd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_af6423760433da72002a7f369eb" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt" FROM "organization_award"` + ); + await queryRunner.query(`DROP TABLE "organization_award"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_award" RENAME TO "organization_award"`); + await queryRunner.query(`CREATE INDEX "IDX_31626e7d39eb95b710d5a2d80f" ON "organization_award" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_2e0d21aab892b5993abaac09bc" ON "organization_award" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_af6423760433da72002a7f369e" ON "organization_award" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_4062b5d54aa740aaff9a6c5fbb" ON "organization_award" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_34c6749e2bc94b2e52e9572f32" ON "organization_award" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd"`); + await queryRunner.query(`DROP INDEX "IDX_a86d2e378b953cb39261f457d2"`); + await queryRunner.query(`DROP INDEX "IDX_de33f92e042365d196d959e774"`); + await queryRunner.query(`DROP INDEX "IDX_6200736cb4d3617b004e5b647f"`); + await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); + await queryRunner.query(`DROP INDEX "IDX_53627a383c9817dbf1164d7dc6"`); + await queryRunner.query(`DROP INDEX "IDX_f91783c7a8565c648b65635efc"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "primaryEmail" varchar, "primaryPhone" varchar, "inviteStatus" varchar, "notes" varchar, "contactType" varchar CHECK( "contactType" IN ('CLIENT','CUSTOMER','LEAD') ) NOT NULL DEFAULT ('CLIENT'), "imageUrl" varchar(500), "budget" integer, "budgetType" varchar CHECK( "budgetType" IN ('hours','cost') ) DEFAULT ('cost'), "createdBy" varchar, "contactId" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_a86d2e378b953cb39261f457d2" UNIQUE ("contactId"), CONSTRAINT "FK_8cfcdc6bc8fb55e273d9ace5fd5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a86d2e378b953cb39261f457d26" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6200736cb4d3617b004e5b647ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e68c43e315ad3aaea4e99cf461d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt" FROM "organization_contact"` + ); + await queryRunner.query(`DROP TABLE "organization_contact"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_contact" RENAME TO "organization_contact"`); + await queryRunner.query(`CREATE INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd" ON "organization_contact" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_6200736cb4d3617b004e5b647f" ON "organization_contact" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e68c43e315ad3aaea4e99cf461" ON "organization_contact" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_53627a383c9817dbf1164d7dc6" ON "organization_contact" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f91783c7a8565c648b65635efc" ON "organization_contact" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_91b652409dc1fb2f712590dd21"`); + await queryRunner.query(`DROP INDEX "IDX_c61a562a2379d1c0077fe7de33"`); + await queryRunner.query(`DROP INDEX "IDX_b3644ff7cd65239e29d292a41d"`); + await queryRunner.query(`DROP INDEX "IDX_6139cd4c620e81aefd4895d370"`); + await queryRunner.query(`DROP INDEX "IDX_b65059949804b20048b1c86c3d"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_department" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c61a562a2379d1c0077fe7de332" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3644ff7cd65239e29d292a41d1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_department"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_department"` + ); + await queryRunner.query(`DROP TABLE "organization_department"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_department" RENAME TO "organization_department"`); + await queryRunner.query(`CREATE INDEX "IDX_91b652409dc1fb2f712590dd21" ON "organization_department" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c61a562a2379d1c0077fe7de33" ON "organization_department" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b3644ff7cd65239e29d292a41d" ON "organization_department" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6139cd4c620e81aefd4895d370" ON "organization_department" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b65059949804b20048b1c86c3d" ON "organization_department" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_c129dee7d1cb84e01e69b5e2c6"`); + await queryRunner.query(`DROP INDEX "IDX_4bc83945c022a862a33629ff1e"`); + await queryRunner.query(`DROP INDEX "IDX_1057ec001a4c6b258658143047"`); + await queryRunner.query(`DROP INDEX "IDX_e5edb48261db95f46c3b4d34a5"`); + await queryRunner.query(`DROP INDEX "IDX_72c6a8ad9de5c04b2b689fd229"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "documentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c129dee7d1cb84e01e69b5e2c66" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4bc83945c022a862a33629ff1e1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1057ec001a4c6b258658143047a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt" FROM "organization_document"` + ); + await queryRunner.query(`DROP TABLE "organization_document"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_document" RENAME TO "organization_document"`); + await queryRunner.query( + `CREATE INDEX "IDX_c129dee7d1cb84e01e69b5e2c6" ON "organization_document" ("documentId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4bc83945c022a862a33629ff1e" ON "organization_document" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1057ec001a4c6b258658143047" ON "organization_document" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e5edb48261db95f46c3b4d34a5" ON "organization_document" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_72c6a8ad9de5c04b2b689fd229" ON "organization_document" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a583cfe32f492f5ba99b7bb205"`); + await queryRunner.query(`DROP INDEX "IDX_227b5bd9867287cbbeece8f6ba"`); + await queryRunner.query(`DROP INDEX "IDX_880f3cce5e03f42bec3da6e6dc"`); + await queryRunner.query(`DROP INDEX "IDX_cc096d49e2399e89cdf32297da"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_employment_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a583cfe32f492f5ba99b7bb2050" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_227b5bd9867287cbbeece8f6ba9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_employment_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_employment_type"` + ); + await queryRunner.query(`DROP TABLE "organization_employment_type"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_employment_type" RENAME TO "organization_employment_type"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a583cfe32f492f5ba99b7bb205" ON "organization_employment_type" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_227b5bd9867287cbbeece8f6ba" ON "organization_employment_type" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_880f3cce5e03f42bec3da6e6dc" ON "organization_employment_type" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cc096d49e2399e89cdf32297da" ON "organization_employment_type" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_020516e74a57cb85d75381e841"`); + await queryRunner.query(`DROP INDEX "IDX_4513931e2d530f78d7144c8c7c"`); + await queryRunner.query(`DROP INDEX "IDX_225e476592214e32e117a85213"`); + await queryRunner.query(`DROP INDEX "IDX_b79e8d45a3ef5503579643f5de"`); + await queryRunner.query(`DROP INDEX "IDX_6577ec9ca4cef331a507264d44"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "languageCode" varchar NOT NULL, "name" varchar NOT NULL, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_020516e74a57cb85d75381e841a" FOREIGN KEY ("languageCode") REFERENCES "language" ("code") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4513931e2d530f78d7144c8c7cd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_225e476592214e32e117a85213c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_language"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt" FROM "organization_language"` + ); + await queryRunner.query(`DROP TABLE "organization_language"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_language" RENAME TO "organization_language"`); + await queryRunner.query( + `CREATE INDEX "IDX_020516e74a57cb85d75381e841" ON "organization_language" ("languageCode") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4513931e2d530f78d7144c8c7c" ON "organization_language" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_225e476592214e32e117a85213" ON "organization_language" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b79e8d45a3ef5503579643f5de" ON "organization_language" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6577ec9ca4cef331a507264d44" ON "organization_language" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3f02c20145af9997253531349c"`); + await queryRunner.query(`DROP INDEX "IDX_a0409e39f23ff6d418f2c03df5"`); + await queryRunner.query(`DROP INDEX "IDX_a8f497b1006ec967964abb0d49"`); + await queryRunner.query(`DROP INDEX "IDX_7317abf7a05a169783b6aa7932"`); + await queryRunner.query(`DROP INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_position" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a0409e39f23ff6d418f2c03df58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a8f497b1006ec967964abb0d497" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_position"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_position"` + ); + await queryRunner.query(`DROP TABLE "organization_position"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_position" RENAME TO "organization_position"`); + await queryRunner.query(`CREATE INDEX "IDX_3f02c20145af9997253531349c" ON "organization_position" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_a0409e39f23ff6d418f2c03df5" ON "organization_position" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a8f497b1006ec967964abb0d49" ON "organization_position" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7317abf7a05a169783b6aa7932" ON "organization_position" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f" ON "organization_position" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "organization_project"` + ); + await queryRunner.query(`DROP TABLE "organization_project"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query(`DROP INDEX "IDX_e6b6555e5fc6c5120110a0195c"`); + await queryRunner.query(`DROP INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0"`); + await queryRunner.query(`DROP INDEX "IDX_7fd3c8f54c01943b283080aefa"`); + await queryRunner.query(`DROP INDEX "IDX_86438fbaa1d857f32f66b24885"`); + await queryRunner.query(`DROP INDEX "IDX_cd928adcb5ebb00c9f2c57e390"`); + await queryRunner.query(`DROP INDEX "IDX_8a7a4d4206c003c3827c5afe5d"`); + await queryRunner.query(`DROP INDEX "IDX_a56086e95fb2627ba2a3dd2eaa"`); + await queryRunner.query(`DROP INDEX "IDX_f33638d289aff2306328c32a8c"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_module" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" text, "status" varchar, "startDate" datetime, "endDate" datetime, "public" boolean DEFAULT (0), "isFavorite" boolean DEFAULT (0), "parentId" varchar, "projectId" varchar, "creatorId" varchar, "managerId" varchar, "archivedAt" datetime, CONSTRAINT "FK_e6b6555e5fc6c5120110a0195cd" FOREIGN KEY ("managerId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f2054a6a2d4b9c17624b9c8a01" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd3c8f54c01943b283080aefa3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bb6fbfa64cf5d5977c2e5346a9" FOREIGN KEY ("parentId") REFERENCES "organization_project_module" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_cd928adcb5ebb00c9f2c57e3908" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a7a4d4206c003c3827c5afe5dc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_module"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId" FROM "organization_project_module"` + ); + await queryRunner.query(`DROP TABLE "organization_project_module"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_module" RENAME TO "organization_project_module"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e6b6555e5fc6c5120110a0195c" ON "organization_project_module" ("managerId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0" ON "organization_project_module" ("creatorId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7fd3c8f54c01943b283080aefa" ON "organization_project_module" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_86438fbaa1d857f32f66b24885" ON "organization_project_module" ("status") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cd928adcb5ebb00c9f2c57e390" ON "organization_project_module" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a7a4d4206c003c3827c5afe5d" ON "organization_project_module" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a56086e95fb2627ba2a3dd2eaa" ON "organization_project_module" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f33638d289aff2306328c32a8c" ON "organization_project_module" ("isActive") ` + ); + await queryRunner.query(`DROP INDEX "IDX_637ac2c467df4bc3b71795a866"`); + await queryRunner.query(`DROP INDEX "IDX_61387780d015923453f4b015b4"`); + await queryRunner.query(`DROP INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b"`); + await queryRunner.query(`DROP INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e"`); + await queryRunner.query(`DROP INDEX "IDX_0b19a287858af40661bd3eb741"`); + await queryRunner.query(`DROP INDEX "IDX_9ad08dbc039d08279dae2dd94e"`); + await queryRunner.query(`DROP INDEX "IDX_f3ef2000abb9762b138cc5a1b3"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "splitExpense" boolean, "parentRecurringExpenseId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_8a12e7a0d47d3c6a6b35f7984e3" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0b19a287858af40661bd3eb7411" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt" FROM "organization_recurring_expense"` + ); + await queryRunner.query(`DROP TABLE "organization_recurring_expense"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_recurring_expense" RENAME TO "organization_recurring_expense"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_637ac2c467df4bc3b71795a866" ON "organization_recurring_expense" ("parentRecurringExpenseId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_61387780d015923453f4b015b4" ON "organization_recurring_expense" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b" ON "organization_recurring_expense" ("categoryName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e" ON "organization_recurring_expense" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0b19a287858af40661bd3eb741" ON "organization_recurring_expense" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9ad08dbc039d08279dae2dd94e" ON "organization_recurring_expense" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3ef2000abb9762b138cc5a1b3" ON "organization_recurring_expense" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_8a1fe8afb3aa672bae5993fbe7"`); + await queryRunner.query(`DROP INDEX "IDX_f57ad03c4e471bd8530494ea63"`); + await queryRunner.query(`DROP INDEX "IDX_5596b4fa7fb2ceb0955580becd"`); + await queryRunner.query(`DROP INDEX "IDX_76e53f9609ca05477d50980743"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_sprint" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "projectId" varchar NOT NULL, "goal" varchar, "length" integer NOT NULL DEFAULT (7), "startDate" datetime, "endDate" datetime, "dayStart" integer, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a140b7e30ff3455551a0fd599fb" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8a1fe8afb3aa672bae5993fbe7d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f57ad03c4e471bd8530494ea63d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_sprint"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt" FROM "organization_sprint"` + ); + await queryRunner.query(`DROP TABLE "organization_sprint"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_sprint" RENAME TO "organization_sprint"`); + await queryRunner.query( + `CREATE INDEX "IDX_8a1fe8afb3aa672bae5993fbe7" ON "organization_sprint" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f57ad03c4e471bd8530494ea63" ON "organization_sprint" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_5596b4fa7fb2ceb0955580becd" ON "organization_sprint" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_76e53f9609ca05477d50980743" ON "organization_sprint" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_20a290f166c0810eafbf271717"`); + await queryRunner.query(`DROP INDEX "IDX_19ab7adf33199bc6f913db277d"`); + await queryRunner.query(`DROP INDEX "IDX_5830901876e426adfc15fb7341"`); + await queryRunner.query(`DROP INDEX "IDX_582768159ef0c749e8552ea9bc"`); + await queryRunner.query(`DROP INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3"`); + await queryRunner.query(`DROP INDEX "IDX_b7be7e61daf2b5af3232c9c4d6"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_task_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isTasksPrivacyEnabled" boolean NOT NULL DEFAULT (1), "isTasksMultipleAssigneesEnabled" boolean NOT NULL DEFAULT (1), "isTasksManualTimeEnabled" boolean NOT NULL DEFAULT (1), "isTasksGroupEstimationEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInHoursEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInStoryPointsEnabled" boolean NOT NULL DEFAULT (1), "isTasksProofOfCompletionEnabled" boolean NOT NULL DEFAULT (1), "tasksProofOfCompletionType" varchar NOT NULL DEFAULT ('PRIVATE'), "isTasksLinkedEnabled" boolean NOT NULL DEFAULT (1), "isTasksCommentsEnabled" boolean NOT NULL DEFAULT (1), "isTasksHistoryEnabled" boolean NOT NULL DEFAULT (1), "isTasksAcceptanceCriteriaEnabled" boolean NOT NULL DEFAULT (1), "isTasksDraftsEnabled" boolean NOT NULL DEFAULT (1), "isTasksNotifyLeftEnabled" boolean NOT NULL DEFAULT (1), "tasksNotifyLeftPeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoCloseEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoClosePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoArchiveEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoArchivePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoStatusEnabled" boolean NOT NULL DEFAULT (1), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_20a290f166c0810eafbf2717171" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_19ab7adf33199bc6f913db277d7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5830901876e426adfc15fb7341b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_582768159ef0c749e8552ea9bcd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_task_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "organization_task_setting"` + ); + await queryRunner.query(`DROP TABLE "organization_task_setting"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_task_setting" RENAME TO "organization_task_setting"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_20a290f166c0810eafbf271717" ON "organization_task_setting" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_19ab7adf33199bc6f913db277d" ON "organization_task_setting" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5830901876e426adfc15fb7341" ON "organization_task_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_582768159ef0c749e8552ea9bc" ON "organization_task_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3" ON "organization_task_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b7be7e61daf2b5af3232c9c4d6" ON "organization_task_setting" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_752d7a0fe6597ee6bbc6502a12"`); + await queryRunner.query(`DROP INDEX "IDX_70fcc451944fbde73d223c2af3"`); + await queryRunner.query(`DROP INDEX "IDX_fe12e1b76bbb76209134d9bdc2"`); + await queryRunner.query(`DROP INDEX "IDX_d8eba1c0e500c60be1b69c1e77"`); + await queryRunner.query(`DROP INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0"`); + await queryRunner.query(`DROP INDEX "IDX_a2a5601d799fbfc29c17b99243"`); + await queryRunner.query(`DROP INDEX "IDX_ce83034f38496f5fe3f1979697"`); + await queryRunner.query(`DROP INDEX "IDX_719aeb37fa7a1dd80d25336a0c"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_team_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "organizationTeamId" varchar NOT NULL, "employeeId" varchar NOT NULL, "roleId" varchar, "isTrackingEnabled" boolean DEFAULT (1), "activeTaskId" varchar, "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "order" integer, "archivedAt" datetime, CONSTRAINT "FK_fe12e1b76bbb76209134d9bdc2e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d8eba1c0e500c60be1b69c1e777" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dc83cdd7c519d73afc0d8bdf09" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2a5601d799fbfc29c17b99243f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ce83034f38496f5fe3f19796977" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_719aeb37fa7a1dd80d25336a0cf" FOREIGN KEY ("activeTaskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_team_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order" FROM "organization_team_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_team_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_team_employee" RENAME TO "organization_team_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_752d7a0fe6597ee6bbc6502a12" ON "organization_team_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_70fcc451944fbde73d223c2af3" ON "organization_team_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fe12e1b76bbb76209134d9bdc2" ON "organization_team_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d8eba1c0e500c60be1b69c1e77" ON "organization_team_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0" ON "organization_team_employee" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a2a5601d799fbfc29c17b99243" ON "organization_team_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ce83034f38496f5fe3f1979697" ON "organization_team_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_719aeb37fa7a1dd80d25336a0c" ON "organization_team_employee" ("activeTaskId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_d9529008c733cb90044b8c2ad6"`); + await queryRunner.query(`DROP INDEX "IDX_c15823bf3f63b1fe331d9de662"`); + await queryRunner.query(`DROP INDEX "IDX_5e73656ce0355347477c42ae19"`); + await queryRunner.query(`DROP INDEX "IDX_171b852be7c1f387eca93775aa"`); + await queryRunner.query(`DROP INDEX "IDX_29ece7e3bb764028387cdbc888"`); + await queryRunner.query(`DROP INDEX "IDX_b027ee2cb18245356b8d963d2f"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_team_join_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "email" varchar NOT NULL, "fullName" varchar, "linkAddress" varchar, "position" varchar, "status" varchar, "code" varchar, "token" varchar, "expiredAt" datetime, "userId" varchar, "organizationTeamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_171b852be7c1f387eca93775aad" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e73656ce0355347477c42ae19b" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c15823bf3f63b1fe331d9de6625" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d9529008c733cb90044b8c2ad6b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_team_join_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "organization_team_join_request"` + ); + await queryRunner.query(`DROP TABLE "organization_team_join_request"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_team_join_request" RENAME TO "organization_team_join_request"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d9529008c733cb90044b8c2ad6" ON "organization_team_join_request" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c15823bf3f63b1fe331d9de662" ON "organization_team_join_request" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5e73656ce0355347477c42ae19" ON "organization_team_join_request" ("userId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_171b852be7c1f387eca93775aa" ON "organization_team_join_request" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_29ece7e3bb764028387cdbc888" ON "organization_team_join_request" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b027ee2cb18245356b8d963d2f" ON "organization_team_join_request" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e22ab0f1236b1a07785b641727"`); + await queryRunner.query(`DROP INDEX "IDX_176f5ed3c4534f3110d423d569"`); + await queryRunner.query(`DROP INDEX "IDX_eef1c19a0cb5321223cfe3286c"`); + await queryRunner.query(`DROP INDEX "IDX_103ae3eb65f4b091efc55cb532"`); + await queryRunner.query(`DROP INDEX "IDX_da625f694eb1e23e585f301008"`); + await queryRunner.query(`DROP INDEX "IDX_51e91be110fa0b8e70066f5727"`); + await queryRunner.query(`DROP INDEX "IDX_722d648e0b83267d4a66332ccb"`); + await queryRunner.query(`DROP INDEX "IDX_38f1d96e8c2d59e4f0f84209ab"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "prefix" varchar, "createdById" varchar, "public" boolean DEFAULT (0), "profile_link" varchar, "logo" varchar, "imageId" varchar, "color" varchar, "emoji" varchar, "teamSize" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "shareProfileView" boolean DEFAULT (1), "requirePlanToTrack" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_176f5ed3c4534f3110d423d5690" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eef1c19a0cb5321223cfe3286c4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da625f694eb1e23e585f3010082" FOREIGN KEY ("createdById") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_51e91be110fa0b8e70066f5727f" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack" FROM "organization_team"` + ); + await queryRunner.query(`DROP TABLE "organization_team"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_team" RENAME TO "organization_team"`); + await queryRunner.query( + `CREATE INDEX "IDX_e22ab0f1236b1a07785b641727" ON "organization_team" ("profile_link") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_176f5ed3c4534f3110d423d569" ON "organization_team" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_eef1c19a0cb5321223cfe3286c" ON "organization_team" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_103ae3eb65f4b091efc55cb532" ON "organization_team" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_da625f694eb1e23e585f301008" ON "organization_team" ("createdById") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_51e91be110fa0b8e70066f5727" ON "organization_team" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_722d648e0b83267d4a66332ccb" ON "organization_team" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_38f1d96e8c2d59e4f0f84209ab" ON "organization_team" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_e56e80136b07ecd52545368611"`); + await queryRunner.query(`DROP INDEX "IDX_56dd132aa3743cfa9b034d020e"`); + await queryRunner.query(`DROP INDEX "IDX_7e0bf6063e1728c9813d5da7ca"`); + await queryRunner.query(`DROP INDEX "IDX_04c6320f910056ecb11b147ac8"`); + await queryRunner.query(`DROP INDEX "IDX_266972cd6ff9656eec8818e12d"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_vendor" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "email" varchar, "phone" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_56dd132aa3743cfa9b034d020eb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e0bf6063e1728c9813d5da7caa" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_vendor"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt" FROM "organization_vendor"` + ); + await queryRunner.query(`DROP TABLE "organization_vendor"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_vendor" RENAME TO "organization_vendor"`); + await queryRunner.query(`CREATE INDEX "IDX_e56e80136b07ecd52545368611" ON "organization_vendor" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_56dd132aa3743cfa9b034d020e" ON "organization_vendor" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_7e0bf6063e1728c9813d5da7ca" ON "organization_vendor" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_04c6320f910056ecb11b147ac8" ON "organization_vendor" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_266972cd6ff9656eec8818e12d" ON "organization_vendor" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b2091c1795f1d0d919b278ab23"`); + await queryRunner.query(`DROP INDEX "IDX_6de52b8f3de32abee3df2628a3"`); + await queryRunner.query(`DROP INDEX "IDX_745a293c8b2c750bc421fa0633"`); + await queryRunner.query(`DROP INDEX "IDX_c21e615583a3ebbb0977452afb"`); + await queryRunner.query(`DROP INDEX "IDX_03e5eecc2328eb545ff748cbdd"`); + await queryRunner.query(`DROP INDEX "IDX_40460ab803bf6e5a62b75a35c5"`); + await queryRunner.query(`DROP INDEX "IDX_6cc2b2052744e352834a4c9e78"`); + await queryRunner.query(`DROP INDEX "IDX_b03a8a28f6ebdb6df8f630216b"`); + await queryRunner.query(`DROP INDEX "IDX_f37d866c3326eca5f579cef35c"`); + await queryRunner.query(`DROP INDEX "IDX_c75285bf286b17c7ca5537857b"`); + await queryRunner.query(`DROP INDEX "IDX_9ea70bf5c390b00e7bb96b86ed"`); + await queryRunner.query(`DROP INDEX "IDX_15458cef74076623c270500053"`); + await queryRunner.query(`DROP INDEX "IDX_2360aa7a4b5ab99e026584f305"`); + await queryRunner.query(`DROP INDEX "IDX_7965db2b12872551b586f76dd7"`); + await queryRunner.query(`DROP INDEX "IDX_47b6a97e09895a06606a4a8042"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isDefault" boolean NOT NULL DEFAULT (0), "profile_link" varchar, "banner" varchar, "totalEmployees" integer, "short_description" varchar, "client_focus" varchar, "overview" varchar, "imageUrl" varchar(500), "currency" varchar NOT NULL, "valueDate" datetime, "defaultValueDateType" varchar CHECK( "defaultValueDateType" IN ('TODAY','END_OF_MONTH','START_OF_MONTH') ) DEFAULT ('TODAY'), "isActive" boolean DEFAULT (1), "defaultAlignmentType" varchar, "timeZone" varchar, "regionCode" varchar, "brandColor" varchar, "dateFormat" varchar, "officialName" varchar, "startWeekOn" varchar, "taxId" varchar, "numberFormat" varchar, "minimumProjectSize" varchar, "bonusType" varchar, "bonusPercentage" integer, "invitesAllowed" boolean DEFAULT (1), "show_income" boolean, "show_profits" boolean, "show_bonuses_paid" boolean, "show_total_hours" boolean, "show_minimum_project_size" boolean, "show_projects_count" boolean, "show_clients_count" boolean, "show_clients" boolean, "show_employees_count" boolean, "inviteExpiryPeriod" integer, "fiscalStartDate" datetime, "fiscalEndDate" datetime, "registrationDate" datetime, "futureDateAllowed" boolean, "allowManualTime" boolean NOT NULL DEFAULT (1), "allowModifyTime" boolean NOT NULL DEFAULT (1), "allowDeleteTime" boolean NOT NULL DEFAULT (1), "requireReason" boolean NOT NULL DEFAULT (0), "requireDescription" boolean NOT NULL DEFAULT (0), "requireProject" boolean NOT NULL DEFAULT (0), "requireTask" boolean NOT NULL DEFAULT (0), "requireClient" boolean NOT NULL DEFAULT (0), "timeFormat" integer NOT NULL DEFAULT (12), "separateInvoiceItemTaxAndDiscount" boolean, "website" varchar, "fiscalInformation" varchar, "currencyPosition" varchar NOT NULL DEFAULT ('LEFT'), "discountAfterTax" boolean, "defaultStartTime" varchar, "defaultEndTime" varchar, "defaultInvoiceEstimateTerms" varchar, "convertAcceptedEstimates" boolean, "daysUntilDue" integer, "contactId" varchar, "allowTrackInactivity" boolean NOT NULL DEFAULT (1), "inactivityTimeLimit" integer NOT NULL DEFAULT (10), "activityProofDuration" integer NOT NULL DEFAULT (1), "isRemoveIdleTime" boolean NOT NULL DEFAULT (0), "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "imageId" varchar, "upworkOrganizationId" varchar, "upworkOrganizationName" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "randomScreenshot" boolean DEFAULT (0), "trackOnSleep" boolean DEFAULT (0), "screenshotFrequency" numeric NOT NULL DEFAULT (10), "enforced" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_745a293c8b2c750bc421fa06332" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7965db2b12872551b586f76dd79" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_47b6a97e09895a06606a4a80421" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization"("id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced" FROM "organization"` + ); + await queryRunner.query(`DROP TABLE "organization"`); + await queryRunner.query(`ALTER TABLE "temporary_organization" RENAME TO "organization"`); + await queryRunner.query(`CREATE INDEX "IDX_b2091c1795f1d0d919b278ab23" ON "organization" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6de52b8f3de32abee3df2628a3" ON "organization" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_745a293c8b2c750bc421fa0633" ON "organization" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c21e615583a3ebbb0977452afb" ON "organization" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_03e5eecc2328eb545ff748cbdd" ON "organization" ("isDefault") `); + await queryRunner.query(`CREATE INDEX "IDX_40460ab803bf6e5a62b75a35c5" ON "organization" ("profile_link") `); + await queryRunner.query(`CREATE INDEX "IDX_6cc2b2052744e352834a4c9e78" ON "organization" ("banner") `); + await queryRunner.query(`CREATE INDEX "IDX_b03a8a28f6ebdb6df8f630216b" ON "organization" ("totalEmployees") `); + await queryRunner.query( + `CREATE INDEX "IDX_f37d866c3326eca5f579cef35c" ON "organization" ("short_description") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c75285bf286b17c7ca5537857b" ON "organization" ("client_focus") `); + await queryRunner.query(`CREATE INDEX "IDX_9ea70bf5c390b00e7bb96b86ed" ON "organization" ("overview") `); + await queryRunner.query(`CREATE INDEX "IDX_15458cef74076623c270500053" ON "organization" ("currency") `); + await queryRunner.query( + `CREATE INDEX "IDX_2360aa7a4b5ab99e026584f305" ON "organization" ("defaultValueDateType") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_7965db2b12872551b586f76dd7" ON "organization" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_47b6a97e09895a06606a4a8042" ON "organization" ("imageId") `); + await queryRunner.query(`DROP INDEX "IDX_1fa632f2d12a06ef8dcc00858f"`); + await queryRunner.query(`DROP INDEX "IDX_e71a736d52820b568f6b0ca203"`); + await queryRunner.query(`DROP INDEX "IDX_380c03025a41ad032191f1ef2d"`); + await queryRunner.query(`DROP INDEX "IDX_1c88db6e50f0704688d1f1978c"`); + await queryRunner.query(`DROP INDEX "IDX_36e929b98372d961bb63bd4b4e"`); + await queryRunner.query( + `CREATE TABLE "temporary_password_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "email" varchar NOT NULL, "token" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "tenantId" varchar, "archivedAt" datetime, CONSTRAINT "FK_1fa632f2d12a06ef8dcc00858ff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_password_reset"("id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId") SELECT "id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId" FROM "password_reset"` + ); + await queryRunner.query(`DROP TABLE "password_reset"`); + await queryRunner.query(`ALTER TABLE "temporary_password_reset" RENAME TO "password_reset"`); + await queryRunner.query(`CREATE INDEX "IDX_1fa632f2d12a06ef8dcc00858f" ON "password_reset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e71a736d52820b568f6b0ca203" ON "password_reset" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_380c03025a41ad032191f1ef2d" ON "password_reset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1c88db6e50f0704688d1f1978c" ON "password_reset" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_36e929b98372d961bb63bd4b4e" ON "password_reset" ("token") `); + await queryRunner.query(`DROP INDEX "IDX_82753b9e315af84b20eaf84d77"`); + await queryRunner.query(`DROP INDEX "IDX_8846e403ec45e1ad8c309f91a3"`); + await queryRunner.query(`DROP INDEX "IDX_3f13c738eff604a85700746ec7"`); + await queryRunner.query(`DROP INDEX "IDX_87223c7f1d4c2ca51cf6992784"`); + await queryRunner.query(`DROP INDEX "IDX_62ef561a3bb084a7d12dad8a2d"`); + await queryRunner.query(`DROP INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9"`); + await queryRunner.query(`DROP INDEX "IDX_6959c37c3acf0832103a253570"`); + await queryRunner.query(`DROP INDEX "IDX_16a49d62227bf23686b77b5a21"`); + await queryRunner.query(`DROP INDEX "IDX_8c4018eab11e92c3b09583495f"`); + await queryRunner.query( + `CREATE TABLE "temporary_payment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "paymentDate" datetime, "amount" numeric, "note" varchar, "currency" varchar NOT NULL, "paymentMethod" varchar, "overdue" boolean, "employeeId" varchar, "invoiceId" varchar, "recordedById" varchar NOT NULL, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_82753b9e315af84b20eaf84d778" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_8846e403ec45e1ad8c309f91a37" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3f13c738eff604a85700746ec7d" FOREIGN KEY ("recordedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_87223c7f1d4c2ca51cf69927844" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62ef561a3bb084a7d12dad8a2d9" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_be7fcc9fb8cd5a74cb602ec6c9b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6959c37c3acf0832103a2535703" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_payment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "payment"` + ); + await queryRunner.query(`DROP TABLE "payment"`); + await queryRunner.query(`ALTER TABLE "temporary_payment" RENAME TO "payment"`); + await queryRunner.query( + `CREATE INDEX "IDX_82753b9e315af84b20eaf84d77" ON "payment" ("organizationContactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_8846e403ec45e1ad8c309f91a3" ON "payment" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_3f13c738eff604a85700746ec7" ON "payment" ("recordedById") `); + await queryRunner.query(`CREATE INDEX "IDX_87223c7f1d4c2ca51cf6992784" ON "payment" ("invoiceId") `); + await queryRunner.query(`CREATE INDEX "IDX_62ef561a3bb084a7d12dad8a2d" ON "payment" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9" ON "payment" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_6959c37c3acf0832103a253570" ON "payment" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_16a49d62227bf23686b77b5a21" ON "payment" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8c4018eab11e92c3b09583495f" ON "payment" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_04d16bdd72668de12c3e41a85a"`); + await queryRunner.query(`DROP INDEX "IDX_28965bf63ad4c0976892d0fd5e"`); + await queryRunner.query(`DROP INDEX "IDX_a6acee4ad726734b73f3886c14"`); + await queryRunner.query(`DROP INDEX "IDX_074caa106ee22d5d675a696a98"`); + await queryRunner.query( + `CREATE TABLE "temporary_pipeline_stage" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "index" integer NOT NULL, "name" varchar NOT NULL, "pipelineId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_73ec3158bf224b485fd715cb3a6" FOREIGN KEY ("pipelineId") REFERENCES "pipeline" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_04d16bdd72668de12c3e41a85a6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_28965bf63ad4c0976892d0fd5e8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_pipeline_stage"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt" FROM "pipeline_stage"` + ); + await queryRunner.query(`DROP TABLE "pipeline_stage"`); + await queryRunner.query(`ALTER TABLE "temporary_pipeline_stage" RENAME TO "pipeline_stage"`); + await queryRunner.query( + `CREATE INDEX "IDX_04d16bdd72668de12c3e41a85a" ON "pipeline_stage" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_28965bf63ad4c0976892d0fd5e" ON "pipeline_stage" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_a6acee4ad726734b73f3886c14" ON "pipeline_stage" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_074caa106ee22d5d675a696a98" ON "pipeline_stage" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_873ade98fbd6ca71c8b4d1bbca"`); + await queryRunner.query(`DROP INDEX "IDX_683274c59fb08b21249096e305"`); + await queryRunner.query(`DROP INDEX "IDX_f3027eabd451ec18b93fab7ed5"`); + await queryRunner.query(`DROP INDEX "IDX_1adf9f97094bc93e176ede2482"`); + await queryRunner.query( + `CREATE TABLE "temporary_pipeline" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_873ade98fbd6ca71c8b4d1bbcac" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_683274c59fb08b21249096e305c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_pipeline"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt" FROM "pipeline"` + ); + await queryRunner.query(`DROP TABLE "pipeline"`); + await queryRunner.query(`ALTER TABLE "temporary_pipeline" RENAME TO "pipeline"`); + await queryRunner.query(`CREATE INDEX "IDX_873ade98fbd6ca71c8b4d1bbca" ON "pipeline" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_683274c59fb08b21249096e305" ON "pipeline" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f3027eabd451ec18b93fab7ed5" ON "pipeline" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1adf9f97094bc93e176ede2482" ON "pipeline" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_586294149d24cd835678878ef1"`); + await queryRunner.query(`DROP INDEX "IDX_e46203bf1dbf3291d174f02cb3"`); + await queryRunner.query(`DROP INDEX "IDX_27d71aa2e843f07fbf36329be3"`); + await queryRunner.query(`DROP INDEX "IDX_e690dd59b69e74a6bb5d94f32b"`); + await queryRunner.query(`DROP INDEX "IDX_d32c5d5e4451acf44fd5b212ce"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_category_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_586294149d24cd835678878ef12" FOREIGN KEY ("referenceId") REFERENCES "product_category" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e46203bf1dbf3291d174f02cb34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_27d71aa2e843f07fbf36329be3f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_category_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_category_translation"` + ); + await queryRunner.query(`DROP TABLE "product_category_translation"`); + await queryRunner.query( + `ALTER TABLE "temporary_product_category_translation" RENAME TO "product_category_translation"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_586294149d24cd835678878ef1" ON "product_category_translation" ("referenceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e46203bf1dbf3291d174f02cb3" ON "product_category_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_27d71aa2e843f07fbf36329be3" ON "product_category_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e690dd59b69e74a6bb5d94f32b" ON "product_category_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d32c5d5e4451acf44fd5b212ce" ON "product_category_translation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f38e86bd280ff9c9c7d9cb7839"`); + await queryRunner.query(`DROP INDEX "IDX_0a0cf25cd8232a154d1cce2641"`); + await queryRunner.query(`DROP INDEX "IDX_853302351eaa4daa39920c270a"`); + await queryRunner.query(`DROP INDEX "IDX_198fba43f049ea621407e7d188"`); + await queryRunner.query(`DROP INDEX "IDX_06cd3959f09e0b12793a763515"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "imageUrl" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f38e86bd280ff9c9c7d9cb78393" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0a0cf25cd8232a154d1cce2641c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_853302351eaa4daa39920c270a9" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt" FROM "product_category"` + ); + await queryRunner.query(`DROP TABLE "product_category"`); + await queryRunner.query(`ALTER TABLE "temporary_product_category" RENAME TO "product_category"`); + await queryRunner.query(`CREATE INDEX "IDX_f38e86bd280ff9c9c7d9cb7839" ON "product_category" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_0a0cf25cd8232a154d1cce2641" ON "product_category" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_853302351eaa4daa39920c270a" ON "product_category" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_198fba43f049ea621407e7d188" ON "product_category" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_06cd3959f09e0b12793a763515" ON "product_category" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_a6e91739227bf4d442f23c52c7"`); + await queryRunner.query(`DROP INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5"`); + await queryRunner.query(`DROP INDEX "IDX_462a7fd3ce68935cf973c6709f"`); + await queryRunner.query(`DROP INDEX "IDX_0fc743f2bc16502dbc5e85420c"`); + await queryRunner.query(`DROP INDEX "IDX_76bda4c33c83614617278617ae"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_option_group" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "productId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a6e91739227bf4d442f23c52c75" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4a1430a01b71ecdfcd54b2b6c5c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_462a7fd3ce68935cf973c6709f9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_option_group"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt" FROM "product_option_group"` + ); + await queryRunner.query(`DROP TABLE "product_option_group"`); + await queryRunner.query(`ALTER TABLE "temporary_product_option_group" RENAME TO "product_option_group"`); + await queryRunner.query( + `CREATE INDEX "IDX_a6e91739227bf4d442f23c52c7" ON "product_option_group" ("productId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5" ON "product_option_group" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_462a7fd3ce68935cf973c6709f" ON "product_option_group" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0fc743f2bc16502dbc5e85420c" ON "product_option_group" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_76bda4c33c83614617278617ae" ON "product_option_group" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_c9ce1da98b6d93293daafee63a"`); + await queryRunner.query(`DROP INDEX "IDX_0e2fcc31743e20a45fc3cf0211"`); + await queryRunner.query(`DROP INDEX "IDX_fd6b39f1fd1db026b5dcc3c795"`); + await queryRunner.query(`DROP INDEX "IDX_75b7065234a6d32fbd03d8703f"`); + await queryRunner.query(`DROP INDEX "IDX_e9e50109d3054fb81205c0a74e"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_option_group_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c9ce1da98b6d93293daafee63aa" FOREIGN KEY ("referenceId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0e2fcc31743e20a45fc3cf0211d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fd6b39f1fd1db026b5dcc3c7953" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_option_group_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_option_group_translation"` + ); + await queryRunner.query(`DROP TABLE "product_option_group_translation"`); + await queryRunner.query( + `ALTER TABLE "temporary_product_option_group_translation" RENAME TO "product_option_group_translation"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c9ce1da98b6d93293daafee63a" ON "product_option_group_translation" ("referenceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e2fcc31743e20a45fc3cf0211" ON "product_option_group_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fd6b39f1fd1db026b5dcc3c795" ON "product_option_group_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75b7065234a6d32fbd03d8703f" ON "product_option_group_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9e50109d3054fb81205c0a74e" ON "product_option_group_translation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f43c46e12db0580af320db7738"`); + await queryRunner.query(`DROP INDEX "IDX_4dc2f466cfa3d0b7fef19d1273"`); + await queryRunner.query(`DROP INDEX "IDX_9869d7680f48487e584f5d2fca"`); + await queryRunner.query(`DROP INDEX "IDX_f284f666950392c55afa0806c8"`); + await queryRunner.query(`DROP INDEX "IDX_2f581c3477a5c7a66de5d7f264"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_option_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f43c46e12db0580af320db77381" FOREIGN KEY ("referenceId") REFERENCES "product_option" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4dc2f466cfa3d0b7fef19d12731" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9869d7680f48487e584f5d2fca7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_option_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_option_translation"` + ); + await queryRunner.query(`DROP TABLE "product_option_translation"`); + await queryRunner.query( + `ALTER TABLE "temporary_product_option_translation" RENAME TO "product_option_translation"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f43c46e12db0580af320db7738" ON "product_option_translation" ("referenceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4dc2f466cfa3d0b7fef19d1273" ON "product_option_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9869d7680f48487e584f5d2fca" ON "product_option_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f284f666950392c55afa0806c8" ON "product_option_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2f581c3477a5c7a66de5d7f264" ON "product_option_translation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a6debf9198e2fbfa006aa10d71"`); + await queryRunner.query(`DROP INDEX "IDX_47ffb82a65c43f102b7e0efa41"`); + await queryRunner.query(`DROP INDEX "IDX_985d235aa5394937c4493262c7"`); + await queryRunner.query(`DROP INDEX "IDX_d81028785f188c253e0bd49a03"`); + await queryRunner.query(`DROP INDEX "IDX_35d083f4ecfe72cce72ee88f58"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_option" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar, "groupId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a6debf9198e2fbfa006aa10d710" FOREIGN KEY ("groupId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_47ffb82a65c43f102b7e0efa41a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_985d235aa5394937c4493262c7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_option"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt" FROM "product_option"` + ); + await queryRunner.query(`DROP TABLE "product_option"`); + await queryRunner.query(`ALTER TABLE "temporary_product_option" RENAME TO "product_option"`); + await queryRunner.query(`CREATE INDEX "IDX_a6debf9198e2fbfa006aa10d71" ON "product_option" ("groupId") `); + await queryRunner.query( + `CREATE INDEX "IDX_47ffb82a65c43f102b7e0efa41" ON "product_option" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_985d235aa5394937c4493262c7" ON "product_option" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d81028785f188c253e0bd49a03" ON "product_option" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_35d083f4ecfe72cce72ee88f58" ON "product_option" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_bed9d45e15866d9b8e87e7a7bf"`); + await queryRunner.query(`DROP INDEX "IDX_2efe48435d4ba480a4bb8b96fa"`); + await queryRunner.query(`DROP INDEX "IDX_ad107ba78e487cd8b13313593b"`); + await queryRunner.query(`DROP INDEX "IDX_ae78776111e1906accfd61511d"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_variant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isSubscription" boolean NOT NULL DEFAULT (0), "isPurchaseAutomatically" boolean NOT NULL DEFAULT (0), "canBeSold" boolean NOT NULL DEFAULT (1), "canBePurchased" boolean NOT NULL DEFAULT (1), "canBeCharged" boolean NOT NULL DEFAULT (0), "canBeRented" boolean NOT NULL DEFAULT (0), "isEquipment" boolean NOT NULL DEFAULT (0), "trackInventory" boolean NOT NULL DEFAULT (0), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_b0d86990fe7160a5f3e4011fb2" UNIQUE ("productVariantId"), CONSTRAINT "FK_b0d86990fe7160a5f3e4011fb23" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed9d45e15866d9b8e87e7a7bfe" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2efe48435d4ba480a4bb8b96fa6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_variant_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "product_variant_setting"` + ); + await queryRunner.query(`DROP TABLE "product_variant_setting"`); + await queryRunner.query(`ALTER TABLE "temporary_product_variant_setting" RENAME TO "product_variant_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_bed9d45e15866d9b8e87e7a7bf" ON "product_variant_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2efe48435d4ba480a4bb8b96fa" ON "product_variant_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ad107ba78e487cd8b13313593b" ON "product_variant_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ae78776111e1906accfd61511d" ON "product_variant_setting" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f4b767c43b4e9130c63382c9b2"`); + await queryRunner.query(`DROP INDEX "IDX_2dd271bdeb602b8c3956287e33"`); + await queryRunner.query(`DROP INDEX "IDX_30aafca59cdb456bf5231f9e46"`); + await queryRunner.query(`DROP INDEX "IDX_e9dca49bad996f1761db3b2f56"`); + await queryRunner.query(`DROP INDEX "IDX_65874d6bab7fefcaeccd2252c1"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_type_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f4b767c43b4e9130c63382c9b28" FOREIGN KEY ("referenceId") REFERENCES "product_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2dd271bdeb602b8c3956287e33c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_30aafca59cdb456bf5231f9e463" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_type_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_type_translation"` + ); + await queryRunner.query(`DROP TABLE "product_type_translation"`); + await queryRunner.query( + `ALTER TABLE "temporary_product_type_translation" RENAME TO "product_type_translation"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f4b767c43b4e9130c63382c9b2" ON "product_type_translation" ("referenceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2dd271bdeb602b8c3956287e33" ON "product_type_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_30aafca59cdb456bf5231f9e46" ON "product_type_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9dca49bad996f1761db3b2f56" ON "product_type_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_65874d6bab7fefcaeccd2252c1" ON "product_type_translation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e4e4120b0c19d3a207ce38d758"`); + await queryRunner.query(`DROP INDEX "IDX_f206c807fc7e41fc8a8b6679ae"`); + await queryRunner.query(`DROP INDEX "IDX_90cc635a1065702ed3b79da6ec"`); + await queryRunner.query(`DROP INDEX "IDX_49064ee0f3acd5882f4d893f3d"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e4e4120b0c19d3a207ce38d7581" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f206c807fc7e41fc8a8b6679ae0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt" FROM "product_type"` + ); + await queryRunner.query(`DROP TABLE "product_type"`); + await queryRunner.query(`ALTER TABLE "temporary_product_type" RENAME TO "product_type"`); + await queryRunner.query(`CREATE INDEX "IDX_e4e4120b0c19d3a207ce38d758" ON "product_type" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f206c807fc7e41fc8a8b6679ae" ON "product_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_90cc635a1065702ed3b79da6ec" ON "product_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_49064ee0f3acd5882f4d893f3d" ON "product_type" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_0cfba32db58a952f58b1e35cf1"`); + await queryRunner.query(`DROP INDEX "IDX_7052eaf00a5795afa5ebf35995"`); + await queryRunner.query(`DROP INDEX "IDX_562ef5984b6d4bed640bfcc6a2"`); + await queryRunner.query(`DROP INDEX "IDX_24ac11e35221577e4ba4fdd229"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_variant_price" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "unitCost" integer NOT NULL DEFAULT (0), "unitCostCurrency" varchar NOT NULL DEFAULT ('USD'), "retailPrice" integer NOT NULL DEFAULT (0), "retailPriceCurrency" varchar NOT NULL DEFAULT ('USD'), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_5842f603bd85d924127d63d73c" UNIQUE ("productVariantId"), CONSTRAINT "FK_5842f603bd85d924127d63d73cd" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cfba32db58a952f58b1e35cf1c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7052eaf00a5795afa5ebf359950" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_variant_price"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "product_variant_price"` + ); + await queryRunner.query(`DROP TABLE "product_variant_price"`); + await queryRunner.query(`ALTER TABLE "temporary_product_variant_price" RENAME TO "product_variant_price"`); + await queryRunner.query( + `CREATE INDEX "IDX_0cfba32db58a952f58b1e35cf1" ON "product_variant_price" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7052eaf00a5795afa5ebf35995" ON "product_variant_price" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_562ef5984b6d4bed640bfcc6a2" ON "product_variant_price" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_24ac11e35221577e4ba4fdd229" ON "product_variant_price" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b83f23626741630a8629960715"`); + await queryRunner.query(`DROP INDEX "IDX_6e420052844edf3a5506d863ce"`); + await queryRunner.query(`DROP INDEX "IDX_6a289b10030ae86903406e3c9b"`); + await queryRunner.query(`DROP INDEX "IDX_9121e00c4dc3500dc610cf8722"`); + await queryRunner.query(`DROP INDEX "IDX_e0d896cadbc695a490f64bb7e7"`); + await queryRunner.query(`DROP INDEX "IDX_e0005cbdabb760488f66f3fbba"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "taxes" integer NOT NULL DEFAULT (0), "notes" varchar, "quantity" integer NOT NULL DEFAULT (0), "billingInvoicingPolicy" varchar NOT NULL DEFAULT ('Quantity ordered'), "internalReference" varchar, "enabled" boolean NOT NULL DEFAULT (1), "productId" varchar, "imageId" varchar, "priceId" varchar, "settingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_9f0fd369dfeb275415c649d110" UNIQUE ("settingId"), CONSTRAINT "REL_41b31a71dda350cfe5da07e0e4" UNIQUE ("priceId"), CONSTRAINT "FK_b83f23626741630a86299607156" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6e420052844edf3a5506d863ce6" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9f0fd369dfeb275415c649d110b" FOREIGN KEY ("settingId") REFERENCES "product_variant_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_41b31a71dda350cfe5da07e0e4f" FOREIGN KEY ("priceId") REFERENCES "product_variant_price" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a289b10030ae86903406e3c9bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9121e00c4dc3500dc610cf8722e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_variant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt" FROM "product_variant"` + ); + await queryRunner.query(`DROP TABLE "product_variant"`); + await queryRunner.query(`ALTER TABLE "temporary_product_variant" RENAME TO "product_variant"`); + await queryRunner.query(`CREATE INDEX "IDX_b83f23626741630a8629960715" ON "product_variant" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_6e420052844edf3a5506d863ce" ON "product_variant" ("productId") `); + await queryRunner.query( + `CREATE INDEX "IDX_6a289b10030ae86903406e3c9b" ON "product_variant" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9121e00c4dc3500dc610cf8722" ON "product_variant" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e0d896cadbc695a490f64bb7e7" ON "product_variant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e0005cbdabb760488f66f3fbba" ON "product_variant" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_618194d24a7ea86a165d7ec628"`); + await queryRunner.query(`DROP INDEX "IDX_374bfd0d1b0e1398d7206456d9"`); + await queryRunner.query(`DROP INDEX "IDX_4627873dbc1af07d732e6eec7b"`); + await queryRunner.query(`DROP INDEX "IDX_32a4bdd261ec81f4ca6b3abe26"`); + await queryRunner.query(`DROP INDEX "IDX_08293ca31a601d3cd0228120bc"`); + await queryRunner.query(`DROP INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4"`); + await queryRunner.query(`DROP INDEX "IDX_6f58935aa2175d930e47e97c9f"`); + await queryRunner.query( + `CREATE TABLE "temporary_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "enabled" boolean NOT NULL DEFAULT (1), "code" varchar NOT NULL, "imageUrl" varchar, "featuredImageId" varchar, "productTypeId" varchar, "productCategoryId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_618194d24a7ea86a165d7ec628e" FOREIGN KEY ("productCategoryId") REFERENCES "product_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_374bfd0d1b0e1398d7206456d98" FOREIGN KEY ("productTypeId") REFERENCES "product_type" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4627873dbc1af07d732e6eec7be" FOREIGN KEY ("featuredImageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_32a4bdd261ec81f4ca6b3abe262" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_08293ca31a601d3cd0228120bc9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt" FROM "product"` + ); + await queryRunner.query(`DROP TABLE "product"`); + await queryRunner.query(`ALTER TABLE "temporary_product" RENAME TO "product"`); + await queryRunner.query(`CREATE INDEX "IDX_618194d24a7ea86a165d7ec628" ON "product" ("productCategoryId") `); + await queryRunner.query(`CREATE INDEX "IDX_374bfd0d1b0e1398d7206456d9" ON "product" ("productTypeId") `); + await queryRunner.query(`CREATE INDEX "IDX_4627873dbc1af07d732e6eec7b" ON "product" ("featuredImageId") `); + await queryRunner.query(`CREATE INDEX "IDX_32a4bdd261ec81f4ca6b3abe26" ON "product" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_08293ca31a601d3cd0228120bc" ON "product" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4" ON "product" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6f58935aa2175d930e47e97c9f" ON "product" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d24bc28e54f1dc296452a25591"`); + await queryRunner.query(`DROP INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2"`); + await queryRunner.query(`DROP INDEX "IDX_7533fd275bfb3219ce9eb4004c"`); + await queryRunner.query(`DROP INDEX "IDX_1d9ca23c7e1c606061fec8bb74"`); + await queryRunner.query(`DROP INDEX "IDX_96413a8061ff4ccdc418d4e16a"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d24bc28e54f1dc296452a255917" FOREIGN KEY ("referenceId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e6abcacc3d3a4f9cf5ca97f2b28" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7533fd275bfb3219ce9eb4004c7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_translation"` + ); + await queryRunner.query(`DROP TABLE "product_translation"`); + await queryRunner.query(`ALTER TABLE "temporary_product_translation" RENAME TO "product_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_d24bc28e54f1dc296452a25591" ON "product_translation" ("referenceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2" ON "product_translation" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_7533fd275bfb3219ce9eb4004c" ON "product_translation" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_1d9ca23c7e1c606061fec8bb74" ON "product_translation" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_96413a8061ff4ccdc418d4e16a" ON "product_translation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_fa278d337ba5e200d44ade6697"`); + await queryRunner.query(`DROP INDEX "IDX_dd9fcd7916d0a22189ecea6a36"`); + await queryRunner.query(`DROP INDEX "IDX_656f05f951faa13d7195853424"`); + await queryRunner.query( + `CREATE TABLE "temporary_report_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "iconClass" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "temporary_report_category"("id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt" FROM "report_category"` + ); + await queryRunner.query(`DROP TABLE "report_category"`); + await queryRunner.query(`ALTER TABLE "temporary_report_category" RENAME TO "report_category"`); + await queryRunner.query(`CREATE INDEX "IDX_fa278d337ba5e200d44ade6697" ON "report_category" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_dd9fcd7916d0a22189ecea6a36" ON "report_category" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_656f05f951faa13d7195853424" ON "report_category" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_5193788a3ebc1143bedb74cf72"`); + await queryRunner.query(`DROP INDEX "IDX_edf9bd011d7f08e3e18a5becb8"`); + await queryRunner.query(`DROP INDEX "IDX_a6bde8f44e18f17b1ca603e150"`); + await queryRunner.query(`DROP INDEX "IDX_40459267d68604655aa6df4251"`); + await queryRunner.query( + `CREATE TABLE "temporary_report_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "reportId" varchar NOT NULL, "isEnabled" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a085d6f9bcfd19f8bae1dbfe135" FOREIGN KEY ("reportId") REFERENCES "report" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5193788a3ebc1143bedb74cf725" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_edf9bd011d7f08e3e18a5becb8b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_report_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt" FROM "report_organization"` + ); + await queryRunner.query(`DROP TABLE "report_organization"`); + await queryRunner.query(`ALTER TABLE "temporary_report_organization" RENAME TO "report_organization"`); + await queryRunner.query( + `CREATE INDEX "IDX_5193788a3ebc1143bedb74cf72" ON "report_organization" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_edf9bd011d7f08e3e18a5becb8" ON "report_organization" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_a6bde8f44e18f17b1ca603e150" ON "report_organization" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_40459267d68604655aa6df4251" ON "report_organization" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_230652e48daa99c50c000fc5d1"`); + await queryRunner.query(`DROP INDEX "IDX_ef16fed5f7e6951027502e6458"`); + await queryRunner.query(`DROP INDEX "IDX_6f9ee54eb839117e83b937648d"`); + await queryRunner.query(`DROP INDEX "IDX_143ead1a6ac5f73125d8c4c3aa"`); + await queryRunner.query(`DROP INDEX "IDX_1316fdd7b9a2926437a13271bf"`); + await queryRunner.query( + `CREATE TABLE "temporary_report" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "categoryId" varchar NOT NULL, "name" varchar NOT NULL, "slug" varchar, "description" varchar, "image" varchar, "iconClass" varchar, "showInMenu" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_230652e48daa99c50c000fc5d10" FOREIGN KEY ("categoryId") REFERENCES "report_category" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_report"("id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt" FROM "report"` + ); + await queryRunner.query(`DROP TABLE "report"`); + await queryRunner.query(`ALTER TABLE "temporary_report" RENAME TO "report"`); + await queryRunner.query(`CREATE INDEX "IDX_230652e48daa99c50c000fc5d1" ON "report" ("categoryId") `); + await queryRunner.query(`CREATE INDEX "IDX_ef16fed5f7e6951027502e6458" ON "report" ("slug") `); + await queryRunner.query(`CREATE INDEX "IDX_6f9ee54eb839117e83b937648d" ON "report" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_143ead1a6ac5f73125d8c4c3aa" ON "report" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1316fdd7b9a2926437a13271bf" ON "report" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_ce2113039f070b3f003aa0db61"`); + await queryRunner.query(`DROP INDEX "IDX_563fec5539b89a57f40731f985"`); + await queryRunner.query(`DROP INDEX "IDX_4071f027554eefff65ac8123e6"`); + await queryRunner.query(`DROP INDEX "IDX_a5445b38b780b29b09369e36a9"`); + await queryRunner.query(`DROP INDEX "IDX_2634ff04775e659c4792325f38"`); + await queryRunner.query(`DROP INDEX "IDX_3d66190c19b9fe69a8bbb300df"`); + await queryRunner.query( + `CREATE TABLE "temporary_request_approval_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_ce2113039f070b3f003aa0db611" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_563fec5539b89a57f40731f9858" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4071f027554eefff65ac8123e6e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a5445b38b780b29b09369e36a9b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_request_approval_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "request_approval_employee"` + ); + await queryRunner.query(`DROP TABLE "request_approval_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_request_approval_employee" RENAME TO "request_approval_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ce2113039f070b3f003aa0db61" ON "request_approval_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_563fec5539b89a57f40731f985" ON "request_approval_employee" ("requestApprovalId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4071f027554eefff65ac8123e6" ON "request_approval_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a5445b38b780b29b09369e36a9" ON "request_approval_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2634ff04775e659c4792325f38" ON "request_approval_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3d66190c19b9fe69a8bbb300df" ON "request_approval_employee" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_9ccdaee6c5c62cda8f7375e841"`); + await queryRunner.query(`DROP INDEX "IDX_6c75d8a8c609e88896b2653cc4"`); + await queryRunner.query(`DROP INDEX "IDX_77e1050669b32cfff482f96016"`); + await queryRunner.query(`DROP INDEX "IDX_94b2a3d0f17c9549dea1493dc9"`); + await queryRunner.query(`DROP INDEX "IDX_34b2e8f794e0336b9ac410d8bd"`); + await queryRunner.query(`DROP INDEX "IDX_bdcb4ea389bdb794bae75b0170"`); + await queryRunner.query( + `CREATE TABLE "temporary_request_approval_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "teamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9ccdaee6c5c62cda8f7375e8417" FOREIGN KEY ("teamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6c75d8a8c609e88896b2653cc41" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_77e1050669b32cfff482f960169" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_94b2a3d0f17c9549dea1493dc96" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_request_approval_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt" FROM "request_approval_team"` + ); + await queryRunner.query(`DROP TABLE "request_approval_team"`); + await queryRunner.query(`ALTER TABLE "temporary_request_approval_team" RENAME TO "request_approval_team"`); + await queryRunner.query(`CREATE INDEX "IDX_9ccdaee6c5c62cda8f7375e841" ON "request_approval_team" ("teamId") `); + await queryRunner.query( + `CREATE INDEX "IDX_6c75d8a8c609e88896b2653cc4" ON "request_approval_team" ("requestApprovalId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_77e1050669b32cfff482f96016" ON "request_approval_team" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_94b2a3d0f17c9549dea1493dc9" ON "request_approval_team" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_34b2e8f794e0336b9ac410d8bd" ON "request_approval_team" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bdcb4ea389bdb794bae75b0170" ON "request_approval_team" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`); + await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`); + await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`); + await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`); + await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`); + await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`); + await queryRunner.query( + `CREATE TABLE "temporary_request_approval" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" integer, "createdBy" varchar, "createdByName" varchar, "min_count" integer, "requestId" varchar, "requestType" varchar, "approvalPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_request_approval"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt" FROM "request_approval"` + ); + await queryRunner.query(`DROP TABLE "request_approval"`); + await queryRunner.query(`ALTER TABLE "temporary_request_approval" RENAME TO "request_approval"`); + await queryRunner.query( + `CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_cbd053921056e77c0a8e03122a"`); + await queryRunner.query(`DROP INDEX "IDX_8307c5c44a4ad6210b767b17a9"`); + await queryRunner.query(`DROP INDEX "IDX_e3130a39c1e4a740d044e68573"`); + await queryRunner.query(`DROP INDEX "IDX_78f93dbb42a97f6785bcf53efd"`); + await queryRunner.query(`DROP INDEX "IDX_5c36df1a5c85016952e90d760f"`); + await queryRunner.query( + `CREATE TABLE "temporary_role_permission" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "permission" varchar NOT NULL, "enabled" boolean DEFAULT (0), "roleId" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cbd053921056e77c0a8e03122af" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e3130a39c1e4a740d044e685730" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_role_permission"("id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt" FROM "role_permission"` + ); + await queryRunner.query(`DROP TABLE "role_permission"`); + await queryRunner.query(`ALTER TABLE "temporary_role_permission" RENAME TO "role_permission"`); + await queryRunner.query(`CREATE INDEX "IDX_cbd053921056e77c0a8e03122a" ON "role_permission" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_8307c5c44a4ad6210b767b17a9" ON "role_permission" ("permission") `); + await queryRunner.query(`CREATE INDEX "IDX_e3130a39c1e4a740d044e68573" ON "role_permission" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_78f93dbb42a97f6785bcf53efd" ON "role_permission" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_5c36df1a5c85016952e90d760f" ON "role_permission" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_1751a572e91385a09d41c62471"`); + await queryRunner.query(`DROP INDEX "IDX_ae4578dcaed5adff96595e6166"`); + await queryRunner.query(`DROP INDEX "IDX_c5f75cd3367769b6f22b298d29"`); + await queryRunner.query(`DROP INDEX "IDX_09868c0733ba37a4753ff8931f"`); + await queryRunner.query( + `CREATE TABLE "temporary_role" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_1751a572e91385a09d41c624714" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_role"("id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt" FROM "role"` + ); + await queryRunner.query(`DROP TABLE "role"`); + await queryRunner.query(`ALTER TABLE "temporary_role" RENAME TO "role"`); + await queryRunner.query(`CREATE INDEX "IDX_1751a572e91385a09d41c62471" ON "role" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_ae4578dcaed5adff96595e6166" ON "role" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_c5f75cd3367769b6f22b298d29" ON "role" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_09868c0733ba37a4753ff8931f" ON "role" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_b2923d394f3636671ff9b3c3e8"`); + await queryRunner.query(`DROP INDEX "IDX_8e502eac7ed1347c71c26beae8"`); + await queryRunner.query(`DROP INDEX "IDX_f4cdbe61d68413f4d6a671f8c2"`); + await queryRunner.query(`DROP INDEX "IDX_ca52119f9e4857399706d723e9"`); + await queryRunner.query( + `CREATE TABLE "temporary_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_b2923d394f3636671ff9b3c3e81" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8e502eac7ed1347c71c26beae81" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt" FROM "skill"` + ); + await queryRunner.query(`DROP TABLE "skill"`); + await queryRunner.query(`ALTER TABLE "temporary_skill" RENAME TO "skill"`); + await queryRunner.query(`CREATE INDEX "IDX_b2923d394f3636671ff9b3c3e8" ON "skill" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_8e502eac7ed1347c71c26beae8" ON "skill" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f4cdbe61d68413f4d6a671f8c2" ON "skill" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_ca52119f9e4857399706d723e9" ON "skill" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_58876ee26a90170551027459bf"`); + await queryRunner.query(`DROP INDEX "IDX_1f22c73374bcca1ea84a4dca59"`); + await queryRunner.query(`DROP INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9"`); + await queryRunner.query(`DROP INDEX "IDX_b08dd29fb6a8acdf83c83d8988"`); + await queryRunner.query(`DROP INDEX "IDX_49746602acc4e5e8721062b69e"`); + await queryRunner.query( + `CREATE TABLE "temporary_tag" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "icon" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "textColor" varchar, "fix_relational_custom_fields" boolean, "archivedAt" datetime, CONSTRAINT "FK_c2f6bec0b39eaa3a6d90903ae99" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b08dd29fb6a8acdf83c83d8988f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_49746602acc4e5e8721062b69ec" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_tag"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields" FROM "tag"` + ); + await queryRunner.query(`DROP TABLE "tag"`); + await queryRunner.query(`ALTER TABLE "temporary_tag" RENAME TO "tag"`); + await queryRunner.query(`CREATE INDEX "IDX_58876ee26a90170551027459bf" ON "tag" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_1f22c73374bcca1ea84a4dca59" ON "tag" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9" ON "tag" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_b08dd29fb6a8acdf83c83d8988" ON "tag" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_49746602acc4e5e8721062b69e" ON "tag" ("organizationTeamId") `); + await queryRunner.query(`DROP INDEX "IDX_b022c2b684c35dcc63c22850f1"`); + await queryRunner.query(`DROP INDEX "IDX_903b08cd4c8025e73316342452"`); + await queryRunner.query(`DROP INDEX "IDX_ce5e588780497b05cd6267e20e"`); + await queryRunner.query(`DROP INDEX "IDX_ecb357a3764a7344c633a257d7"`); + await queryRunner.query(`DROP INDEX "IDX_9779a35ef1338bafb7b90714f1"`); + await queryRunner.query(`DROP INDEX "IDX_f2cf366f3f08e31784b056df88"`); + await queryRunner.query( + `CREATE TABLE "temporary_daily_plan" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "date" datetime NOT NULL, "workTimePlanned" decimal NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationTeamId" varchar, "archivedAt" datetime, CONSTRAINT "FK_b022c2b684c35dcc63c22850f13" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb357a3764a7344c633a257d76" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9779a35ef1338bafb7b90714f16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2cf366f3f08e31784b056df880" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_daily_plan"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId" FROM "daily_plan"` + ); + await queryRunner.query(`DROP TABLE "daily_plan"`); + await queryRunner.query(`ALTER TABLE "temporary_daily_plan" RENAME TO "daily_plan"`); + await queryRunner.query( + `CREATE INDEX "IDX_b022c2b684c35dcc63c22850f1" ON "daily_plan" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_903b08cd4c8025e73316342452" ON "daily_plan" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_ce5e588780497b05cd6267e20e" ON "daily_plan" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_ecb357a3764a7344c633a257d7" ON "daily_plan" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9779a35ef1338bafb7b90714f1" ON "daily_plan" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f2cf366f3f08e31784b056df88" ON "daily_plan" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_a3ee022203211f678376cd919b"`); + await queryRunner.query(`DROP INDEX "IDX_8f274646f2bdf4e12990feeb04"`); + await queryRunner.query(`DROP INDEX "IDX_16507eb222e3c50be077fb4ace"`); + await queryRunner.query(`DROP INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6"`); + await queryRunner.query(`DROP INDEX "IDX_b1a7086c279309b20e8384d0d9"`); + await queryRunner.query(`DROP INDEX "IDX_1f3ffda4fce02682e76308b476"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_estimation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "estimate" integer NOT NULL, "employeeId" varchar NOT NULL, "taskId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a3ee022203211f678376cd919bb" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f274646f2bdf4e12990feeb040" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16507eb222e3c50be077fb4ace2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_87bfea6d0b9a1ec602ee88e5f68" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_estimation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt" FROM "task_estimation"` + ); + await queryRunner.query(`DROP TABLE "task_estimation"`); + await queryRunner.query(`ALTER TABLE "temporary_task_estimation" RENAME TO "task_estimation"`); + await queryRunner.query(`CREATE INDEX "IDX_a3ee022203211f678376cd919b" ON "task_estimation" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_8f274646f2bdf4e12990feeb04" ON "task_estimation" ("employeeId") `); + await queryRunner.query( + `CREATE INDEX "IDX_16507eb222e3c50be077fb4ace" ON "task_estimation" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6" ON "task_estimation" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_b1a7086c279309b20e8384d0d9" ON "task_estimation" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1f3ffda4fce02682e76308b476" ON "task_estimation" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_1909e9bae7d8b2c920b3e4d859"`); + await queryRunner.query(`DROP INDEX "IDX_722ce5d7535524b96c6d03f7c4"`); + await queryRunner.query(`DROP INDEX "IDX_8b12c913c39c72fe5980427c96"`); + await queryRunner.query(`DROP INDEX "IDX_16dbef9d1b2b422abdce8ee3ae"`); + await queryRunner.query(`DROP INDEX "IDX_4af451ab46a94e94394c72d911"`); + await queryRunner.query(`DROP INDEX "IDX_af2d743ed61571bcdc5d9a27a0"`); + await queryRunner.query(`DROP INDEX "IDX_33779b0395f72af0b50dc526d1"`); + await queryRunner.query(`DROP INDEX "IDX_131331557078611a68b4a5b2e7"`); + await queryRunner.query(`DROP INDEX "IDX_586513cceb16777fd14a17bfe1"`); + await queryRunner.query( + `CREATE TABLE "temporary_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "imageId" varchar, "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isDefault" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_8b12c913c39c72fe5980427c963" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16dbef9d1b2b422abdce8ee3ae2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_33779b0395f72af0b50dc526d1d" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_131331557078611a68b4a5b2e7e" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_586513cceb16777fd14a17bfe10" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault" FROM "issue_type"` + ); + await queryRunner.query(`DROP TABLE "issue_type"`); + await queryRunner.query(`ALTER TABLE "temporary_issue_type" RENAME TO "issue_type"`); + await queryRunner.query(`CREATE INDEX "IDX_1909e9bae7d8b2c920b3e4d859" ON "issue_type" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_722ce5d7535524b96c6d03f7c4" ON "issue_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8b12c913c39c72fe5980427c96" ON "issue_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_16dbef9d1b2b422abdce8ee3ae" ON "issue_type" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4af451ab46a94e94394c72d911" ON "issue_type" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_af2d743ed61571bcdc5d9a27a0" ON "issue_type" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_33779b0395f72af0b50dc526d1" ON "issue_type" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_131331557078611a68b4a5b2e7" ON "issue_type" ("projectId") `); + await queryRunner.query( + `CREATE INDEX "IDX_586513cceb16777fd14a17bfe1" ON "issue_type" ("organizationTeamId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_579534d8e12f22d308d6bd5f42"`); + await queryRunner.query(`DROP INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54"`); + await queryRunner.query(`DROP INDEX "IDX_3e16c81005c389a4db83c0e5e3"`); + await queryRunner.query(`DROP INDEX "taskNumber"`); + await queryRunner.query(`DROP INDEX "IDX_1e1f64696aa3a26d3e12c840e5"`); + await queryRunner.query(`DROP INDEX "IDX_94fe6b3a5aec5f85427df4f8cd"`); + await queryRunner.query(`DROP INDEX "IDX_3797a20ef5553ae87af126bc2f"`); + await queryRunner.query(`DROP INDEX "IDX_5b0272d923a31c972bed1a1ac4"`); + await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); + await queryRunner.query(`DROP INDEX "IDX_2fe7a278e6f08d2be55740a939"`); + await queryRunner.query(`DROP INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1"`); + await queryRunner.query(`DROP INDEX "IDX_7127880d6fae956ecc1c84ac31"`); + await queryRunner.query(`DROP INDEX "IDX_ed5441fb13e82854a994da5a78"`); + await queryRunner.query(`DROP INDEX "IDX_0cbe714983eb0aae5feeee8212"`); + await queryRunner.query(`DROP INDEX "IDX_2f4bdd2593fd6038aaa91fd107"`); + await queryRunner.query(`DROP INDEX "IDX_b8616deefe44d0622233e73fbf"`); + await queryRunner.query( + `CREATE TABLE "temporary_task" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "description" varchar, "status" varchar, "estimate" integer, "dueDate" datetime, "projectId" varchar, "creatorId" varchar, "organizationSprintId" varchar, "number" integer, "prefix" varchar, "priority" varchar, "size" varchar, "public" boolean DEFAULT (1), "startDate" datetime, "resolvedAt" datetime, "version" varchar, "issueType" varchar, "parentId" varchar, "taskStatusId" varchar, "taskSizeId" varchar, "taskPriorityId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "projectModuleId" varchar, "archivedAt" datetime, CONSTRAINT "FK_579534d8e12f22d308d6bd5f428" FOREIGN KEY ("projectModuleId") REFERENCES "organization_project_module" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8c9920b5fb32c3d8453f64b705c" FOREIGN KEY ("parentId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1e1f64696aa3a26d3e12c840e55" FOREIGN KEY ("organizationSprintId") REFERENCES "organization_sprint" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_94fe6b3a5aec5f85427df4f8cd7" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3797a20ef5553ae87af126bc2fe" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b0272d923a31c972bed1a1ac4d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e91cbff3d206f150ccc14d0c3a1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cbe714983eb0aae5feeee8212b" FOREIGN KEY ("taskStatusId") REFERENCES "task_status" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_2f4bdd2593fd6038aaa91fd1076" FOREIGN KEY ("taskSizeId") REFERENCES "task_size" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b8616deefe44d0622233e73fbf9" FOREIGN KEY ("taskPriorityId") REFERENCES "task_priority" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId" FROM "task"` + ); + await queryRunner.query(`DROP TABLE "task"`); + await queryRunner.query(`ALTER TABLE "temporary_task" RENAME TO "task"`); + await queryRunner.query(`CREATE INDEX "IDX_579534d8e12f22d308d6bd5f42" ON "task" ("projectModuleId") `); + await queryRunner.query(`CREATE INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54" ON "task" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_3e16c81005c389a4db83c0e5e3" ON "task" ("isActive") `); + await queryRunner.query(`CREATE UNIQUE INDEX "taskNumber" ON "task" ("projectId", "number") `); + await queryRunner.query(`CREATE INDEX "IDX_1e1f64696aa3a26d3e12c840e5" ON "task" ("organizationSprintId") `); + await queryRunner.query(`CREATE INDEX "IDX_94fe6b3a5aec5f85427df4f8cd" ON "task" ("creatorId") `); + await queryRunner.query(`CREATE INDEX "IDX_3797a20ef5553ae87af126bc2f" ON "task" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_5b0272d923a31c972bed1a1ac4" ON "task" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_e91cbff3d206f150ccc14d0c3a" ON "task" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_2fe7a278e6f08d2be55740a939" ON "task" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1" ON "task" ("priority") `); + await queryRunner.query(`CREATE INDEX "IDX_7127880d6fae956ecc1c84ac31" ON "task" ("size") `); + await queryRunner.query(`CREATE INDEX "IDX_ed5441fb13e82854a994da5a78" ON "task" ("issueType") `); + await queryRunner.query(`CREATE INDEX "IDX_0cbe714983eb0aae5feeee8212" ON "task" ("taskStatusId") `); + await queryRunner.query(`CREATE INDEX "IDX_2f4bdd2593fd6038aaa91fd107" ON "task" ("taskSizeId") `); + await queryRunner.query(`CREATE INDEX "IDX_b8616deefe44d0622233e73fbf" ON "task" ("taskPriorityId") `); + await queryRunner.query(`DROP INDEX "IDX_0848fd2b8c23c0ab55146297cf"`); + await queryRunner.query(`DROP INDEX "IDX_6deea7b3671e45973e191a1502"`); + await queryRunner.query(`DROP INDEX "IDX_24114c4059e6b6991daba541b1"`); + await queryRunner.query(`DROP INDEX "IDX_20b50abc5c97610a75d49ad381"`); + await queryRunner.query(`DROP INDEX "IDX_d49853e18e5bc772f5435b01a5"`); + await queryRunner.query(`DROP INDEX "IDX_88021c0cd9508757d3d90333f8"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_linked_issues" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" integer NOT NULL, "taskFromId" varchar NOT NULL, "taskToId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0848fd2b8c23c0ab55146297cff" FOREIGN KEY ("taskToId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6deea7b3671e45973e191a1502c" FOREIGN KEY ("taskFromId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_24114c4059e6b6991daba541b1d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_20b50abc5c97610a75d49ad3817" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_linked_issues"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt" FROM "task_linked_issues"` + ); + await queryRunner.query(`DROP TABLE "task_linked_issues"`); + await queryRunner.query(`ALTER TABLE "temporary_task_linked_issues" RENAME TO "task_linked_issues"`); + await queryRunner.query(`CREATE INDEX "IDX_0848fd2b8c23c0ab55146297cf" ON "task_linked_issues" ("taskToId") `); + await queryRunner.query( + `CREATE INDEX "IDX_6deea7b3671e45973e191a1502" ON "task_linked_issues" ("taskFromId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_24114c4059e6b6991daba541b1" ON "task_linked_issues" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_20b50abc5c97610a75d49ad381" ON "task_linked_issues" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d49853e18e5bc772f5435b01a5" ON "task_linked_issues" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_88021c0cd9508757d3d90333f8" ON "task_linked_issues" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_db4237960ca989eb7a48cd433b"`); + await queryRunner.query(`DROP INDEX "IDX_46daede7b19176b6ad959d70da"`); + await queryRunner.query(`DROP INDEX "IDX_7d656b4cba8f11e639dbc5aab3"`); + await queryRunner.query(`DROP INDEX "IDX_7fd1b30d159b608cbf59009f68"`); + await queryRunner.query(`DROP INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d"`); + await queryRunner.query(`DROP INDEX "IDX_52b039cff6a1adf6b7f9e49ee4"`); + await queryRunner.query(`DROP INDEX "IDX_8ddcc5eeaf96314f53ca486821"`); + await queryRunner.query(`DROP INDEX "IDX_e6adb82db368af15f2b8cdd4e8"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_priority" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_52b039cff6a1adf6b7f9e49ee44" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_db4237960ca989eb7a48cd433b1" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1818655f27b8cf4f0d1dbfeb8db" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd1b30d159b608cbf59009f681" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_priority"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_priority"` + ); + await queryRunner.query(`DROP TABLE "task_priority"`); + await queryRunner.query(`ALTER TABLE "temporary_task_priority" RENAME TO "task_priority"`); + await queryRunner.query(`CREATE INDEX "IDX_db4237960ca989eb7a48cd433b" ON "task_priority" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_46daede7b19176b6ad959d70da" ON "task_priority" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_7d656b4cba8f11e639dbc5aab3" ON "task_priority" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_7fd1b30d159b608cbf59009f68" ON "task_priority" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d" ON "task_priority" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_52b039cff6a1adf6b7f9e49ee4" ON "task_priority" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_8ddcc5eeaf96314f53ca486821" ON "task_priority" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e6adb82db368af15f2b8cdd4e8" ON "task_priority" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_4967ebdca0aefb9d43e56695e4"`); + await queryRunner.query(`DROP INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9"`); + await queryRunner.query(`DROP INDEX "IDX_61a7cb4452d9e23f91231b7fd6"`); + await queryRunner.query(`DROP INDEX "IDX_9423f99da972c150f85dbc11c1"`); + await queryRunner.query(`DROP INDEX "IDX_bed691e21fe01cf5aceee72295"`); + await queryRunner.query(`DROP INDEX "IDX_b7b0ea8ac2825fb981c1181d11"`); + await queryRunner.query(`DROP INDEX "IDX_5a341f51d8f5ec12db24ab033f"`); + await queryRunner.query(`DROP INDEX "IDX_8177dd93be8044b37d3bb9285d"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_related_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_4967ebdca0aefb9d43e56695e42" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d99fe5b50dbe5078e0d9a9b6a9d" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed691e21fe01cf5aceee722952" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b7b0ea8ac2825fb981c1181d115" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_related_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_related_issue_type"` + ); + await queryRunner.query(`DROP TABLE "task_related_issue_type"`); + await queryRunner.query(`ALTER TABLE "temporary_task_related_issue_type" RENAME TO "task_related_issue_type"`); + await queryRunner.query( + `CREATE INDEX "IDX_4967ebdca0aefb9d43e56695e4" ON "task_related_issue_type" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9" ON "task_related_issue_type" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_61a7cb4452d9e23f91231b7fd6" ON "task_related_issue_type" ("value") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9423f99da972c150f85dbc11c1" ON "task_related_issue_type" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_bed691e21fe01cf5aceee72295" ON "task_related_issue_type" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b7b0ea8ac2825fb981c1181d11" ON "task_related_issue_type" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5a341f51d8f5ec12db24ab033f" ON "task_related_issue_type" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8177dd93be8044b37d3bb9285d" ON "task_related_issue_type" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_ad6792b26526bd96ab18d63454"`); + await queryRunner.query(`DROP INDEX "IDX_1a7b137d009616a2ff1aa6834f"`); + await queryRunner.query(`DROP INDEX "IDX_90c54f57b29cc8b67edc2738ae"`); + await queryRunner.query(`DROP INDEX "IDX_596512cc6508a482cc23ae6ab7"`); + await queryRunner.query(`DROP INDEX "IDX_f6ec2207e50680a475d71c8979"`); + await queryRunner.query(`DROP INDEX "IDX_f4438327b3c2afb0832569b2a1"`); + await queryRunner.query(`DROP INDEX "IDX_d65afcfe2d64e49d43931579a3"`); + await queryRunner.query(`DROP INDEX "IDX_8f26ffc61abaef417b0f807695"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_size" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f4438327b3c2afb0832569b2a1e" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ad6792b26526bd96ab18d634544" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f6ec2207e50680a475d71c89793" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_596512cc6508a482cc23ae6ab78" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_size"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_size"` + ); + await queryRunner.query(`DROP TABLE "task_size"`); + await queryRunner.query(`ALTER TABLE "temporary_task_size" RENAME TO "task_size"`); + await queryRunner.query(`CREATE INDEX "IDX_ad6792b26526bd96ab18d63454" ON "task_size" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_1a7b137d009616a2ff1aa6834f" ON "task_size" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_90c54f57b29cc8b67edc2738ae" ON "task_size" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_596512cc6508a482cc23ae6ab7" ON "task_size" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f6ec2207e50680a475d71c8979" ON "task_size" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f4438327b3c2afb0832569b2a1" ON "task_size" ("organizationTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_d65afcfe2d64e49d43931579a3" ON "task_size" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8f26ffc61abaef417b0f807695" ON "task_size" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); + await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); + await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); + await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); + await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); + await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); + await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); + await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isCollapsed" boolean NOT NULL DEFAULT (0), "order" integer, "isTodo" boolean NOT NULL DEFAULT (0), "isInProgress" boolean NOT NULL DEFAULT (0), "isDone" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone" FROM "task_status"` + ); + await queryRunner.query(`DROP TABLE "task_status"`); + await queryRunner.query(`ALTER TABLE "temporary_task_status" RENAME TO "task_status"`); + await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); + await queryRunner.query(`DROP INDEX "IDX_959e77718a2e76ee56498c1106"`); + await queryRunner.query(`DROP INDEX "IDX_91988120385964f213aec8aa84"`); + await queryRunner.query(`DROP INDEX "IDX_e9fd8df772ad2d955a65f4c68a"`); + await queryRunner.query(`DROP INDEX "IDX_3396dda57286ca17ab61fd3704"`); + await queryRunner.query(`DROP INDEX "IDX_9c845f353378371ee3aa60f686"`); + await queryRunner.query(`DROP INDEX "IDX_379c8bd0ce203341148c1f99ee"`); + await queryRunner.query(`DROP INDEX "IDX_7e509a66367ecaf8e3bc96f263"`); + await queryRunner.query(`DROP INDEX "IDX_313b0e55871c1c9b6c22341536"`); + await queryRunner.query( + `CREATE TABLE "temporary_task_version" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_959e77718a2e76ee56498c1106a" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91988120385964f213aec8aa84c" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9c845f353378371ee3aa60f6865" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_379c8bd0ce203341148c1f99ee7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_task_version"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_version"` + ); + await queryRunner.query(`DROP TABLE "task_version"`); + await queryRunner.query(`ALTER TABLE "temporary_task_version" RENAME TO "task_version"`); + await queryRunner.query( + `CREATE INDEX "IDX_959e77718a2e76ee56498c1106" ON "task_version" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_91988120385964f213aec8aa84" ON "task_version" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_e9fd8df772ad2d955a65f4c68a" ON "task_version" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_3396dda57286ca17ab61fd3704" ON "task_version" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_9c845f353378371ee3aa60f686" ON "task_version" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_379c8bd0ce203341148c1f99ee" ON "task_version" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_7e509a66367ecaf8e3bc96f263" ON "task_version" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_313b0e55871c1c9b6c22341536" ON "task_version" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_affdab301e348b892175f30fa3"`); + await queryRunner.query(`DROP INDEX "IDX_1d9975b98d82f385ae14b4d7c6"`); + await queryRunner.query(`DROP INDEX "IDX_a7500f9b1b7917bf10882c820e"`); + await queryRunner.query( + `CREATE TABLE "temporary_tenant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "value" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_affdab301e348b892175f30fa39" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_tenant_setting"("id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt" FROM "tenant_setting"` + ); + await queryRunner.query(`DROP TABLE "tenant_setting"`); + await queryRunner.query(`ALTER TABLE "temporary_tenant_setting" RENAME TO "tenant_setting"`); + await queryRunner.query(`CREATE INDEX "IDX_affdab301e348b892175f30fa3" ON "tenant_setting" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_1d9975b98d82f385ae14b4d7c6" ON "tenant_setting" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a7500f9b1b7917bf10882c820e" ON "tenant_setting" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d154d06dac0d0e0a5d9a083e25"`); + await queryRunner.query(`DROP INDEX "IDX_56211336b5ff35fd944f225917"`); + await queryRunner.query(`DROP INDEX "IDX_b8eb9f3e420aa846f30e291960"`); + await queryRunner.query(`DROP INDEX "IDX_eeedffab85b3534a1068d9270f"`); + await queryRunner.query( + `CREATE TABLE "temporary_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "logo" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d154d06dac0d0e0a5d9a083e253" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_tenant"("id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt" FROM "tenant"` + ); + await queryRunner.query(`DROP TABLE "tenant"`); + await queryRunner.query(`ALTER TABLE "temporary_tenant" RENAME TO "tenant"`); + await queryRunner.query(`CREATE INDEX "IDX_d154d06dac0d0e0a5d9a083e25" ON "tenant" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_b8eb9f3e420aa846f30e291960" ON "tenant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_eeedffab85b3534a1068d9270f" ON "tenant" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_7d7f69c79df4a6f152b0e362b1"`); + await queryRunner.query(`DROP INDEX "IDX_c2744cffeca55c3c9c52bb9789"`); + await queryRunner.query(`DROP INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1"`); + await queryRunner.query(`DROP INDEX "IDX_cf9377d3bcb7cb996f72268941"`); + await queryRunner.query(`DROP INDEX "IDX_22d919e53cf5f6d836b18d407a"`); + await queryRunner.query( + `CREATE TABLE "temporary_time_off_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "requiresApproval" boolean NOT NULL, "paid" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c2744cffeca55c3c9c52bb9789c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1c0ed84d54f8fbe4af10dfcda1c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_time_off_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt" FROM "time_off_policy"` + ); + await queryRunner.query(`DROP TABLE "time_off_policy"`); + await queryRunner.query(`ALTER TABLE "temporary_time_off_policy" RENAME TO "time_off_policy"`); + await queryRunner.query(`CREATE INDEX "IDX_7d7f69c79df4a6f152b0e362b1" ON "time_off_policy" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c2744cffeca55c3c9c52bb9789" ON "time_off_policy" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1" ON "time_off_policy" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_cf9377d3bcb7cb996f72268941" ON "time_off_policy" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_22d919e53cf5f6d836b18d407a" ON "time_off_policy" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_c009cdd795be674c2047062374"`); + await queryRunner.query(`DROP INDEX "IDX_c1f8ae47dc2f1882afc5045c73"`); + await queryRunner.query(`DROP INDEX "IDX_981333982a6df8b815957dcbf2"`); + await queryRunner.query(`DROP INDEX "IDX_4989834dd1c9c8ea3576ed99ce"`); + await queryRunner.query(`DROP INDEX "IDX_45e4bc4476681f4db2097cc2d5"`); + await queryRunner.query(`DROP INDEX "IDX_5ddef92c4694e6d650d9e557b3"`); + await queryRunner.query( + `CREATE TABLE "temporary_time_off_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "documentUrl" varchar, "description" varchar, "start" datetime NOT NULL, "end" datetime NOT NULL, "requestDate" datetime NOT NULL, "status" varchar NOT NULL, "isHoliday" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "policyId" varchar NOT NULL, "documentId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c009cdd795be674c20470623742" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c1f8ae47dc2f1882afc5045c739" FOREIGN KEY ("policyId") REFERENCES "time_off_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_981333982a6df8b815957dcbf27" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4989834dd1c9c8ea3576ed99ce5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_time_off_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt" FROM "time_off_request"` + ); + await queryRunner.query(`DROP TABLE "time_off_request"`); + await queryRunner.query(`ALTER TABLE "temporary_time_off_request" RENAME TO "time_off_request"`); + await queryRunner.query(`CREATE INDEX "IDX_c009cdd795be674c2047062374" ON "time_off_request" ("documentId") `); + await queryRunner.query(`CREATE INDEX "IDX_c1f8ae47dc2f1882afc5045c73" ON "time_off_request" ("policyId") `); + await queryRunner.query( + `CREATE INDEX "IDX_981333982a6df8b815957dcbf2" ON "time_off_request" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_4989834dd1c9c8ea3576ed99ce" ON "time_off_request" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_45e4bc4476681f4db2097cc2d5" ON "time_off_request" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_5ddef92c4694e6d650d9e557b3" ON "time_off_request" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_ffd736f18ba71b3221e4f835a9"`); + await queryRunner.query(`DROP INDEX "IDX_0e36a2c95e2f1df7f1b3059d24"`); + await queryRunner.query(`DROP INDEX "IDX_f27285af15ef48363745ab2d79"`); + await queryRunner.query(`DROP INDEX "IDX_b5525385e85f7429e233d4a0fa"`); + await queryRunner.query(`DROP INDEX "IDX_302b60a4970ffe94d5223f1c23"`); + await queryRunner.query(`DROP INDEX "IDX_a28a1682ea80f10d1ecc7babaa"`); + await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); + await queryRunner.query(`DROP INDEX "IDX_4e382caaf07ab0923b2e06bf91"`); + await queryRunner.query(`DROP INDEX "IDX_5a898f44fa31ef7916f0c38b01"`); + await queryRunner.query(`DROP INDEX "IDX_a6f74ae99d549932391f0f4460"`); + await queryRunner.query(`DROP INDEX "IDX_fdb3f018c2bba4885bfa5757d1"`); + await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); + await queryRunner.query(`DROP INDEX "IDX_ae6ac57aafef59f561d4db3dd7"`); + await queryRunner.query(`DROP INDEX "IDX_d2d6db7f03da5632687e5d140e"`); + await queryRunner.query( + `CREATE TABLE "temporary_activity" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" varchar, "metaData" text, "date" date, "time" time, "duration" integer NOT NULL DEFAULT (0), "type" varchar, "source" varchar NOT NULL DEFAULT ('BROWSER'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "projectId" varchar, "timeSlotId" varchar, "taskId" varchar, "recordedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_2743f8990fde12f9586287eb09f" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4e382caaf07ab0923b2e06bf918" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5a898f44fa31ef7916f0c38b016" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a6f74ae99d549932391f0f44609" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fdb3f018c2bba4885bfa5757d16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2401d8fdff5d8970dfe30d3aed" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_activity"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived" FROM "activity"` + ); + await queryRunner.query(`DROP TABLE "activity"`); + await queryRunner.query(`ALTER TABLE "temporary_activity" RENAME TO "activity"`); + await queryRunner.query(`CREATE INDEX "IDX_ffd736f18ba71b3221e4f835a9" ON "activity" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_0e36a2c95e2f1df7f1b3059d24" ON "activity" ("source") `); + await queryRunner.query(`CREATE INDEX "IDX_f27285af15ef48363745ab2d79" ON "activity" ("type") `); + await queryRunner.query(`CREATE INDEX "IDX_b5525385e85f7429e233d4a0fa" ON "activity" ("time") `); + await queryRunner.query(`CREATE INDEX "IDX_302b60a4970ffe94d5223f1c23" ON "activity" ("date") `); + await queryRunner.query(`CREATE INDEX "IDX_a28a1682ea80f10d1ecc7babaa" ON "activity" ("title") `); + await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_5a898f44fa31ef7916f0c38b01" ON "activity" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_a6f74ae99d549932391f0f4460" ON "activity" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_fdb3f018c2bba4885bfa5757d1" ON "activity" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f2401d8fdff5d8970dfe30d3ae" ON "activity" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_ae6ac57aafef59f561d4db3dd7" ON "activity" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d2d6db7f03da5632687e5d140e" ON "activity" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_eea7986acfb827bf5d0622c41f"`); + await queryRunner.query(`DROP INDEX "IDX_1b0867d86ead2332f3d4edba7d"`); + await queryRunner.query(`DROP INDEX "IDX_fa1896dc735403799311968f7e"`); + await queryRunner.query(`DROP INDEX "IDX_5b594d02d98d5defcde323abe5"`); + await queryRunner.query(`DROP INDEX "IDX_0951aacffe3f8d0cff54cf2f34"`); + await queryRunner.query(`DROP INDEX "IDX_235004f3dafac90692cd64d915"`); + await queryRunner.query(`DROP INDEX "IDX_3d7feb5fe793e4811cdb79f983"`); + await queryRunner.query(`DROP INDEX "IDX_2b374e5cdee1145ebb2a832f20"`); + await queryRunner.query(`DROP INDEX "IDX_742688858e0484d66f04e4d4c4"`); + await queryRunner.query(`DROP INDEX "IDX_892e285e1da2b3e61e51e50628"`); + await queryRunner.query( + `CREATE TABLE "temporary_screenshot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "file" varchar NOT NULL, "thumb" varchar, "recordedAt" datetime, "deletedAt" datetime, "timeSlotId" varchar, "storageProvider" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "isWorkRelated" boolean, "description" varchar, "apps" text, "archivedAt" datetime, CONSTRAINT "FK_fa1896dc735403799311968f7ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b594d02d98d5defcde323abe5b" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0951aacffe3f8d0cff54cf2f341" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_235004f3dafac90692cd64d9158" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_screenshot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps" FROM "screenshot"` + ); + await queryRunner.query(`DROP TABLE "screenshot"`); + await queryRunner.query(`ALTER TABLE "temporary_screenshot" RENAME TO "screenshot"`); + await queryRunner.query(`CREATE INDEX "IDX_eea7986acfb827bf5d0622c41f" ON "screenshot" ("description") `); + await queryRunner.query(`CREATE INDEX "IDX_1b0867d86ead2332f3d4edba7d" ON "screenshot" ("isWorkRelated") `); + await queryRunner.query(`CREATE INDEX "IDX_fa1896dc735403799311968f7e" ON "screenshot" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_5b594d02d98d5defcde323abe5" ON "screenshot" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_0951aacffe3f8d0cff54cf2f34" ON "screenshot" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_235004f3dafac90692cd64d915" ON "screenshot" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_3d7feb5fe793e4811cdb79f983" ON "screenshot" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2b374e5cdee1145ebb2a832f20" ON "screenshot" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_742688858e0484d66f04e4d4c4" ON "screenshot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_892e285e1da2b3e61e51e50628" ON "screenshot" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_154e9120e2acb632d8bd9b91ff"`); + await queryRunner.query(`DROP INDEX "IDX_18dcdf754396f0cb0308dc91f4"`); + await queryRunner.query(`DROP INDEX "IDX_d1e8f22c02c5e949453dde7f2d"`); + await queryRunner.query(`DROP INDEX "IDX_1ddf2da35e34378fd845d80a18"`); + await queryRunner.query(`DROP INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5"`); + await queryRunner.query(`DROP INDEX "IDX_e65393bb52aa8275b1392c73f7"`); + await queryRunner.query(`DROP INDEX "IDX_a89a849957e005bafb8e4220bc"`); + await queryRunner.query(`DROP INDEX "IDX_aed2d5cc5680fba9d387c7f931"`); + await queryRunner.query(`DROP INDEX "IDX_fa9018cb248ea0f3b2b30ef143"`); + await queryRunner.query(`DROP INDEX "IDX_189b79acd611870aba62b3594e"`); + await queryRunner.query(`DROP INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec"`); + await queryRunner.query(`DROP INDEX "IDX_e80fb588b1086ce2a4f2244814"`); + await queryRunner.query(`DROP INDEX "IDX_402290e7045e0c10ef97d9f982"`); + await queryRunner.query(`DROP INDEX "IDX_722b9cb3a991c964d86396b6bc"`); + await queryRunner.query(`DROP INDEX "IDX_f447474d185cd70b3015853874"`); + await queryRunner.query(`DROP INDEX "IDX_79001d281ecb766005b3d331c1"`); + await queryRunner.query(`DROP INDEX "IDX_a1910a76044b971609b75ea165"`); + await queryRunner.query(`DROP INDEX "IDX_91a64228fbbe1516730a0cab5d"`); + await queryRunner.query( + `CREATE TABLE "temporary_time_log" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startedAt" datetime, "stoppedAt" datetime, "logType" varchar NOT NULL DEFAULT ('TRACKED'), "source" varchar NOT NULL DEFAULT ('BROWSER'), "description" varchar, "reason" varchar, "isBillable" boolean NOT NULL DEFAULT (0), "deletedAt" datetime, "employeeId" varchar NOT NULL, "timesheetId" varchar, "projectId" varchar, "taskId" varchar, "organizationContactId" varchar, "isRunning" boolean, "version" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_18dcdf754396f0cb0308dc91f4c" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d1e8f22c02c5e949453dde7f2d1" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1ddf2da35e34378fd845d80a18b" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_54776f6f5fd3c13c3bc1fbfac5b" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e65393bb52aa8275b1392c73f72" FOREIGN KEY ("timesheetId") REFERENCES "timesheet" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aed2d5cc5680fba9d387c7f931d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa9018cb248ea0f3b2b30ef143b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a89a849957e005bafb8e4220bc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_time_log"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt" FROM "time_log"` + ); + await queryRunner.query(`DROP TABLE "time_log"`); + await queryRunner.query(`ALTER TABLE "temporary_time_log" RENAME TO "time_log"`); + await queryRunner.query(`CREATE INDEX "IDX_154e9120e2acb632d8bd9b91ff" ON "time_log" ("editedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_18dcdf754396f0cb0308dc91f4" ON "time_log" ("organizationTeamId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d1e8f22c02c5e949453dde7f2d" ON "time_log" ("organizationContactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1ddf2da35e34378fd845d80a18" ON "time_log" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5" ON "time_log" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_e65393bb52aa8275b1392c73f7" ON "time_log" ("timesheetId") `); + await queryRunner.query(`CREATE INDEX "IDX_a89a849957e005bafb8e4220bc" ON "time_log" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_aed2d5cc5680fba9d387c7f931" ON "time_log" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_fa9018cb248ea0f3b2b30ef143" ON "time_log" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_189b79acd611870aba62b3594e" ON "time_log" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec" ON "time_log" ("stoppedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e80fb588b1086ce2a4f2244814" ON "time_log" ("logType") `); + await queryRunner.query(`CREATE INDEX "IDX_402290e7045e0c10ef97d9f982" ON "time_log" ("source") `); + await queryRunner.query(`CREATE INDEX "IDX_722b9cb3a991c964d86396b6bc" ON "time_log" ("isBillable") `); + await queryRunner.query(`CREATE INDEX "IDX_f447474d185cd70b3015853874" ON "time_log" ("isRunning") `); + await queryRunner.query(`CREATE INDEX "IDX_79001d281ecb766005b3d331c1" ON "time_log" ("version") `); + await queryRunner.query(`CREATE INDEX "IDX_a1910a76044b971609b75ea165" ON "time_log" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_91a64228fbbe1516730a0cab5d" ON "time_log" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_7913305b850c7afc89b6ed96a3"`); + await queryRunner.query(`DROP INDEX "IDX_c6e7d1075bfd97eea6643b1479"`); + await queryRunner.query(`DROP INDEX "IDX_f44e721669d5c6bed32cd6a3bf"`); + await queryRunner.query(`DROP INDEX "IDX_0c707825a7c2ecc4e186b07ebf"`); + await queryRunner.query(`DROP INDEX "IDX_b8284109257b5137256b5b3e84"`); + await queryRunner.query(`DROP INDEX "IDX_b407841271245501dd1a8c7551"`); + await queryRunner.query(`DROP INDEX "IDX_645a6bc3f1141d4a111a3166d8"`); + await queryRunner.query(`DROP INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5"`); + await queryRunner.query( + `CREATE TABLE "temporary_time_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7913305b850c7afc89b6ed96a30" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b8284109257b5137256b5b3e848" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b407841271245501dd1a8c75513" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_time_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt" FROM "time_slot"` + ); + await queryRunner.query(`DROP TABLE "time_slot"`); + await queryRunner.query(`ALTER TABLE "temporary_time_slot" RENAME TO "time_slot"`); + await queryRunner.query(`CREATE INDEX "IDX_7913305b850c7afc89b6ed96a3" ON "time_slot" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_c6e7d1075bfd97eea6643b1479" ON "time_slot" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_f44e721669d5c6bed32cd6a3bf" ON "time_slot" ("overall") `); + await queryRunner.query(`CREATE INDEX "IDX_0c707825a7c2ecc4e186b07ebf" ON "time_slot" ("duration") `); + await queryRunner.query(`CREATE INDEX "IDX_b8284109257b5137256b5b3e84" ON "time_slot" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_b407841271245501dd1a8c7551" ON "time_slot" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_645a6bc3f1141d4a111a3166d8" ON "time_slot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5" ON "time_slot" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_9272701d3da8bd8507f316c915"`); + await queryRunner.query(`DROP INDEX "IDX_82c5edbd179359212f16f0d386"`); + await queryRunner.query(`DROP INDEX "IDX_c7f72cb68b22b8ab988158e4d2"`); + await queryRunner.query(`DROP INDEX "IDX_8260fdc7862ca27d8cf10e6290"`); + await queryRunner.query(`DROP INDEX "IDX_a3eeb9629f550c367bb752855e"`); + await queryRunner.query( + `CREATE TABLE "temporary_time_slot_minute" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "datetime" datetime NOT NULL, "timeSlotId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_0ac1d2777eefcee82db52ca3660" UNIQUE ("timeSlotId", "datetime"), CONSTRAINT "FK_9272701d3da8bd8507f316c9154" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_82c5edbd179359212f16f0d386a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_c7f72cb68b22b8ab988158e4d26" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_time_slot_minute"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt" FROM "time_slot_minute"` + ); + await queryRunner.query(`DROP TABLE "time_slot_minute"`); + await queryRunner.query(`ALTER TABLE "temporary_time_slot_minute" RENAME TO "time_slot_minute"`); + await queryRunner.query(`CREATE INDEX "IDX_9272701d3da8bd8507f316c915" ON "time_slot_minute" ("timeSlotId") `); + await queryRunner.query( + `CREATE INDEX "IDX_82c5edbd179359212f16f0d386" ON "time_slot_minute" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c7f72cb68b22b8ab988158e4d2" ON "time_slot_minute" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_8260fdc7862ca27d8cf10e6290" ON "time_slot_minute" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a3eeb9629f550c367bb752855e" ON "time_slot_minute" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_ea81b5247ecdf5d82cf71fa096"`); + await queryRunner.query(`DROP INDEX "IDX_23fdffa8369387d87101090684"`); + await queryRunner.query(`DROP INDEX "IDX_c828facbb4250117f83416d9f7"`); + await queryRunner.query(`DROP INDEX "IDX_3502c60f98a7cda58dea75bcb5"`); + await queryRunner.query(`DROP INDEX "IDX_3f8fc4b5718fcaa913f9438e27"`); + await queryRunner.query(`DROP INDEX "IDX_6a79eb7534066b11f59243ede1"`); + await queryRunner.query(`DROP INDEX "IDX_f6558fbb3158ab90da1c41d943"`); + await queryRunner.query(`DROP INDEX "IDX_930e2b28de9ecb1ea689d5a97a"`); + await queryRunner.query(`DROP INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7"`); + await queryRunner.query(`DROP INDEX "IDX_aca65a79fe0c1ec9e6a59022c5"`); + await queryRunner.query(`DROP INDEX "IDX_8c8f821cb0fe0dd387491ea7d9"`); + await queryRunner.query(`DROP INDEX "IDX_6c1f81934a3f597b3b1a17f562"`); + await queryRunner.query(`DROP INDEX "IDX_42205a9e6af108364e5cc62dd4"`); + await queryRunner.query(`DROP INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff"`); + await queryRunner.query( + `CREATE TABLE "temporary_timesheet" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime, "stoppedAt" datetime, "approvedAt" datetime, "submittedAt" datetime, "lockedAt" datetime, "isBilled" boolean NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('PENDING'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "approvedById" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_6c1f81934a3f597b3b1a17f5623" FOREIGN KEY ("approvedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_25b8df69c9b7f5752c6a6a6ef7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aca65a79fe0c1ec9e6a59022c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8c8f821cb0fe0dd387491ea7d9e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_timesheet"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt" FROM "timesheet"` + ); + await queryRunner.query(`DROP TABLE "timesheet"`); + await queryRunner.query(`ALTER TABLE "temporary_timesheet" RENAME TO "timesheet"`); + await queryRunner.query(`CREATE INDEX "IDX_ea81b5247ecdf5d82cf71fa096" ON "timesheet" ("editedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_23fdffa8369387d87101090684" ON "timesheet" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_c828facbb4250117f83416d9f7" ON "timesheet" ("isBilled") `); + await queryRunner.query(`CREATE INDEX "IDX_3502c60f98a7cda58dea75bcb5" ON "timesheet" ("lockedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_3f8fc4b5718fcaa913f9438e27" ON "timesheet" ("submittedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6a79eb7534066b11f59243ede1" ON "timesheet" ("approvedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_f6558fbb3158ab90da1c41d943" ON "timesheet" ("stoppedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_930e2b28de9ecb1ea689d5a97a" ON "timesheet" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7" ON "timesheet" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_aca65a79fe0c1ec9e6a59022c5" ON "timesheet" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_8c8f821cb0fe0dd387491ea7d9" ON "timesheet" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_6c1f81934a3f597b3b1a17f562" ON "timesheet" ("approvedById") `); + await queryRunner.query(`CREATE INDEX "IDX_42205a9e6af108364e5cc62dd4" ON "timesheet" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff" ON "timesheet" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5"`); + await queryRunner.query(`DROP INDEX "IDX_ca24fc59aac015d9660955f5f6"`); + await queryRunner.query(`DROP INDEX "IDX_1f97ff07fb198bd0a7786b2abd"`); + await queryRunner.query(`DROP INDEX "IDX_7143f31467178a6164a42426c1"`); + await queryRunner.query(`DROP INDEX "IDX_611e1392c8cc9b101e3ea7ad80"`); + await queryRunner.query(`DROP INDEX "IDX_c764336019c69cc4927f317cb0"`); + await queryRunner.query( + `CREATE TABLE "temporary_user_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isDefault" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "userId" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_29c3c8cc3ea9db22e4a347f4b5a" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7143f31467178a6164a42426c15" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_611e1392c8cc9b101e3ea7ad80c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_user_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt" FROM "user_organization"` + ); + await queryRunner.query(`DROP TABLE "user_organization"`); + await queryRunner.query(`ALTER TABLE "temporary_user_organization" RENAME TO "user_organization"`); + await queryRunner.query(`CREATE INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5" ON "user_organization" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_ca24fc59aac015d9660955f5f6" ON "user_organization" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1f97ff07fb198bd0a7786b2abd" ON "user_organization" ("isDefault") `); + await queryRunner.query( + `CREATE INDEX "IDX_7143f31467178a6164a42426c1" ON "user_organization" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_611e1392c8cc9b101e3ea7ad80" ON "user_organization" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c764336019c69cc4927f317cb0" ON "user_organization" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_f725c3df76a1a94e3e9f0313a5"`); + await queryRunner.query(`DROP INDEX "IDX_0e9f745ad08103a1c21523326c"`); + await queryRunner.query(`DROP INDEX "IDX_5864814596f85fe59bd1a0dc76"`); + await queryRunner.query(`DROP INDEX "IDX_1a8ae1126aae1823d62ccf3f82"`); + await queryRunner.query(`DROP INDEX "IDX_685bf353c85f23b6f848e4dcde"`); + await queryRunner.query(`DROP INDEX "IDX_19de43e9f1842360ce646253d7"`); + await queryRunner.query(`DROP INDEX "IDX_58e4dbff0e1a32a9bdc861bb29"`); + await queryRunner.query(`DROP INDEX "IDX_f0e1b4ecdca13b177e2e3a0613"`); + await queryRunner.query(`DROP INDEX "IDX_e12875dfb3b1d92d7d7c5377e2"`); + await queryRunner.query(`DROP INDEX "IDX_78a916df40e02a9deb1c4b75ed"`); + await queryRunner.query(`DROP INDEX "IDX_c28e52f758e7bbc53828db9219"`); + await queryRunner.query(`DROP INDEX "IDX_f2578043e491921209f5dadd08"`); + await queryRunner.query(`DROP INDEX "IDX_5e028298e103e1694147ada69e"`); + await queryRunner.query(`DROP INDEX "IDX_fde2ce12ab12b02ae583dd76c7"`); + await queryRunner.query(`DROP INDEX "IDX_557cb712d32a9ad9ffbb4cd50d"`); + await queryRunner.query( + `CREATE TABLE "temporary_user" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "thirdPartyId" varchar, "firstName" varchar, "lastName" varchar, "email" varchar, "username" varchar, "hash" varchar, "imageUrl" varchar(500), "preferredLanguage" varchar DEFAULT ('en'), "preferredComponentLayout" varchar CHECK( "preferredComponentLayout" IN ('CARDS_GRID','TABLE') ) DEFAULT ('TABLE'), "roleId" varchar, "refreshToken" varchar, "isActive" boolean DEFAULT (1), "code" varchar, "codeExpireAt" datetime, "emailVerifiedAt" datetime, "emailToken" varchar, "phoneNumber" varchar, "timeZone" varchar, "imageId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "timeFormat" varchar CHECK( "timeFormat" IN ('12','24') ) NOT NULL DEFAULT (12), "lastLoginAt" datetime, "defaultTeamId" varchar, "lastTeamId" varchar, "defaultOrganizationId" varchar, "lastOrganizationId" varchar, "archivedAt" datetime, CONSTRAINT "FK_f725c3df76a1a94e3e9f0313a5f" FOREIGN KEY ("lastOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0e9f745ad08103a1c21523326c6" FOREIGN KEY ("defaultOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5864814596f85fe59bd1a0dc766" FOREIGN KEY ("lastTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1a8ae1126aae1823d62ccf3f821" FOREIGN KEY ("defaultTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c28e52f758e7bbc53828db92194" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_685bf353c85f23b6f848e4dcded" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e028298e103e1694147ada69e5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_user"("id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId") SELECT "id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId" FROM "user"` + ); + await queryRunner.query(`DROP TABLE "user"`); + await queryRunner.query(`ALTER TABLE "temporary_user" RENAME TO "user"`); + await queryRunner.query(`CREATE INDEX "IDX_f725c3df76a1a94e3e9f0313a5" ON "user" ("lastOrganizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_0e9f745ad08103a1c21523326c" ON "user" ("defaultOrganizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_5864814596f85fe59bd1a0dc76" ON "user" ("lastTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_1a8ae1126aae1823d62ccf3f82" ON "user" ("defaultTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_685bf353c85f23b6f848e4dcde" ON "user" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_19de43e9f1842360ce646253d7" ON "user" ("thirdPartyId") `); + await queryRunner.query(`CREATE INDEX "IDX_58e4dbff0e1a32a9bdc861bb29" ON "user" ("firstName") `); + await queryRunner.query(`CREATE INDEX "IDX_f0e1b4ecdca13b177e2e3a0613" ON "user" ("lastName") `); + await queryRunner.query(`CREATE INDEX "IDX_e12875dfb3b1d92d7d7c5377e2" ON "user" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_78a916df40e02a9deb1c4b75ed" ON "user" ("username") `); + await queryRunner.query(`CREATE INDEX "IDX_c28e52f758e7bbc53828db9219" ON "user" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_f2578043e491921209f5dadd08" ON "user" ("phoneNumber") `); + await queryRunner.query(`CREATE INDEX "IDX_5e028298e103e1694147ada69e" ON "user" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_fde2ce12ab12b02ae583dd76c7" ON "user" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_557cb712d32a9ad9ffbb4cd50d" ON "user" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_c899e17322d11e1977832e8c65"`); + await queryRunner.query(`DROP INDEX "IDX_62573a939f834f2de343f98288"`); + await queryRunner.query(`DROP INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb"`); + await queryRunner.query(`DROP INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7"`); + await queryRunner.query(`DROP INDEX "IDX_7a584a02d15a022e9c4f06ea72"`); + await queryRunner.query(`DROP INDEX "IDX_3370818c940a51996d80bb4d16"`); + await queryRunner.query( + `CREATE TABLE "temporary_warehouse_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "warehouseId" varchar NOT NULL, "productId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3f934c4772e7c7f2c66d7ea4e72" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a8c9aee14d47ec7b3f2ac429ebc" FOREIGN KEY ("warehouseId") REFERENCES "warehouse" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c899e17322d11e1977832e8c656" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_62573a939f834f2de343f98288c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_warehouse_product"("id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "warehouse_product"` + ); + await queryRunner.query(`DROP TABLE "warehouse_product"`); + await queryRunner.query(`ALTER TABLE "temporary_warehouse_product" RENAME TO "warehouse_product"`); + await queryRunner.query( + `CREATE INDEX "IDX_c899e17322d11e1977832e8c65" ON "warehouse_product" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_62573a939f834f2de343f98288" ON "warehouse_product" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb" ON "warehouse_product" ("warehouseId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7" ON "warehouse_product" ("productId") `); + await queryRunner.query(`CREATE INDEX "IDX_7a584a02d15a022e9c4f06ea72" ON "warehouse_product" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_3370818c940a51996d80bb4d16" ON "warehouse_product" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed"`); + await queryRunner.query(`DROP INDEX "IDX_a1c4a97b928b547c3041d3ac1f"`); + await queryRunner.query(`DROP INDEX "IDX_a2f863689d1316810c41c1ea38"`); + await queryRunner.query(`DROP INDEX "IDX_617306cb3613dd8d59301ae16f"`); + await queryRunner.query(`DROP INDEX "IDX_5f32a52e9bd19bf323b02efcd1"`); + await queryRunner.query(`DROP INDEX "IDX_40aa52eaed1ce133f5fee76bca"`); + await queryRunner.query( + `CREATE TABLE "temporary_warehouse_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "variantId" varchar NOT NULL, "warehouseProductId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d5f4b64e6a80546fd6dd4ac3ed0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a1c4a97b928b547c3041d3ac1f6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2f863689d1316810c41c1ea38e" FOREIGN KEY ("variantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_617306cb3613dd8d59301ae16fd" FOREIGN KEY ("warehouseProductId") REFERENCES "warehouse_product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_warehouse_product_variant"("id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "warehouse_product_variant"` + ); + await queryRunner.query(`DROP TABLE "warehouse_product_variant"`); + await queryRunner.query( + `ALTER TABLE "temporary_warehouse_product_variant" RENAME TO "warehouse_product_variant"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed" ON "warehouse_product_variant" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a1c4a97b928b547c3041d3ac1f" ON "warehouse_product_variant" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a2f863689d1316810c41c1ea38" ON "warehouse_product_variant" ("variantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_617306cb3613dd8d59301ae16f" ON "warehouse_product_variant" ("warehouseProductId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f32a52e9bd19bf323b02efcd1" ON "warehouse_product_variant" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_40aa52eaed1ce133f5fee76bca" ON "warehouse_product_variant" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_9b2f00761a6b1b77cb6289e3ff"`); + await queryRunner.query(`DROP INDEX "IDX_f5735eafddabdb4b20f621a976"`); + await queryRunner.query(`DROP INDEX "IDX_f502dc6d9802306f9d1584932b"`); + await queryRunner.query(`DROP INDEX "IDX_84594016a98da8b87e0f51cd93"`); + await queryRunner.query(`DROP INDEX "IDX_ee85901ae866ffe2061d5b35c8"`); + await queryRunner.query(`DROP INDEX "IDX_835691d3dd62d0b705302cbb2d"`); + await queryRunner.query( + `CREATE TABLE "temporary_warehouse" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "logoId" varchar, "contactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_84594016a98da8b87e0f51cd93" UNIQUE ("contactId"), CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f502dc6d9802306f9d1584932b8" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f5735eafddabdb4b20f621a976a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9b2f00761a6b1b77cb6289e3fff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_warehouse"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt" FROM "warehouse"` + ); + await queryRunner.query(`DROP TABLE "warehouse"`); + await queryRunner.query(`ALTER TABLE "temporary_warehouse" RENAME TO "warehouse"`); + await queryRunner.query(`CREATE INDEX "IDX_9b2f00761a6b1b77cb6289e3ff" ON "warehouse" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f5735eafddabdb4b20f621a976" ON "warehouse" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f502dc6d9802306f9d1584932b" ON "warehouse" ("logoId") `); + await queryRunner.query(`CREATE INDEX "IDX_84594016a98da8b87e0f51cd93" ON "warehouse" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_ee85901ae866ffe2061d5b35c8" ON "warehouse" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_835691d3dd62d0b705302cbb2d" ON "warehouse" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); + await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); + await queryRunner.query(`DROP INDEX "IDX_cc89233c87fcf64b01df07e038"`); + await queryRunner.query(`DROP INDEX "IDX_cbc2b8338d45e774afd8682ffe"`); + await queryRunner.query( + `CREATE TABLE "temporary_changelog" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "title" varchar, "date" datetime NOT NULL, "content" varchar NOT NULL, "learnMoreUrl" varchar, "isFeature" boolean, "imageUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_744268ee0ec6073883267bc3b66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c2037b621d2e8023898aee4ac74" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_changelog"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt" FROM "changelog"` + ); + await queryRunner.query(`DROP TABLE "changelog"`); + await queryRunner.query(`ALTER TABLE "temporary_changelog" RENAME TO "changelog"`); + await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_cc89233c87fcf64b01df07e038" ON "changelog" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_cbc2b8338d45e774afd8682ffe" ON "changelog" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_add7dbec156589dd0b27e2e0c4"`); + await queryRunner.query(`DROP INDEX "IDX_9e8a77c1d330554fab9230100a"`); + await queryRunner.query(`DROP INDEX "IDX_a146e202c19f521bf5ec69bb26"`); + await queryRunner.query(`DROP INDEX "IDX_6eea42a69e130bbd14b7ea3659"`); + await queryRunner.query(`DROP INDEX "IDX_ca0fa80f50baed7287a499dc2c"`); + await queryRunner.query(`DROP INDEX "IDX_69d75a47af6bfcda545a865691"`); + await queryRunner.query(`DROP INDEX "IDX_480158f21938444e4f62fb3185"`); + await queryRunner.query(`DROP INDEX "IDX_ef65338e8597b9f56fd0fe3c94"`); + await queryRunner.query(`DROP INDEX "IDX_5e97728cfda96f49cc7f95bbaf"`); + await queryRunner.query(`DROP INDEX "IDX_04717f25bea7d9cef0d51cac50"`); + await queryRunner.query(`DROP INDEX "IDX_34c48d11eb82ef42e89370bdc7"`); + await queryRunner.query(`DROP INDEX "IDX_2eec784cadcb7847b64937fb58"`); + await queryRunner.query(`DROP INDEX "IDX_59407d03d189560ac1a0a4b0eb"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_github_repository" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "repositoryId" bigint NOT NULL, "name" varchar NOT NULL, "fullName" varchar NOT NULL, "owner" varchar NOT NULL, "integrationId" varchar, "issuesCount" integer, "hasSyncEnabled" boolean DEFAULT (1), "private" boolean DEFAULT (0), "status" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_add7dbec156589dd0b27e2e0c49" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_69d75a47af6bfcda545a865691b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_480158f21938444e4f62fb31857" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_github_repository"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt" FROM "organization_github_repository"` + ); + await queryRunner.query(`DROP TABLE "organization_github_repository"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_github_repository" RENAME TO "organization_github_repository"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_add7dbec156589dd0b27e2e0c4" ON "organization_github_repository" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9e8a77c1d330554fab9230100a" ON "organization_github_repository" ("owner") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a146e202c19f521bf5ec69bb26" ON "organization_github_repository" ("fullName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6eea42a69e130bbd14b7ea3659" ON "organization_github_repository" ("name") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ca0fa80f50baed7287a499dc2c" ON "organization_github_repository" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_69d75a47af6bfcda545a865691" ON "organization_github_repository" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_480158f21938444e4f62fb3185" ON "organization_github_repository" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ef65338e8597b9f56fd0fe3c94" ON "organization_github_repository" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5e97728cfda96f49cc7f95bbaf" ON "organization_github_repository" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_04717f25bea7d9cef0d51cac50" ON "organization_github_repository" ("issuesCount") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_34c48d11eb82ef42e89370bdc7" ON "organization_github_repository" ("hasSyncEnabled") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2eec784cadcb7847b64937fb58" ON "organization_github_repository" ("private") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_59407d03d189560ac1a0a4b0eb" ON "organization_github_repository" ("status") ` + ); + await queryRunner.query(`DROP INDEX "IDX_5065401113abb6e9608225e567"`); + await queryRunner.query(`DROP INDEX "IDX_a8709a9c5cc142c6fbe92df274"`); + await queryRunner.query(`DROP INDEX "IDX_055f310a04a928343494a5255a"`); + await queryRunner.query(`DROP INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b"`); + await queryRunner.query(`DROP INDEX "IDX_b3234be5b70c2362cdf67bb188"`); + await queryRunner.query(`DROP INDEX "IDX_c774c276d6b7ea05a7e12d3c81"`); + await queryRunner.query(`DROP INDEX "IDX_d706210d377ece2a1bc3386388"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_github_repository_issue" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "issueId" bigint NOT NULL, "issueNumber" integer NOT NULL, "repositoryId" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5065401113abb6e9608225e5678" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6c8e119fc6a2a7d3413aa76d3bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3234be5b70c2362cdf67bb1889" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_github_repository_issue"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt" FROM "organization_github_repository_issue"` + ); + await queryRunner.query(`DROP TABLE "organization_github_repository_issue"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_github_repository_issue" RENAME TO "organization_github_repository_issue"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5065401113abb6e9608225e567" ON "organization_github_repository_issue" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a8709a9c5cc142c6fbe92df274" ON "organization_github_repository_issue" ("issueNumber") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_055f310a04a928343494a5255a" ON "organization_github_repository_issue" ("issueId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b" ON "organization_github_repository_issue" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b3234be5b70c2362cdf67bb188" ON "organization_github_repository_issue" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c774c276d6b7ea05a7e12d3c81" ON "organization_github_repository_issue" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d706210d377ece2a1bc3386388" ON "organization_github_repository_issue" ("isActive") ` + ); + await queryRunner.query(`DROP INDEX "IDX_cc28a54171231fbd9a127051f0"`); + await queryRunner.query(`DROP INDEX "IDX_d59ec6899d435f430799795ad7"`); + await queryRunner.query(`DROP INDEX "IDX_4177329f5e6ddbfb6416592713"`); + await queryRunner.query(`DROP INDEX "IDX_61a30a7d83666bf265fd86a72d"`); + await queryRunner.query(`DROP INDEX "IDX_e2836e856f491dd4676e1ec8d3"`); + await queryRunner.query( + `CREATE TABLE "temporary_proposal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPostUrl" varchar, "valueDate" datetime, "jobPostContent" varchar NOT NULL, "proposalContent" varchar NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_61c45ab51852e4b0e539756d40f" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f399488a0f3ea10bb511e3f5aa3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d59ec6899d435f430799795ad7b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4177329f5e6ddbfb64165927134" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_proposal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "proposal"` + ); + await queryRunner.query(`DROP TABLE "proposal"`); + await queryRunner.query(`ALTER TABLE "temporary_proposal" RENAME TO "proposal"`); + await queryRunner.query(`CREATE INDEX "IDX_cc28a54171231fbd9a127051f0" ON "proposal" ("jobPostUrl") `); + await queryRunner.query(`CREATE INDEX "IDX_d59ec6899d435f430799795ad7" ON "proposal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4177329f5e6ddbfb6416592713" ON "proposal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_61a30a7d83666bf265fd86a72d" ON "proposal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e2836e856f491dd4676e1ec8d3" ON "proposal" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_2be728a7f8b118712a4200990d"`); + await queryRunner.query(`DROP INDEX "IDX_a13f3564eae9db44ddc4308afc"`); + await queryRunner.query(`DROP INDEX "IDX_0111963c9cb4dd14565c0d9c84"`); + await queryRunner.query(`DROP INDEX "IDX_dc2ff85f7de16dea6453a833dd"`); + await queryRunner.query(`DROP INDEX "IDX_ee780fbd8f91de31c004929eec"`); + await queryRunner.query(`DROP INDEX "IDX_f577c9bc6183c1d1eae1e154bb"`); + await queryRunner.query(`DROP INDEX "IDX_2bb17670e2bea3980ff960bbcf"`); + await queryRunner.query(`DROP INDEX "IDX_e396663e1a31114eac39087829"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_proposal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "content" text, "isDefault" boolean NOT NULL DEFAULT (0), "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2be728a7f8b118712a4200990d4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ee780fbd8f91de31c004929eecb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f577c9bc6183c1d1eae1e154bbc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_proposal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_proposal_template"` + ); + await queryRunner.query(`DROP TABLE "employee_proposal_template"`); + await queryRunner.query( + `ALTER TABLE "temporary_employee_proposal_template" RENAME TO "employee_proposal_template"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2be728a7f8b118712a4200990d" ON "employee_proposal_template" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a13f3564eae9db44ddc4308afc" ON "employee_proposal_template" ("isDefault") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0111963c9cb4dd14565c0d9c84" ON "employee_proposal_template" ("content") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_dc2ff85f7de16dea6453a833dd" ON "employee_proposal_template" ("name") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ee780fbd8f91de31c004929eec" ON "employee_proposal_template" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f577c9bc6183c1d1eae1e154bb" ON "employee_proposal_template" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2bb17670e2bea3980ff960bbcf" ON "employee_proposal_template" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e396663e1a31114eac39087829" ON "employee_proposal_template" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_44e22d88b47daf2095491b7cac"`); + await queryRunner.query(`DROP INDEX "IDX_1a62a99e1016e4a2b461e886ec"`); + await queryRunner.query(`DROP INDEX "IDX_9f1288205ae91f91cf356cac2f"`); + await queryRunner.query(`DROP INDEX "IDX_cb64573b18dd7b23f591f15502"`); + await queryRunner.query(`DROP INDEX "IDX_c8723c90a6f007f8d7e882a04f"`); + await queryRunner.query(`DROP INDEX "IDX_4b8450a24233df8b47ca472923"`); + await queryRunner.query(`DROP INDEX "IDX_e4bc75a1cbb07d117a0acfcdba"`); + await queryRunner.query( + `CREATE TABLE "temporary_job_search_occupation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceOccupationId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_44e22d88b47daf2095491b7cac3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1a62a99e1016e4a2b461e886ecd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_job_search_occupation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "job_search_occupation"` + ); + await queryRunner.query(`DROP TABLE "job_search_occupation"`); + await queryRunner.query(`ALTER TABLE "temporary_job_search_occupation" RENAME TO "job_search_occupation"`); + await queryRunner.query( + `CREATE INDEX "IDX_44e22d88b47daf2095491b7cac" ON "job_search_occupation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1a62a99e1016e4a2b461e886ec" ON "job_search_occupation" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9f1288205ae91f91cf356cac2f" ON "job_search_occupation" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_cb64573b18dd7b23f591f15502" ON "job_search_occupation" ("jobSourceOccupationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c8723c90a6f007f8d7e882a04f" ON "job_search_occupation" ("jobSource") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b8450a24233df8b47ca472923" ON "job_search_occupation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e4bc75a1cbb07d117a0acfcdba" ON "job_search_occupation" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_35e120f2b6e5188391cf068d3b"`); + await queryRunner.query(`DROP INDEX "IDX_86381fb6d28978b101b3aec8ca"`); + await queryRunner.query(`DROP INDEX "IDX_3b335bbcbf7d5e00853acaa165"`); + await queryRunner.query(`DROP INDEX "IDX_d0a798419c775b9157bf0269f4"`); + await queryRunner.query(`DROP INDEX "IDX_6ee5218c869b57197e4a209bed"`); + await queryRunner.query(`DROP INDEX "IDX_36333846c37e5f8812a5c9f7ff"`); + await queryRunner.query(`DROP INDEX "IDX_015231c6e28cfb2b789ca4b76f"`); + await queryRunner.query( + `CREATE TABLE "temporary_job_search_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceCategoryId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_35e120f2b6e5188391cf068d3ba" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86381fb6d28978b101b3aec8ca4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "temporary_job_search_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "job_search_category"` + ); + await queryRunner.query(`DROP TABLE "job_search_category"`); + await queryRunner.query(`ALTER TABLE "temporary_job_search_category" RENAME TO "job_search_category"`); + await queryRunner.query(`CREATE INDEX "IDX_35e120f2b6e5188391cf068d3b" ON "job_search_category" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_86381fb6d28978b101b3aec8ca" ON "job_search_category" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3b335bbcbf7d5e00853acaa165" ON "job_search_category" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_d0a798419c775b9157bf0269f4" ON "job_search_category" ("jobSourceCategoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6ee5218c869b57197e4a209bed" ON "job_search_category" ("jobSource") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_36333846c37e5f8812a5c9f7ff" ON "job_search_category" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_015231c6e28cfb2b789ca4b76f" ON "job_search_category" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_630337302efe97cc93deeb2151"`); + await queryRunner.query(`DROP INDEX "IDX_afe6c40d3d9951388fa05f83f2"`); + await queryRunner.query(`DROP INDEX "IDX_6bae61744663a416e73903d9af"`); + await queryRunner.query(`DROP INDEX "IDX_0e130a25bb4abe1b27c8a0adf4"`); + await queryRunner.query( + `CREATE TABLE "temporary_employee_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar, "employeeId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d2b148ddd67e520fb8061f4c133" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b6bcd5ceb60e4bb493344a6b4f2" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c872e6e3ab28e813c2324d1f4fb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_2dc73e07ac7040f273cea3c999d" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_630337302efe97cc93deeb21516" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_afe6c40d3d9951388fa05f83f28" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_employee_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "employee_upwork_job_search_criterion"` + ); + await queryRunner.query(`DROP TABLE "employee_upwork_job_search_criterion"`); + await queryRunner.query( + `ALTER TABLE "temporary_employee_upwork_job_search_criterion" RENAME TO "employee_upwork_job_search_criterion"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_630337302efe97cc93deeb2151" ON "employee_upwork_job_search_criterion" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_afe6c40d3d9951388fa05f83f2" ON "employee_upwork_job_search_criterion" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6bae61744663a416e73903d9af" ON "employee_upwork_job_search_criterion" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e130a25bb4abe1b27c8a0adf4" ON "employee_upwork_job_search_criterion" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f2c1b6770dd2a3abfa35f49411"`); + await queryRunner.query(`DROP INDEX "IDX_a4b038417e3221c0791dd8c771"`); + await queryRunner.query(`DROP INDEX "IDX_7e53ea80aca15da11a8a5ec038"`); + await queryRunner.query(`DROP INDEX "IDX_46226c3185e3ca3d7033831d7a"`); + await queryRunner.query(`DROP INDEX "IDX_e210f70c3904cf84ab5113be8f"`); + await queryRunner.query( + `CREATE TABLE "temporary_job_preset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a4b038417e3221c0791dd8c7714" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e53ea80aca15da11a8a5ec0380" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_job_preset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "job_preset"` + ); + await queryRunner.query(`DROP TABLE "job_preset"`); + await queryRunner.query(`ALTER TABLE "temporary_job_preset" RENAME TO "job_preset"`); + await queryRunner.query(`CREATE INDEX "IDX_f2c1b6770dd2a3abfa35f49411" ON "job_preset" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_a4b038417e3221c0791dd8c771" ON "job_preset" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_7e53ea80aca15da11a8a5ec038" ON "job_preset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_46226c3185e3ca3d7033831d7a" ON "job_preset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e210f70c3904cf84ab5113be8f" ON "job_preset" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_d5ca48cfacfb516543d6507ca4"`); + await queryRunner.query(`DROP INDEX "IDX_2323220b4decfd2f4d8307fd78"`); + await queryRunner.query(`DROP INDEX "IDX_af850e1fa48af82d66e9bf81c7"`); + await queryRunner.query(`DROP INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56"`); + await queryRunner.query( + `CREATE TABLE "temporary_job_preset_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_b909a3df761d7e489aca80f138a" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d45b36b85ffbd5189f7e70f29f5" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_9a687ce1a10a3abda460922cf84" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d5ca48cfacfb516543d6507ca4a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2323220b4decfd2f4d8307fd78f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_job_preset_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "job_preset_upwork_job_search_criterion"` + ); + await queryRunner.query(`DROP TABLE "job_preset_upwork_job_search_criterion"`); + await queryRunner.query( + `ALTER TABLE "temporary_job_preset_upwork_job_search_criterion" RENAME TO "job_preset_upwork_job_search_criterion"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5ca48cfacfb516543d6507ca4" ON "job_preset_upwork_job_search_criterion" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2323220b4decfd2f4d8307fd78" ON "job_preset_upwork_job_search_criterion" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_af850e1fa48af82d66e9bf81c7" ON "job_preset_upwork_job_search_criterion" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56" ON "job_preset_upwork_job_search_criterion" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_ff979040ce93cbc60863d322ec"`); + await queryRunner.query(`DROP INDEX "IDX_2ba72a9dec732a10e8c05bcdec"`); + await queryRunner.query(`DROP INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed"`); + await queryRunner.query(`DROP INDEX "IDX_9b22423b8cb20087c16613ecba"`); + await queryRunner.query(`DROP INDEX "IDX_0765098c5a6f93f51a55bda026"`); + await queryRunner.query( + `CREATE TABLE "temporary_knowledge_base" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "flag" varchar NOT NULL, "icon" varchar NOT NULL, "privacy" varchar NOT NULL, "language" varchar NOT NULL, "color" varchar NOT NULL, "description" varchar, "data" varchar, "index" integer, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_ff979040ce93cbc60863d322ecd" FOREIGN KEY ("parentId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba72a9dec732a10e8c05bcdec1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_bcb30c9893f4c8d0c4e556b4ed3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_knowledge_base"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base"` + ); + await queryRunner.query(`DROP TABLE "knowledge_base"`); + await queryRunner.query(`ALTER TABLE "temporary_knowledge_base" RENAME TO "knowledge_base"`); + await queryRunner.query(`CREATE INDEX "IDX_ff979040ce93cbc60863d322ec" ON "knowledge_base" ("parentId") `); + await queryRunner.query( + `CREATE INDEX "IDX_2ba72a9dec732a10e8c05bcdec" ON "knowledge_base" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed" ON "knowledge_base" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9b22423b8cb20087c16613ecba" ON "knowledge_base" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_0765098c5a6f93f51a55bda026" ON "knowledge_base" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_66af194845635058239e794e1b"`); + await queryRunner.query(`DROP INDEX "IDX_3547f82f867489542ceae58a49"`); + await queryRunner.query(`DROP INDEX "IDX_06a9902fedc1f9dcdbaf14afb0"`); + await queryRunner.query(`DROP INDEX "IDX_1544c43e36e1ccf7d578c70607"`); + await queryRunner.query(`DROP INDEX "IDX_e9720156c57ff1ad841e95ace7"`); + await queryRunner.query( + `CREATE TABLE "temporary_knowledge_base_article" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "data" varchar, "draft" boolean NOT NULL, "privacy" boolean NOT NULL, "index" integer NOT NULL, "categoryId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_66af194845635058239e794e1b9" FOREIGN KEY ("categoryId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3547f82f867489542ceae58a49e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_06a9902fedc1f9dcdbaf14afb01" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_knowledge_base_article"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base_article"` + ); + await queryRunner.query(`DROP TABLE "knowledge_base_article"`); + await queryRunner.query(`ALTER TABLE "temporary_knowledge_base_article" RENAME TO "knowledge_base_article"`); + await queryRunner.query( + `CREATE INDEX "IDX_66af194845635058239e794e1b" ON "knowledge_base_article" ("categoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3547f82f867489542ceae58a49" ON "knowledge_base_article" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_06a9902fedc1f9dcdbaf14afb0" ON "knowledge_base_article" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1544c43e36e1ccf7d578c70607" ON "knowledge_base_article" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9720156c57ff1ad841e95ace7" ON "knowledge_base_article" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2d5ecab1f06b327bad54553614"`); + await queryRunner.query(`DROP INDEX "IDX_8eb7e413257d7a26104f4e326f"`); + await queryRunner.query(`DROP INDEX "IDX_81558bb2bef673628d92540b4e"`); + await queryRunner.query(`DROP INDEX "IDX_1551e821871d9230cc0dafbbe5"`); + await queryRunner.query(`DROP INDEX "IDX_b9623984c84eb7be4c0eb076c2"`); + await queryRunner.query(`DROP INDEX "IDX_a9130ad7824fb843f06103971e"`); + await queryRunner.query( + `CREATE TABLE "temporary_knowledge_base_author" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar NOT NULL, "articleId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2d5ecab1f06b327bad545536143" FOREIGN KEY ("articleId") REFERENCES "knowledge_base_article" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8eb7e413257d7a26104f4e326fd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_81558bb2bef673628d92540b4e4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1551e821871d9230cc0dafbbe58" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_knowledge_base_author"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base_author"` + ); + await queryRunner.query(`DROP TABLE "knowledge_base_author"`); + await queryRunner.query(`ALTER TABLE "temporary_knowledge_base_author" RENAME TO "knowledge_base_author"`); + await queryRunner.query( + `CREATE INDEX "IDX_2d5ecab1f06b327bad54553614" ON "knowledge_base_author" ("articleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8eb7e413257d7a26104f4e326f" ON "knowledge_base_author" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_81558bb2bef673628d92540b4e" ON "knowledge_base_author" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1551e821871d9230cc0dafbbe5" ON "knowledge_base_author" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b9623984c84eb7be4c0eb076c2" ON "knowledge_base_author" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9130ad7824fb843f06103971e" ON "knowledge_base_author" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_db21a1dc776b455ee83eb7ff88"`); + await queryRunner.query(`DROP INDEX "IDX_06e7335708b5e7870f1eaa608d"`); + await queryRunner.query(`DROP INDEX "IDX_913f7739f1262fc8c70cbbafa3"`); + await queryRunner.query(`DROP INDEX "IDX_f3591fd59cc32b585c3ba7d3ae"`); + await queryRunner.query(`DROP INDEX "IDX_28f06c5655d507668b8839b59a"`); + await queryRunner.query(`DROP INDEX "IDX_28ce717020729e36aa06cca5c5"`); + await queryRunner.query(`DROP INDEX "IDX_586e6b1273ba2732ec0ee41a80"`); + await queryRunner.query(`DROP INDEX "IDX_9cb4931c7348b6c171f13b6216"`); + await queryRunner.query(`DROP INDEX "IDX_6248458c7e237cef4adac4761d"`); + await queryRunner.query( + `CREATE TABLE "temporary_product_review" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" text, "rating" integer NOT NULL, "upvotes" integer NOT NULL DEFAULT (0), "downvotes" integer NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('pending'), "editedAt" datetime, "productId" varchar NOT NULL, "userId" varchar NOT NULL, "archivedAt" datetime, CONSTRAINT "FK_db21a1dc776b455ee83eb7ff88e" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_06e7335708b5e7870f1eaa608d2" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_28ce717020729e36aa06cca5c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_586e6b1273ba2732ec0ee41a80b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_product_review"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId" FROM "product_review"` + ); + await queryRunner.query(`DROP TABLE "product_review"`); + await queryRunner.query(`ALTER TABLE "temporary_product_review" RENAME TO "product_review"`); + await queryRunner.query(`CREATE INDEX "IDX_db21a1dc776b455ee83eb7ff88" ON "product_review" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_06e7335708b5e7870f1eaa608d" ON "product_review" ("productId") `); + await queryRunner.query(`CREATE INDEX "IDX_913f7739f1262fc8c70cbbafa3" ON "product_review" ("editedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_f3591fd59cc32b585c3ba7d3ae" ON "product_review" ("downvotes") `); + await queryRunner.query(`CREATE INDEX "IDX_28f06c5655d507668b8839b59a" ON "product_review" ("upvotes") `); + await queryRunner.query( + `CREATE INDEX "IDX_28ce717020729e36aa06cca5c5" ON "product_review" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_586e6b1273ba2732ec0ee41a80" ON "product_review" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9cb4931c7348b6c171f13b6216" ON "product_review" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6248458c7e237cef4adac4761d" ON "product_review" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_5d74a3f25e6acfb6caec05ec65" ON "accounting_template" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e0c6443e0d2d5630067bc10ccf" ON "appointment_employee" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_829e02292a572f25476c4e426c" ON "approval_policy" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2ada776a231239b8e99f78bf64" ON "availability_slot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c323aa830e10a871854d0a0408" ON "social_account" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_75bd5526e43c8801085225ffa9" ON "candidate_criterion_rating" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4985a92870282574f6fec8dd98" ON "candidate_document" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_745780f5553e56a3ca19bccf86" ON "candidate_education" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bb09aa3130d0e54007a98523c5" ON "candidate_experience" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_89ff7e0a8c37fdf7770b753776" ON "candidate_feedback" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_09f72a1a309aae91e0cd83949a" ON "candidate_interview" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_54b281d06e1a4e7e6ff640dab4" ON "candidate_interviewer" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fa411cb89c9c6848d192d7f2e6" ON "candidate_personal_quality" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f651e72ab42727f28c29441f1b" ON "candidate_skill" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436" ON "candidate_source" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_5cb080756923318f19f1d2eabe" ON "candidate_technology" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_ac765cfc390ec77d765dd48b61" ON "candidate" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_67a4423093e3c311cb76275659" ON "contact" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_711fd0159178a0102abc4db336" ON "country" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e99bb270f0fa89ea715a457d29" ON "currency" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_36106478339961c8a17674a031" ON "custom_smtp" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_284658fe519bca6048fd73ff72" ON "deal" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_753f4b022ec98a0c8f38b370c0" ON "email_sent" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_35ac91a92c521b68277e780e6e" ON "email_reset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ce96229ae8d1d1af61348730da" ON "email_template" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_e69d60f1adcded4445095c4787" ON "employee_appointment" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_cee87c9b8743f0e81db8152f68" ON "employee_award" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_9dff154a1be222c66c179ad14b" ON "employee_level" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_08e391262cb3d4fbe9db97ecf8" ON "employee_phone" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_185b880550575c61d4212896e2" ON "employee_recurring_expense" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_a8e048dfb4d618068376407c86" ON "employee_setting" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c17e703a7008f6b9c2770a5cba" ON "employee" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_0c5508f4c86446f84d609e3b76" ON "equipment_sharing_policy" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_21bb7aec28dbb12ebc58a41d02" ON "equipment_sharing" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8" ON "equipment" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c029854e57e273cb30445e6417" ON "estimate_email" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc" ON "event_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_0edbfb90f0bc4c28eb57892900" ON "expense_category" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6620af16ccd56e7e52b6ad914d" ON "expense" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ca5fc2af0a26e454779d014a6a" ON "import-history" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_b1669a96371cbdb8fd8d4724d6" ON "import-record" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_c795b7a18f1213b980bcc91ffe" ON "feature_organization" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9" ON "feature" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_03dbd727034c431934185d1d6f" ON "goal_general_setting" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_84a5a399408725b9c8612767e0" ON "goal_kpi_template" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_dae34450bed722e897370e2aec" ON "goal_kpi" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_25e0f8060ed921994873391253" ON "goal_template" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_cc3487eb32dd8baa86a8043540" ON "goal_time_frame" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_265b5cbc3e414bb3bb2facbb22" ON "goal" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2a8cd17a33093bb6afed97e9d3" ON "image_asset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_263e874cebea17ad3f2ba39e11" ON "income" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_2a9f9f6fa9064b328e277063a1" ON "integration_entity_setting_tied" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5053bf22f9e0a5e9e8df7850da" ON "integration_entity_setting" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3907c6f563fc45d824558d239d" ON "integration_map" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_02f667ad727ca0975d5022e695" ON "integration_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b6654519fbad729cdb490069be" ON "integration_tenant" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_842e81def8eef9f71a97496ff1" ON "integration_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_90aec772805c7fd508d71bedfe" ON "integration" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_00a3c849694b6f8be7b193c888" ON "invite" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_599de8ec6ea69550c6d49c4ae1" ON "invoice_estimate_history" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_457cbab434fc9a031f03eb6211" ON "invoice_item" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_40ee7b28c0ea835534a93b54bf" ON "invoice" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_04b8ef5663b40baa58e1b65160" ON "key_result_template" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c5df67196c2aca0a7fb6ffd274" ON "key_result_update" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_30bf8575f0744aa3b68b611985" ON "key_result" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_745828269219870069b3b46a7f" ON "language" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_ebff440aec581d4893ad743c7e" ON "merchant" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_20aebc4219b9f9196f5ca2344d" ON "organization_award" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cdf46b38fd75cd7baebce81cc6" ON "organization_contact" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8cf81262c7cddfcf3fedcbc106" ON "organization_department" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bf9a2edebcda9ac2c59e4439cb" ON "organization_document" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a11abe644b2cb5810bb65c8f9" ON "organization_employment_type" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_94330f9121dd1e72fe31fdb3c5" ON "organization_language" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122" ON "organization_position" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_21510dbb86b763f55a8bf4ec93" ON "organization_project_module" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_636a95bda1eaf9fab00849dec2" ON "organization_recurring_expense" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cbb3f1eb241abc47103df48f83" ON "organization_sprint" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_60683da6db3f64a0767d40b291" ON "organization_task_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d109b8470a4cf2662bec0a672b" ON "organization_team_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5deae148453dfaf555b24d151f" ON "organization_team_join_request" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_af48bbfa76f6261a5520e5e90f" ON "organization_team" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_6c41095093c47ac91434a1bdf9" ON "organization_vendor" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94" ON "organization" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_7f8ba01a73690cbabe6c6ab93c" ON "password_reset" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_523b77d9dcbace8377fbca05ae" ON "payment" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c5075efc6dab483721af36616f" ON "pipeline_stage" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_8b0d255d8f0ec4ca22e36249a8" ON "pipeline" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_2dce278beac80aebe7e179d7c9" ON "product_category_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_89d6d92ce60b7b6de00449b30d" ON "product_category" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_e69de0d6c91d71407822a95bc9" ON "product_option_group" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fdca637f69b879c6e95525a01f" ON "product_option_group_translation" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_eed2b389448b96ec1118ca38ef" ON "product_option_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_41bff03b05f43a4e22e54cb83e" ON "product_option" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_18a46a61494103f9db1c42285d" ON "product_variant_setting" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7c3776ae0d403baebc8a9387d8" ON "product_type_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_577cfbbd0e9dedad955108df36" ON "product_type" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_3041f4d50857a4bc37dd72f233" ON "product_variant_price" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0eb547a970dfecff424eb2098b" ON "product_variant" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_98c2019d4a108469e30b265972" ON "product" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_12de5ef2de583b2e92a1dfee3d" ON "product_translation" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0ad88d687468141532bef9cc5e" ON "report_category" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_3619176cb8845c5c03803caf9d" ON "report_organization" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_5a453f466165d928a495e158ac" ON "report" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_f6c789158e91e7a6242174aaae" ON "request_approval_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c02d6337074841598e6952fed" ON "request_approval_team" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_aac7b3092d5d02d80deb5808b3" ON "request_approval" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592" ON "role_permission" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6c388c8d50b4238ab077fdc800" ON "role" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_0d379f40301224bfa5043dc7cc" ON "skill" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1ddd19850ad49f4e61ad727018" ON "tag" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_1255e02d6dddd4e09a5ddb10d4" ON "daily_plan" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_da2990e3e7d2047d950ab8edea" ON "task_estimation" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2ff61d100d00793724c099b86c" ON "issue_type" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_93bb4c9fb014dda0d984e9060a" ON "task" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_024d5a6727f6f4804d8cecfe32" ON "task_linked_issues" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f9fdc26bc564bf9f7963489f23" ON "task_priority" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_d1689daf93e2cb6029a9ff96d2" ON "task_related_issue_type" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c364d9cb885e274666950b1afc" ON "task_size" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_259cb3e6d0d59edad2798b0ac3" ON "task_status" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_526e175838190ccc3c350df01a" ON "task_version" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6e8dc5c9992499a05248237e58" ON "tenant_setting" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_10ede978ae7c1b67755932eac6" ON "tenant" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_21aa702abacf7dabe11da12818" ON "time_off_policy" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_a5c6d8b62974fb9e4161e09499" ON "time_off_request" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_83df5ca85dae51ff9341e47785" ON "activity" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_afad5ae421b31768c4232f7224" ON "screenshot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_2cbd790171893d994992116f19" ON "time_log" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_b520b83e91a6d3c8ef33675efe" ON "time_slot" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_bb9f95f639ced2a5b71395169e" ON "time_slot_minute" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_43f3709ff2b8dcc90c1809b023" ON "timesheet" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6f87e00eb9e37242f01e6e5566" ON "user_organization" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd" ON "user" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_fa9bdc44b90c4f32e658938a2d" ON "warehouse_product" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_21bba7ad2249260cc9d0022af9" ON "warehouse_product_variant" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_66abaca4fc9c367203403310aa" ON "warehouse" ("archivedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_888ffe5a395d1cf7afb001dc3a" ON "changelog" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_55dbb0b04712921d3c5dd7664e" ON "organization_github_repository" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_290ccd540d1e1f450c408539a1" ON "organization_github_repository_issue" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_811cc78a6e4df2ae75d237e40e" ON "proposal" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_6b73b978dcd27856a83df0d23c" ON "employee_proposal_template" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_551be2742a129d5d8ff461e9fe" ON "job_search_occupation" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b69eac7a9f1b9e93eebe3a850" ON "job_search_category" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0d66c27013f4c34b339738f210" ON "employee_upwork_job_search_criterion" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c271c2698e24de252f1fd148f0" ON "job_preset" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_84a641af24ce125f296142216b" ON "job_preset_upwork_job_search_criterion" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_407463aef81b89c8bc5943ac8a" ON "knowledge_base" ("archivedAt") `); + await queryRunner.query( + `CREATE INDEX "IDX_bd8360d2c539ae6b351129c86d" ON "knowledge_base_article" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_eb418dd0f3234df01222bcf438" ON "knowledge_base_author" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c94775caea731394d690d67db1" ON "product_review" ("archivedAt") `); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId" FROM "organization_project"` + ); + await queryRunner.query(`DROP TABLE "organization_project"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query( + `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + } /** * SqliteDB and BetterSQlite3DB Down Migration * * @param queryRunner */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); + await queryRunner.query( + `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId" FROM "temporary_organization_project"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_c94775caea731394d690d67db1"`); + await queryRunner.query(`DROP INDEX "IDX_eb418dd0f3234df01222bcf438"`); + await queryRunner.query(`DROP INDEX "IDX_bd8360d2c539ae6b351129c86d"`); + await queryRunner.query(`DROP INDEX "IDX_407463aef81b89c8bc5943ac8a"`); + await queryRunner.query(`DROP INDEX "IDX_84a641af24ce125f296142216b"`); + await queryRunner.query(`DROP INDEX "IDX_c271c2698e24de252f1fd148f0"`); + await queryRunner.query(`DROP INDEX "IDX_0d66c27013f4c34b339738f210"`); + await queryRunner.query(`DROP INDEX "IDX_4b69eac7a9f1b9e93eebe3a850"`); + await queryRunner.query(`DROP INDEX "IDX_551be2742a129d5d8ff461e9fe"`); + await queryRunner.query(`DROP INDEX "IDX_6b73b978dcd27856a83df0d23c"`); + await queryRunner.query(`DROP INDEX "IDX_811cc78a6e4df2ae75d237e40e"`); + await queryRunner.query(`DROP INDEX "IDX_290ccd540d1e1f450c408539a1"`); + await queryRunner.query(`DROP INDEX "IDX_55dbb0b04712921d3c5dd7664e"`); + await queryRunner.query(`DROP INDEX "IDX_888ffe5a395d1cf7afb001dc3a"`); + await queryRunner.query(`DROP INDEX "IDX_66abaca4fc9c367203403310aa"`); + await queryRunner.query(`DROP INDEX "IDX_21bba7ad2249260cc9d0022af9"`); + await queryRunner.query(`DROP INDEX "IDX_fa9bdc44b90c4f32e658938a2d"`); + await queryRunner.query(`DROP INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd"`); + await queryRunner.query(`DROP INDEX "IDX_6f87e00eb9e37242f01e6e5566"`); + await queryRunner.query(`DROP INDEX "IDX_43f3709ff2b8dcc90c1809b023"`); + await queryRunner.query(`DROP INDEX "IDX_bb9f95f639ced2a5b71395169e"`); + await queryRunner.query(`DROP INDEX "IDX_b520b83e91a6d3c8ef33675efe"`); + await queryRunner.query(`DROP INDEX "IDX_2cbd790171893d994992116f19"`); + await queryRunner.query(`DROP INDEX "IDX_afad5ae421b31768c4232f7224"`); + await queryRunner.query(`DROP INDEX "IDX_83df5ca85dae51ff9341e47785"`); + await queryRunner.query(`DROP INDEX "IDX_a5c6d8b62974fb9e4161e09499"`); + await queryRunner.query(`DROP INDEX "IDX_21aa702abacf7dabe11da12818"`); + await queryRunner.query(`DROP INDEX "IDX_10ede978ae7c1b67755932eac6"`); + await queryRunner.query(`DROP INDEX "IDX_6e8dc5c9992499a05248237e58"`); + await queryRunner.query(`DROP INDEX "IDX_526e175838190ccc3c350df01a"`); + await queryRunner.query(`DROP INDEX "IDX_259cb3e6d0d59edad2798b0ac3"`); + await queryRunner.query(`DROP INDEX "IDX_c364d9cb885e274666950b1afc"`); + await queryRunner.query(`DROP INDEX "IDX_d1689daf93e2cb6029a9ff96d2"`); + await queryRunner.query(`DROP INDEX "IDX_f9fdc26bc564bf9f7963489f23"`); + await queryRunner.query(`DROP INDEX "IDX_024d5a6727f6f4804d8cecfe32"`); + await queryRunner.query(`DROP INDEX "IDX_93bb4c9fb014dda0d984e9060a"`); + await queryRunner.query(`DROP INDEX "IDX_2ff61d100d00793724c099b86c"`); + await queryRunner.query(`DROP INDEX "IDX_da2990e3e7d2047d950ab8edea"`); + await queryRunner.query(`DROP INDEX "IDX_1255e02d6dddd4e09a5ddb10d4"`); + await queryRunner.query(`DROP INDEX "IDX_1ddd19850ad49f4e61ad727018"`); + await queryRunner.query(`DROP INDEX "IDX_0d379f40301224bfa5043dc7cc"`); + await queryRunner.query(`DROP INDEX "IDX_6c388c8d50b4238ab077fdc800"`); + await queryRunner.query(`DROP INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592"`); + await queryRunner.query(`DROP INDEX "IDX_aac7b3092d5d02d80deb5808b3"`); + await queryRunner.query(`DROP INDEX "IDX_1c02d6337074841598e6952fed"`); + await queryRunner.query(`DROP INDEX "IDX_f6c789158e91e7a6242174aaae"`); + await queryRunner.query(`DROP INDEX "IDX_5a453f466165d928a495e158ac"`); + await queryRunner.query(`DROP INDEX "IDX_3619176cb8845c5c03803caf9d"`); + await queryRunner.query(`DROP INDEX "IDX_0ad88d687468141532bef9cc5e"`); + await queryRunner.query(`DROP INDEX "IDX_12de5ef2de583b2e92a1dfee3d"`); + await queryRunner.query(`DROP INDEX "IDX_98c2019d4a108469e30b265972"`); + await queryRunner.query(`DROP INDEX "IDX_0eb547a970dfecff424eb2098b"`); + await queryRunner.query(`DROP INDEX "IDX_3041f4d50857a4bc37dd72f233"`); + await queryRunner.query(`DROP INDEX "IDX_577cfbbd0e9dedad955108df36"`); + await queryRunner.query(`DROP INDEX "IDX_7c3776ae0d403baebc8a9387d8"`); + await queryRunner.query(`DROP INDEX "IDX_18a46a61494103f9db1c42285d"`); + await queryRunner.query(`DROP INDEX "IDX_41bff03b05f43a4e22e54cb83e"`); + await queryRunner.query(`DROP INDEX "IDX_eed2b389448b96ec1118ca38ef"`); + await queryRunner.query(`DROP INDEX "IDX_fdca637f69b879c6e95525a01f"`); + await queryRunner.query(`DROP INDEX "IDX_e69de0d6c91d71407822a95bc9"`); + await queryRunner.query(`DROP INDEX "IDX_89d6d92ce60b7b6de00449b30d"`); + await queryRunner.query(`DROP INDEX "IDX_2dce278beac80aebe7e179d7c9"`); + await queryRunner.query(`DROP INDEX "IDX_8b0d255d8f0ec4ca22e36249a8"`); + await queryRunner.query(`DROP INDEX "IDX_c5075efc6dab483721af36616f"`); + await queryRunner.query(`DROP INDEX "IDX_523b77d9dcbace8377fbca05ae"`); + await queryRunner.query(`DROP INDEX "IDX_7f8ba01a73690cbabe6c6ab93c"`); + await queryRunner.query(`DROP INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94"`); + await queryRunner.query(`DROP INDEX "IDX_6c41095093c47ac91434a1bdf9"`); + await queryRunner.query(`DROP INDEX "IDX_af48bbfa76f6261a5520e5e90f"`); + await queryRunner.query(`DROP INDEX "IDX_5deae148453dfaf555b24d151f"`); + await queryRunner.query(`DROP INDEX "IDX_d109b8470a4cf2662bec0a672b"`); + await queryRunner.query(`DROP INDEX "IDX_60683da6db3f64a0767d40b291"`); + await queryRunner.query(`DROP INDEX "IDX_cbb3f1eb241abc47103df48f83"`); + await queryRunner.query(`DROP INDEX "IDX_636a95bda1eaf9fab00849dec2"`); + await queryRunner.query(`DROP INDEX "IDX_21510dbb86b763f55a8bf4ec93"`); + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); + await queryRunner.query(`DROP INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122"`); + await queryRunner.query(`DROP INDEX "IDX_94330f9121dd1e72fe31fdb3c5"`); + await queryRunner.query(`DROP INDEX "IDX_8a11abe644b2cb5810bb65c8f9"`); + await queryRunner.query(`DROP INDEX "IDX_bf9a2edebcda9ac2c59e4439cb"`); + await queryRunner.query(`DROP INDEX "IDX_8cf81262c7cddfcf3fedcbc106"`); + await queryRunner.query(`DROP INDEX "IDX_cdf46b38fd75cd7baebce81cc6"`); + await queryRunner.query(`DROP INDEX "IDX_20aebc4219b9f9196f5ca2344d"`); + await queryRunner.query(`DROP INDEX "IDX_ebff440aec581d4893ad743c7e"`); + await queryRunner.query(`DROP INDEX "IDX_745828269219870069b3b46a7f"`); + await queryRunner.query(`DROP INDEX "IDX_30bf8575f0744aa3b68b611985"`); + await queryRunner.query(`DROP INDEX "IDX_c5df67196c2aca0a7fb6ffd274"`); + await queryRunner.query(`DROP INDEX "IDX_04b8ef5663b40baa58e1b65160"`); + await queryRunner.query(`DROP INDEX "IDX_40ee7b28c0ea835534a93b54bf"`); + await queryRunner.query(`DROP INDEX "IDX_457cbab434fc9a031f03eb6211"`); + await queryRunner.query(`DROP INDEX "IDX_599de8ec6ea69550c6d49c4ae1"`); + await queryRunner.query(`DROP INDEX "IDX_00a3c849694b6f8be7b193c888"`); + await queryRunner.query(`DROP INDEX "IDX_90aec772805c7fd508d71bedfe"`); + await queryRunner.query(`DROP INDEX "IDX_842e81def8eef9f71a97496ff1"`); + await queryRunner.query(`DROP INDEX "IDX_b6654519fbad729cdb490069be"`); + await queryRunner.query(`DROP INDEX "IDX_02f667ad727ca0975d5022e695"`); + await queryRunner.query(`DROP INDEX "IDX_3907c6f563fc45d824558d239d"`); + await queryRunner.query(`DROP INDEX "IDX_5053bf22f9e0a5e9e8df7850da"`); + await queryRunner.query(`DROP INDEX "IDX_2a9f9f6fa9064b328e277063a1"`); + await queryRunner.query(`DROP INDEX "IDX_263e874cebea17ad3f2ba39e11"`); + await queryRunner.query(`DROP INDEX "IDX_2a8cd17a33093bb6afed97e9d3"`); + await queryRunner.query(`DROP INDEX "IDX_265b5cbc3e414bb3bb2facbb22"`); + await queryRunner.query(`DROP INDEX "IDX_cc3487eb32dd8baa86a8043540"`); + await queryRunner.query(`DROP INDEX "IDX_25e0f8060ed921994873391253"`); + await queryRunner.query(`DROP INDEX "IDX_dae34450bed722e897370e2aec"`); + await queryRunner.query(`DROP INDEX "IDX_84a5a399408725b9c8612767e0"`); + await queryRunner.query(`DROP INDEX "IDX_03dbd727034c431934185d1d6f"`); + await queryRunner.query(`DROP INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9"`); + await queryRunner.query(`DROP INDEX "IDX_c795b7a18f1213b980bcc91ffe"`); + await queryRunner.query(`DROP INDEX "IDX_b1669a96371cbdb8fd8d4724d6"`); + await queryRunner.query(`DROP INDEX "IDX_ca5fc2af0a26e454779d014a6a"`); + await queryRunner.query(`DROP INDEX "IDX_6620af16ccd56e7e52b6ad914d"`); + await queryRunner.query(`DROP INDEX "IDX_0edbfb90f0bc4c28eb57892900"`); + await queryRunner.query(`DROP INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc"`); + await queryRunner.query(`DROP INDEX "IDX_c029854e57e273cb30445e6417"`); + await queryRunner.query(`DROP INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8"`); + await queryRunner.query(`DROP INDEX "IDX_21bb7aec28dbb12ebc58a41d02"`); + await queryRunner.query(`DROP INDEX "IDX_0c5508f4c86446f84d609e3b76"`); + await queryRunner.query(`DROP INDEX "IDX_c17e703a7008f6b9c2770a5cba"`); + await queryRunner.query(`DROP INDEX "IDX_a8e048dfb4d618068376407c86"`); + await queryRunner.query(`DROP INDEX "IDX_185b880550575c61d4212896e2"`); + await queryRunner.query(`DROP INDEX "IDX_08e391262cb3d4fbe9db97ecf8"`); + await queryRunner.query(`DROP INDEX "IDX_9dff154a1be222c66c179ad14b"`); + await queryRunner.query(`DROP INDEX "IDX_cee87c9b8743f0e81db8152f68"`); + await queryRunner.query(`DROP INDEX "IDX_e69d60f1adcded4445095c4787"`); + await queryRunner.query(`DROP INDEX "IDX_ce96229ae8d1d1af61348730da"`); + await queryRunner.query(`DROP INDEX "IDX_35ac91a92c521b68277e780e6e"`); + await queryRunner.query(`DROP INDEX "IDX_753f4b022ec98a0c8f38b370c0"`); + await queryRunner.query(`DROP INDEX "IDX_284658fe519bca6048fd73ff72"`); + await queryRunner.query(`DROP INDEX "IDX_36106478339961c8a17674a031"`); + await queryRunner.query(`DROP INDEX "IDX_e99bb270f0fa89ea715a457d29"`); + await queryRunner.query(`DROP INDEX "IDX_711fd0159178a0102abc4db336"`); + await queryRunner.query(`DROP INDEX "IDX_67a4423093e3c311cb76275659"`); + await queryRunner.query(`DROP INDEX "IDX_ac765cfc390ec77d765dd48b61"`); + await queryRunner.query(`DROP INDEX "IDX_5cb080756923318f19f1d2eabe"`); + await queryRunner.query(`DROP INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436"`); + await queryRunner.query(`DROP INDEX "IDX_f651e72ab42727f28c29441f1b"`); + await queryRunner.query(`DROP INDEX "IDX_fa411cb89c9c6848d192d7f2e6"`); + await queryRunner.query(`DROP INDEX "IDX_54b281d06e1a4e7e6ff640dab4"`); + await queryRunner.query(`DROP INDEX "IDX_09f72a1a309aae91e0cd83949a"`); + await queryRunner.query(`DROP INDEX "IDX_89ff7e0a8c37fdf7770b753776"`); + await queryRunner.query(`DROP INDEX "IDX_bb09aa3130d0e54007a98523c5"`); + await queryRunner.query(`DROP INDEX "IDX_745780f5553e56a3ca19bccf86"`); + await queryRunner.query(`DROP INDEX "IDX_4985a92870282574f6fec8dd98"`); + await queryRunner.query(`DROP INDEX "IDX_75bd5526e43c8801085225ffa9"`); + await queryRunner.query(`DROP INDEX "IDX_c323aa830e10a871854d0a0408"`); + await queryRunner.query(`DROP INDEX "IDX_2ada776a231239b8e99f78bf64"`); + await queryRunner.query(`DROP INDEX "IDX_829e02292a572f25476c4e426c"`); + await queryRunner.query(`DROP INDEX "IDX_e0c6443e0d2d5630067bc10ccf"`); + await queryRunner.query(`DROP INDEX "IDX_5d74a3f25e6acfb6caec05ec65"`); + await queryRunner.query(`DROP INDEX "IDX_6248458c7e237cef4adac4761d"`); + await queryRunner.query(`DROP INDEX "IDX_9cb4931c7348b6c171f13b6216"`); + await queryRunner.query(`DROP INDEX "IDX_586e6b1273ba2732ec0ee41a80"`); + await queryRunner.query(`DROP INDEX "IDX_28ce717020729e36aa06cca5c5"`); + await queryRunner.query(`DROP INDEX "IDX_28f06c5655d507668b8839b59a"`); + await queryRunner.query(`DROP INDEX "IDX_f3591fd59cc32b585c3ba7d3ae"`); + await queryRunner.query(`DROP INDEX "IDX_913f7739f1262fc8c70cbbafa3"`); + await queryRunner.query(`DROP INDEX "IDX_06e7335708b5e7870f1eaa608d"`); + await queryRunner.query(`DROP INDEX "IDX_db21a1dc776b455ee83eb7ff88"`); + await queryRunner.query(`ALTER TABLE "product_review" RENAME TO "temporary_product_review"`); + await queryRunner.query( + `CREATE TABLE "product_review" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" text, "rating" integer NOT NULL, "upvotes" integer NOT NULL DEFAULT (0), "downvotes" integer NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('pending'), "editedAt" datetime, "productId" varchar NOT NULL, "userId" varchar NOT NULL, CONSTRAINT "FK_db21a1dc776b455ee83eb7ff88e" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_06e7335708b5e7870f1eaa608d2" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_28ce717020729e36aa06cca5c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_586e6b1273ba2732ec0ee41a80b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_review"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId" FROM "temporary_product_review"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_review"`); + await queryRunner.query(`CREATE INDEX "IDX_6248458c7e237cef4adac4761d" ON "product_review" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_9cb4931c7348b6c171f13b6216" ON "product_review" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_586e6b1273ba2732ec0ee41a80" ON "product_review" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_28ce717020729e36aa06cca5c5" ON "product_review" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_28f06c5655d507668b8839b59a" ON "product_review" ("upvotes") `); + await queryRunner.query(`CREATE INDEX "IDX_f3591fd59cc32b585c3ba7d3ae" ON "product_review" ("downvotes") `); + await queryRunner.query(`CREATE INDEX "IDX_913f7739f1262fc8c70cbbafa3" ON "product_review" ("editedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_06e7335708b5e7870f1eaa608d" ON "product_review" ("productId") `); + await queryRunner.query(`CREATE INDEX "IDX_db21a1dc776b455ee83eb7ff88" ON "product_review" ("userId") `); + await queryRunner.query(`DROP INDEX "IDX_a9130ad7824fb843f06103971e"`); + await queryRunner.query(`DROP INDEX "IDX_b9623984c84eb7be4c0eb076c2"`); + await queryRunner.query(`DROP INDEX "IDX_1551e821871d9230cc0dafbbe5"`); + await queryRunner.query(`DROP INDEX "IDX_81558bb2bef673628d92540b4e"`); + await queryRunner.query(`DROP INDEX "IDX_8eb7e413257d7a26104f4e326f"`); + await queryRunner.query(`DROP INDEX "IDX_2d5ecab1f06b327bad54553614"`); + await queryRunner.query(`ALTER TABLE "knowledge_base_author" RENAME TO "temporary_knowledge_base_author"`); + await queryRunner.query( + `CREATE TABLE "knowledge_base_author" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar NOT NULL, "articleId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2d5ecab1f06b327bad545536143" FOREIGN KEY ("articleId") REFERENCES "knowledge_base_article" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8eb7e413257d7a26104f4e326fd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_81558bb2bef673628d92540b4e4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1551e821871d9230cc0dafbbe58" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "knowledge_base_author"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base_author"` + ); + await queryRunner.query(`DROP TABLE "temporary_knowledge_base_author"`); + await queryRunner.query( + `CREATE INDEX "IDX_a9130ad7824fb843f06103971e" ON "knowledge_base_author" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b9623984c84eb7be4c0eb076c2" ON "knowledge_base_author" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1551e821871d9230cc0dafbbe5" ON "knowledge_base_author" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_81558bb2bef673628d92540b4e" ON "knowledge_base_author" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8eb7e413257d7a26104f4e326f" ON "knowledge_base_author" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2d5ecab1f06b327bad54553614" ON "knowledge_base_author" ("articleId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e9720156c57ff1ad841e95ace7"`); + await queryRunner.query(`DROP INDEX "IDX_1544c43e36e1ccf7d578c70607"`); + await queryRunner.query(`DROP INDEX "IDX_06a9902fedc1f9dcdbaf14afb0"`); + await queryRunner.query(`DROP INDEX "IDX_3547f82f867489542ceae58a49"`); + await queryRunner.query(`DROP INDEX "IDX_66af194845635058239e794e1b"`); + await queryRunner.query(`ALTER TABLE "knowledge_base_article" RENAME TO "temporary_knowledge_base_article"`); + await queryRunner.query( + `CREATE TABLE "knowledge_base_article" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "data" varchar, "draft" boolean NOT NULL, "privacy" boolean NOT NULL, "index" integer NOT NULL, "categoryId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_66af194845635058239e794e1b9" FOREIGN KEY ("categoryId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3547f82f867489542ceae58a49e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_06a9902fedc1f9dcdbaf14afb01" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "knowledge_base_article"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base_article"` + ); + await queryRunner.query(`DROP TABLE "temporary_knowledge_base_article"`); + await queryRunner.query( + `CREATE INDEX "IDX_e9720156c57ff1ad841e95ace7" ON "knowledge_base_article" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1544c43e36e1ccf7d578c70607" ON "knowledge_base_article" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_06a9902fedc1f9dcdbaf14afb0" ON "knowledge_base_article" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3547f82f867489542ceae58a49" ON "knowledge_base_article" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_66af194845635058239e794e1b" ON "knowledge_base_article" ("categoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_0765098c5a6f93f51a55bda026"`); + await queryRunner.query(`DROP INDEX "IDX_9b22423b8cb20087c16613ecba"`); + await queryRunner.query(`DROP INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed"`); + await queryRunner.query(`DROP INDEX "IDX_2ba72a9dec732a10e8c05bcdec"`); + await queryRunner.query(`DROP INDEX "IDX_ff979040ce93cbc60863d322ec"`); + await queryRunner.query(`ALTER TABLE "knowledge_base" RENAME TO "temporary_knowledge_base"`); + await queryRunner.query( + `CREATE TABLE "knowledge_base" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "flag" varchar NOT NULL, "icon" varchar NOT NULL, "privacy" varchar NOT NULL, "language" varchar NOT NULL, "color" varchar NOT NULL, "description" varchar, "data" varchar, "index" integer, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_ff979040ce93cbc60863d322ecd" FOREIGN KEY ("parentId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba72a9dec732a10e8c05bcdec1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_bcb30c9893f4c8d0c4e556b4ed3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "knowledge_base"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base"` + ); + await queryRunner.query(`DROP TABLE "temporary_knowledge_base"`); + await queryRunner.query(`CREATE INDEX "IDX_0765098c5a6f93f51a55bda026" ON "knowledge_base" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_9b22423b8cb20087c16613ecba" ON "knowledge_base" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed" ON "knowledge_base" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_2ba72a9dec732a10e8c05bcdec" ON "knowledge_base" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_ff979040ce93cbc60863d322ec" ON "knowledge_base" ("parentId") `); + await queryRunner.query(`DROP INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56"`); + await queryRunner.query(`DROP INDEX "IDX_af850e1fa48af82d66e9bf81c7"`); + await queryRunner.query(`DROP INDEX "IDX_2323220b4decfd2f4d8307fd78"`); + await queryRunner.query(`DROP INDEX "IDX_d5ca48cfacfb516543d6507ca4"`); + await queryRunner.query( + `ALTER TABLE "job_preset_upwork_job_search_criterion" RENAME TO "temporary_job_preset_upwork_job_search_criterion"` + ); + await queryRunner.query( + `CREATE TABLE "job_preset_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_b909a3df761d7e489aca80f138a" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d45b36b85ffbd5189f7e70f29f5" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_9a687ce1a10a3abda460922cf84" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d5ca48cfacfb516543d6507ca4a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2323220b4decfd2f4d8307fd78f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "job_preset_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "temporary_job_preset_upwork_job_search_criterion"` + ); + await queryRunner.query(`DROP TABLE "temporary_job_preset_upwork_job_search_criterion"`); + await queryRunner.query( + `CREATE INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56" ON "job_preset_upwork_job_search_criterion" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_af850e1fa48af82d66e9bf81c7" ON "job_preset_upwork_job_search_criterion" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2323220b4decfd2f4d8307fd78" ON "job_preset_upwork_job_search_criterion" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5ca48cfacfb516543d6507ca4" ON "job_preset_upwork_job_search_criterion" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e210f70c3904cf84ab5113be8f"`); + await queryRunner.query(`DROP INDEX "IDX_46226c3185e3ca3d7033831d7a"`); + await queryRunner.query(`DROP INDEX "IDX_7e53ea80aca15da11a8a5ec038"`); + await queryRunner.query(`DROP INDEX "IDX_a4b038417e3221c0791dd8c771"`); + await queryRunner.query(`DROP INDEX "IDX_f2c1b6770dd2a3abfa35f49411"`); + await queryRunner.query(`ALTER TABLE "job_preset" RENAME TO "temporary_job_preset"`); + await queryRunner.query( + `CREATE TABLE "job_preset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a4b038417e3221c0791dd8c7714" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e53ea80aca15da11a8a5ec0380" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "job_preset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_job_preset"` + ); + await queryRunner.query(`DROP TABLE "temporary_job_preset"`); + await queryRunner.query(`CREATE INDEX "IDX_e210f70c3904cf84ab5113be8f" ON "job_preset" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_46226c3185e3ca3d7033831d7a" ON "job_preset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_7e53ea80aca15da11a8a5ec038" ON "job_preset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_a4b038417e3221c0791dd8c771" ON "job_preset" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f2c1b6770dd2a3abfa35f49411" ON "job_preset" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_0e130a25bb4abe1b27c8a0adf4"`); + await queryRunner.query(`DROP INDEX "IDX_6bae61744663a416e73903d9af"`); + await queryRunner.query(`DROP INDEX "IDX_afe6c40d3d9951388fa05f83f2"`); + await queryRunner.query(`DROP INDEX "IDX_630337302efe97cc93deeb2151"`); + await queryRunner.query( + `ALTER TABLE "employee_upwork_job_search_criterion" RENAME TO "temporary_employee_upwork_job_search_criterion"` + ); + await queryRunner.query( + `CREATE TABLE "employee_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar, "employeeId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d2b148ddd67e520fb8061f4c133" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b6bcd5ceb60e4bb493344a6b4f2" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c872e6e3ab28e813c2324d1f4fb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_2dc73e07ac7040f273cea3c999d" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_630337302efe97cc93deeb21516" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_afe6c40d3d9951388fa05f83f28" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_upwork_job_search_criterion"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_upwork_job_search_criterion"`); + await queryRunner.query( + `CREATE INDEX "IDX_0e130a25bb4abe1b27c8a0adf4" ON "employee_upwork_job_search_criterion" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6bae61744663a416e73903d9af" ON "employee_upwork_job_search_criterion" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_afe6c40d3d9951388fa05f83f2" ON "employee_upwork_job_search_criterion" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_630337302efe97cc93deeb2151" ON "employee_upwork_job_search_criterion" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_015231c6e28cfb2b789ca4b76f"`); + await queryRunner.query(`DROP INDEX "IDX_36333846c37e5f8812a5c9f7ff"`); + await queryRunner.query(`DROP INDEX "IDX_6ee5218c869b57197e4a209bed"`); + await queryRunner.query(`DROP INDEX "IDX_d0a798419c775b9157bf0269f4"`); + await queryRunner.query(`DROP INDEX "IDX_3b335bbcbf7d5e00853acaa165"`); + await queryRunner.query(`DROP INDEX "IDX_86381fb6d28978b101b3aec8ca"`); + await queryRunner.query(`DROP INDEX "IDX_35e120f2b6e5188391cf068d3b"`); + await queryRunner.query(`ALTER TABLE "job_search_category" RENAME TO "temporary_job_search_category"`); + await queryRunner.query( + `CREATE TABLE "job_search_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceCategoryId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_35e120f2b6e5188391cf068d3ba" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86381fb6d28978b101b3aec8ca4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "job_search_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "temporary_job_search_category"` + ); + await queryRunner.query(`DROP TABLE "temporary_job_search_category"`); + await queryRunner.query( + `CREATE INDEX "IDX_015231c6e28cfb2b789ca4b76f" ON "job_search_category" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_36333846c37e5f8812a5c9f7ff" ON "job_search_category" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_6ee5218c869b57197e4a209bed" ON "job_search_category" ("jobSource") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0a798419c775b9157bf0269f4" ON "job_search_category" ("jobSourceCategoryId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3b335bbcbf7d5e00853acaa165" ON "job_search_category" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_86381fb6d28978b101b3aec8ca" ON "job_search_category" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_35e120f2b6e5188391cf068d3b" ON "job_search_category" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_e4bc75a1cbb07d117a0acfcdba"`); + await queryRunner.query(`DROP INDEX "IDX_4b8450a24233df8b47ca472923"`); + await queryRunner.query(`DROP INDEX "IDX_c8723c90a6f007f8d7e882a04f"`); + await queryRunner.query(`DROP INDEX "IDX_cb64573b18dd7b23f591f15502"`); + await queryRunner.query(`DROP INDEX "IDX_9f1288205ae91f91cf356cac2f"`); + await queryRunner.query(`DROP INDEX "IDX_1a62a99e1016e4a2b461e886ec"`); + await queryRunner.query(`DROP INDEX "IDX_44e22d88b47daf2095491b7cac"`); + await queryRunner.query(`ALTER TABLE "job_search_occupation" RENAME TO "temporary_job_search_occupation"`); + await queryRunner.query( + `CREATE TABLE "job_search_occupation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceOccupationId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_44e22d88b47daf2095491b7cac3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1a62a99e1016e4a2b461e886ecd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "job_search_occupation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "temporary_job_search_occupation"` + ); + await queryRunner.query(`DROP TABLE "temporary_job_search_occupation"`); + await queryRunner.query( + `CREATE INDEX "IDX_e4bc75a1cbb07d117a0acfcdba" ON "job_search_occupation" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4b8450a24233df8b47ca472923" ON "job_search_occupation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c8723c90a6f007f8d7e882a04f" ON "job_search_occupation" ("jobSource") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cb64573b18dd7b23f591f15502" ON "job_search_occupation" ("jobSourceOccupationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9f1288205ae91f91cf356cac2f" ON "job_search_occupation" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_1a62a99e1016e4a2b461e886ec" ON "job_search_occupation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_44e22d88b47daf2095491b7cac" ON "job_search_occupation" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e396663e1a31114eac39087829"`); + await queryRunner.query(`DROP INDEX "IDX_2bb17670e2bea3980ff960bbcf"`); + await queryRunner.query(`DROP INDEX "IDX_f577c9bc6183c1d1eae1e154bb"`); + await queryRunner.query(`DROP INDEX "IDX_ee780fbd8f91de31c004929eec"`); + await queryRunner.query(`DROP INDEX "IDX_dc2ff85f7de16dea6453a833dd"`); + await queryRunner.query(`DROP INDEX "IDX_0111963c9cb4dd14565c0d9c84"`); + await queryRunner.query(`DROP INDEX "IDX_a13f3564eae9db44ddc4308afc"`); + await queryRunner.query(`DROP INDEX "IDX_2be728a7f8b118712a4200990d"`); + await queryRunner.query( + `ALTER TABLE "employee_proposal_template" RENAME TO "temporary_employee_proposal_template"` + ); + await queryRunner.query( + `CREATE TABLE "employee_proposal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "content" text, "isDefault" boolean NOT NULL DEFAULT (0), "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2be728a7f8b118712a4200990d4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ee780fbd8f91de31c004929eecb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f577c9bc6183c1d1eae1e154bbc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_proposal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_proposal_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_proposal_template"`); + await queryRunner.query( + `CREATE INDEX "IDX_e396663e1a31114eac39087829" ON "employee_proposal_template" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2bb17670e2bea3980ff960bbcf" ON "employee_proposal_template" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f577c9bc6183c1d1eae1e154bb" ON "employee_proposal_template" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ee780fbd8f91de31c004929eec" ON "employee_proposal_template" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_dc2ff85f7de16dea6453a833dd" ON "employee_proposal_template" ("name") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0111963c9cb4dd14565c0d9c84" ON "employee_proposal_template" ("content") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a13f3564eae9db44ddc4308afc" ON "employee_proposal_template" ("isDefault") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2be728a7f8b118712a4200990d" ON "employee_proposal_template" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e2836e856f491dd4676e1ec8d3"`); + await queryRunner.query(`DROP INDEX "IDX_61a30a7d83666bf265fd86a72d"`); + await queryRunner.query(`DROP INDEX "IDX_4177329f5e6ddbfb6416592713"`); + await queryRunner.query(`DROP INDEX "IDX_d59ec6899d435f430799795ad7"`); + await queryRunner.query(`DROP INDEX "IDX_cc28a54171231fbd9a127051f0"`); + await queryRunner.query(`ALTER TABLE "proposal" RENAME TO "temporary_proposal"`); + await queryRunner.query( + `CREATE TABLE "proposal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPostUrl" varchar, "valueDate" datetime, "jobPostContent" varchar NOT NULL, "proposalContent" varchar NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_61c45ab51852e4b0e539756d40f" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f399488a0f3ea10bb511e3f5aa3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d59ec6899d435f430799795ad7b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4177329f5e6ddbfb64165927134" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "proposal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_proposal"` + ); + await queryRunner.query(`DROP TABLE "temporary_proposal"`); + await queryRunner.query(`CREATE INDEX "IDX_e2836e856f491dd4676e1ec8d3" ON "proposal" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_61a30a7d83666bf265fd86a72d" ON "proposal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4177329f5e6ddbfb6416592713" ON "proposal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d59ec6899d435f430799795ad7" ON "proposal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_cc28a54171231fbd9a127051f0" ON "proposal" ("jobPostUrl") `); + await queryRunner.query(`DROP INDEX "IDX_d706210d377ece2a1bc3386388"`); + await queryRunner.query(`DROP INDEX "IDX_c774c276d6b7ea05a7e12d3c81"`); + await queryRunner.query(`DROP INDEX "IDX_b3234be5b70c2362cdf67bb188"`); + await queryRunner.query(`DROP INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b"`); + await queryRunner.query(`DROP INDEX "IDX_055f310a04a928343494a5255a"`); + await queryRunner.query(`DROP INDEX "IDX_a8709a9c5cc142c6fbe92df274"`); + await queryRunner.query(`DROP INDEX "IDX_5065401113abb6e9608225e567"`); + await queryRunner.query( + `ALTER TABLE "organization_github_repository_issue" RENAME TO "temporary_organization_github_repository_issue"` + ); + await queryRunner.query( + `CREATE TABLE "organization_github_repository_issue" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "issueId" bigint NOT NULL, "issueNumber" integer NOT NULL, "repositoryId" varchar, "deletedAt" datetime, CONSTRAINT "FK_5065401113abb6e9608225e5678" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6c8e119fc6a2a7d3413aa76d3bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3234be5b70c2362cdf67bb1889" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_github_repository_issue"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt" FROM "temporary_organization_github_repository_issue"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_github_repository_issue"`); + await queryRunner.query( + `CREATE INDEX "IDX_d706210d377ece2a1bc3386388" ON "organization_github_repository_issue" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c774c276d6b7ea05a7e12d3c81" ON "organization_github_repository_issue" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b3234be5b70c2362cdf67bb188" ON "organization_github_repository_issue" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b" ON "organization_github_repository_issue" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_055f310a04a928343494a5255a" ON "organization_github_repository_issue" ("issueId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a8709a9c5cc142c6fbe92df274" ON "organization_github_repository_issue" ("issueNumber") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5065401113abb6e9608225e567" ON "organization_github_repository_issue" ("repositoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_59407d03d189560ac1a0a4b0eb"`); + await queryRunner.query(`DROP INDEX "IDX_2eec784cadcb7847b64937fb58"`); + await queryRunner.query(`DROP INDEX "IDX_34c48d11eb82ef42e89370bdc7"`); + await queryRunner.query(`DROP INDEX "IDX_04717f25bea7d9cef0d51cac50"`); + await queryRunner.query(`DROP INDEX "IDX_5e97728cfda96f49cc7f95bbaf"`); + await queryRunner.query(`DROP INDEX "IDX_ef65338e8597b9f56fd0fe3c94"`); + await queryRunner.query(`DROP INDEX "IDX_480158f21938444e4f62fb3185"`); + await queryRunner.query(`DROP INDEX "IDX_69d75a47af6bfcda545a865691"`); + await queryRunner.query(`DROP INDEX "IDX_ca0fa80f50baed7287a499dc2c"`); + await queryRunner.query(`DROP INDEX "IDX_6eea42a69e130bbd14b7ea3659"`); + await queryRunner.query(`DROP INDEX "IDX_a146e202c19f521bf5ec69bb26"`); + await queryRunner.query(`DROP INDEX "IDX_9e8a77c1d330554fab9230100a"`); + await queryRunner.query(`DROP INDEX "IDX_add7dbec156589dd0b27e2e0c4"`); + await queryRunner.query( + `ALTER TABLE "organization_github_repository" RENAME TO "temporary_organization_github_repository"` + ); + await queryRunner.query( + `CREATE TABLE "organization_github_repository" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "repositoryId" bigint NOT NULL, "name" varchar NOT NULL, "fullName" varchar NOT NULL, "owner" varchar NOT NULL, "integrationId" varchar, "issuesCount" integer, "hasSyncEnabled" boolean DEFAULT (1), "private" boolean DEFAULT (0), "status" varchar, "deletedAt" datetime, CONSTRAINT "FK_add7dbec156589dd0b27e2e0c49" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_69d75a47af6bfcda545a865691b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_480158f21938444e4f62fb31857" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_github_repository"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt" FROM "temporary_organization_github_repository"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_github_repository"`); + await queryRunner.query( + `CREATE INDEX "IDX_59407d03d189560ac1a0a4b0eb" ON "organization_github_repository" ("status") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2eec784cadcb7847b64937fb58" ON "organization_github_repository" ("private") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_34c48d11eb82ef42e89370bdc7" ON "organization_github_repository" ("hasSyncEnabled") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_04717f25bea7d9cef0d51cac50" ON "organization_github_repository" ("issuesCount") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5e97728cfda96f49cc7f95bbaf" ON "organization_github_repository" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ef65338e8597b9f56fd0fe3c94" ON "organization_github_repository" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_480158f21938444e4f62fb3185" ON "organization_github_repository" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_69d75a47af6bfcda545a865691" ON "organization_github_repository" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ca0fa80f50baed7287a499dc2c" ON "organization_github_repository" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6eea42a69e130bbd14b7ea3659" ON "organization_github_repository" ("name") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a146e202c19f521bf5ec69bb26" ON "organization_github_repository" ("fullName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9e8a77c1d330554fab9230100a" ON "organization_github_repository" ("owner") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_add7dbec156589dd0b27e2e0c4" ON "organization_github_repository" ("integrationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_cbc2b8338d45e774afd8682ffe"`); + await queryRunner.query(`DROP INDEX "IDX_cc89233c87fcf64b01df07e038"`); + await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); + await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); + await queryRunner.query(`ALTER TABLE "changelog" RENAME TO "temporary_changelog"`); + await queryRunner.query( + `CREATE TABLE "changelog" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "title" varchar, "date" datetime NOT NULL, "content" varchar NOT NULL, "learnMoreUrl" varchar, "isFeature" boolean, "imageUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_744268ee0ec6073883267bc3b66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c2037b621d2e8023898aee4ac74" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "changelog"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt" FROM "temporary_changelog"` + ); + await queryRunner.query(`DROP TABLE "temporary_changelog"`); + await queryRunner.query(`CREATE INDEX "IDX_cbc2b8338d45e774afd8682ffe" ON "changelog" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_cc89233c87fcf64b01df07e038" ON "changelog" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_835691d3dd62d0b705302cbb2d"`); + await queryRunner.query(`DROP INDEX "IDX_ee85901ae866ffe2061d5b35c8"`); + await queryRunner.query(`DROP INDEX "IDX_84594016a98da8b87e0f51cd93"`); + await queryRunner.query(`DROP INDEX "IDX_f502dc6d9802306f9d1584932b"`); + await queryRunner.query(`DROP INDEX "IDX_f5735eafddabdb4b20f621a976"`); + await queryRunner.query(`DROP INDEX "IDX_9b2f00761a6b1b77cb6289e3ff"`); + await queryRunner.query(`ALTER TABLE "warehouse" RENAME TO "temporary_warehouse"`); + await queryRunner.query( + `CREATE TABLE "warehouse" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "logoId" varchar, "contactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_84594016a98da8b87e0f51cd93" UNIQUE ("contactId"), CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f502dc6d9802306f9d1584932b8" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f5735eafddabdb4b20f621a976a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9b2f00761a6b1b77cb6289e3fff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "warehouse"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse"` + ); + await queryRunner.query(`DROP TABLE "temporary_warehouse"`); + await queryRunner.query(`CREATE INDEX "IDX_835691d3dd62d0b705302cbb2d" ON "warehouse" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_ee85901ae866ffe2061d5b35c8" ON "warehouse" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_84594016a98da8b87e0f51cd93" ON "warehouse" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_f502dc6d9802306f9d1584932b" ON "warehouse" ("logoId") `); + await queryRunner.query(`CREATE INDEX "IDX_f5735eafddabdb4b20f621a976" ON "warehouse" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_9b2f00761a6b1b77cb6289e3ff" ON "warehouse" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_40aa52eaed1ce133f5fee76bca"`); + await queryRunner.query(`DROP INDEX "IDX_5f32a52e9bd19bf323b02efcd1"`); + await queryRunner.query(`DROP INDEX "IDX_617306cb3613dd8d59301ae16f"`); + await queryRunner.query(`DROP INDEX "IDX_a2f863689d1316810c41c1ea38"`); + await queryRunner.query(`DROP INDEX "IDX_a1c4a97b928b547c3041d3ac1f"`); + await queryRunner.query(`DROP INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed"`); + await queryRunner.query( + `ALTER TABLE "warehouse_product_variant" RENAME TO "temporary_warehouse_product_variant"` + ); + await queryRunner.query( + `CREATE TABLE "warehouse_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "variantId" varchar NOT NULL, "warehouseProductId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d5f4b64e6a80546fd6dd4ac3ed0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a1c4a97b928b547c3041d3ac1f6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2f863689d1316810c41c1ea38e" FOREIGN KEY ("variantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_617306cb3613dd8d59301ae16fd" FOREIGN KEY ("warehouseProductId") REFERENCES "warehouse_product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "warehouse_product_variant"("id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse_product_variant"` + ); + await queryRunner.query(`DROP TABLE "temporary_warehouse_product_variant"`); + await queryRunner.query( + `CREATE INDEX "IDX_40aa52eaed1ce133f5fee76bca" ON "warehouse_product_variant" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f32a52e9bd19bf323b02efcd1" ON "warehouse_product_variant" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_617306cb3613dd8d59301ae16f" ON "warehouse_product_variant" ("warehouseProductId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a2f863689d1316810c41c1ea38" ON "warehouse_product_variant" ("variantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a1c4a97b928b547c3041d3ac1f" ON "warehouse_product_variant" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed" ON "warehouse_product_variant" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3370818c940a51996d80bb4d16"`); + await queryRunner.query(`DROP INDEX "IDX_7a584a02d15a022e9c4f06ea72"`); + await queryRunner.query(`DROP INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7"`); + await queryRunner.query(`DROP INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb"`); + await queryRunner.query(`DROP INDEX "IDX_62573a939f834f2de343f98288"`); + await queryRunner.query(`DROP INDEX "IDX_c899e17322d11e1977832e8c65"`); + await queryRunner.query(`ALTER TABLE "warehouse_product" RENAME TO "temporary_warehouse_product"`); + await queryRunner.query( + `CREATE TABLE "warehouse_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "warehouseId" varchar NOT NULL, "productId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3f934c4772e7c7f2c66d7ea4e72" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a8c9aee14d47ec7b3f2ac429ebc" FOREIGN KEY ("warehouseId") REFERENCES "warehouse" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c899e17322d11e1977832e8c656" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_62573a939f834f2de343f98288c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "warehouse_product"("id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse_product"` + ); + await queryRunner.query(`DROP TABLE "temporary_warehouse_product"`); + await queryRunner.query(`CREATE INDEX "IDX_3370818c940a51996d80bb4d16" ON "warehouse_product" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_7a584a02d15a022e9c4f06ea72" ON "warehouse_product" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7" ON "warehouse_product" ("productId") `); + await queryRunner.query( + `CREATE INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb" ON "warehouse_product" ("warehouseId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_62573a939f834f2de343f98288" ON "warehouse_product" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_c899e17322d11e1977832e8c65" ON "warehouse_product" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_557cb712d32a9ad9ffbb4cd50d"`); + await queryRunner.query(`DROP INDEX "IDX_fde2ce12ab12b02ae583dd76c7"`); + await queryRunner.query(`DROP INDEX "IDX_5e028298e103e1694147ada69e"`); + await queryRunner.query(`DROP INDEX "IDX_f2578043e491921209f5dadd08"`); + await queryRunner.query(`DROP INDEX "IDX_c28e52f758e7bbc53828db9219"`); + await queryRunner.query(`DROP INDEX "IDX_78a916df40e02a9deb1c4b75ed"`); + await queryRunner.query(`DROP INDEX "IDX_e12875dfb3b1d92d7d7c5377e2"`); + await queryRunner.query(`DROP INDEX "IDX_f0e1b4ecdca13b177e2e3a0613"`); + await queryRunner.query(`DROP INDEX "IDX_58e4dbff0e1a32a9bdc861bb29"`); + await queryRunner.query(`DROP INDEX "IDX_19de43e9f1842360ce646253d7"`); + await queryRunner.query(`DROP INDEX "IDX_685bf353c85f23b6f848e4dcde"`); + await queryRunner.query(`DROP INDEX "IDX_1a8ae1126aae1823d62ccf3f82"`); + await queryRunner.query(`DROP INDEX "IDX_5864814596f85fe59bd1a0dc76"`); + await queryRunner.query(`DROP INDEX "IDX_0e9f745ad08103a1c21523326c"`); + await queryRunner.query(`DROP INDEX "IDX_f725c3df76a1a94e3e9f0313a5"`); + await queryRunner.query(`ALTER TABLE "user" RENAME TO "temporary_user"`); + await queryRunner.query( + `CREATE TABLE "user" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "thirdPartyId" varchar, "firstName" varchar, "lastName" varchar, "email" varchar, "username" varchar, "hash" varchar, "imageUrl" varchar(500), "preferredLanguage" varchar DEFAULT ('en'), "preferredComponentLayout" varchar CHECK( "preferredComponentLayout" IN ('CARDS_GRID','TABLE') ) DEFAULT ('TABLE'), "roleId" varchar, "refreshToken" varchar, "isActive" boolean DEFAULT (1), "code" varchar, "codeExpireAt" datetime, "emailVerifiedAt" datetime, "emailToken" varchar, "phoneNumber" varchar, "timeZone" varchar, "imageId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "timeFormat" varchar CHECK( "timeFormat" IN ('12','24') ) NOT NULL DEFAULT (12), "lastLoginAt" datetime, "defaultTeamId" varchar, "lastTeamId" varchar, "defaultOrganizationId" varchar, "lastOrganizationId" varchar, CONSTRAINT "FK_f725c3df76a1a94e3e9f0313a5f" FOREIGN KEY ("lastOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0e9f745ad08103a1c21523326c6" FOREIGN KEY ("defaultOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5864814596f85fe59bd1a0dc766" FOREIGN KEY ("lastTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1a8ae1126aae1823d62ccf3f821" FOREIGN KEY ("defaultTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c28e52f758e7bbc53828db92194" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_685bf353c85f23b6f848e4dcded" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e028298e103e1694147ada69e5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "user"("id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId") SELECT "id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId" FROM "temporary_user"` + ); + await queryRunner.query(`DROP TABLE "temporary_user"`); + await queryRunner.query(`CREATE INDEX "IDX_557cb712d32a9ad9ffbb4cd50d" ON "user" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_fde2ce12ab12b02ae583dd76c7" ON "user" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_5e028298e103e1694147ada69e" ON "user" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_f2578043e491921209f5dadd08" ON "user" ("phoneNumber") `); + await queryRunner.query(`CREATE INDEX "IDX_c28e52f758e7bbc53828db9219" ON "user" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_78a916df40e02a9deb1c4b75ed" ON "user" ("username") `); + await queryRunner.query(`CREATE INDEX "IDX_e12875dfb3b1d92d7d7c5377e2" ON "user" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_f0e1b4ecdca13b177e2e3a0613" ON "user" ("lastName") `); + await queryRunner.query(`CREATE INDEX "IDX_58e4dbff0e1a32a9bdc861bb29" ON "user" ("firstName") `); + await queryRunner.query(`CREATE INDEX "IDX_19de43e9f1842360ce646253d7" ON "user" ("thirdPartyId") `); + await queryRunner.query(`CREATE INDEX "IDX_685bf353c85f23b6f848e4dcde" ON "user" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_1a8ae1126aae1823d62ccf3f82" ON "user" ("defaultTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_5864814596f85fe59bd1a0dc76" ON "user" ("lastTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_0e9f745ad08103a1c21523326c" ON "user" ("defaultOrganizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_f725c3df76a1a94e3e9f0313a5" ON "user" ("lastOrganizationId") `); + await queryRunner.query(`DROP INDEX "IDX_c764336019c69cc4927f317cb0"`); + await queryRunner.query(`DROP INDEX "IDX_611e1392c8cc9b101e3ea7ad80"`); + await queryRunner.query(`DROP INDEX "IDX_7143f31467178a6164a42426c1"`); + await queryRunner.query(`DROP INDEX "IDX_1f97ff07fb198bd0a7786b2abd"`); + await queryRunner.query(`DROP INDEX "IDX_ca24fc59aac015d9660955f5f6"`); + await queryRunner.query(`DROP INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5"`); + await queryRunner.query(`ALTER TABLE "user_organization" RENAME TO "temporary_user_organization"`); + await queryRunner.query( + `CREATE TABLE "user_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isDefault" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "userId" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_29c3c8cc3ea9db22e4a347f4b5a" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7143f31467178a6164a42426c15" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_611e1392c8cc9b101e3ea7ad80c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "user_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt" FROM "temporary_user_organization"` + ); + await queryRunner.query(`DROP TABLE "temporary_user_organization"`); + await queryRunner.query(`CREATE INDEX "IDX_c764336019c69cc4927f317cb0" ON "user_organization" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_611e1392c8cc9b101e3ea7ad80" ON "user_organization" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7143f31467178a6164a42426c1" ON "user_organization" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1f97ff07fb198bd0a7786b2abd" ON "user_organization" ("isDefault") `); + await queryRunner.query(`CREATE INDEX "IDX_ca24fc59aac015d9660955f5f6" ON "user_organization" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5" ON "user_organization" ("userId") `); + await queryRunner.query(`DROP INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff"`); + await queryRunner.query(`DROP INDEX "IDX_42205a9e6af108364e5cc62dd4"`); + await queryRunner.query(`DROP INDEX "IDX_6c1f81934a3f597b3b1a17f562"`); + await queryRunner.query(`DROP INDEX "IDX_8c8f821cb0fe0dd387491ea7d9"`); + await queryRunner.query(`DROP INDEX "IDX_aca65a79fe0c1ec9e6a59022c5"`); + await queryRunner.query(`DROP INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7"`); + await queryRunner.query(`DROP INDEX "IDX_930e2b28de9ecb1ea689d5a97a"`); + await queryRunner.query(`DROP INDEX "IDX_f6558fbb3158ab90da1c41d943"`); + await queryRunner.query(`DROP INDEX "IDX_6a79eb7534066b11f59243ede1"`); + await queryRunner.query(`DROP INDEX "IDX_3f8fc4b5718fcaa913f9438e27"`); + await queryRunner.query(`DROP INDEX "IDX_3502c60f98a7cda58dea75bcb5"`); + await queryRunner.query(`DROP INDEX "IDX_c828facbb4250117f83416d9f7"`); + await queryRunner.query(`DROP INDEX "IDX_23fdffa8369387d87101090684"`); + await queryRunner.query(`DROP INDEX "IDX_ea81b5247ecdf5d82cf71fa096"`); + await queryRunner.query(`ALTER TABLE "timesheet" RENAME TO "temporary_timesheet"`); + await queryRunner.query( + `CREATE TABLE "timesheet" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime, "stoppedAt" datetime, "approvedAt" datetime, "submittedAt" datetime, "lockedAt" datetime, "isBilled" boolean NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('PENDING'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "approvedById" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, CONSTRAINT "FK_6c1f81934a3f597b3b1a17f5623" FOREIGN KEY ("approvedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_25b8df69c9b7f5752c6a6a6ef7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aca65a79fe0c1ec9e6a59022c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8c8f821cb0fe0dd387491ea7d9e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "timesheet"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt" FROM "temporary_timesheet"` + ); + await queryRunner.query(`DROP TABLE "temporary_timesheet"`); + await queryRunner.query(`CREATE INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff" ON "timesheet" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_42205a9e6af108364e5cc62dd4" ON "timesheet" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6c1f81934a3f597b3b1a17f562" ON "timesheet" ("approvedById") `); + await queryRunner.query(`CREATE INDEX "IDX_8c8f821cb0fe0dd387491ea7d9" ON "timesheet" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_aca65a79fe0c1ec9e6a59022c5" ON "timesheet" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7" ON "timesheet" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_930e2b28de9ecb1ea689d5a97a" ON "timesheet" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_f6558fbb3158ab90da1c41d943" ON "timesheet" ("stoppedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_6a79eb7534066b11f59243ede1" ON "timesheet" ("approvedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_3f8fc4b5718fcaa913f9438e27" ON "timesheet" ("submittedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_3502c60f98a7cda58dea75bcb5" ON "timesheet" ("lockedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_c828facbb4250117f83416d9f7" ON "timesheet" ("isBilled") `); + await queryRunner.query(`CREATE INDEX "IDX_23fdffa8369387d87101090684" ON "timesheet" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_ea81b5247ecdf5d82cf71fa096" ON "timesheet" ("editedAt") `); + await queryRunner.query(`DROP INDEX "IDX_a3eeb9629f550c367bb752855e"`); + await queryRunner.query(`DROP INDEX "IDX_8260fdc7862ca27d8cf10e6290"`); + await queryRunner.query(`DROP INDEX "IDX_c7f72cb68b22b8ab988158e4d2"`); + await queryRunner.query(`DROP INDEX "IDX_82c5edbd179359212f16f0d386"`); + await queryRunner.query(`DROP INDEX "IDX_9272701d3da8bd8507f316c915"`); + await queryRunner.query(`ALTER TABLE "time_slot_minute" RENAME TO "temporary_time_slot_minute"`); + await queryRunner.query( + `CREATE TABLE "time_slot_minute" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "datetime" datetime NOT NULL, "timeSlotId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_0ac1d2777eefcee82db52ca3660" UNIQUE ("timeSlotId", "datetime"), CONSTRAINT "FK_9272701d3da8bd8507f316c9154" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_82c5edbd179359212f16f0d386a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_c7f72cb68b22b8ab988158e4d26" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "time_slot_minute"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt" FROM "temporary_time_slot_minute"` + ); + await queryRunner.query(`DROP TABLE "temporary_time_slot_minute"`); + await queryRunner.query(`CREATE INDEX "IDX_a3eeb9629f550c367bb752855e" ON "time_slot_minute" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_8260fdc7862ca27d8cf10e6290" ON "time_slot_minute" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_c7f72cb68b22b8ab988158e4d2" ON "time_slot_minute" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_82c5edbd179359212f16f0d386" ON "time_slot_minute" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9272701d3da8bd8507f316c915" ON "time_slot_minute" ("timeSlotId") `); + await queryRunner.query(`DROP INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5"`); + await queryRunner.query(`DROP INDEX "IDX_645a6bc3f1141d4a111a3166d8"`); + await queryRunner.query(`DROP INDEX "IDX_b407841271245501dd1a8c7551"`); + await queryRunner.query(`DROP INDEX "IDX_b8284109257b5137256b5b3e84"`); + await queryRunner.query(`DROP INDEX "IDX_0c707825a7c2ecc4e186b07ebf"`); + await queryRunner.query(`DROP INDEX "IDX_f44e721669d5c6bed32cd6a3bf"`); + await queryRunner.query(`DROP INDEX "IDX_c6e7d1075bfd97eea6643b1479"`); + await queryRunner.query(`DROP INDEX "IDX_7913305b850c7afc89b6ed96a3"`); + await queryRunner.query(`ALTER TABLE "time_slot" RENAME TO "temporary_time_slot"`); + await queryRunner.query( + `CREATE TABLE "time_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7913305b850c7afc89b6ed96a30" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b8284109257b5137256b5b3e848" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b407841271245501dd1a8c75513" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "time_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_time_slot"` + ); + await queryRunner.query(`DROP TABLE "temporary_time_slot"`); + await queryRunner.query(`CREATE INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5" ON "time_slot" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_645a6bc3f1141d4a111a3166d8" ON "time_slot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_b407841271245501dd1a8c7551" ON "time_slot" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_b8284109257b5137256b5b3e84" ON "time_slot" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_0c707825a7c2ecc4e186b07ebf" ON "time_slot" ("duration") `); + await queryRunner.query(`CREATE INDEX "IDX_f44e721669d5c6bed32cd6a3bf" ON "time_slot" ("overall") `); + await queryRunner.query(`CREATE INDEX "IDX_c6e7d1075bfd97eea6643b1479" ON "time_slot" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_7913305b850c7afc89b6ed96a3" ON "time_slot" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_91a64228fbbe1516730a0cab5d"`); + await queryRunner.query(`DROP INDEX "IDX_a1910a76044b971609b75ea165"`); + await queryRunner.query(`DROP INDEX "IDX_79001d281ecb766005b3d331c1"`); + await queryRunner.query(`DROP INDEX "IDX_f447474d185cd70b3015853874"`); + await queryRunner.query(`DROP INDEX "IDX_722b9cb3a991c964d86396b6bc"`); + await queryRunner.query(`DROP INDEX "IDX_402290e7045e0c10ef97d9f982"`); + await queryRunner.query(`DROP INDEX "IDX_e80fb588b1086ce2a4f2244814"`); + await queryRunner.query(`DROP INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec"`); + await queryRunner.query(`DROP INDEX "IDX_189b79acd611870aba62b3594e"`); + await queryRunner.query(`DROP INDEX "IDX_fa9018cb248ea0f3b2b30ef143"`); + await queryRunner.query(`DROP INDEX "IDX_aed2d5cc5680fba9d387c7f931"`); + await queryRunner.query(`DROP INDEX "IDX_a89a849957e005bafb8e4220bc"`); + await queryRunner.query(`DROP INDEX "IDX_e65393bb52aa8275b1392c73f7"`); + await queryRunner.query(`DROP INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5"`); + await queryRunner.query(`DROP INDEX "IDX_1ddf2da35e34378fd845d80a18"`); + await queryRunner.query(`DROP INDEX "IDX_d1e8f22c02c5e949453dde7f2d"`); + await queryRunner.query(`DROP INDEX "IDX_18dcdf754396f0cb0308dc91f4"`); + await queryRunner.query(`DROP INDEX "IDX_154e9120e2acb632d8bd9b91ff"`); + await queryRunner.query(`ALTER TABLE "time_log" RENAME TO "temporary_time_log"`); + await queryRunner.query( + `CREATE TABLE "time_log" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startedAt" datetime, "stoppedAt" datetime, "logType" varchar NOT NULL DEFAULT ('TRACKED'), "source" varchar NOT NULL DEFAULT ('BROWSER'), "description" varchar, "reason" varchar, "isBillable" boolean NOT NULL DEFAULT (0), "deletedAt" datetime, "employeeId" varchar NOT NULL, "timesheetId" varchar, "projectId" varchar, "taskId" varchar, "organizationContactId" varchar, "isRunning" boolean, "version" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, CONSTRAINT "FK_18dcdf754396f0cb0308dc91f4c" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d1e8f22c02c5e949453dde7f2d1" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1ddf2da35e34378fd845d80a18b" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_54776f6f5fd3c13c3bc1fbfac5b" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e65393bb52aa8275b1392c73f72" FOREIGN KEY ("timesheetId") REFERENCES "timesheet" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aed2d5cc5680fba9d387c7f931d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa9018cb248ea0f3b2b30ef143b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a89a849957e005bafb8e4220bc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "time_log"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt" FROM "temporary_time_log"` + ); + await queryRunner.query(`DROP TABLE "temporary_time_log"`); + await queryRunner.query(`CREATE INDEX "IDX_91a64228fbbe1516730a0cab5d" ON "time_log" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_a1910a76044b971609b75ea165" ON "time_log" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_79001d281ecb766005b3d331c1" ON "time_log" ("version") `); + await queryRunner.query(`CREATE INDEX "IDX_f447474d185cd70b3015853874" ON "time_log" ("isRunning") `); + await queryRunner.query(`CREATE INDEX "IDX_722b9cb3a991c964d86396b6bc" ON "time_log" ("isBillable") `); + await queryRunner.query(`CREATE INDEX "IDX_402290e7045e0c10ef97d9f982" ON "time_log" ("source") `); + await queryRunner.query(`CREATE INDEX "IDX_e80fb588b1086ce2a4f2244814" ON "time_log" ("logType") `); + await queryRunner.query(`CREATE INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec" ON "time_log" ("stoppedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_189b79acd611870aba62b3594e" ON "time_log" ("startedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_fa9018cb248ea0f3b2b30ef143" ON "time_log" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_aed2d5cc5680fba9d387c7f931" ON "time_log" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_a89a849957e005bafb8e4220bc" ON "time_log" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_e65393bb52aa8275b1392c73f7" ON "time_log" ("timesheetId") `); + await queryRunner.query(`CREATE INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5" ON "time_log" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_1ddf2da35e34378fd845d80a18" ON "time_log" ("taskId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d1e8f22c02c5e949453dde7f2d" ON "time_log" ("organizationContactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_18dcdf754396f0cb0308dc91f4" ON "time_log" ("organizationTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_154e9120e2acb632d8bd9b91ff" ON "time_log" ("editedAt") `); + await queryRunner.query(`DROP INDEX "IDX_892e285e1da2b3e61e51e50628"`); + await queryRunner.query(`DROP INDEX "IDX_742688858e0484d66f04e4d4c4"`); + await queryRunner.query(`DROP INDEX "IDX_2b374e5cdee1145ebb2a832f20"`); + await queryRunner.query(`DROP INDEX "IDX_3d7feb5fe793e4811cdb79f983"`); + await queryRunner.query(`DROP INDEX "IDX_235004f3dafac90692cd64d915"`); + await queryRunner.query(`DROP INDEX "IDX_0951aacffe3f8d0cff54cf2f34"`); + await queryRunner.query(`DROP INDEX "IDX_5b594d02d98d5defcde323abe5"`); + await queryRunner.query(`DROP INDEX "IDX_fa1896dc735403799311968f7e"`); + await queryRunner.query(`DROP INDEX "IDX_1b0867d86ead2332f3d4edba7d"`); + await queryRunner.query(`DROP INDEX "IDX_eea7986acfb827bf5d0622c41f"`); + await queryRunner.query(`ALTER TABLE "screenshot" RENAME TO "temporary_screenshot"`); + await queryRunner.query( + `CREATE TABLE "screenshot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "file" varchar NOT NULL, "thumb" varchar, "recordedAt" datetime, "deletedAt" datetime, "timeSlotId" varchar, "storageProvider" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "isWorkRelated" boolean, "description" varchar, "apps" text, CONSTRAINT "FK_fa1896dc735403799311968f7ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b594d02d98d5defcde323abe5b" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0951aacffe3f8d0cff54cf2f341" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_235004f3dafac90692cd64d9158" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "screenshot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps" FROM "temporary_screenshot"` + ); + await queryRunner.query(`DROP TABLE "temporary_screenshot"`); + await queryRunner.query(`CREATE INDEX "IDX_892e285e1da2b3e61e51e50628" ON "screenshot" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_742688858e0484d66f04e4d4c4" ON "screenshot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_2b374e5cdee1145ebb2a832f20" ON "screenshot" ("storageProvider") `); + await queryRunner.query(`CREATE INDEX "IDX_3d7feb5fe793e4811cdb79f983" ON "screenshot" ("recordedAt") `); + await queryRunner.query(`CREATE INDEX "IDX_235004f3dafac90692cd64d915" ON "screenshot" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_0951aacffe3f8d0cff54cf2f34" ON "screenshot" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_5b594d02d98d5defcde323abe5" ON "screenshot" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_fa1896dc735403799311968f7e" ON "screenshot" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_1b0867d86ead2332f3d4edba7d" ON "screenshot" ("isWorkRelated") `); + await queryRunner.query(`CREATE INDEX "IDX_eea7986acfb827bf5d0622c41f" ON "screenshot" ("description") `); + await queryRunner.query(`DROP INDEX "IDX_d2d6db7f03da5632687e5d140e"`); + await queryRunner.query(`DROP INDEX "IDX_ae6ac57aafef59f561d4db3dd7"`); + await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); + await queryRunner.query(`DROP INDEX "IDX_fdb3f018c2bba4885bfa5757d1"`); + await queryRunner.query(`DROP INDEX "IDX_a6f74ae99d549932391f0f4460"`); + await queryRunner.query(`DROP INDEX "IDX_5a898f44fa31ef7916f0c38b01"`); + await queryRunner.query(`DROP INDEX "IDX_4e382caaf07ab0923b2e06bf91"`); + await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); + await queryRunner.query(`DROP INDEX "IDX_a28a1682ea80f10d1ecc7babaa"`); + await queryRunner.query(`DROP INDEX "IDX_302b60a4970ffe94d5223f1c23"`); + await queryRunner.query(`DROP INDEX "IDX_b5525385e85f7429e233d4a0fa"`); + await queryRunner.query(`DROP INDEX "IDX_f27285af15ef48363745ab2d79"`); + await queryRunner.query(`DROP INDEX "IDX_0e36a2c95e2f1df7f1b3059d24"`); + await queryRunner.query(`DROP INDEX "IDX_ffd736f18ba71b3221e4f835a9"`); + await queryRunner.query(`ALTER TABLE "activity" RENAME TO "temporary_activity"`); + await queryRunner.query( + `CREATE TABLE "activity" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" varchar, "metaData" text, "date" date, "time" time, "duration" integer NOT NULL DEFAULT (0), "type" varchar, "source" varchar NOT NULL DEFAULT ('BROWSER'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "projectId" varchar, "timeSlotId" varchar, "taskId" varchar, "recordedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), CONSTRAINT "FK_2743f8990fde12f9586287eb09f" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4e382caaf07ab0923b2e06bf918" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5a898f44fa31ef7916f0c38b016" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a6f74ae99d549932391f0f44609" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fdb3f018c2bba4885bfa5757d16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2401d8fdff5d8970dfe30d3aed" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "activity"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived" FROM "temporary_activity"` + ); + await queryRunner.query(`DROP TABLE "temporary_activity"`); + await queryRunner.query(`CREATE INDEX "IDX_d2d6db7f03da5632687e5d140e" ON "activity" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_ae6ac57aafef59f561d4db3dd7" ON "activity" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f2401d8fdff5d8970dfe30d3ae" ON "activity" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_fdb3f018c2bba4885bfa5757d1" ON "activity" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_a6f74ae99d549932391f0f4460" ON "activity" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_5a898f44fa31ef7916f0c38b01" ON "activity" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); + await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_a28a1682ea80f10d1ecc7babaa" ON "activity" ("title") `); + await queryRunner.query(`CREATE INDEX "IDX_302b60a4970ffe94d5223f1c23" ON "activity" ("date") `); + await queryRunner.query(`CREATE INDEX "IDX_b5525385e85f7429e233d4a0fa" ON "activity" ("time") `); + await queryRunner.query(`CREATE INDEX "IDX_f27285af15ef48363745ab2d79" ON "activity" ("type") `); + await queryRunner.query(`CREATE INDEX "IDX_0e36a2c95e2f1df7f1b3059d24" ON "activity" ("source") `); + await queryRunner.query(`CREATE INDEX "IDX_ffd736f18ba71b3221e4f835a9" ON "activity" ("recordedAt") `); + await queryRunner.query(`DROP INDEX "IDX_5ddef92c4694e6d650d9e557b3"`); + await queryRunner.query(`DROP INDEX "IDX_45e4bc4476681f4db2097cc2d5"`); + await queryRunner.query(`DROP INDEX "IDX_4989834dd1c9c8ea3576ed99ce"`); + await queryRunner.query(`DROP INDEX "IDX_981333982a6df8b815957dcbf2"`); + await queryRunner.query(`DROP INDEX "IDX_c1f8ae47dc2f1882afc5045c73"`); + await queryRunner.query(`DROP INDEX "IDX_c009cdd795be674c2047062374"`); + await queryRunner.query(`ALTER TABLE "time_off_request" RENAME TO "temporary_time_off_request"`); + await queryRunner.query( + `CREATE TABLE "time_off_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "documentUrl" varchar, "description" varchar, "start" datetime NOT NULL, "end" datetime NOT NULL, "requestDate" datetime NOT NULL, "status" varchar NOT NULL, "isHoliday" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "policyId" varchar NOT NULL, "documentId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "FK_c009cdd795be674c20470623742" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c1f8ae47dc2f1882afc5045c739" FOREIGN KEY ("policyId") REFERENCES "time_off_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_981333982a6df8b815957dcbf27" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4989834dd1c9c8ea3576ed99ce5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "time_off_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt" FROM "temporary_time_off_request"` + ); + await queryRunner.query(`DROP TABLE "temporary_time_off_request"`); + await queryRunner.query(`CREATE INDEX "IDX_5ddef92c4694e6d650d9e557b3" ON "time_off_request" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_45e4bc4476681f4db2097cc2d5" ON "time_off_request" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4989834dd1c9c8ea3576ed99ce" ON "time_off_request" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_981333982a6df8b815957dcbf2" ON "time_off_request" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c1f8ae47dc2f1882afc5045c73" ON "time_off_request" ("policyId") `); + await queryRunner.query(`CREATE INDEX "IDX_c009cdd795be674c2047062374" ON "time_off_request" ("documentId") `); + await queryRunner.query(`DROP INDEX "IDX_22d919e53cf5f6d836b18d407a"`); + await queryRunner.query(`DROP INDEX "IDX_cf9377d3bcb7cb996f72268941"`); + await queryRunner.query(`DROP INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1"`); + await queryRunner.query(`DROP INDEX "IDX_c2744cffeca55c3c9c52bb9789"`); + await queryRunner.query(`DROP INDEX "IDX_7d7f69c79df4a6f152b0e362b1"`); + await queryRunner.query(`ALTER TABLE "time_off_policy" RENAME TO "temporary_time_off_policy"`); + await queryRunner.query( + `CREATE TABLE "time_off_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "requiresApproval" boolean NOT NULL, "paid" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c2744cffeca55c3c9c52bb9789c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1c0ed84d54f8fbe4af10dfcda1c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "time_off_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt" FROM "temporary_time_off_policy"` + ); + await queryRunner.query(`DROP TABLE "temporary_time_off_policy"`); + await queryRunner.query(`CREATE INDEX "IDX_22d919e53cf5f6d836b18d407a" ON "time_off_policy" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_cf9377d3bcb7cb996f72268941" ON "time_off_policy" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1" ON "time_off_policy" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_c2744cffeca55c3c9c52bb9789" ON "time_off_policy" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_7d7f69c79df4a6f152b0e362b1" ON "time_off_policy" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_eeedffab85b3534a1068d9270f"`); + await queryRunner.query(`DROP INDEX "IDX_b8eb9f3e420aa846f30e291960"`); + await queryRunner.query(`DROP INDEX "IDX_56211336b5ff35fd944f225917"`); + await queryRunner.query(`DROP INDEX "IDX_d154d06dac0d0e0a5d9a083e25"`); + await queryRunner.query(`ALTER TABLE "tenant" RENAME TO "temporary_tenant"`); + await queryRunner.query( + `CREATE TABLE "tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "logo" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d154d06dac0d0e0a5d9a083e253" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "tenant"("id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_tenant"` + ); + await queryRunner.query(`DROP TABLE "temporary_tenant"`); + await queryRunner.query(`CREATE INDEX "IDX_eeedffab85b3534a1068d9270f" ON "tenant" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_b8eb9f3e420aa846f30e291960" ON "tenant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_d154d06dac0d0e0a5d9a083e25" ON "tenant" ("imageId") `); + await queryRunner.query(`DROP INDEX "IDX_a7500f9b1b7917bf10882c820e"`); + await queryRunner.query(`DROP INDEX "IDX_1d9975b98d82f385ae14b4d7c6"`); + await queryRunner.query(`DROP INDEX "IDX_affdab301e348b892175f30fa3"`); + await queryRunner.query(`ALTER TABLE "tenant_setting" RENAME TO "temporary_tenant_setting"`); + await queryRunner.query( + `CREATE TABLE "tenant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "value" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_affdab301e348b892175f30fa39" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "tenant_setting"("id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt" FROM "temporary_tenant_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_tenant_setting"`); + await queryRunner.query(`CREATE INDEX "IDX_a7500f9b1b7917bf10882c820e" ON "tenant_setting" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_1d9975b98d82f385ae14b4d7c6" ON "tenant_setting" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_affdab301e348b892175f30fa3" ON "tenant_setting" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_313b0e55871c1c9b6c22341536"`); + await queryRunner.query(`DROP INDEX "IDX_7e509a66367ecaf8e3bc96f263"`); + await queryRunner.query(`DROP INDEX "IDX_379c8bd0ce203341148c1f99ee"`); + await queryRunner.query(`DROP INDEX "IDX_9c845f353378371ee3aa60f686"`); + await queryRunner.query(`DROP INDEX "IDX_3396dda57286ca17ab61fd3704"`); + await queryRunner.query(`DROP INDEX "IDX_e9fd8df772ad2d955a65f4c68a"`); + await queryRunner.query(`DROP INDEX "IDX_91988120385964f213aec8aa84"`); + await queryRunner.query(`DROP INDEX "IDX_959e77718a2e76ee56498c1106"`); + await queryRunner.query(`ALTER TABLE "task_version" RENAME TO "temporary_task_version"`); + await queryRunner.query( + `CREATE TABLE "task_version" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_959e77718a2e76ee56498c1106a" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91988120385964f213aec8aa84c" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9c845f353378371ee3aa60f6865" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_379c8bd0ce203341148c1f99ee7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task_version"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_version"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_version"`); + await queryRunner.query(`CREATE INDEX "IDX_313b0e55871c1c9b6c22341536" ON "task_version" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_7e509a66367ecaf8e3bc96f263" ON "task_version" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_379c8bd0ce203341148c1f99ee" ON "task_version" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_9c845f353378371ee3aa60f686" ON "task_version" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_3396dda57286ca17ab61fd3704" ON "task_version" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_e9fd8df772ad2d955a65f4c68a" ON "task_version" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_91988120385964f213aec8aa84" ON "task_version" ("projectId") `); + await queryRunner.query( + `CREATE INDEX "IDX_959e77718a2e76ee56498c1106" ON "task_version" ("organizationTeamId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); + await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); + await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); + await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); + await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); + await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); + await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); + await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); + await queryRunner.query(`ALTER TABLE "task_status" RENAME TO "temporary_task_status"`); + await queryRunner.query( + `CREATE TABLE "task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isCollapsed" boolean NOT NULL DEFAULT (0), "order" integer, "isTodo" boolean NOT NULL DEFAULT (0), "isInProgress" boolean NOT NULL DEFAULT (0), "isDone" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone" FROM "temporary_task_status"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_status"`); + await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_8f26ffc61abaef417b0f807695"`); + await queryRunner.query(`DROP INDEX "IDX_d65afcfe2d64e49d43931579a3"`); + await queryRunner.query(`DROP INDEX "IDX_f4438327b3c2afb0832569b2a1"`); + await queryRunner.query(`DROP INDEX "IDX_f6ec2207e50680a475d71c8979"`); + await queryRunner.query(`DROP INDEX "IDX_596512cc6508a482cc23ae6ab7"`); + await queryRunner.query(`DROP INDEX "IDX_90c54f57b29cc8b67edc2738ae"`); + await queryRunner.query(`DROP INDEX "IDX_1a7b137d009616a2ff1aa6834f"`); + await queryRunner.query(`DROP INDEX "IDX_ad6792b26526bd96ab18d63454"`); + await queryRunner.query(`ALTER TABLE "task_size" RENAME TO "temporary_task_size"`); + await queryRunner.query( + `CREATE TABLE "task_size" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f4438327b3c2afb0832569b2a1e" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ad6792b26526bd96ab18d634544" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f6ec2207e50680a475d71c89793" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_596512cc6508a482cc23ae6ab78" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "task_size"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_size"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_size"`); + await queryRunner.query(`CREATE INDEX "IDX_8f26ffc61abaef417b0f807695" ON "task_size" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_d65afcfe2d64e49d43931579a3" ON "task_size" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f4438327b3c2afb0832569b2a1" ON "task_size" ("organizationTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_f6ec2207e50680a475d71c8979" ON "task_size" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_596512cc6508a482cc23ae6ab7" ON "task_size" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_90c54f57b29cc8b67edc2738ae" ON "task_size" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_1a7b137d009616a2ff1aa6834f" ON "task_size" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_ad6792b26526bd96ab18d63454" ON "task_size" ("projectId") `); + await queryRunner.query(`DROP INDEX "IDX_8177dd93be8044b37d3bb9285d"`); + await queryRunner.query(`DROP INDEX "IDX_5a341f51d8f5ec12db24ab033f"`); + await queryRunner.query(`DROP INDEX "IDX_b7b0ea8ac2825fb981c1181d11"`); + await queryRunner.query(`DROP INDEX "IDX_bed691e21fe01cf5aceee72295"`); + await queryRunner.query(`DROP INDEX "IDX_9423f99da972c150f85dbc11c1"`); + await queryRunner.query(`DROP INDEX "IDX_61a7cb4452d9e23f91231b7fd6"`); + await queryRunner.query(`DROP INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9"`); + await queryRunner.query(`DROP INDEX "IDX_4967ebdca0aefb9d43e56695e4"`); + await queryRunner.query(`ALTER TABLE "task_related_issue_type" RENAME TO "temporary_task_related_issue_type"`); + await queryRunner.query( + `CREATE TABLE "task_related_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_4967ebdca0aefb9d43e56695e42" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d99fe5b50dbe5078e0d9a9b6a9d" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed691e21fe01cf5aceee722952" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b7b0ea8ac2825fb981c1181d115" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task_related_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_related_issue_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_related_issue_type"`); + await queryRunner.query( + `CREATE INDEX "IDX_8177dd93be8044b37d3bb9285d" ON "task_related_issue_type" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5a341f51d8f5ec12db24ab033f" ON "task_related_issue_type" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b7b0ea8ac2825fb981c1181d11" ON "task_related_issue_type" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bed691e21fe01cf5aceee72295" ON "task_related_issue_type" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9423f99da972c150f85dbc11c1" ON "task_related_issue_type" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_61a7cb4452d9e23f91231b7fd6" ON "task_related_issue_type" ("value") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9" ON "task_related_issue_type" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4967ebdca0aefb9d43e56695e4" ON "task_related_issue_type" ("organizationTeamId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e6adb82db368af15f2b8cdd4e8"`); + await queryRunner.query(`DROP INDEX "IDX_8ddcc5eeaf96314f53ca486821"`); + await queryRunner.query(`DROP INDEX "IDX_52b039cff6a1adf6b7f9e49ee4"`); + await queryRunner.query(`DROP INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d"`); + await queryRunner.query(`DROP INDEX "IDX_7fd1b30d159b608cbf59009f68"`); + await queryRunner.query(`DROP INDEX "IDX_7d656b4cba8f11e639dbc5aab3"`); + await queryRunner.query(`DROP INDEX "IDX_46daede7b19176b6ad959d70da"`); + await queryRunner.query(`DROP INDEX "IDX_db4237960ca989eb7a48cd433b"`); + await queryRunner.query(`ALTER TABLE "task_priority" RENAME TO "temporary_task_priority"`); + await queryRunner.query( + `CREATE TABLE "task_priority" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_52b039cff6a1adf6b7f9e49ee44" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_db4237960ca989eb7a48cd433b1" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1818655f27b8cf4f0d1dbfeb8db" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd1b30d159b608cbf59009f681" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "task_priority"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_priority"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_priority"`); + await queryRunner.query(`CREATE INDEX "IDX_e6adb82db368af15f2b8cdd4e8" ON "task_priority" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_8ddcc5eeaf96314f53ca486821" ON "task_priority" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_52b039cff6a1adf6b7f9e49ee4" ON "task_priority" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d" ON "task_priority" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_7fd1b30d159b608cbf59009f68" ON "task_priority" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_7d656b4cba8f11e639dbc5aab3" ON "task_priority" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_46daede7b19176b6ad959d70da" ON "task_priority" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_db4237960ca989eb7a48cd433b" ON "task_priority" ("projectId") `); + await queryRunner.query(`DROP INDEX "IDX_88021c0cd9508757d3d90333f8"`); + await queryRunner.query(`DROP INDEX "IDX_d49853e18e5bc772f5435b01a5"`); + await queryRunner.query(`DROP INDEX "IDX_20b50abc5c97610a75d49ad381"`); + await queryRunner.query(`DROP INDEX "IDX_24114c4059e6b6991daba541b1"`); + await queryRunner.query(`DROP INDEX "IDX_6deea7b3671e45973e191a1502"`); + await queryRunner.query(`DROP INDEX "IDX_0848fd2b8c23c0ab55146297cf"`); + await queryRunner.query(`ALTER TABLE "task_linked_issues" RENAME TO "temporary_task_linked_issues"`); + await queryRunner.query( + `CREATE TABLE "task_linked_issues" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" integer NOT NULL, "taskFromId" varchar NOT NULL, "taskToId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0848fd2b8c23c0ab55146297cff" FOREIGN KEY ("taskToId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6deea7b3671e45973e191a1502c" FOREIGN KEY ("taskFromId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_24114c4059e6b6991daba541b1d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_20b50abc5c97610a75d49ad3817" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task_linked_issues"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_linked_issues"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_linked_issues"`); + await queryRunner.query( + `CREATE INDEX "IDX_88021c0cd9508757d3d90333f8" ON "task_linked_issues" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_d49853e18e5bc772f5435b01a5" ON "task_linked_issues" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_20b50abc5c97610a75d49ad381" ON "task_linked_issues" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_24114c4059e6b6991daba541b1" ON "task_linked_issues" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6deea7b3671e45973e191a1502" ON "task_linked_issues" ("taskFromId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0848fd2b8c23c0ab55146297cf" ON "task_linked_issues" ("taskToId") `); + await queryRunner.query(`DROP INDEX "IDX_b8616deefe44d0622233e73fbf"`); + await queryRunner.query(`DROP INDEX "IDX_2f4bdd2593fd6038aaa91fd107"`); + await queryRunner.query(`DROP INDEX "IDX_0cbe714983eb0aae5feeee8212"`); + await queryRunner.query(`DROP INDEX "IDX_ed5441fb13e82854a994da5a78"`); + await queryRunner.query(`DROP INDEX "IDX_7127880d6fae956ecc1c84ac31"`); + await queryRunner.query(`DROP INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1"`); + await queryRunner.query(`DROP INDEX "IDX_2fe7a278e6f08d2be55740a939"`); + await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); + await queryRunner.query(`DROP INDEX "IDX_5b0272d923a31c972bed1a1ac4"`); + await queryRunner.query(`DROP INDEX "IDX_3797a20ef5553ae87af126bc2f"`); + await queryRunner.query(`DROP INDEX "IDX_94fe6b3a5aec5f85427df4f8cd"`); + await queryRunner.query(`DROP INDEX "IDX_1e1f64696aa3a26d3e12c840e5"`); + await queryRunner.query(`DROP INDEX "taskNumber"`); + await queryRunner.query(`DROP INDEX "IDX_3e16c81005c389a4db83c0e5e3"`); + await queryRunner.query(`DROP INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54"`); + await queryRunner.query(`DROP INDEX "IDX_579534d8e12f22d308d6bd5f42"`); + await queryRunner.query(`ALTER TABLE "task" RENAME TO "temporary_task"`); + await queryRunner.query( + `CREATE TABLE "task" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "description" varchar, "status" varchar, "estimate" integer, "dueDate" datetime, "projectId" varchar, "creatorId" varchar, "organizationSprintId" varchar, "number" integer, "prefix" varchar, "priority" varchar, "size" varchar, "public" boolean DEFAULT (1), "startDate" datetime, "resolvedAt" datetime, "version" varchar, "issueType" varchar, "parentId" varchar, "taskStatusId" varchar, "taskSizeId" varchar, "taskPriorityId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "projectModuleId" varchar, CONSTRAINT "FK_579534d8e12f22d308d6bd5f428" FOREIGN KEY ("projectModuleId") REFERENCES "organization_project_module" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8c9920b5fb32c3d8453f64b705c" FOREIGN KEY ("parentId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1e1f64696aa3a26d3e12c840e55" FOREIGN KEY ("organizationSprintId") REFERENCES "organization_sprint" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_94fe6b3a5aec5f85427df4f8cd7" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3797a20ef5553ae87af126bc2fe" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b0272d923a31c972bed1a1ac4d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e91cbff3d206f150ccc14d0c3a1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cbe714983eb0aae5feeee8212b" FOREIGN KEY ("taskStatusId") REFERENCES "task_status" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_2f4bdd2593fd6038aaa91fd1076" FOREIGN KEY ("taskSizeId") REFERENCES "task_size" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b8616deefe44d0622233e73fbf9" FOREIGN KEY ("taskPriorityId") REFERENCES "task_priority" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId" FROM "temporary_task"` + ); + await queryRunner.query(`DROP TABLE "temporary_task"`); + await queryRunner.query(`CREATE INDEX "IDX_b8616deefe44d0622233e73fbf" ON "task" ("taskPriorityId") `); + await queryRunner.query(`CREATE INDEX "IDX_2f4bdd2593fd6038aaa91fd107" ON "task" ("taskSizeId") `); + await queryRunner.query(`CREATE INDEX "IDX_0cbe714983eb0aae5feeee8212" ON "task" ("taskStatusId") `); + await queryRunner.query(`CREATE INDEX "IDX_ed5441fb13e82854a994da5a78" ON "task" ("issueType") `); + await queryRunner.query(`CREATE INDEX "IDX_7127880d6fae956ecc1c84ac31" ON "task" ("size") `); + await queryRunner.query(`CREATE INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1" ON "task" ("priority") `); + await queryRunner.query(`CREATE INDEX "IDX_2fe7a278e6f08d2be55740a939" ON "task" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_e91cbff3d206f150ccc14d0c3a" ON "task" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_5b0272d923a31c972bed1a1ac4" ON "task" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_3797a20ef5553ae87af126bc2f" ON "task" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_94fe6b3a5aec5f85427df4f8cd" ON "task" ("creatorId") `); + await queryRunner.query(`CREATE INDEX "IDX_1e1f64696aa3a26d3e12c840e5" ON "task" ("organizationSprintId") `); + await queryRunner.query(`CREATE UNIQUE INDEX "taskNumber" ON "task" ("projectId", "number") `); + await queryRunner.query(`CREATE INDEX "IDX_3e16c81005c389a4db83c0e5e3" ON "task" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54" ON "task" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_579534d8e12f22d308d6bd5f42" ON "task" ("projectModuleId") `); + await queryRunner.query(`DROP INDEX "IDX_586513cceb16777fd14a17bfe1"`); + await queryRunner.query(`DROP INDEX "IDX_131331557078611a68b4a5b2e7"`); + await queryRunner.query(`DROP INDEX "IDX_33779b0395f72af0b50dc526d1"`); + await queryRunner.query(`DROP INDEX "IDX_af2d743ed61571bcdc5d9a27a0"`); + await queryRunner.query(`DROP INDEX "IDX_4af451ab46a94e94394c72d911"`); + await queryRunner.query(`DROP INDEX "IDX_16dbef9d1b2b422abdce8ee3ae"`); + await queryRunner.query(`DROP INDEX "IDX_8b12c913c39c72fe5980427c96"`); + await queryRunner.query(`DROP INDEX "IDX_722ce5d7535524b96c6d03f7c4"`); + await queryRunner.query(`DROP INDEX "IDX_1909e9bae7d8b2c920b3e4d859"`); + await queryRunner.query(`ALTER TABLE "issue_type" RENAME TO "temporary_issue_type"`); + await queryRunner.query( + `CREATE TABLE "issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "imageId" varchar, "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isDefault" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_8b12c913c39c72fe5980427c963" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16dbef9d1b2b422abdce8ee3ae2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_33779b0395f72af0b50dc526d1d" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_131331557078611a68b4a5b2e7e" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_586513cceb16777fd14a17bfe10" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault" FROM "temporary_issue_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_issue_type"`); + await queryRunner.query( + `CREATE INDEX "IDX_586513cceb16777fd14a17bfe1" ON "issue_type" ("organizationTeamId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_131331557078611a68b4a5b2e7" ON "issue_type" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_33779b0395f72af0b50dc526d1" ON "issue_type" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_af2d743ed61571bcdc5d9a27a0" ON "issue_type" ("value") `); + await queryRunner.query(`CREATE INDEX "IDX_4af451ab46a94e94394c72d911" ON "issue_type" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_16dbef9d1b2b422abdce8ee3ae" ON "issue_type" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_8b12c913c39c72fe5980427c96" ON "issue_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_722ce5d7535524b96c6d03f7c4" ON "issue_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1909e9bae7d8b2c920b3e4d859" ON "issue_type" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_1f3ffda4fce02682e76308b476"`); + await queryRunner.query(`DROP INDEX "IDX_b1a7086c279309b20e8384d0d9"`); + await queryRunner.query(`DROP INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6"`); + await queryRunner.query(`DROP INDEX "IDX_16507eb222e3c50be077fb4ace"`); + await queryRunner.query(`DROP INDEX "IDX_8f274646f2bdf4e12990feeb04"`); + await queryRunner.query(`DROP INDEX "IDX_a3ee022203211f678376cd919b"`); + await queryRunner.query(`ALTER TABLE "task_estimation" RENAME TO "temporary_task_estimation"`); + await queryRunner.query( + `CREATE TABLE "task_estimation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "estimate" integer NOT NULL, "employeeId" varchar NOT NULL, "taskId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a3ee022203211f678376cd919bb" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f274646f2bdf4e12990feeb040" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16507eb222e3c50be077fb4ace2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_87bfea6d0b9a1ec602ee88e5f68" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "task_estimation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_estimation"` + ); + await queryRunner.query(`DROP TABLE "temporary_task_estimation"`); + await queryRunner.query(`CREATE INDEX "IDX_1f3ffda4fce02682e76308b476" ON "task_estimation" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_b1a7086c279309b20e8384d0d9" ON "task_estimation" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6" ON "task_estimation" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_16507eb222e3c50be077fb4ace" ON "task_estimation" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_8f274646f2bdf4e12990feeb04" ON "task_estimation" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_a3ee022203211f678376cd919b" ON "task_estimation" ("taskId") `); + await queryRunner.query(`DROP INDEX "IDX_f2cf366f3f08e31784b056df88"`); + await queryRunner.query(`DROP INDEX "IDX_9779a35ef1338bafb7b90714f1"`); + await queryRunner.query(`DROP INDEX "IDX_ecb357a3764a7344c633a257d7"`); + await queryRunner.query(`DROP INDEX "IDX_ce5e588780497b05cd6267e20e"`); + await queryRunner.query(`DROP INDEX "IDX_903b08cd4c8025e73316342452"`); + await queryRunner.query(`DROP INDEX "IDX_b022c2b684c35dcc63c22850f1"`); + await queryRunner.query(`ALTER TABLE "daily_plan" RENAME TO "temporary_daily_plan"`); + await queryRunner.query( + `CREATE TABLE "daily_plan" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "date" datetime NOT NULL, "workTimePlanned" decimal NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationTeamId" varchar, CONSTRAINT "FK_b022c2b684c35dcc63c22850f13" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb357a3764a7344c633a257d76" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9779a35ef1338bafb7b90714f16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2cf366f3f08e31784b056df880" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "daily_plan"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId" FROM "temporary_daily_plan"` + ); + await queryRunner.query(`DROP TABLE "temporary_daily_plan"`); + await queryRunner.query(`CREATE INDEX "IDX_f2cf366f3f08e31784b056df88" ON "daily_plan" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_9779a35ef1338bafb7b90714f1" ON "daily_plan" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_ecb357a3764a7344c633a257d7" ON "daily_plan" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_ce5e588780497b05cd6267e20e" ON "daily_plan" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_903b08cd4c8025e73316342452" ON "daily_plan" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_b022c2b684c35dcc63c22850f1" ON "daily_plan" ("organizationTeamId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_49746602acc4e5e8721062b69e"`); + await queryRunner.query(`DROP INDEX "IDX_b08dd29fb6a8acdf83c83d8988"`); + await queryRunner.query(`DROP INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9"`); + await queryRunner.query(`DROP INDEX "IDX_1f22c73374bcca1ea84a4dca59"`); + await queryRunner.query(`DROP INDEX "IDX_58876ee26a90170551027459bf"`); + await queryRunner.query(`ALTER TABLE "tag" RENAME TO "temporary_tag"`); + await queryRunner.query( + `CREATE TABLE "tag" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "icon" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "textColor" varchar, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_c2f6bec0b39eaa3a6d90903ae99" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b08dd29fb6a8acdf83c83d8988f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_49746602acc4e5e8721062b69ec" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "tag"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields" FROM "temporary_tag"` + ); + await queryRunner.query(`DROP TABLE "temporary_tag"`); + await queryRunner.query(`CREATE INDEX "IDX_49746602acc4e5e8721062b69e" ON "tag" ("organizationTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_b08dd29fb6a8acdf83c83d8988" ON "tag" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9" ON "tag" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_1f22c73374bcca1ea84a4dca59" ON "tag" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_58876ee26a90170551027459bf" ON "tag" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_ca52119f9e4857399706d723e9"`); + await queryRunner.query(`DROP INDEX "IDX_f4cdbe61d68413f4d6a671f8c2"`); + await queryRunner.query(`DROP INDEX "IDX_8e502eac7ed1347c71c26beae8"`); + await queryRunner.query(`DROP INDEX "IDX_b2923d394f3636671ff9b3c3e8"`); + await queryRunner.query(`ALTER TABLE "skill" RENAME TO "temporary_skill"`); + await queryRunner.query( + `CREATE TABLE "skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_b2923d394f3636671ff9b3c3e81" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8e502eac7ed1347c71c26beae81" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt" FROM "temporary_skill"` + ); + await queryRunner.query(`DROP TABLE "temporary_skill"`); + await queryRunner.query(`CREATE INDEX "IDX_ca52119f9e4857399706d723e9" ON "skill" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_f4cdbe61d68413f4d6a671f8c2" ON "skill" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8e502eac7ed1347c71c26beae8" ON "skill" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_b2923d394f3636671ff9b3c3e8" ON "skill" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_09868c0733ba37a4753ff8931f"`); + await queryRunner.query(`DROP INDEX "IDX_c5f75cd3367769b6f22b298d29"`); + await queryRunner.query(`DROP INDEX "IDX_ae4578dcaed5adff96595e6166"`); + await queryRunner.query(`DROP INDEX "IDX_1751a572e91385a09d41c62471"`); + await queryRunner.query(`ALTER TABLE "role" RENAME TO "temporary_role"`); + await queryRunner.query( + `CREATE TABLE "role" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_1751a572e91385a09d41c624714" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "role"("id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt" FROM "temporary_role"` + ); + await queryRunner.query(`DROP TABLE "temporary_role"`); + await queryRunner.query(`CREATE INDEX "IDX_09868c0733ba37a4753ff8931f" ON "role" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_c5f75cd3367769b6f22b298d29" ON "role" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_ae4578dcaed5adff96595e6166" ON "role" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_1751a572e91385a09d41c62471" ON "role" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_5c36df1a5c85016952e90d760f"`); + await queryRunner.query(`DROP INDEX "IDX_78f93dbb42a97f6785bcf53efd"`); + await queryRunner.query(`DROP INDEX "IDX_e3130a39c1e4a740d044e68573"`); + await queryRunner.query(`DROP INDEX "IDX_8307c5c44a4ad6210b767b17a9"`); + await queryRunner.query(`DROP INDEX "IDX_cbd053921056e77c0a8e03122a"`); + await queryRunner.query(`ALTER TABLE "role_permission" RENAME TO "temporary_role_permission"`); + await queryRunner.query( + `CREATE TABLE "role_permission" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "permission" varchar NOT NULL, "enabled" boolean DEFAULT (0), "roleId" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_cbd053921056e77c0a8e03122af" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e3130a39c1e4a740d044e685730" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "role_permission"("id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt" FROM "temporary_role_permission"` + ); + await queryRunner.query(`DROP TABLE "temporary_role_permission"`); + await queryRunner.query(`CREATE INDEX "IDX_5c36df1a5c85016952e90d760f" ON "role_permission" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_78f93dbb42a97f6785bcf53efd" ON "role_permission" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e3130a39c1e4a740d044e68573" ON "role_permission" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_8307c5c44a4ad6210b767b17a9" ON "role_permission" ("permission") `); + await queryRunner.query(`CREATE INDEX "IDX_cbd053921056e77c0a8e03122a" ON "role_permission" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`); + await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`); + await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`); + await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`); + await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`); + await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`); + await queryRunner.query(`ALTER TABLE "request_approval" RENAME TO "temporary_request_approval"`); + await queryRunner.query( + `CREATE TABLE "request_approval" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" integer, "createdBy" varchar, "createdByName" varchar, "min_count" integer, "requestId" varchar, "requestType" varchar, "approvalPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "request_approval"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval"` + ); + await queryRunner.query(`DROP TABLE "temporary_request_approval"`); + await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_bdcb4ea389bdb794bae75b0170"`); + await queryRunner.query(`DROP INDEX "IDX_34b2e8f794e0336b9ac410d8bd"`); + await queryRunner.query(`DROP INDEX "IDX_94b2a3d0f17c9549dea1493dc9"`); + await queryRunner.query(`DROP INDEX "IDX_77e1050669b32cfff482f96016"`); + await queryRunner.query(`DROP INDEX "IDX_6c75d8a8c609e88896b2653cc4"`); + await queryRunner.query(`DROP INDEX "IDX_9ccdaee6c5c62cda8f7375e841"`); + await queryRunner.query(`ALTER TABLE "request_approval_team" RENAME TO "temporary_request_approval_team"`); + await queryRunner.query( + `CREATE TABLE "request_approval_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "teamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9ccdaee6c5c62cda8f7375e8417" FOREIGN KEY ("teamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6c75d8a8c609e88896b2653cc41" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_77e1050669b32cfff482f960169" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_94b2a3d0f17c9549dea1493dc96" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "request_approval_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval_team"` + ); + await queryRunner.query(`DROP TABLE "temporary_request_approval_team"`); + await queryRunner.query( + `CREATE INDEX "IDX_bdcb4ea389bdb794bae75b0170" ON "request_approval_team" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_34b2e8f794e0336b9ac410d8bd" ON "request_approval_team" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_94b2a3d0f17c9549dea1493dc9" ON "request_approval_team" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_77e1050669b32cfff482f96016" ON "request_approval_team" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6c75d8a8c609e88896b2653cc4" ON "request_approval_team" ("requestApprovalId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9ccdaee6c5c62cda8f7375e841" ON "request_approval_team" ("teamId") `); + await queryRunner.query(`DROP INDEX "IDX_3d66190c19b9fe69a8bbb300df"`); + await queryRunner.query(`DROP INDEX "IDX_2634ff04775e659c4792325f38"`); + await queryRunner.query(`DROP INDEX "IDX_a5445b38b780b29b09369e36a9"`); + await queryRunner.query(`DROP INDEX "IDX_4071f027554eefff65ac8123e6"`); + await queryRunner.query(`DROP INDEX "IDX_563fec5539b89a57f40731f985"`); + await queryRunner.query(`DROP INDEX "IDX_ce2113039f070b3f003aa0db61"`); + await queryRunner.query( + `ALTER TABLE "request_approval_employee" RENAME TO "temporary_request_approval_employee"` + ); + await queryRunner.query( + `CREATE TABLE "request_approval_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_ce2113039f070b3f003aa0db611" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_563fec5539b89a57f40731f9858" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4071f027554eefff65ac8123e6e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a5445b38b780b29b09369e36a9b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "request_approval_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_request_approval_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_3d66190c19b9fe69a8bbb300df" ON "request_approval_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2634ff04775e659c4792325f38" ON "request_approval_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a5445b38b780b29b09369e36a9" ON "request_approval_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4071f027554eefff65ac8123e6" ON "request_approval_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_563fec5539b89a57f40731f985" ON "request_approval_employee" ("requestApprovalId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ce2113039f070b3f003aa0db61" ON "request_approval_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1316fdd7b9a2926437a13271bf"`); + await queryRunner.query(`DROP INDEX "IDX_143ead1a6ac5f73125d8c4c3aa"`); + await queryRunner.query(`DROP INDEX "IDX_6f9ee54eb839117e83b937648d"`); + await queryRunner.query(`DROP INDEX "IDX_ef16fed5f7e6951027502e6458"`); + await queryRunner.query(`DROP INDEX "IDX_230652e48daa99c50c000fc5d1"`); + await queryRunner.query(`ALTER TABLE "report" RENAME TO "temporary_report"`); + await queryRunner.query( + `CREATE TABLE "report" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "categoryId" varchar NOT NULL, "name" varchar NOT NULL, "slug" varchar, "description" varchar, "image" varchar, "iconClass" varchar, "showInMenu" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_230652e48daa99c50c000fc5d10" FOREIGN KEY ("categoryId") REFERENCES "report_category" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "report"("id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt" FROM "temporary_report"` + ); + await queryRunner.query(`DROP TABLE "temporary_report"`); + await queryRunner.query(`CREATE INDEX "IDX_1316fdd7b9a2926437a13271bf" ON "report" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_143ead1a6ac5f73125d8c4c3aa" ON "report" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6f9ee54eb839117e83b937648d" ON "report" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_ef16fed5f7e6951027502e6458" ON "report" ("slug") `); + await queryRunner.query(`CREATE INDEX "IDX_230652e48daa99c50c000fc5d1" ON "report" ("categoryId") `); + await queryRunner.query(`DROP INDEX "IDX_40459267d68604655aa6df4251"`); + await queryRunner.query(`DROP INDEX "IDX_a6bde8f44e18f17b1ca603e150"`); + await queryRunner.query(`DROP INDEX "IDX_edf9bd011d7f08e3e18a5becb8"`); + await queryRunner.query(`DROP INDEX "IDX_5193788a3ebc1143bedb74cf72"`); + await queryRunner.query(`ALTER TABLE "report_organization" RENAME TO "temporary_report_organization"`); + await queryRunner.query( + `CREATE TABLE "report_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "reportId" varchar NOT NULL, "isEnabled" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a085d6f9bcfd19f8bae1dbfe135" FOREIGN KEY ("reportId") REFERENCES "report" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5193788a3ebc1143bedb74cf725" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_edf9bd011d7f08e3e18a5becb8b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "report_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt" FROM "temporary_report_organization"` + ); + await queryRunner.query(`DROP TABLE "temporary_report_organization"`); + await queryRunner.query( + `CREATE INDEX "IDX_40459267d68604655aa6df4251" ON "report_organization" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_a6bde8f44e18f17b1ca603e150" ON "report_organization" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_edf9bd011d7f08e3e18a5becb8" ON "report_organization" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_5193788a3ebc1143bedb74cf72" ON "report_organization" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_656f05f951faa13d7195853424"`); + await queryRunner.query(`DROP INDEX "IDX_dd9fcd7916d0a22189ecea6a36"`); + await queryRunner.query(`DROP INDEX "IDX_fa278d337ba5e200d44ade6697"`); + await queryRunner.query(`ALTER TABLE "report_category" RENAME TO "temporary_report_category"`); + await queryRunner.query( + `CREATE TABLE "report_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "iconClass" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "report_category"("id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt" FROM "temporary_report_category"` + ); + await queryRunner.query(`DROP TABLE "temporary_report_category"`); + await queryRunner.query(`CREATE INDEX "IDX_656f05f951faa13d7195853424" ON "report_category" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_dd9fcd7916d0a22189ecea6a36" ON "report_category" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_fa278d337ba5e200d44ade6697" ON "report_category" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_96413a8061ff4ccdc418d4e16a"`); + await queryRunner.query(`DROP INDEX "IDX_1d9ca23c7e1c606061fec8bb74"`); + await queryRunner.query(`DROP INDEX "IDX_7533fd275bfb3219ce9eb4004c"`); + await queryRunner.query(`DROP INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2"`); + await queryRunner.query(`DROP INDEX "IDX_d24bc28e54f1dc296452a25591"`); + await queryRunner.query(`ALTER TABLE "product_translation" RENAME TO "temporary_product_translation"`); + await queryRunner.query( + `CREATE TABLE "product_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d24bc28e54f1dc296452a255917" FOREIGN KEY ("referenceId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e6abcacc3d3a4f9cf5ca97f2b28" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7533fd275bfb3219ce9eb4004c7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_translation"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_96413a8061ff4ccdc418d4e16a" ON "product_translation" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1d9ca23c7e1c606061fec8bb74" ON "product_translation" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_7533fd275bfb3219ce9eb4004c" ON "product_translation" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2" ON "product_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d24bc28e54f1dc296452a25591" ON "product_translation" ("referenceId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6f58935aa2175d930e47e97c9f"`); + await queryRunner.query(`DROP INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4"`); + await queryRunner.query(`DROP INDEX "IDX_08293ca31a601d3cd0228120bc"`); + await queryRunner.query(`DROP INDEX "IDX_32a4bdd261ec81f4ca6b3abe26"`); + await queryRunner.query(`DROP INDEX "IDX_4627873dbc1af07d732e6eec7b"`); + await queryRunner.query(`DROP INDEX "IDX_374bfd0d1b0e1398d7206456d9"`); + await queryRunner.query(`DROP INDEX "IDX_618194d24a7ea86a165d7ec628"`); + await queryRunner.query(`ALTER TABLE "product" RENAME TO "temporary_product"`); + await queryRunner.query( + `CREATE TABLE "product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "enabled" boolean NOT NULL DEFAULT (1), "code" varchar NOT NULL, "imageUrl" varchar, "featuredImageId" varchar, "productTypeId" varchar, "productCategoryId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_618194d24a7ea86a165d7ec628e" FOREIGN KEY ("productCategoryId") REFERENCES "product_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_374bfd0d1b0e1398d7206456d98" FOREIGN KEY ("productTypeId") REFERENCES "product_type" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4627873dbc1af07d732e6eec7be" FOREIGN KEY ("featuredImageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_32a4bdd261ec81f4ca6b3abe262" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_08293ca31a601d3cd0228120bc9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt" FROM "temporary_product"` + ); + await queryRunner.query(`DROP TABLE "temporary_product"`); + await queryRunner.query(`CREATE INDEX "IDX_6f58935aa2175d930e47e97c9f" ON "product" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4" ON "product" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_08293ca31a601d3cd0228120bc" ON "product" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_32a4bdd261ec81f4ca6b3abe26" ON "product" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4627873dbc1af07d732e6eec7b" ON "product" ("featuredImageId") `); + await queryRunner.query(`CREATE INDEX "IDX_374bfd0d1b0e1398d7206456d9" ON "product" ("productTypeId") `); + await queryRunner.query(`CREATE INDEX "IDX_618194d24a7ea86a165d7ec628" ON "product" ("productCategoryId") `); + await queryRunner.query(`DROP INDEX "IDX_e0005cbdabb760488f66f3fbba"`); + await queryRunner.query(`DROP INDEX "IDX_e0d896cadbc695a490f64bb7e7"`); + await queryRunner.query(`DROP INDEX "IDX_9121e00c4dc3500dc610cf8722"`); + await queryRunner.query(`DROP INDEX "IDX_6a289b10030ae86903406e3c9b"`); + await queryRunner.query(`DROP INDEX "IDX_6e420052844edf3a5506d863ce"`); + await queryRunner.query(`DROP INDEX "IDX_b83f23626741630a8629960715"`); + await queryRunner.query(`ALTER TABLE "product_variant" RENAME TO "temporary_product_variant"`); + await queryRunner.query( + `CREATE TABLE "product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "taxes" integer NOT NULL DEFAULT (0), "notes" varchar, "quantity" integer NOT NULL DEFAULT (0), "billingInvoicingPolicy" varchar NOT NULL DEFAULT ('Quantity ordered'), "internalReference" varchar, "enabled" boolean NOT NULL DEFAULT (1), "productId" varchar, "imageId" varchar, "priceId" varchar, "settingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_9f0fd369dfeb275415c649d110" UNIQUE ("settingId"), CONSTRAINT "REL_41b31a71dda350cfe5da07e0e4" UNIQUE ("priceId"), CONSTRAINT "FK_b83f23626741630a86299607156" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6e420052844edf3a5506d863ce6" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9f0fd369dfeb275415c649d110b" FOREIGN KEY ("settingId") REFERENCES "product_variant_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_41b31a71dda350cfe5da07e0e4f" FOREIGN KEY ("priceId") REFERENCES "product_variant_price" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a289b10030ae86903406e3c9bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9121e00c4dc3500dc610cf8722e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_variant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_variant"`); + await queryRunner.query(`CREATE INDEX "IDX_e0005cbdabb760488f66f3fbba" ON "product_variant" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e0d896cadbc695a490f64bb7e7" ON "product_variant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_9121e00c4dc3500dc610cf8722" ON "product_variant" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_6a289b10030ae86903406e3c9b" ON "product_variant" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_6e420052844edf3a5506d863ce" ON "product_variant" ("productId") `); + await queryRunner.query(`CREATE INDEX "IDX_b83f23626741630a8629960715" ON "product_variant" ("imageId") `); + await queryRunner.query(`DROP INDEX "IDX_24ac11e35221577e4ba4fdd229"`); + await queryRunner.query(`DROP INDEX "IDX_562ef5984b6d4bed640bfcc6a2"`); + await queryRunner.query(`DROP INDEX "IDX_7052eaf00a5795afa5ebf35995"`); + await queryRunner.query(`DROP INDEX "IDX_0cfba32db58a952f58b1e35cf1"`); + await queryRunner.query(`ALTER TABLE "product_variant_price" RENAME TO "temporary_product_variant_price"`); + await queryRunner.query( + `CREATE TABLE "product_variant_price" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "unitCost" integer NOT NULL DEFAULT (0), "unitCostCurrency" varchar NOT NULL DEFAULT ('USD'), "retailPrice" integer NOT NULL DEFAULT (0), "retailPriceCurrency" varchar NOT NULL DEFAULT ('USD'), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_5842f603bd85d924127d63d73c" UNIQUE ("productVariantId"), CONSTRAINT "FK_5842f603bd85d924127d63d73cd" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cfba32db58a952f58b1e35cf1c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7052eaf00a5795afa5ebf359950" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_variant_price"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant_price"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_variant_price"`); + await queryRunner.query( + `CREATE INDEX "IDX_24ac11e35221577e4ba4fdd229" ON "product_variant_price" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_562ef5984b6d4bed640bfcc6a2" ON "product_variant_price" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7052eaf00a5795afa5ebf35995" ON "product_variant_price" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0cfba32db58a952f58b1e35cf1" ON "product_variant_price" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_49064ee0f3acd5882f4d893f3d"`); + await queryRunner.query(`DROP INDEX "IDX_90cc635a1065702ed3b79da6ec"`); + await queryRunner.query(`DROP INDEX "IDX_f206c807fc7e41fc8a8b6679ae"`); + await queryRunner.query(`DROP INDEX "IDX_e4e4120b0c19d3a207ce38d758"`); + await queryRunner.query(`ALTER TABLE "product_type" RENAME TO "temporary_product_type"`); + await queryRunner.query( + `CREATE TABLE "product_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e4e4120b0c19d3a207ce38d7581" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f206c807fc7e41fc8a8b6679ae0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt" FROM "temporary_product_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_type"`); + await queryRunner.query(`CREATE INDEX "IDX_49064ee0f3acd5882f4d893f3d" ON "product_type" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_90cc635a1065702ed3b79da6ec" ON "product_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f206c807fc7e41fc8a8b6679ae" ON "product_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e4e4120b0c19d3a207ce38d758" ON "product_type" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_65874d6bab7fefcaeccd2252c1"`); + await queryRunner.query(`DROP INDEX "IDX_e9dca49bad996f1761db3b2f56"`); + await queryRunner.query(`DROP INDEX "IDX_30aafca59cdb456bf5231f9e46"`); + await queryRunner.query(`DROP INDEX "IDX_2dd271bdeb602b8c3956287e33"`); + await queryRunner.query(`DROP INDEX "IDX_f4b767c43b4e9130c63382c9b2"`); + await queryRunner.query( + `ALTER TABLE "product_type_translation" RENAME TO "temporary_product_type_translation"` + ); + await queryRunner.query( + `CREATE TABLE "product_type_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f4b767c43b4e9130c63382c9b28" FOREIGN KEY ("referenceId") REFERENCES "product_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2dd271bdeb602b8c3956287e33c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_30aafca59cdb456bf5231f9e463" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_type_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_type_translation"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_type_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_65874d6bab7fefcaeccd2252c1" ON "product_type_translation" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9dca49bad996f1761db3b2f56" ON "product_type_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_30aafca59cdb456bf5231f9e46" ON "product_type_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2dd271bdeb602b8c3956287e33" ON "product_type_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f4b767c43b4e9130c63382c9b2" ON "product_type_translation" ("referenceId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_ae78776111e1906accfd61511d"`); + await queryRunner.query(`DROP INDEX "IDX_ad107ba78e487cd8b13313593b"`); + await queryRunner.query(`DROP INDEX "IDX_2efe48435d4ba480a4bb8b96fa"`); + await queryRunner.query(`DROP INDEX "IDX_bed9d45e15866d9b8e87e7a7bf"`); + await queryRunner.query(`ALTER TABLE "product_variant_setting" RENAME TO "temporary_product_variant_setting"`); + await queryRunner.query( + `CREATE TABLE "product_variant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isSubscription" boolean NOT NULL DEFAULT (0), "isPurchaseAutomatically" boolean NOT NULL DEFAULT (0), "canBeSold" boolean NOT NULL DEFAULT (1), "canBePurchased" boolean NOT NULL DEFAULT (1), "canBeCharged" boolean NOT NULL DEFAULT (0), "canBeRented" boolean NOT NULL DEFAULT (0), "isEquipment" boolean NOT NULL DEFAULT (0), "trackInventory" boolean NOT NULL DEFAULT (0), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_b0d86990fe7160a5f3e4011fb2" UNIQUE ("productVariantId"), CONSTRAINT "FK_b0d86990fe7160a5f3e4011fb23" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed9d45e15866d9b8e87e7a7bfe" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2efe48435d4ba480a4bb8b96fa6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_variant_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_variant_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_ae78776111e1906accfd61511d" ON "product_variant_setting" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ad107ba78e487cd8b13313593b" ON "product_variant_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2efe48435d4ba480a4bb8b96fa" ON "product_variant_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bed9d45e15866d9b8e87e7a7bf" ON "product_variant_setting" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_35d083f4ecfe72cce72ee88f58"`); + await queryRunner.query(`DROP INDEX "IDX_d81028785f188c253e0bd49a03"`); + await queryRunner.query(`DROP INDEX "IDX_985d235aa5394937c4493262c7"`); + await queryRunner.query(`DROP INDEX "IDX_47ffb82a65c43f102b7e0efa41"`); + await queryRunner.query(`DROP INDEX "IDX_a6debf9198e2fbfa006aa10d71"`); + await queryRunner.query(`ALTER TABLE "product_option" RENAME TO "temporary_product_option"`); + await queryRunner.query( + `CREATE TABLE "product_option" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar, "groupId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a6debf9198e2fbfa006aa10d710" FOREIGN KEY ("groupId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_47ffb82a65c43f102b7e0efa41a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_985d235aa5394937c4493262c7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_option"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_option"`); + await queryRunner.query(`CREATE INDEX "IDX_35d083f4ecfe72cce72ee88f58" ON "product_option" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_d81028785f188c253e0bd49a03" ON "product_option" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_985d235aa5394937c4493262c7" ON "product_option" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_47ffb82a65c43f102b7e0efa41" ON "product_option" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_a6debf9198e2fbfa006aa10d71" ON "product_option" ("groupId") `); + await queryRunner.query(`DROP INDEX "IDX_2f581c3477a5c7a66de5d7f264"`); + await queryRunner.query(`DROP INDEX "IDX_f284f666950392c55afa0806c8"`); + await queryRunner.query(`DROP INDEX "IDX_9869d7680f48487e584f5d2fca"`); + await queryRunner.query(`DROP INDEX "IDX_4dc2f466cfa3d0b7fef19d1273"`); + await queryRunner.query(`DROP INDEX "IDX_f43c46e12db0580af320db7738"`); + await queryRunner.query( + `ALTER TABLE "product_option_translation" RENAME TO "temporary_product_option_translation"` + ); + await queryRunner.query( + `CREATE TABLE "product_option_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f43c46e12db0580af320db77381" FOREIGN KEY ("referenceId") REFERENCES "product_option" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4dc2f466cfa3d0b7fef19d12731" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9869d7680f48487e584f5d2fca7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_option_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_translation"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_option_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_2f581c3477a5c7a66de5d7f264" ON "product_option_translation" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f284f666950392c55afa0806c8" ON "product_option_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9869d7680f48487e584f5d2fca" ON "product_option_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4dc2f466cfa3d0b7fef19d1273" ON "product_option_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f43c46e12db0580af320db7738" ON "product_option_translation" ("referenceId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e9e50109d3054fb81205c0a74e"`); + await queryRunner.query(`DROP INDEX "IDX_75b7065234a6d32fbd03d8703f"`); + await queryRunner.query(`DROP INDEX "IDX_fd6b39f1fd1db026b5dcc3c795"`); + await queryRunner.query(`DROP INDEX "IDX_0e2fcc31743e20a45fc3cf0211"`); + await queryRunner.query(`DROP INDEX "IDX_c9ce1da98b6d93293daafee63a"`); + await queryRunner.query( + `ALTER TABLE "product_option_group_translation" RENAME TO "temporary_product_option_group_translation"` + ); + await queryRunner.query( + `CREATE TABLE "product_option_group_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c9ce1da98b6d93293daafee63aa" FOREIGN KEY ("referenceId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0e2fcc31743e20a45fc3cf0211d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fd6b39f1fd1db026b5dcc3c7953" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_option_group_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_group_translation"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_option_group_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_e9e50109d3054fb81205c0a74e" ON "product_option_group_translation" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75b7065234a6d32fbd03d8703f" ON "product_option_group_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fd6b39f1fd1db026b5dcc3c795" ON "product_option_group_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0e2fcc31743e20a45fc3cf0211" ON "product_option_group_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c9ce1da98b6d93293daafee63a" ON "product_option_group_translation" ("referenceId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_76bda4c33c83614617278617ae"`); + await queryRunner.query(`DROP INDEX "IDX_0fc743f2bc16502dbc5e85420c"`); + await queryRunner.query(`DROP INDEX "IDX_462a7fd3ce68935cf973c6709f"`); + await queryRunner.query(`DROP INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5"`); + await queryRunner.query(`DROP INDEX "IDX_a6e91739227bf4d442f23c52c7"`); + await queryRunner.query(`ALTER TABLE "product_option_group" RENAME TO "temporary_product_option_group"`); + await queryRunner.query( + `CREATE TABLE "product_option_group" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "productId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a6e91739227bf4d442f23c52c75" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4a1430a01b71ecdfcd54b2b6c5c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_462a7fd3ce68935cf973c6709f9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_option_group"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_group"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_option_group"`); + await queryRunner.query( + `CREATE INDEX "IDX_76bda4c33c83614617278617ae" ON "product_option_group" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0fc743f2bc16502dbc5e85420c" ON "product_option_group" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_462a7fd3ce68935cf973c6709f" ON "product_option_group" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5" ON "product_option_group" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a6e91739227bf4d442f23c52c7" ON "product_option_group" ("productId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_06cd3959f09e0b12793a763515"`); + await queryRunner.query(`DROP INDEX "IDX_198fba43f049ea621407e7d188"`); + await queryRunner.query(`DROP INDEX "IDX_853302351eaa4daa39920c270a"`); + await queryRunner.query(`DROP INDEX "IDX_0a0cf25cd8232a154d1cce2641"`); + await queryRunner.query(`DROP INDEX "IDX_f38e86bd280ff9c9c7d9cb7839"`); + await queryRunner.query(`ALTER TABLE "product_category" RENAME TO "temporary_product_category"`); + await queryRunner.query( + `CREATE TABLE "product_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "imageUrl" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f38e86bd280ff9c9c7d9cb78393" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0a0cf25cd8232a154d1cce2641c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_853302351eaa4daa39920c270a9" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "product_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_category"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_category"`); + await queryRunner.query(`CREATE INDEX "IDX_06cd3959f09e0b12793a763515" ON "product_category" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_198fba43f049ea621407e7d188" ON "product_category" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_853302351eaa4daa39920c270a" ON "product_category" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_0a0cf25cd8232a154d1cce2641" ON "product_category" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f38e86bd280ff9c9c7d9cb7839" ON "product_category" ("imageId") `); + await queryRunner.query(`DROP INDEX "IDX_d32c5d5e4451acf44fd5b212ce"`); + await queryRunner.query(`DROP INDEX "IDX_e690dd59b69e74a6bb5d94f32b"`); + await queryRunner.query(`DROP INDEX "IDX_27d71aa2e843f07fbf36329be3"`); + await queryRunner.query(`DROP INDEX "IDX_e46203bf1dbf3291d174f02cb3"`); + await queryRunner.query(`DROP INDEX "IDX_586294149d24cd835678878ef1"`); + await queryRunner.query( + `ALTER TABLE "product_category_translation" RENAME TO "temporary_product_category_translation"` + ); + await queryRunner.query( + `CREATE TABLE "product_category_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_586294149d24cd835678878ef12" FOREIGN KEY ("referenceId") REFERENCES "product_category" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e46203bf1dbf3291d174f02cb34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_27d71aa2e843f07fbf36329be3f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "product_category_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_category_translation"` + ); + await queryRunner.query(`DROP TABLE "temporary_product_category_translation"`); + await queryRunner.query( + `CREATE INDEX "IDX_d32c5d5e4451acf44fd5b212ce" ON "product_category_translation" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e690dd59b69e74a6bb5d94f32b" ON "product_category_translation" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_27d71aa2e843f07fbf36329be3" ON "product_category_translation" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e46203bf1dbf3291d174f02cb3" ON "product_category_translation" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_586294149d24cd835678878ef1" ON "product_category_translation" ("referenceId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1adf9f97094bc93e176ede2482"`); + await queryRunner.query(`DROP INDEX "IDX_f3027eabd451ec18b93fab7ed5"`); + await queryRunner.query(`DROP INDEX "IDX_683274c59fb08b21249096e305"`); + await queryRunner.query(`DROP INDEX "IDX_873ade98fbd6ca71c8b4d1bbca"`); + await queryRunner.query(`ALTER TABLE "pipeline" RENAME TO "temporary_pipeline"`); + await queryRunner.query( + `CREATE TABLE "pipeline" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_873ade98fbd6ca71c8b4d1bbcac" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_683274c59fb08b21249096e305c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "pipeline"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_pipeline"` + ); + await queryRunner.query(`DROP TABLE "temporary_pipeline"`); + await queryRunner.query(`CREATE INDEX "IDX_1adf9f97094bc93e176ede2482" ON "pipeline" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_f3027eabd451ec18b93fab7ed5" ON "pipeline" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_683274c59fb08b21249096e305" ON "pipeline" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_873ade98fbd6ca71c8b4d1bbca" ON "pipeline" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_074caa106ee22d5d675a696a98"`); + await queryRunner.query(`DROP INDEX "IDX_a6acee4ad726734b73f3886c14"`); + await queryRunner.query(`DROP INDEX "IDX_28965bf63ad4c0976892d0fd5e"`); + await queryRunner.query(`DROP INDEX "IDX_04d16bdd72668de12c3e41a85a"`); + await queryRunner.query(`ALTER TABLE "pipeline_stage" RENAME TO "temporary_pipeline_stage"`); + await queryRunner.query( + `CREATE TABLE "pipeline_stage" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "index" integer NOT NULL, "name" varchar NOT NULL, "pipelineId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_73ec3158bf224b485fd715cb3a6" FOREIGN KEY ("pipelineId") REFERENCES "pipeline" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_04d16bdd72668de12c3e41a85a6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_28965bf63ad4c0976892d0fd5e8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "pipeline_stage"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt" FROM "temporary_pipeline_stage"` + ); + await queryRunner.query(`DROP TABLE "temporary_pipeline_stage"`); + await queryRunner.query(`CREATE INDEX "IDX_074caa106ee22d5d675a696a98" ON "pipeline_stage" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_a6acee4ad726734b73f3886c14" ON "pipeline_stage" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_28965bf63ad4c0976892d0fd5e" ON "pipeline_stage" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_04d16bdd72668de12c3e41a85a" ON "pipeline_stage" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_8c4018eab11e92c3b09583495f"`); + await queryRunner.query(`DROP INDEX "IDX_16a49d62227bf23686b77b5a21"`); + await queryRunner.query(`DROP INDEX "IDX_6959c37c3acf0832103a253570"`); + await queryRunner.query(`DROP INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9"`); + await queryRunner.query(`DROP INDEX "IDX_62ef561a3bb084a7d12dad8a2d"`); + await queryRunner.query(`DROP INDEX "IDX_87223c7f1d4c2ca51cf6992784"`); + await queryRunner.query(`DROP INDEX "IDX_3f13c738eff604a85700746ec7"`); + await queryRunner.query(`DROP INDEX "IDX_8846e403ec45e1ad8c309f91a3"`); + await queryRunner.query(`DROP INDEX "IDX_82753b9e315af84b20eaf84d77"`); + await queryRunner.query(`ALTER TABLE "payment" RENAME TO "temporary_payment"`); + await queryRunner.query( + `CREATE TABLE "payment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "paymentDate" datetime, "amount" numeric, "note" varchar, "currency" varchar NOT NULL, "paymentMethod" varchar, "overdue" boolean, "employeeId" varchar, "invoiceId" varchar, "recordedById" varchar NOT NULL, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_82753b9e315af84b20eaf84d778" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_8846e403ec45e1ad8c309f91a37" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3f13c738eff604a85700746ec7d" FOREIGN KEY ("recordedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_87223c7f1d4c2ca51cf69927844" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62ef561a3bb084a7d12dad8a2d9" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_be7fcc9fb8cd5a74cb602ec6c9b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6959c37c3acf0832103a2535703" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "payment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_payment"` + ); + await queryRunner.query(`DROP TABLE "temporary_payment"`); + await queryRunner.query(`CREATE INDEX "IDX_8c4018eab11e92c3b09583495f" ON "payment" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_16a49d62227bf23686b77b5a21" ON "payment" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6959c37c3acf0832103a253570" ON "payment" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9" ON "payment" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_62ef561a3bb084a7d12dad8a2d" ON "payment" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_87223c7f1d4c2ca51cf6992784" ON "payment" ("invoiceId") `); + await queryRunner.query(`CREATE INDEX "IDX_3f13c738eff604a85700746ec7" ON "payment" ("recordedById") `); + await queryRunner.query(`CREATE INDEX "IDX_8846e403ec45e1ad8c309f91a3" ON "payment" ("projectId") `); + await queryRunner.query( + `CREATE INDEX "IDX_82753b9e315af84b20eaf84d77" ON "payment" ("organizationContactId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_36e929b98372d961bb63bd4b4e"`); + await queryRunner.query(`DROP INDEX "IDX_1c88db6e50f0704688d1f1978c"`); + await queryRunner.query(`DROP INDEX "IDX_380c03025a41ad032191f1ef2d"`); + await queryRunner.query(`DROP INDEX "IDX_e71a736d52820b568f6b0ca203"`); + await queryRunner.query(`DROP INDEX "IDX_1fa632f2d12a06ef8dcc00858f"`); + await queryRunner.query(`ALTER TABLE "password_reset" RENAME TO "temporary_password_reset"`); + await queryRunner.query( + `CREATE TABLE "password_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "email" varchar NOT NULL, "token" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "tenantId" varchar, CONSTRAINT "FK_1fa632f2d12a06ef8dcc00858ff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "password_reset"("id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId") SELECT "id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId" FROM "temporary_password_reset"` + ); + await queryRunner.query(`DROP TABLE "temporary_password_reset"`); + await queryRunner.query(`CREATE INDEX "IDX_36e929b98372d961bb63bd4b4e" ON "password_reset" ("token") `); + await queryRunner.query(`CREATE INDEX "IDX_1c88db6e50f0704688d1f1978c" ON "password_reset" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_380c03025a41ad032191f1ef2d" ON "password_reset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_e71a736d52820b568f6b0ca203" ON "password_reset" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_1fa632f2d12a06ef8dcc00858f" ON "password_reset" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_47b6a97e09895a06606a4a8042"`); + await queryRunner.query(`DROP INDEX "IDX_7965db2b12872551b586f76dd7"`); + await queryRunner.query(`DROP INDEX "IDX_2360aa7a4b5ab99e026584f305"`); + await queryRunner.query(`DROP INDEX "IDX_15458cef74076623c270500053"`); + await queryRunner.query(`DROP INDEX "IDX_9ea70bf5c390b00e7bb96b86ed"`); + await queryRunner.query(`DROP INDEX "IDX_c75285bf286b17c7ca5537857b"`); + await queryRunner.query(`DROP INDEX "IDX_f37d866c3326eca5f579cef35c"`); + await queryRunner.query(`DROP INDEX "IDX_b03a8a28f6ebdb6df8f630216b"`); + await queryRunner.query(`DROP INDEX "IDX_6cc2b2052744e352834a4c9e78"`); + await queryRunner.query(`DROP INDEX "IDX_40460ab803bf6e5a62b75a35c5"`); + await queryRunner.query(`DROP INDEX "IDX_03e5eecc2328eb545ff748cbdd"`); + await queryRunner.query(`DROP INDEX "IDX_c21e615583a3ebbb0977452afb"`); + await queryRunner.query(`DROP INDEX "IDX_745a293c8b2c750bc421fa0633"`); + await queryRunner.query(`DROP INDEX "IDX_6de52b8f3de32abee3df2628a3"`); + await queryRunner.query(`DROP INDEX "IDX_b2091c1795f1d0d919b278ab23"`); + await queryRunner.query(`ALTER TABLE "organization" RENAME TO "temporary_organization"`); + await queryRunner.query( + `CREATE TABLE "organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isDefault" boolean NOT NULL DEFAULT (0), "profile_link" varchar, "banner" varchar, "totalEmployees" integer, "short_description" varchar, "client_focus" varchar, "overview" varchar, "imageUrl" varchar(500), "currency" varchar NOT NULL, "valueDate" datetime, "defaultValueDateType" varchar CHECK( "defaultValueDateType" IN ('TODAY','END_OF_MONTH','START_OF_MONTH') ) DEFAULT ('TODAY'), "isActive" boolean DEFAULT (1), "defaultAlignmentType" varchar, "timeZone" varchar, "regionCode" varchar, "brandColor" varchar, "dateFormat" varchar, "officialName" varchar, "startWeekOn" varchar, "taxId" varchar, "numberFormat" varchar, "minimumProjectSize" varchar, "bonusType" varchar, "bonusPercentage" integer, "invitesAllowed" boolean DEFAULT (1), "show_income" boolean, "show_profits" boolean, "show_bonuses_paid" boolean, "show_total_hours" boolean, "show_minimum_project_size" boolean, "show_projects_count" boolean, "show_clients_count" boolean, "show_clients" boolean, "show_employees_count" boolean, "inviteExpiryPeriod" integer, "fiscalStartDate" datetime, "fiscalEndDate" datetime, "registrationDate" datetime, "futureDateAllowed" boolean, "allowManualTime" boolean NOT NULL DEFAULT (1), "allowModifyTime" boolean NOT NULL DEFAULT (1), "allowDeleteTime" boolean NOT NULL DEFAULT (1), "requireReason" boolean NOT NULL DEFAULT (0), "requireDescription" boolean NOT NULL DEFAULT (0), "requireProject" boolean NOT NULL DEFAULT (0), "requireTask" boolean NOT NULL DEFAULT (0), "requireClient" boolean NOT NULL DEFAULT (0), "timeFormat" integer NOT NULL DEFAULT (12), "separateInvoiceItemTaxAndDiscount" boolean, "website" varchar, "fiscalInformation" varchar, "currencyPosition" varchar NOT NULL DEFAULT ('LEFT'), "discountAfterTax" boolean, "defaultStartTime" varchar, "defaultEndTime" varchar, "defaultInvoiceEstimateTerms" varchar, "convertAcceptedEstimates" boolean, "daysUntilDue" integer, "contactId" varchar, "allowTrackInactivity" boolean NOT NULL DEFAULT (1), "inactivityTimeLimit" integer NOT NULL DEFAULT (10), "activityProofDuration" integer NOT NULL DEFAULT (1), "isRemoveIdleTime" boolean NOT NULL DEFAULT (0), "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "imageId" varchar, "upworkOrganizationId" varchar, "upworkOrganizationName" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "randomScreenshot" boolean DEFAULT (0), "trackOnSleep" boolean DEFAULT (0), "screenshotFrequency" numeric NOT NULL DEFAULT (10), "enforced" boolean DEFAULT (0), CONSTRAINT "FK_745a293c8b2c750bc421fa06332" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7965db2b12872551b586f76dd79" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_47b6a97e09895a06606a4a80421" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization"("id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced" FROM "temporary_organization"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization"`); + await queryRunner.query(`CREATE INDEX "IDX_47b6a97e09895a06606a4a8042" ON "organization" ("imageId") `); + await queryRunner.query(`CREATE INDEX "IDX_7965db2b12872551b586f76dd7" ON "organization" ("contactId") `); + await queryRunner.query( + `CREATE INDEX "IDX_2360aa7a4b5ab99e026584f305" ON "organization" ("defaultValueDateType") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_15458cef74076623c270500053" ON "organization" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_9ea70bf5c390b00e7bb96b86ed" ON "organization" ("overview") `); + await queryRunner.query(`CREATE INDEX "IDX_c75285bf286b17c7ca5537857b" ON "organization" ("client_focus") `); + await queryRunner.query( + `CREATE INDEX "IDX_f37d866c3326eca5f579cef35c" ON "organization" ("short_description") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b03a8a28f6ebdb6df8f630216b" ON "organization" ("totalEmployees") `); + await queryRunner.query(`CREATE INDEX "IDX_6cc2b2052744e352834a4c9e78" ON "organization" ("banner") `); + await queryRunner.query(`CREATE INDEX "IDX_40460ab803bf6e5a62b75a35c5" ON "organization" ("profile_link") `); + await queryRunner.query(`CREATE INDEX "IDX_03e5eecc2328eb545ff748cbdd" ON "organization" ("isDefault") `); + await queryRunner.query(`CREATE INDEX "IDX_c21e615583a3ebbb0977452afb" ON "organization" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_745a293c8b2c750bc421fa0633" ON "organization" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_6de52b8f3de32abee3df2628a3" ON "organization" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_b2091c1795f1d0d919b278ab23" ON "organization" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_266972cd6ff9656eec8818e12d"`); + await queryRunner.query(`DROP INDEX "IDX_04c6320f910056ecb11b147ac8"`); + await queryRunner.query(`DROP INDEX "IDX_7e0bf6063e1728c9813d5da7ca"`); + await queryRunner.query(`DROP INDEX "IDX_56dd132aa3743cfa9b034d020e"`); + await queryRunner.query(`DROP INDEX "IDX_e56e80136b07ecd52545368611"`); + await queryRunner.query(`ALTER TABLE "organization_vendor" RENAME TO "temporary_organization_vendor"`); + await queryRunner.query( + `CREATE TABLE "organization_vendor" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "email" varchar, "phone" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_56dd132aa3743cfa9b034d020eb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e0bf6063e1728c9813d5da7caa" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_vendor"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_vendor"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_vendor"`); + await queryRunner.query( + `CREATE INDEX "IDX_266972cd6ff9656eec8818e12d" ON "organization_vendor" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_04c6320f910056ecb11b147ac8" ON "organization_vendor" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_7e0bf6063e1728c9813d5da7ca" ON "organization_vendor" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_56dd132aa3743cfa9b034d020e" ON "organization_vendor" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_e56e80136b07ecd52545368611" ON "organization_vendor" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_38f1d96e8c2d59e4f0f84209ab"`); + await queryRunner.query(`DROP INDEX "IDX_722d648e0b83267d4a66332ccb"`); + await queryRunner.query(`DROP INDEX "IDX_51e91be110fa0b8e70066f5727"`); + await queryRunner.query(`DROP INDEX "IDX_da625f694eb1e23e585f301008"`); + await queryRunner.query(`DROP INDEX "IDX_103ae3eb65f4b091efc55cb532"`); + await queryRunner.query(`DROP INDEX "IDX_eef1c19a0cb5321223cfe3286c"`); + await queryRunner.query(`DROP INDEX "IDX_176f5ed3c4534f3110d423d569"`); + await queryRunner.query(`DROP INDEX "IDX_e22ab0f1236b1a07785b641727"`); + await queryRunner.query(`ALTER TABLE "organization_team" RENAME TO "temporary_organization_team"`); + await queryRunner.query( + `CREATE TABLE "organization_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "prefix" varchar, "createdById" varchar, "public" boolean DEFAULT (0), "profile_link" varchar, "logo" varchar, "imageId" varchar, "color" varchar, "emoji" varchar, "teamSize" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "shareProfileView" boolean DEFAULT (1), "requirePlanToTrack" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_176f5ed3c4534f3110d423d5690" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eef1c19a0cb5321223cfe3286c4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da625f694eb1e23e585f3010082" FOREIGN KEY ("createdById") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_51e91be110fa0b8e70066f5727f" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack" FROM "temporary_organization_team"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_team"`); + await queryRunner.query(`CREATE INDEX "IDX_38f1d96e8c2d59e4f0f84209ab" ON "organization_team" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_722d648e0b83267d4a66332ccb" ON "organization_team" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_51e91be110fa0b8e70066f5727" ON "organization_team" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_da625f694eb1e23e585f301008" ON "organization_team" ("createdById") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_103ae3eb65f4b091efc55cb532" ON "organization_team" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_eef1c19a0cb5321223cfe3286c" ON "organization_team" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_176f5ed3c4534f3110d423d569" ON "organization_team" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_e22ab0f1236b1a07785b641727" ON "organization_team" ("profile_link") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b027ee2cb18245356b8d963d2f"`); + await queryRunner.query(`DROP INDEX "IDX_29ece7e3bb764028387cdbc888"`); + await queryRunner.query(`DROP INDEX "IDX_171b852be7c1f387eca93775aa"`); + await queryRunner.query(`DROP INDEX "IDX_5e73656ce0355347477c42ae19"`); + await queryRunner.query(`DROP INDEX "IDX_c15823bf3f63b1fe331d9de662"`); + await queryRunner.query(`DROP INDEX "IDX_d9529008c733cb90044b8c2ad6"`); + await queryRunner.query( + `ALTER TABLE "organization_team_join_request" RENAME TO "temporary_organization_team_join_request"` + ); + await queryRunner.query( + `CREATE TABLE "organization_team_join_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "email" varchar NOT NULL, "fullName" varchar, "linkAddress" varchar, "position" varchar, "status" varchar, "code" varchar, "token" varchar, "expiredAt" datetime, "userId" varchar, "organizationTeamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_171b852be7c1f387eca93775aad" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e73656ce0355347477c42ae19b" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c15823bf3f63b1fe331d9de6625" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d9529008c733cb90044b8c2ad6b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_team_join_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_team_join_request"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_team_join_request"`); + await queryRunner.query( + `CREATE INDEX "IDX_b027ee2cb18245356b8d963d2f" ON "organization_team_join_request" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_29ece7e3bb764028387cdbc888" ON "organization_team_join_request" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_171b852be7c1f387eca93775aa" ON "organization_team_join_request" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5e73656ce0355347477c42ae19" ON "organization_team_join_request" ("userId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c15823bf3f63b1fe331d9de662" ON "organization_team_join_request" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d9529008c733cb90044b8c2ad6" ON "organization_team_join_request" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_719aeb37fa7a1dd80d25336a0c"`); + await queryRunner.query(`DROP INDEX "IDX_ce83034f38496f5fe3f1979697"`); + await queryRunner.query(`DROP INDEX "IDX_a2a5601d799fbfc29c17b99243"`); + await queryRunner.query(`DROP INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0"`); + await queryRunner.query(`DROP INDEX "IDX_d8eba1c0e500c60be1b69c1e77"`); + await queryRunner.query(`DROP INDEX "IDX_fe12e1b76bbb76209134d9bdc2"`); + await queryRunner.query(`DROP INDEX "IDX_70fcc451944fbde73d223c2af3"`); + await queryRunner.query(`DROP INDEX "IDX_752d7a0fe6597ee6bbc6502a12"`); + await queryRunner.query( + `ALTER TABLE "organization_team_employee" RENAME TO "temporary_organization_team_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_team_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "organizationTeamId" varchar NOT NULL, "employeeId" varchar NOT NULL, "roleId" varchar, "isTrackingEnabled" boolean DEFAULT (1), "activeTaskId" varchar, "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "order" integer, CONSTRAINT "FK_fe12e1b76bbb76209134d9bdc2e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d8eba1c0e500c60be1b69c1e777" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dc83cdd7c519d73afc0d8bdf09" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2a5601d799fbfc29c17b99243f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ce83034f38496f5fe3f19796977" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_719aeb37fa7a1dd80d25336a0cf" FOREIGN KEY ("activeTaskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_team_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order" FROM "temporary_organization_team_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_team_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_719aeb37fa7a1dd80d25336a0c" ON "organization_team_employee" ("activeTaskId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ce83034f38496f5fe3f1979697" ON "organization_team_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a2a5601d799fbfc29c17b99243" ON "organization_team_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0" ON "organization_team_employee" ("organizationTeamId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d8eba1c0e500c60be1b69c1e77" ON "organization_team_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_fe12e1b76bbb76209134d9bdc2" ON "organization_team_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_70fcc451944fbde73d223c2af3" ON "organization_team_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_752d7a0fe6597ee6bbc6502a12" ON "organization_team_employee" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b7be7e61daf2b5af3232c9c4d6"`); + await queryRunner.query(`DROP INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3"`); + await queryRunner.query(`DROP INDEX "IDX_582768159ef0c749e8552ea9bc"`); + await queryRunner.query(`DROP INDEX "IDX_5830901876e426adfc15fb7341"`); + await queryRunner.query(`DROP INDEX "IDX_19ab7adf33199bc6f913db277d"`); + await queryRunner.query(`DROP INDEX "IDX_20a290f166c0810eafbf271717"`); + await queryRunner.query( + `ALTER TABLE "organization_task_setting" RENAME TO "temporary_organization_task_setting"` + ); + await queryRunner.query( + `CREATE TABLE "organization_task_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isTasksPrivacyEnabled" boolean NOT NULL DEFAULT (1), "isTasksMultipleAssigneesEnabled" boolean NOT NULL DEFAULT (1), "isTasksManualTimeEnabled" boolean NOT NULL DEFAULT (1), "isTasksGroupEstimationEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInHoursEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInStoryPointsEnabled" boolean NOT NULL DEFAULT (1), "isTasksProofOfCompletionEnabled" boolean NOT NULL DEFAULT (1), "tasksProofOfCompletionType" varchar NOT NULL DEFAULT ('PRIVATE'), "isTasksLinkedEnabled" boolean NOT NULL DEFAULT (1), "isTasksCommentsEnabled" boolean NOT NULL DEFAULT (1), "isTasksHistoryEnabled" boolean NOT NULL DEFAULT (1), "isTasksAcceptanceCriteriaEnabled" boolean NOT NULL DEFAULT (1), "isTasksDraftsEnabled" boolean NOT NULL DEFAULT (1), "isTasksNotifyLeftEnabled" boolean NOT NULL DEFAULT (1), "tasksNotifyLeftPeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoCloseEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoClosePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoArchiveEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoArchivePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoStatusEnabled" boolean NOT NULL DEFAULT (1), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_20a290f166c0810eafbf2717171" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_19ab7adf33199bc6f913db277d7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5830901876e426adfc15fb7341b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_582768159ef0c749e8552ea9bcd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_task_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_task_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_task_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_b7be7e61daf2b5af3232c9c4d6" ON "organization_task_setting" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3" ON "organization_task_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_582768159ef0c749e8552ea9bc" ON "organization_task_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5830901876e426adfc15fb7341" ON "organization_task_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_19ab7adf33199bc6f913db277d" ON "organization_task_setting" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_20a290f166c0810eafbf271717" ON "organization_task_setting" ("organizationTeamId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_76e53f9609ca05477d50980743"`); + await queryRunner.query(`DROP INDEX "IDX_5596b4fa7fb2ceb0955580becd"`); + await queryRunner.query(`DROP INDEX "IDX_f57ad03c4e471bd8530494ea63"`); + await queryRunner.query(`DROP INDEX "IDX_8a1fe8afb3aa672bae5993fbe7"`); + await queryRunner.query(`ALTER TABLE "organization_sprint" RENAME TO "temporary_organization_sprint"`); + await queryRunner.query( + `CREATE TABLE "organization_sprint" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "projectId" varchar NOT NULL, "goal" varchar, "length" integer NOT NULL DEFAULT (7), "startDate" datetime, "endDate" datetime, "dayStart" integer, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a140b7e30ff3455551a0fd599fb" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8a1fe8afb3aa672bae5993fbe7d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f57ad03c4e471bd8530494ea63d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_sprint"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_sprint"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_sprint"`); + await queryRunner.query( + `CREATE INDEX "IDX_76e53f9609ca05477d50980743" ON "organization_sprint" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_5596b4fa7fb2ceb0955580becd" ON "organization_sprint" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f57ad03c4e471bd8530494ea63" ON "organization_sprint" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_8a1fe8afb3aa672bae5993fbe7" ON "organization_sprint" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f3ef2000abb9762b138cc5a1b3"`); + await queryRunner.query(`DROP INDEX "IDX_9ad08dbc039d08279dae2dd94e"`); + await queryRunner.query(`DROP INDEX "IDX_0b19a287858af40661bd3eb741"`); + await queryRunner.query(`DROP INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e"`); + await queryRunner.query(`DROP INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b"`); + await queryRunner.query(`DROP INDEX "IDX_61387780d015923453f4b015b4"`); + await queryRunner.query(`DROP INDEX "IDX_637ac2c467df4bc3b71795a866"`); + await queryRunner.query( + `ALTER TABLE "organization_recurring_expense" RENAME TO "temporary_organization_recurring_expense"` + ); + await queryRunner.query( + `CREATE TABLE "organization_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "splitExpense" boolean, "parentRecurringExpenseId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_8a12e7a0d47d3c6a6b35f7984e3" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0b19a287858af40661bd3eb7411" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_recurring_expense"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_recurring_expense"`); + await queryRunner.query( + `CREATE INDEX "IDX_f3ef2000abb9762b138cc5a1b3" ON "organization_recurring_expense" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9ad08dbc039d08279dae2dd94e" ON "organization_recurring_expense" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0b19a287858af40661bd3eb741" ON "organization_recurring_expense" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e" ON "organization_recurring_expense" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b" ON "organization_recurring_expense" ("categoryName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_61387780d015923453f4b015b4" ON "organization_recurring_expense" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_637ac2c467df4bc3b71795a866" ON "organization_recurring_expense" ("parentRecurringExpenseId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f33638d289aff2306328c32a8c"`); + await queryRunner.query(`DROP INDEX "IDX_a56086e95fb2627ba2a3dd2eaa"`); + await queryRunner.query(`DROP INDEX "IDX_8a7a4d4206c003c3827c5afe5d"`); + await queryRunner.query(`DROP INDEX "IDX_cd928adcb5ebb00c9f2c57e390"`); + await queryRunner.query(`DROP INDEX "IDX_86438fbaa1d857f32f66b24885"`); + await queryRunner.query(`DROP INDEX "IDX_7fd3c8f54c01943b283080aefa"`); + await queryRunner.query(`DROP INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0"`); + await queryRunner.query(`DROP INDEX "IDX_e6b6555e5fc6c5120110a0195c"`); + await queryRunner.query( + `ALTER TABLE "organization_project_module" RENAME TO "temporary_organization_project_module"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_module" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" text, "status" varchar, "startDate" datetime, "endDate" datetime, "public" boolean DEFAULT (0), "isFavorite" boolean DEFAULT (0), "parentId" varchar, "projectId" varchar, "creatorId" varchar, "managerId" varchar, CONSTRAINT "FK_e6b6555e5fc6c5120110a0195cd" FOREIGN KEY ("managerId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f2054a6a2d4b9c17624b9c8a01" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd3c8f54c01943b283080aefa3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bb6fbfa64cf5d5977c2e5346a9" FOREIGN KEY ("parentId") REFERENCES "organization_project_module" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_cd928adcb5ebb00c9f2c57e3908" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a7a4d4206c003c3827c5afe5dc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_module"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId" FROM "temporary_organization_project_module"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_module"`); + await queryRunner.query( + `CREATE INDEX "IDX_f33638d289aff2306328c32a8c" ON "organization_project_module" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a56086e95fb2627ba2a3dd2eaa" ON "organization_project_module" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8a7a4d4206c003c3827c5afe5d" ON "organization_project_module" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_cd928adcb5ebb00c9f2c57e390" ON "organization_project_module" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_86438fbaa1d857f32f66b24885" ON "organization_project_module" ("status") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7fd3c8f54c01943b283080aefa" ON "organization_project_module" ("projectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0" ON "organization_project_module" ("creatorId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e6b6555e5fc6c5120110a0195c" ON "organization_project_module" ("managerId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); + await queryRunner.query( + `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "temporary_organization_project"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project"`); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f"`); + await queryRunner.query(`DROP INDEX "IDX_7317abf7a05a169783b6aa7932"`); + await queryRunner.query(`DROP INDEX "IDX_a8f497b1006ec967964abb0d49"`); + await queryRunner.query(`DROP INDEX "IDX_a0409e39f23ff6d418f2c03df5"`); + await queryRunner.query(`DROP INDEX "IDX_3f02c20145af9997253531349c"`); + await queryRunner.query(`ALTER TABLE "organization_position" RENAME TO "temporary_organization_position"`); + await queryRunner.query( + `CREATE TABLE "organization_position" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a0409e39f23ff6d418f2c03df58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a8f497b1006ec967964abb0d497" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_position"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_position"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_position"`); + await queryRunner.query( + `CREATE INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f" ON "organization_position" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7317abf7a05a169783b6aa7932" ON "organization_position" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a8f497b1006ec967964abb0d49" ON "organization_position" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a0409e39f23ff6d418f2c03df5" ON "organization_position" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3f02c20145af9997253531349c" ON "organization_position" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_6577ec9ca4cef331a507264d44"`); + await queryRunner.query(`DROP INDEX "IDX_b79e8d45a3ef5503579643f5de"`); + await queryRunner.query(`DROP INDEX "IDX_225e476592214e32e117a85213"`); + await queryRunner.query(`DROP INDEX "IDX_4513931e2d530f78d7144c8c7c"`); + await queryRunner.query(`DROP INDEX "IDX_020516e74a57cb85d75381e841"`); + await queryRunner.query(`ALTER TABLE "organization_language" RENAME TO "temporary_organization_language"`); + await queryRunner.query( + `CREATE TABLE "organization_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "languageCode" varchar NOT NULL, "name" varchar NOT NULL, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_020516e74a57cb85d75381e841a" FOREIGN KEY ("languageCode") REFERENCES "language" ("code") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4513931e2d530f78d7144c8c7cd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_225e476592214e32e117a85213c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_language"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_language"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_language"`); + await queryRunner.query( + `CREATE INDEX "IDX_6577ec9ca4cef331a507264d44" ON "organization_language" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b79e8d45a3ef5503579643f5de" ON "organization_language" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_225e476592214e32e117a85213" ON "organization_language" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4513931e2d530f78d7144c8c7c" ON "organization_language" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_020516e74a57cb85d75381e841" ON "organization_language" ("languageCode") ` + ); + await queryRunner.query(`DROP INDEX "IDX_cc096d49e2399e89cdf32297da"`); + await queryRunner.query(`DROP INDEX "IDX_880f3cce5e03f42bec3da6e6dc"`); + await queryRunner.query(`DROP INDEX "IDX_227b5bd9867287cbbeece8f6ba"`); + await queryRunner.query(`DROP INDEX "IDX_a583cfe32f492f5ba99b7bb205"`); + await queryRunner.query( + `ALTER TABLE "organization_employment_type" RENAME TO "temporary_organization_employment_type"` + ); + await queryRunner.query( + `CREATE TABLE "organization_employment_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a583cfe32f492f5ba99b7bb2050" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_227b5bd9867287cbbeece8f6ba9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_employment_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_employment_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_employment_type"`); + await queryRunner.query( + `CREATE INDEX "IDX_cc096d49e2399e89cdf32297da" ON "organization_employment_type" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_880f3cce5e03f42bec3da6e6dc" ON "organization_employment_type" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_227b5bd9867287cbbeece8f6ba" ON "organization_employment_type" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a583cfe32f492f5ba99b7bb205" ON "organization_employment_type" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_72c6a8ad9de5c04b2b689fd229"`); + await queryRunner.query(`DROP INDEX "IDX_e5edb48261db95f46c3b4d34a5"`); + await queryRunner.query(`DROP INDEX "IDX_1057ec001a4c6b258658143047"`); + await queryRunner.query(`DROP INDEX "IDX_4bc83945c022a862a33629ff1e"`); + await queryRunner.query(`DROP INDEX "IDX_c129dee7d1cb84e01e69b5e2c6"`); + await queryRunner.query(`ALTER TABLE "organization_document" RENAME TO "temporary_organization_document"`); + await queryRunner.query( + `CREATE TABLE "organization_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "documentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c129dee7d1cb84e01e69b5e2c66" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4bc83945c022a862a33629ff1e1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1057ec001a4c6b258658143047a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "organization_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_document"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_document"`); + await queryRunner.query( + `CREATE INDEX "IDX_72c6a8ad9de5c04b2b689fd229" ON "organization_document" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e5edb48261db95f46c3b4d34a5" ON "organization_document" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1057ec001a4c6b258658143047" ON "organization_document" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4bc83945c022a862a33629ff1e" ON "organization_document" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c129dee7d1cb84e01e69b5e2c6" ON "organization_document" ("documentId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b65059949804b20048b1c86c3d"`); + await queryRunner.query(`DROP INDEX "IDX_6139cd4c620e81aefd4895d370"`); + await queryRunner.query(`DROP INDEX "IDX_b3644ff7cd65239e29d292a41d"`); + await queryRunner.query(`DROP INDEX "IDX_c61a562a2379d1c0077fe7de33"`); + await queryRunner.query(`DROP INDEX "IDX_91b652409dc1fb2f712590dd21"`); + await queryRunner.query(`ALTER TABLE "organization_department" RENAME TO "temporary_organization_department"`); + await queryRunner.query( + `CREATE TABLE "organization_department" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c61a562a2379d1c0077fe7de332" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3644ff7cd65239e29d292a41d1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_department"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_department"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_department"`); + await queryRunner.query( + `CREATE INDEX "IDX_b65059949804b20048b1c86c3d" ON "organization_department" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6139cd4c620e81aefd4895d370" ON "organization_department" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b3644ff7cd65239e29d292a41d" ON "organization_department" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c61a562a2379d1c0077fe7de33" ON "organization_department" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_91b652409dc1fb2f712590dd21" ON "organization_department" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_f91783c7a8565c648b65635efc"`); + await queryRunner.query(`DROP INDEX "IDX_53627a383c9817dbf1164d7dc6"`); + await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); + await queryRunner.query(`DROP INDEX "IDX_6200736cb4d3617b004e5b647f"`); + await queryRunner.query(`DROP INDEX "IDX_de33f92e042365d196d959e774"`); + await queryRunner.query(`DROP INDEX "IDX_a86d2e378b953cb39261f457d2"`); + await queryRunner.query(`DROP INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd"`); + await queryRunner.query(`ALTER TABLE "organization_contact" RENAME TO "temporary_organization_contact"`); + await queryRunner.query( + `CREATE TABLE "organization_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "primaryEmail" varchar, "primaryPhone" varchar, "inviteStatus" varchar, "notes" varchar, "contactType" varchar CHECK( "contactType" IN ('CLIENT','CUSTOMER','LEAD') ) NOT NULL DEFAULT ('CLIENT'), "imageUrl" varchar(500), "budget" integer, "budgetType" varchar CHECK( "budgetType" IN ('hours','cost') ) DEFAULT ('cost'), "createdBy" varchar, "contactId" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_a86d2e378b953cb39261f457d2" UNIQUE ("contactId"), CONSTRAINT "FK_8cfcdc6bc8fb55e273d9ace5fd5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a86d2e378b953cb39261f457d26" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6200736cb4d3617b004e5b647ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e68c43e315ad3aaea4e99cf461d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_contact"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_contact"`); + await queryRunner.query( + `CREATE INDEX "IDX_f91783c7a8565c648b65635efc" ON "organization_contact" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_53627a383c9817dbf1164d7dc6" ON "organization_contact" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e68c43e315ad3aaea4e99cf461" ON "organization_contact" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6200736cb4d3617b004e5b647f" ON "organization_contact" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd" ON "organization_contact" ("imageId") `); + await queryRunner.query(`DROP INDEX "IDX_34c6749e2bc94b2e52e9572f32"`); + await queryRunner.query(`DROP INDEX "IDX_4062b5d54aa740aaff9a6c5fbb"`); + await queryRunner.query(`DROP INDEX "IDX_af6423760433da72002a7f369e"`); + await queryRunner.query(`DROP INDEX "IDX_2e0d21aab892b5993abaac09bc"`); + await queryRunner.query(`DROP INDEX "IDX_31626e7d39eb95b710d5a2d80f"`); + await queryRunner.query(`ALTER TABLE "organization_award" RENAME TO "temporary_organization_award"`); + await queryRunner.query( + `CREATE TABLE "organization_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2e0d21aab892b5993abaac09bcd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_af6423760433da72002a7f369eb" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_award"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_award"`); + await queryRunner.query( + `CREATE INDEX "IDX_34c6749e2bc94b2e52e9572f32" ON "organization_award" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_4062b5d54aa740aaff9a6c5fbb" ON "organization_award" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_af6423760433da72002a7f369e" ON "organization_award" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_2e0d21aab892b5993abaac09bc" ON "organization_award" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_31626e7d39eb95b710d5a2d80f" ON "organization_award" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_0a0f972564e74c9c4905e3abcb"`); + await queryRunner.query(`DROP INDEX "IDX_a03be8a86e528e2720504a041f"`); + await queryRunner.query(`DROP INDEX "IDX_533144d7ae94180235ea456625"`); + await queryRunner.query(`DROP INDEX "IDX_d306a524b507f72fa8550aeffe"`); + await queryRunner.query(`DROP INDEX "IDX_e03ddff05652be527e04abdc56"`); + await queryRunner.query(`DROP INDEX "IDX_20acc3c3a6c900c6ef9fc68199"`); + await queryRunner.query(`ALTER TABLE "merchant" RENAME TO "temporary_merchant"`); + await queryRunner.query( + `CREATE TABLE "merchant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "phone" varchar, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "currency" varchar NOT NULL DEFAULT ('USD'), "contactId" varchar, "logoId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_e03ddff05652be527e04abdc56" UNIQUE ("contactId"), CONSTRAINT "FK_20acc3c3a6c900c6ef9fc681996" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e03ddff05652be527e04abdc56f" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d306a524b507f72fa8550aeffe4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_533144d7ae94180235ea456625b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "merchant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt" FROM "temporary_merchant"` + ); + await queryRunner.query(`DROP TABLE "temporary_merchant"`); + await queryRunner.query(`CREATE INDEX "IDX_0a0f972564e74c9c4905e3abcb" ON "merchant" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_a03be8a86e528e2720504a041f" ON "merchant" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_533144d7ae94180235ea456625" ON "merchant" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d306a524b507f72fa8550aeffe" ON "merchant" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_e03ddff05652be527e04abdc56" ON "merchant" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_20acc3c3a6c900c6ef9fc68199" ON "merchant" ("logoId") `); + await queryRunner.query(`DROP INDEX "IDX_15fcb8179bc7b0642ca78da69e"`); + await queryRunner.query(`DROP INDEX "IDX_3a7abee35dfa3c90ed491583eb"`); + await queryRunner.query(`ALTER TABLE "language" RENAME TO "temporary_language"`); + await queryRunner.query( + `CREATE TABLE "language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar, "is_system" boolean DEFAULT (1), "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))` + ); + await queryRunner.query( + `INSERT INTO "language"("id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt" FROM "temporary_language"` + ); + await queryRunner.query(`DROP TABLE "temporary_language"`); + await queryRunner.query(`CREATE INDEX "IDX_15fcb8179bc7b0642ca78da69e" ON "language" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_3a7abee35dfa3c90ed491583eb" ON "language" ("isActive") `); + await queryRunner.query(`DROP INDEX "IDX_8889e2618366faefa575a8049b"`); + await queryRunner.query(`DROP INDEX "IDX_9b62dd2dddcde032f46a981733"`); + await queryRunner.query(`DROP INDEX "IDX_8ac2c6b487d03157adda874789"`); + await queryRunner.query(`DROP INDEX "IDX_d1f45ca98f17bd84a5e430feaf"`); + await queryRunner.query(`DROP INDEX "IDX_5880347716f9ec5056ec15112c"`); + await queryRunner.query(`DROP INDEX "IDX_c89adeff0de3aedb2e772a5bf4"`); + await queryRunner.query(`DROP INDEX "IDX_38dc003f3484eff4b59918e9ae"`); + await queryRunner.query(`DROP INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a"`); + await queryRunner.query(`DROP INDEX "IDX_4e1e975124c1d717814a4bb2ec"`); + await queryRunner.query(`DROP INDEX "IDX_3e1d08761a717c1dd71fe67249"`); + await queryRunner.query(`ALTER TABLE "key_result" RENAME TO "temporary_key_result"`); + await queryRunner.query( + `CREATE TABLE "key_result" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "type" varchar NOT NULL, "targetValue" integer, "initialValue" integer, "unit" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "deadline" varchar NOT NULL, "hardDeadline" datetime, "softDeadline" datetime, "status" varchar NOT NULL, "weight" varchar, "ownerId" varchar NOT NULL, "leadId" varchar, "projectId" varchar, "taskId" varchar, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3e1d08761a717c1dd71fe67249b" FOREIGN KEY ("goalId") REFERENCES "goal" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4e1e975124c1d717814a4bb2ec8" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d8547e21ccb8e37ac9f0d69c1af" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38dc003f3484eff4b59918e9ae3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c89adeff0de3aedb2e772a5bf4c" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_5880347716f9ec5056ec15112cc" FOREIGN KEY ("ownerId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d1f45ca98f17bd84a5e430feaf4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8ac2c6b487d03157adda874789f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "key_result"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result"` + ); + await queryRunner.query(`DROP TABLE "temporary_key_result"`); + await queryRunner.query(`CREATE INDEX "IDX_8889e2618366faefa575a8049b" ON "key_result" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_9b62dd2dddcde032f46a981733" ON "key_result" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8ac2c6b487d03157adda874789" ON "key_result" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_d1f45ca98f17bd84a5e430feaf" ON "key_result" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_5880347716f9ec5056ec15112c" ON "key_result" ("ownerId") `); + await queryRunner.query(`CREATE INDEX "IDX_c89adeff0de3aedb2e772a5bf4" ON "key_result" ("leadId") `); + await queryRunner.query(`CREATE INDEX "IDX_38dc003f3484eff4b59918e9ae" ON "key_result" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a" ON "key_result" ("taskId") `); + await queryRunner.query(`CREATE INDEX "IDX_4e1e975124c1d717814a4bb2ec" ON "key_result" ("kpiId") `); + await queryRunner.query(`CREATE INDEX "IDX_3e1d08761a717c1dd71fe67249" ON "key_result" ("goalId") `); + await queryRunner.query(`DROP INDEX "IDX_94aad97b26aede6545a3226fb3"`); + await queryRunner.query(`DROP INDEX "IDX_12b8b54f416ec9f5ec002f0a83"`); + await queryRunner.query(`DROP INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65"`); + await queryRunner.query(`DROP INDEX "IDX_fd4b0cb7a44ed914acdda55e29"`); + await queryRunner.query(`ALTER TABLE "key_result_update" RENAME TO "temporary_key_result_update"`); + await queryRunner.query( + `CREATE TABLE "key_result_update" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "owner" varchar NOT NULL, "status" varchar NOT NULL, "keyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7497a70a581e5f56f792015dd37" FOREIGN KEY ("keyResultId") REFERENCES "key_result" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fd4b0cb7a44ed914acdda55e29c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cd9cbc0d5b6d62dbb63c3b3a65b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "key_result_update"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result_update"` + ); + await queryRunner.query(`DROP TABLE "temporary_key_result_update"`); + await queryRunner.query(`CREATE INDEX "IDX_94aad97b26aede6545a3226fb3" ON "key_result_update" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_12b8b54f416ec9f5ec002f0a83" ON "key_result_update" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65" ON "key_result_update" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_fd4b0cb7a44ed914acdda55e29" ON "key_result_update" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_aa0e9b0cfcba1926925b025512"`); + await queryRunner.query(`DROP INDEX "IDX_f4e813d72dc732f16497ee2c52"`); + await queryRunner.query(`DROP INDEX "IDX_86c09eb673b0e66129dbdc7211"`); + await queryRunner.query(`DROP INDEX "IDX_fab6b6200b9ed6fd002c1ff62a"`); + await queryRunner.query(`DROP INDEX "IDX_46426ea45456e240a092b73204"`); + await queryRunner.query(`ALTER TABLE "key_result_template" RENAME TO "temporary_key_result_template"`); + await queryRunner.query( + `CREATE TABLE "key_result_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "unit" varchar, "targetValue" integer, "initialValue" integer, "deadline" varchar NOT NULL, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_46426ea45456e240a092b732047" FOREIGN KEY ("goalId") REFERENCES "goal_template" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bc62c3d2ffdd6f9c7f8b3dcd1c" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_fab6b6200b9ed6fd002c1ff62ab" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_86c09eb673b0e66129dbdc72111" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "key_result_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_key_result_template"`); + await queryRunner.query( + `CREATE INDEX "IDX_aa0e9b0cfcba1926925b025512" ON "key_result_template" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_f4e813d72dc732f16497ee2c52" ON "key_result_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_86c09eb673b0e66129dbdc7211" ON "key_result_template" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_fab6b6200b9ed6fd002c1ff62a" ON "key_result_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_46426ea45456e240a092b73204" ON "key_result_template" ("goalId") `); + await queryRunner.query(`DROP INDEX "IDX_eabacf7474d75e53d7b7046f3e"`); + await queryRunner.query(`DROP INDEX "IDX_850ca385c1985c1808cd4ea241"`); + await queryRunner.query(`DROP INDEX "IDX_7fb52a5f267f53b7d93af3d8c3"`); + await queryRunner.query(`DROP INDEX "IDX_058ef835f99e28fc6717cd7c80"`); + await queryRunner.query(`DROP INDEX "IDX_b5c33892e630b66c65d623baf8"`); + await queryRunner.query(`DROP INDEX "IDX_d9e965da0f63c94983d3a1006a"`); + await queryRunner.query(`ALTER TABLE "invoice" RENAME TO "temporary_invoice"`); + await queryRunner.query( + `CREATE TABLE "invoice" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "invoiceDate" datetime, "invoiceNumber" numeric, "dueDate" datetime, "currency" varchar NOT NULL, "discountValue" numeric NOT NULL, "paid" boolean, "tax" numeric, "tax2" numeric, "terms" varchar NOT NULL, "totalValue" numeric, "status" varchar NOT NULL, "isEstimate" boolean, "isAccepted" boolean, "discountType" varchar, "taxType" varchar, "tax2Type" varchar, "invoiceType" varchar, "sentTo" varchar, "organizationContactId" varchar, "internalNote" varchar, "alreadyPaid" numeric, "amountDue" numeric, "hasRemainingAmountInvoiced" boolean, "token" varchar, "isArchived" boolean DEFAULT (0), "fromOrganizationId" varchar NOT NULL, "toContactId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "UQ_d7bed97fb47876e03fd7d7c285a" UNIQUE ("invoiceNumber"), CONSTRAINT "FK_d9e965da0f63c94983d3a1006ac" FOREIGN KEY ("toContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b5c33892e630b66c65d623baf8e" FOREIGN KEY ("fromOrganizationId") REFERENCES "organization" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_058ef835f99e28fc6717cd7c80f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7fb52a5f267f53b7d93af3d8c3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "invoice"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt" FROM "temporary_invoice"` + ); + await queryRunner.query(`DROP TABLE "temporary_invoice"`); + await queryRunner.query(`CREATE INDEX "IDX_eabacf7474d75e53d7b7046f3e" ON "invoice" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_850ca385c1985c1808cd4ea241" ON "invoice" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_7fb52a5f267f53b7d93af3d8c3" ON "invoice" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_058ef835f99e28fc6717cd7c80" ON "invoice" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_b5c33892e630b66c65d623baf8" ON "invoice" ("fromOrganizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_d9e965da0f63c94983d3a1006a" ON "invoice" ("toContactId") `); + await queryRunner.query(`DROP INDEX "IDX_b7da14d2b61cf1dd5c65188b9c"`); + await queryRunner.query(`DROP INDEX "IDX_e2835fd8776ae5d56d892e087e"`); + await queryRunner.query(`DROP INDEX "IDX_f78214cd9de76e80fe8a6305f5"`); + await queryRunner.query(`DROP INDEX "IDX_e89749c8e8258b2ec110c0776f"`); + await queryRunner.query(`ALTER TABLE "invoice_item" RENAME TO "temporary_invoice_item"`); + await queryRunner.query( + `CREATE TABLE "invoice_item" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "price" numeric NOT NULL, "quantity" numeric NOT NULL, "totalValue" numeric NOT NULL, "applyTax" boolean, "applyDiscount" boolean, "expenseId" varchar, "invoiceId" varchar, "taskId" varchar, "employeeId" varchar, "projectId" varchar, "productId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e558df60d7d9a3e412ef0bbb844" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16f1d0e74b4d33e59c0eabdaac7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d4d92abde074b3da8054d7cfbc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62d486728b272e3b4d23a6b5db6" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_553d5aac210d22fdca5c8d48ead" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_897c33b49a04cf3db7acd336afc" FOREIGN KEY ("expenseId") REFERENCES "expense" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e89749c8e8258b2ec110c0776ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f78214cd9de76e80fe8a6305f52" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "invoice_item"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt" FROM "temporary_invoice_item"` + ); + await queryRunner.query(`DROP TABLE "temporary_invoice_item"`); + await queryRunner.query(`CREATE INDEX "IDX_b7da14d2b61cf1dd5c65188b9c" ON "invoice_item" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e2835fd8776ae5d56d892e087e" ON "invoice_item" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f78214cd9de76e80fe8a6305f5" ON "invoice_item" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e89749c8e8258b2ec110c0776f" ON "invoice_item" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_cc0ac824ba89deda98bb418e8c"`); + await queryRunner.query(`DROP INDEX "IDX_856f24297f120604f8ae294276"`); + await queryRunner.query(`DROP INDEX "IDX_da2893697d57368470952a76f6"`); + await queryRunner.query(`DROP INDEX "IDX_31ec3d5a6b0985cec544c64217"`); + await queryRunner.query(`DROP INDEX "IDX_483eb296a94d821ebedb375858"`); + await queryRunner.query(`DROP INDEX "IDX_8106063f79cce8e67790d79092"`); + await queryRunner.query( + `ALTER TABLE "invoice_estimate_history" RENAME TO "temporary_invoice_estimate_history"` + ); + await queryRunner.query( + `CREATE TABLE "invoice_estimate_history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" varchar NOT NULL, "userId" varchar, "invoiceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "title" varchar, "deletedAt" datetime, CONSTRAINT "FK_cc0ac824ba89deda98bb418e8ca" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_856f24297f120604f8ae2942769" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da2893697d57368470952a76f65" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_31ec3d5a6b0985cec544c642178" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "invoice_estimate_history"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt" FROM "temporary_invoice_estimate_history"` + ); + await queryRunner.query(`DROP TABLE "temporary_invoice_estimate_history"`); + await queryRunner.query( + `CREATE INDEX "IDX_cc0ac824ba89deda98bb418e8c" ON "invoice_estimate_history" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_856f24297f120604f8ae294276" ON "invoice_estimate_history" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_da2893697d57368470952a76f6" ON "invoice_estimate_history" ("userId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_31ec3d5a6b0985cec544c64217" ON "invoice_estimate_history" ("invoiceId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_483eb296a94d821ebedb375858" ON "invoice_estimate_history" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8106063f79cce8e67790d79092" ON "invoice_estimate_history" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3cef860504647ccd52d39d7dc2"`); + await queryRunner.query(`DROP INDEX "IDX_bd44bcb10034bc0c5fe4427b3e"`); + await queryRunner.query(`DROP INDEX "IDX_91bfeec7a9574f458e5b592472"`); + await queryRunner.query(`DROP INDEX "IDX_900a3ed40499c79c1c289fec28"`); + await queryRunner.query(`DROP INDEX "IDX_5a182e8b3e225b14ddf6df7e6c"`); + await queryRunner.query(`DROP INDEX "IDX_68eef4ab86b67747f24f288a16"`); + await queryRunner.query(`DROP INDEX "IDX_7c2328f76efb850b8114797247"`); + await queryRunner.query(`ALTER TABLE "invite" RENAME TO "temporary_invite"`); + await queryRunner.query( + `CREATE TABLE "invite" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "status" varchar NOT NULL, "expireDate" datetime, "actionDate" datetime, "invitedById" varchar, "roleId" varchar, "code" varchar, "fullName" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7c2328f76efb850b81147972476" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_68eef4ab86b67747f24f288a16c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5a182e8b3e225b14ddf6df7e6c3" FOREIGN KEY ("invitedById") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_900a3ed40499c79c1c289fec284" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91bfeec7a9574f458e5b592472d" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "invite"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt" FROM "temporary_invite"` + ); + await queryRunner.query(`DROP TABLE "temporary_invite"`); + await queryRunner.query(`CREATE INDEX "IDX_3cef860504647ccd52d39d7dc2" ON "invite" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_bd44bcb10034bc0c5fe4427b3e" ON "invite" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_91bfeec7a9574f458e5b592472" ON "invite" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_900a3ed40499c79c1c289fec28" ON "invite" ("roleId") `); + await queryRunner.query(`CREATE INDEX "IDX_5a182e8b3e225b14ddf6df7e6c" ON "invite" ("invitedById") `); + await queryRunner.query(`CREATE INDEX "IDX_68eef4ab86b67747f24f288a16" ON "invite" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_7c2328f76efb850b8114797247" ON "invite" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_85d7b0f07f3e3707b4586670a9"`); + await queryRunner.query(`DROP INDEX "IDX_24981cd300007cf88601c2d616"`); + await queryRunner.query(`ALTER TABLE "integration" RENAME TO "temporary_integration"`); + await queryRunner.query( + `CREATE TABLE "integration" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "imgSrc" varchar, "isComingSoon" boolean NOT NULL DEFAULT (0), "isPaid" boolean NOT NULL DEFAULT (0), "version" varchar, "docUrl" varchar, "isFreeTrial" boolean NOT NULL DEFAULT (0), "freeTrialPeriod" numeric DEFAULT (0), "order" integer, "provider" varchar, "redirectUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_938c19d92ad3f290ff5fc163531" UNIQUE ("name"))` + ); + await queryRunner.query( + `INSERT INTO "integration"("id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt" FROM "temporary_integration"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration"`); + await queryRunner.query(`CREATE INDEX "IDX_85d7b0f07f3e3707b4586670a9" ON "integration" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_24981cd300007cf88601c2d616" ON "integration" ("isActive") `); + await queryRunner.query(`DROP INDEX "IDX_e7b65ef60492b1c34007736f99"`); + await queryRunner.query(`DROP INDEX "IDX_34a49d941459e1031c766b941f"`); + await queryRunner.query(`ALTER TABLE "integration_type" RENAME TO "temporary_integration_type"`); + await queryRunner.query( + `CREATE TABLE "integration_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "groupName" varchar NOT NULL, "order" integer NOT NULL, "description" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_be0d67f4df84f036fab2ed89c47" UNIQUE ("name"))` + ); + await queryRunner.query( + `INSERT INTO "integration_type"("id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_type"`); + await queryRunner.query(`CREATE INDEX "IDX_e7b65ef60492b1c34007736f99" ON "integration_type" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_34a49d941459e1031c766b941f" ON "integration_type" ("isActive") `); + await queryRunner.query(`DROP INDEX "IDX_d0532ed8020981736b58748de6"`); + await queryRunner.query(`DROP INDEX "IDX_0d6ddc27d687ca879042c5f3ce"`); + await queryRunner.query(`DROP INDEX "IDX_24e37d03ef224f1a16a35069c2"`); + await queryRunner.query(`DROP INDEX "IDX_33ab224e7755a46fff5bc1e64e"`); + await queryRunner.query(`DROP INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46"`); + await queryRunner.query(`DROP INDEX "IDX_5487f9197c106d774bae20991c"`); + await queryRunner.query(`ALTER TABLE "integration_tenant" RENAME TO "temporary_integration_tenant"`); + await queryRunner.query( + `CREATE TABLE "integration_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "integrationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "lastSyncedAt" datetime DEFAULT (CURRENT_TIMESTAMP), "deletedAt" datetime, CONSTRAINT "FK_33ab224e7755a46fff5bc1e64e5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_24e37d03ef224f1a16a35069c2c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0d6ddc27d687ca879042c5f3ce3" FOREIGN KEY ("integrationId") REFERENCES "integration" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "integration_tenant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt" FROM "temporary_integration_tenant"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_tenant"`); + await queryRunner.query( + `CREATE INDEX "IDX_d0532ed8020981736b58748de6" ON "integration_tenant" ("lastSyncedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0d6ddc27d687ca879042c5f3ce" ON "integration_tenant" ("integrationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_24e37d03ef224f1a16a35069c2" ON "integration_tenant" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_33ab224e7755a46fff5bc1e64e" ON "integration_tenant" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46" ON "integration_tenant" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_5487f9197c106d774bae20991c" ON "integration_tenant" ("isArchived") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f515574f1251562c52fe25b6a3"`); + await queryRunner.query(`DROP INDEX "IDX_97c0d54aae21ccdbb5c3581642"`); + await queryRunner.query(`DROP INDEX "IDX_954c6b05297814776d9cb66ca7"`); + await queryRunner.query(`DROP INDEX "IDX_369eaafb13afe9903a170077ed"`); + await queryRunner.query(`DROP INDEX "IDX_34daf030004ad37b88f1f3d863"`); + await queryRunner.query(`ALTER TABLE "integration_setting" RENAME TO "temporary_integration_setting"`); + await queryRunner.query( + `CREATE TABLE "integration_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "settingsName" varchar NOT NULL, "settingsValue" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_34daf030004ad37b88f1f3d863c" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_369eaafb13afe9903a170077edb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_954c6b05297814776d9cb66ca77" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "integration_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_f515574f1251562c52fe25b6a3" ON "integration_setting" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_97c0d54aae21ccdbb5c3581642" ON "integration_setting" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_954c6b05297814776d9cb66ca7" ON "integration_setting" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_369eaafb13afe9903a170077ed" ON "integration_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_34daf030004ad37b88f1f3d863" ON "integration_setting" ("integrationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_e63f4791631e7572ca213ac4a4"`); + await queryRunner.query(`DROP INDEX "IDX_c79464c4ccf7e5195d69675c15"`); + await queryRunner.query(`DROP INDEX "IDX_c327ea26bda3d349a1eceb5658"`); + await queryRunner.query(`DROP INDEX "IDX_7022dafd72c1b92f7d50691441"`); + await queryRunner.query(`DROP INDEX "IDX_eec3d6064578610ddc609dd360"`); + await queryRunner.query(`ALTER TABLE "integration_map" RENAME TO "temporary_integration_map"`); + await queryRunner.query( + `CREATE TABLE "integration_map" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sourceId" varchar NOT NULL, "gauzyId" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c327ea26bda3d349a1eceb5658e" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eec3d6064578610ddc609dd360e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7022dafd72c1b92f7d506914411" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "integration_map"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_map"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_map"`); + await queryRunner.query(`CREATE INDEX "IDX_e63f4791631e7572ca213ac4a4" ON "integration_map" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_c79464c4ccf7e5195d69675c15" ON "integration_map" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_c327ea26bda3d349a1eceb5658" ON "integration_map" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7022dafd72c1b92f7d50691441" ON "integration_map" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_eec3d6064578610ddc609dd360" ON "integration_map" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_1c653ebceca3b9c8766131db91"`); + await queryRunner.query(`DROP INDEX "IDX_e3d407c5532edaceaa4df34623"`); + await queryRunner.query(`DROP INDEX "IDX_f80ff4ebbf0b33a67dce598911"`); + await queryRunner.query(`DROP INDEX "IDX_c6c01e38eebd8b26b9214b9044"`); + await queryRunner.query(`DROP INDEX "IDX_23e9cfcf1bfff07dcc3254378d"`); + await queryRunner.query( + `ALTER TABLE "integration_entity_setting" RENAME TO "temporary_integration_entity_setting"` + ); + await queryRunner.query( + `CREATE TABLE "integration_entity_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f80ff4ebbf0b33a67dce5989117" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_23e9cfcf1bfff07dcc3254378df" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6c01e38eebd8b26b9214b90441" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "integration_entity_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_entity_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_entity_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_1c653ebceca3b9c8766131db91" ON "integration_entity_setting" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e3d407c5532edaceaa4df34623" ON "integration_entity_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f80ff4ebbf0b33a67dce598911" ON "integration_entity_setting" ("integrationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c6c01e38eebd8b26b9214b9044" ON "integration_entity_setting" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_23e9cfcf1bfff07dcc3254378d" ON "integration_entity_setting" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_101cd83aa75949cfb5b8eec084"`); + await queryRunner.query(`DROP INDEX "IDX_6d43cc33c80221dbe4854b38e6"`); + await queryRunner.query(`DROP INDEX "IDX_3fb863167095805e33f38a0fdc"`); + await queryRunner.query(`DROP INDEX "IDX_d5ac36aa3d5919908414154fca"`); + await queryRunner.query(`DROP INDEX "IDX_b208a754c7a538cb3422f39f5b"`); + await queryRunner.query( + `ALTER TABLE "integration_entity_setting_tied" RENAME TO "temporary_integration_entity_setting_tied"` + ); + await queryRunner.query( + `CREATE TABLE "integration_entity_setting_tied" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationEntitySettingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3fb863167095805e33f38a0fdcc" FOREIGN KEY ("integrationEntitySettingId") REFERENCES "integration_entity_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b208a754c7a538cb3422f39f5b9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d5ac36aa3d5919908414154fca0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "integration_entity_setting_tied"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_entity_setting_tied"` + ); + await queryRunner.query(`DROP TABLE "temporary_integration_entity_setting_tied"`); + await queryRunner.query( + `CREATE INDEX "IDX_101cd83aa75949cfb5b8eec084" ON "integration_entity_setting_tied" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d43cc33c80221dbe4854b38e6" ON "integration_entity_setting_tied" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3fb863167095805e33f38a0fdc" ON "integration_entity_setting_tied" ("integrationEntitySettingId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d5ac36aa3d5919908414154fca" ON "integration_entity_setting_tied" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b208a754c7a538cb3422f39f5b" ON "integration_entity_setting_tied" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_aedb8b1d10c498309bed9edf53"`); + await queryRunner.query(`DROP INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb"`); + await queryRunner.query(`DROP INDEX "IDX_8608b275644cfc7a0f3f585081"`); + await queryRunner.query(`DROP INDEX "IDX_64409de4711cd14e2c43371cc0"`); + await queryRunner.query(`DROP INDEX "IDX_bd39a647a2843177723ddf733e"`); + await queryRunner.query(`DROP INDEX "IDX_86b5a121b3775a1b0b7fa75680"`); + await queryRunner.query(`DROP INDEX "IDX_20207d9f915066dfbc2210bcf1"`); + await queryRunner.query(`DROP INDEX "IDX_a05d52b7ffe89140f9cbcf114b"`); + await queryRunner.query(`DROP INDEX "IDX_29fbd3a17710a27e6f856072c0"`); + await queryRunner.query(`ALTER TABLE "income" RENAME TO "temporary_income"`); + await queryRunner.query( + `CREATE TABLE "income" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "currency" varchar NOT NULL, "valueDate" datetime, "notes" varchar, "isBonus" boolean, "reference" varchar, "employeeId" varchar, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_29fbd3a17710a27e6f856072c01" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a05d52b7ffe89140f9cbcf114b3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_64409de4711cd14e2c43371cc02" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8608b275644cfc7a0f3f5850814" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "income"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt" FROM "temporary_income"` + ); + await queryRunner.query(`DROP TABLE "temporary_income"`); + await queryRunner.query(`CREATE INDEX "IDX_aedb8b1d10c498309bed9edf53" ON "income" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb" ON "income" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8608b275644cfc7a0f3f585081" ON "income" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_64409de4711cd14e2c43371cc0" ON "income" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_bd39a647a2843177723ddf733e" ON "income" ("amount") `); + await queryRunner.query(`CREATE INDEX "IDX_86b5a121b3775a1b0b7fa75680" ON "income" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_20207d9f915066dfbc2210bcf1" ON "income" ("notes") `); + await queryRunner.query(`CREATE INDEX "IDX_a05d52b7ffe89140f9cbcf114b" ON "income" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_29fbd3a17710a27e6f856072c0" ON "income" ("clientId") `); + await queryRunner.query(`DROP INDEX "IDX_af1a212cb378bb0eed51c1b2bc"`); + await queryRunner.query(`DROP INDEX "IDX_9d44ce9eb8689e578b941a6a54"`); + await queryRunner.query(`DROP INDEX "IDX_d3675304df9971cccf96d9a7c3"`); + await queryRunner.query(`DROP INDEX "IDX_01856a9a730b7e79d70aa661cb"`); + await queryRunner.query(`ALTER TABLE "image_asset" RENAME TO "temporary_image_asset"`); + await queryRunner.query( + `CREATE TABLE "image_asset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "url" varchar NOT NULL, "width" integer NOT NULL DEFAULT (0), "height" integer NOT NULL DEFAULT (0), "isFeatured" boolean NOT NULL DEFAULT (0), "thumb" varchar, "size" numeric, "externalProviderId" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), CONSTRAINT "FK_01856a9a730b7e79d70aa661cb0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d3675304df9971cccf96d9a7c34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "image_asset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived" FROM "temporary_image_asset"` + ); + await queryRunner.query(`DROP TABLE "temporary_image_asset"`); + await queryRunner.query(`CREATE INDEX "IDX_af1a212cb378bb0eed51c1b2bc" ON "image_asset" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_9d44ce9eb8689e578b941a6a54" ON "image_asset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d3675304df9971cccf96d9a7c3" ON "image_asset" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_01856a9a730b7e79d70aa661cb" ON "image_asset" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_4a2c00a44350a063d75be80ba9"`); + await queryRunner.query(`DROP INDEX "IDX_72641ffde44e1a1627aa2d040f"`); + await queryRunner.query(`DROP INDEX "IDX_6b4758a5442713070c9a366d0e"`); + await queryRunner.query(`DROP INDEX "IDX_c6e8ae55a4db3584686cbf6afe"`); + await queryRunner.query(`DROP INDEX "IDX_ac161c1a0c0ff8e83554f097e5"`); + await queryRunner.query(`DROP INDEX "IDX_35526ff1063ab5fa2b20e71bd6"`); + await queryRunner.query(`DROP INDEX "IDX_af0a11734e70412b742ac339c8"`); + await queryRunner.query(`DROP INDEX "IDX_4c8b4e887a994182fd6132e640"`); + await queryRunner.query(`ALTER TABLE "goal" RENAME TO "temporary_goal"`); + await queryRunner.query( + `CREATE TABLE "goal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "deadline" varchar NOT NULL, "level" varchar NOT NULL, "progress" integer NOT NULL, "ownerTeamId" varchar, "ownerEmployeeId" varchar, "leadId" varchar, "alignedKeyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_4c8b4e887a994182fd6132e6400" FOREIGN KEY ("alignedKeyResultId") REFERENCES "key_result" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_af0a11734e70412b742ac339c88" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_35526ff1063ab5fa2b20e71bd66" FOREIGN KEY ("ownerEmployeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ac161c1a0c0ff8e83554f097e5e" FOREIGN KEY ("ownerTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6e8ae55a4db3584686cbf6afe1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b4758a5442713070c9a366d0e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal"`); + await queryRunner.query(`CREATE INDEX "IDX_4a2c00a44350a063d75be80ba9" ON "goal" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_72641ffde44e1a1627aa2d040f" ON "goal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6b4758a5442713070c9a366d0e" ON "goal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_c6e8ae55a4db3584686cbf6afe" ON "goal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_ac161c1a0c0ff8e83554f097e5" ON "goal" ("ownerTeamId") `); + await queryRunner.query(`CREATE INDEX "IDX_35526ff1063ab5fa2b20e71bd6" ON "goal" ("ownerEmployeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_af0a11734e70412b742ac339c8" ON "goal" ("leadId") `); + await queryRunner.query(`CREATE INDEX "IDX_4c8b4e887a994182fd6132e640" ON "goal" ("alignedKeyResultId") `); + await queryRunner.query(`DROP INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2"`); + await queryRunner.query(`DROP INDEX "IDX_646565982726362cc2ca4fb807"`); + await queryRunner.query(`DROP INDEX "IDX_b56723b53a76ca1c171890c479"`); + await queryRunner.query(`DROP INDEX "IDX_405bc5bba9ed71aefef84a29f1"`); + await queryRunner.query(`ALTER TABLE "goal_time_frame" RENAME TO "temporary_goal_time_frame"`); + await queryRunner.query( + `CREATE TABLE "goal_time_frame" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" varchar NOT NULL, "startDate" datetime NOT NULL, "endDate" datetime NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_405bc5bba9ed71aefef84a29f10" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b56723b53a76ca1c171890c479b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal_time_frame"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_time_frame"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal_time_frame"`); + await queryRunner.query(`CREATE INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2" ON "goal_time_frame" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_646565982726362cc2ca4fb807" ON "goal_time_frame" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_b56723b53a76ca1c171890c479" ON "goal_time_frame" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_405bc5bba9ed71aefef84a29f1" ON "goal_time_frame" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_056e869152a335f88c38c5b693"`); + await queryRunner.query(`DROP INDEX "IDX_cd91c5925942061527b1bc112c"`); + await queryRunner.query(`DROP INDEX "IDX_774bf82989475befe301fe1bca"`); + await queryRunner.query(`DROP INDEX "IDX_5708fe06608c72fc77b65ae651"`); + await queryRunner.query(`ALTER TABLE "goal_template" RENAME TO "temporary_goal_template"`); + await queryRunner.query( + `CREATE TABLE "goal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "level" varchar NOT NULL, "category" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_5708fe06608c72fc77b65ae6519" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_774bf82989475befe301fe1bca5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal_template"`); + await queryRunner.query(`CREATE INDEX "IDX_056e869152a335f88c38c5b693" ON "goal_template" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_cd91c5925942061527b1bc112c" ON "goal_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_774bf82989475befe301fe1bca" ON "goal_template" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_5708fe06608c72fc77b65ae651" ON "goal_template" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_a96c22c51607f878c8a98bc488"`); + await queryRunner.query(`DROP INDEX "IDX_cfc393bd9835d8259e73019226"`); + await queryRunner.query(`DROP INDEX "IDX_43aa2985216560cd9fa93f501e"`); + await queryRunner.query(`DROP INDEX "IDX_e49e37fe88a2725a38a3b05849"`); + await queryRunner.query(`DROP INDEX "IDX_d4f093ca4eb7c40db68d9a789d"`); + await queryRunner.query(`ALTER TABLE "goal_kpi" RENAME TO "temporary_goal_kpi"`); + await queryRunner.query( + `CREATE TABLE "goal_kpi" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d4f093ca4eb7c40db68d9a789d0" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e49e37fe88a2725a38a3b058493" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_43aa2985216560cd9fa93f501e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal_kpi"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_kpi"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal_kpi"`); + await queryRunner.query(`CREATE INDEX "IDX_a96c22c51607f878c8a98bc488" ON "goal_kpi" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_cfc393bd9835d8259e73019226" ON "goal_kpi" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_43aa2985216560cd9fa93f501e" ON "goal_kpi" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e49e37fe88a2725a38a3b05849" ON "goal_kpi" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_d4f093ca4eb7c40db68d9a789d" ON "goal_kpi" ("leadId") `); + await queryRunner.query(`DROP INDEX "IDX_26311c417ba945c901c65d515d"`); + await queryRunner.query(`DROP INDEX "IDX_b4f4701ddb0e973602445ed1c6"`); + await queryRunner.query(`DROP INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf"`); + await queryRunner.query(`DROP INDEX "IDX_df7ab026698c02859ff7540809"`); + await queryRunner.query(`ALTER TABLE "goal_kpi_template" RENAME TO "temporary_goal_kpi_template"`); + await queryRunner.query( + `CREATE TABLE "goal_kpi_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f69e740b066c6469d1c68a4a28b" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_df7ab026698c02859ff75408093" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cc72d4e8e4284dcc8ffbf96caf4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal_kpi_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_kpi_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal_kpi_template"`); + await queryRunner.query(`CREATE INDEX "IDX_26311c417ba945c901c65d515d" ON "goal_kpi_template" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_b4f4701ddb0e973602445ed1c6" ON "goal_kpi_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf" ON "goal_kpi_template" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_df7ab026698c02859ff7540809" ON "goal_kpi_template" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_4a44905db4ca1e40b62021fdfb"`); + await queryRunner.query(`DROP INDEX "IDX_bdee8704ebeb79368ff6154fc7"`); + await queryRunner.query(`DROP INDEX "IDX_d17a5159d888ac6320459eda39"`); + await queryRunner.query(`DROP INDEX "IDX_e35d0f7b794ca8850669d12c78"`); + await queryRunner.query(`ALTER TABLE "goal_general_setting" RENAME TO "temporary_goal_general_setting"`); + await queryRunner.query( + `CREATE TABLE "goal_general_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "maxObjectives" integer NOT NULL, "maxKeyResults" integer NOT NULL, "employeeCanCreateObjective" boolean NOT NULL, "canOwnObjectives" varchar NOT NULL, "canOwnKeyResult" varchar NOT NULL, "krTypeKPI" boolean NOT NULL, "krTypeTask" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e35d0f7b794ca8850669d12c78c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d17a5159d888ac6320459eda392" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "goal_general_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_general_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_goal_general_setting"`); + await queryRunner.query( + `CREATE INDEX "IDX_4a44905db4ca1e40b62021fdfb" ON "goal_general_setting" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bdee8704ebeb79368ff6154fc7" ON "goal_general_setting" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d17a5159d888ac6320459eda39" ON "goal_general_setting" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e35d0f7b794ca8850669d12c78" ON "goal_general_setting" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a26cc341268d22bd55f06e3ef6"`); + await queryRunner.query(`DROP INDEX "IDX_5405b67f1df904831a358df7c4"`); + await queryRunner.query(`DROP INDEX "IDX_4832be692a2dc63d67e8e93c75"`); + await queryRunner.query(`DROP INDEX "IDX_c30465b5a6e0fae1c8ee7e3120"`); + await queryRunner.query(`DROP INDEX "IDX_d4a28a8e70d450a412bf0cfb52"`); + await queryRunner.query(`ALTER TABLE "feature" RENAME TO "temporary_feature"`); + await queryRunner.query( + `CREATE TABLE "feature" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar NOT NULL, "isPaid" boolean NOT NULL DEFAULT (0), "description" varchar, "image" varchar, "link" varchar NOT NULL, "status" varchar, "icon" varchar, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d4a28a8e70d450a412bf0cfb52a" FOREIGN KEY ("parentId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "feature"("id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt" FROM "temporary_feature"` + ); + await queryRunner.query(`DROP TABLE "temporary_feature"`); + await queryRunner.query(`CREATE INDEX "IDX_a26cc341268d22bd55f06e3ef6" ON "feature" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_5405b67f1df904831a358df7c4" ON "feature" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4832be692a2dc63d67e8e93c75" ON "feature" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_c30465b5a6e0fae1c8ee7e3120" ON "feature" ("code") `); + await queryRunner.query(`CREATE INDEX "IDX_d4a28a8e70d450a412bf0cfb52" ON "feature" ("parentId") `); + await queryRunner.query(`DROP INDEX "IDX_e4c142f37091b47056012d34ba"`); + await queryRunner.query(`DROP INDEX "IDX_4ee685760ddb60ff71f763d8f6"`); + await queryRunner.query(`DROP INDEX "IDX_8f71803d96dcdbcc6b19bb28d3"`); + await queryRunner.query(`DROP INDEX "IDX_6a94e6b0a572f591288ac44a42"`); + await queryRunner.query(`DROP INDEX "IDX_6d413f9fdd5366b1b9add46483"`); + await queryRunner.query(`ALTER TABLE "feature_organization" RENAME TO "temporary_feature_organization"`); + await queryRunner.query( + `CREATE TABLE "feature_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isEnabled" boolean NOT NULL DEFAULT (1), "featureId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_6d413f9fdd5366b1b9add464836" FOREIGN KEY ("featureId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a94e6b0a572f591288ac44a421" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8f71803d96dcdbcc6b19bb28d38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "feature_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt" FROM "temporary_feature_organization"` + ); + await queryRunner.query(`DROP TABLE "temporary_feature_organization"`); + await queryRunner.query( + `CREATE INDEX "IDX_e4c142f37091b47056012d34ba" ON "feature_organization" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_4ee685760ddb60ff71f763d8f6" ON "feature_organization" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8f71803d96dcdbcc6b19bb28d3" ON "feature_organization" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6a94e6b0a572f591288ac44a42" ON "feature_organization" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6d413f9fdd5366b1b9add46483" ON "feature_organization" ("featureId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_339328a7247aa09d061c642ae1"`); + await queryRunner.query(`DROP INDEX "IDX_b90957ef81e74c43d6ae037560"`); + await queryRunner.query(`DROP INDEX "IDX_a43b235c35c2c4d3263ada770c"`); + await queryRunner.query(`ALTER TABLE "import-record" RENAME TO "temporary_import-record"`); + await queryRunner.query( + `CREATE TABLE "import-record" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "entityType" varchar NOT NULL, "sourceId" varchar NOT NULL, "destinationId" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a43b235c35c2c4d3263ada770c6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "import-record"("id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt" FROM "temporary_import-record"` + ); + await queryRunner.query(`DROP TABLE "temporary_import-record"`); + await queryRunner.query(`CREATE INDEX "IDX_339328a7247aa09d061c642ae1" ON "import-record" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_b90957ef81e74c43d6ae037560" ON "import-record" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_a43b235c35c2c4d3263ada770c" ON "import-record" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_d6a626bee6cddf4bc53a493bc3"`); + await queryRunner.query(`DROP INDEX "IDX_e339340014a6c4e2f57be00b0c"`); + await queryRunner.query(`DROP INDEX "IDX_54868607115e2fee3b0b764eec"`); + await queryRunner.query(`ALTER TABLE "import-history" RENAME TO "temporary_import-history"`); + await queryRunner.query( + `CREATE TABLE "import-history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "file" varchar NOT NULL, "path" varchar NOT NULL, "size" integer, "status" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_54868607115e2fee3b0b764eec2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "import-history"("id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt" FROM "temporary_import-history"` + ); + await queryRunner.query(`DROP TABLE "temporary_import-history"`); + await queryRunner.query(`CREATE INDEX "IDX_d6a626bee6cddf4bc53a493bc3" ON "import-history" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e339340014a6c4e2f57be00b0c" ON "import-history" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_54868607115e2fee3b0b764eec" ON "import-history" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_d77aeb93f2439ebdf4babaab4c"`); + await queryRunner.query(`DROP INDEX "IDX_1aa0e5fd480214ae4851471e3c"`); + await queryRunner.query(`DROP INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4"`); + await queryRunner.query(`DROP INDEX "IDX_9971c4171ae051e74b833984a3"`); + await queryRunner.query(`DROP INDEX "IDX_42eea5debc63f4d1bf89881c10"`); + await queryRunner.query(`DROP INDEX "IDX_eacb116ab0521ad9b96f2bb53b"`); + await queryRunner.query(`DROP INDEX "IDX_5e7b197dbac69012dbdb4964f3"`); + await queryRunner.query(`DROP INDEX "IDX_5f57d077c28b378a6c885e81c5"`); + await queryRunner.query(`DROP INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9"`); + await queryRunner.query(`DROP INDEX "IDX_0006d3025b6c92fbd4089b9465"`); + await queryRunner.query(`DROP INDEX "IDX_dd8ab9312fb8d787982b9feebf"`); + await queryRunner.query(`DROP INDEX "IDX_cbfebdb1419f9b8036a8b0546e"`); + await queryRunner.query(`DROP INDEX "IDX_89508d119b1a279c037d9da151"`); + await queryRunner.query(`DROP INDEX "IDX_3826d6ca74a08a8498fa17d330"`); + await queryRunner.query(`DROP INDEX "IDX_b5bb8f62d401475fcc8c2ba35e"`); + await queryRunner.query(`DROP INDEX "IDX_846a933af451a33b95b7b198c6"`); + await queryRunner.query(`DROP INDEX "IDX_c5fb146726ff128e600f23d0a1"`); + await queryRunner.query(`DROP INDEX "IDX_6d171c9d5f81095436b99da5e6"`); + await queryRunner.query(`ALTER TABLE "expense" RENAME TO "temporary_expense"`); + await queryRunner.query( + `CREATE TABLE "expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "typeOfExpense" varchar, "notes" varchar, "currency" varchar NOT NULL, "valueDate" datetime, "purpose" varchar, "taxType" varchar, "taxLabel" varchar, "rateValue" numeric, "receipt" varchar, "splitExpense" boolean, "reference" varchar, "status" varchar, "employeeId" varchar, "vendorId" varchar, "categoryId" varchar, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a" FOREIGN KEY ("categoryId") REFERENCES "expense_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba" FOREIGN KEY ("vendorId") REFERENCES "organization_vendor" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6d171c9d5f81095436b99da5e62" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c5fb146726ff128e600f23d0a1b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5e7b197dbac69012dbdb4964f37" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9971c4171ae051e74b833984a30" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_047b8b5c0782d5a6d4c8bfc1a4e" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_expense"` + ); + await queryRunner.query(`DROP TABLE "temporary_expense"`); + await queryRunner.query(`CREATE INDEX "IDX_d77aeb93f2439ebdf4babaab4c" ON "expense" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_1aa0e5fd480214ae4851471e3c" ON "expense" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4" ON "expense" ("organizationContactId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9971c4171ae051e74b833984a3" ON "expense" ("projectId") `); + await queryRunner.query(`CREATE INDEX "IDX_42eea5debc63f4d1bf89881c10" ON "expense" ("categoryId") `); + await queryRunner.query(`CREATE INDEX "IDX_eacb116ab0521ad9b96f2bb53b" ON "expense" ("vendorId") `); + await queryRunner.query(`CREATE INDEX "IDX_5e7b197dbac69012dbdb4964f3" ON "expense" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_5f57d077c28b378a6c885e81c5" ON "expense" ("receipt") `); + await queryRunner.query(`CREATE INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9" ON "expense" ("rateValue") `); + await queryRunner.query(`CREATE INDEX "IDX_0006d3025b6c92fbd4089b9465" ON "expense" ("taxLabel") `); + await queryRunner.query(`CREATE INDEX "IDX_dd8ab9312fb8d787982b9feebf" ON "expense" ("taxType") `); + await queryRunner.query(`CREATE INDEX "IDX_cbfebdb1419f9b8036a8b0546e" ON "expense" ("purpose") `); + await queryRunner.query(`CREATE INDEX "IDX_89508d119b1a279c037d9da151" ON "expense" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_3826d6ca74a08a8498fa17d330" ON "expense" ("notes") `); + await queryRunner.query(`CREATE INDEX "IDX_b5bb8f62d401475fcc8c2ba35e" ON "expense" ("typeOfExpense") `); + await queryRunner.query(`CREATE INDEX "IDX_846a933af451a33b95b7b198c6" ON "expense" ("amount") `); + await queryRunner.query(`CREATE INDEX "IDX_c5fb146726ff128e600f23d0a1" ON "expense" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_6d171c9d5f81095436b99da5e6" ON "expense" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc"`); + await queryRunner.query(`DROP INDEX "IDX_8376e41fd82aba147a433dc097"`); + await queryRunner.query(`DROP INDEX "IDX_37504e920ee5ca46a4000b89da"`); + await queryRunner.query(`DROP INDEX "IDX_9c9bfe5baaf83f53533ff035fc"`); + await queryRunner.query(`ALTER TABLE "expense_category" RENAME TO "temporary_expense_category"`); + await queryRunner.query( + `CREATE TABLE "expense_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9c9bfe5baaf83f53533ff035fc0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_37504e920ee5ca46a4000b89da5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "expense_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_expense_category"` + ); + await queryRunner.query(`DROP TABLE "temporary_expense_category"`); + await queryRunner.query(`CREATE INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc" ON "expense_category" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_8376e41fd82aba147a433dc097" ON "expense_category" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_37504e920ee5ca46a4000b89da" ON "expense_category" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_9c9bfe5baaf83f53533ff035fc" ON "expense_category" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_613cfa5783e164cad10dc27e58"`); + await queryRunner.query(`DROP INDEX "IDX_f14eee32875b112fab1139b332"`); + await queryRunner.query(`DROP INDEX "IDX_92fc62260c0c7ff108622850bf"`); + await queryRunner.query(`DROP INDEX "IDX_fc8818d6fde74370ec703a0135"`); + await queryRunner.query(`DROP INDEX "IDX_4b02d8616129f39fca2b10e98b"`); + await queryRunner.query(`DROP INDEX "IDX_9d5980ff1064e2edb77509d312"`); + await queryRunner.query(`DROP INDEX "IDX_43459c650957e478203c738574"`); + await queryRunner.query(`DROP INDEX "IDX_5bde7aeb2c7fb3a421b175871e"`); + await queryRunner.query(`DROP INDEX "IDX_24d905ec9e127ade23754a363d"`); + await queryRunner.query(`ALTER TABLE "event_type" RENAME TO "temporary_event_type"`); + await queryRunner.query( + `CREATE TABLE "event_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" numeric NOT NULL, "durationUnit" varchar, "title" varchar, "description" varchar, "isActive" boolean DEFAULT (1), "employeeId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_24d905ec9e127ade23754a363dd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fc8818d6fde74370ec703a01352" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_92fc62260c0c7ff108622850bff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "event_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt" FROM "temporary_event_type"` + ); + await queryRunner.query(`DROP TABLE "temporary_event_type"`); + await queryRunner.query(`CREATE INDEX "IDX_613cfa5783e164cad10dc27e58" ON "event_type" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_f14eee32875b112fab1139b332" ON "event_type" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_92fc62260c0c7ff108622850bf" ON "event_type" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_fc8818d6fde74370ec703a0135" ON "event_type" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4b02d8616129f39fca2b10e98b" ON "event_type" ("duration") `); + await queryRunner.query(`CREATE INDEX "IDX_9d5980ff1064e2edb77509d312" ON "event_type" ("durationUnit") `); + await queryRunner.query(`CREATE INDEX "IDX_43459c650957e478203c738574" ON "event_type" ("title") `); + await queryRunner.query(`CREATE INDEX "IDX_5bde7aeb2c7fb3a421b175871e" ON "event_type" ("description") `); + await queryRunner.query(`CREATE INDEX "IDX_24d905ec9e127ade23754a363d" ON "event_type" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_f1fac79e17c475f00daa4db3d2"`); + await queryRunner.query(`DROP INDEX "IDX_1a4bd2a8034bb1309b4ea87882"`); + await queryRunner.query(`DROP INDEX "IDX_391d3f83244fea73c619aecadd"`); + await queryRunner.query(`DROP INDEX "IDX_233c1d351d63441aeb039d1164"`); + await queryRunner.query(`ALTER TABLE "estimate_email" RENAME TO "temporary_estimate_email"`); + await queryRunner.query( + `CREATE TABLE "estimate_email" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "expireDate" datetime NOT NULL, "convertAcceptedEstimates" boolean, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_233c1d351d63441aeb039d1164f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_391d3f83244fea73c619aecadd9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "estimate_email"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt" FROM "temporary_estimate_email"` + ); + await queryRunner.query(`DROP TABLE "temporary_estimate_email"`); + await queryRunner.query(`CREATE INDEX "IDX_f1fac79e17c475f00daa4db3d2" ON "estimate_email" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_1a4bd2a8034bb1309b4ea87882" ON "estimate_email" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_391d3f83244fea73c619aecadd" ON "estimate_email" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_233c1d351d63441aeb039d1164" ON "estimate_email" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_d8452bfe9f18ced4ce76c4b70b"`); + await queryRunner.query(`DROP INDEX "IDX_39e1b443404ea7fa42b3d36ccb"`); + await queryRunner.query(`DROP INDEX "IDX_fb6808468066849ab7b7454d5f"`); + await queryRunner.query(`DROP INDEX "IDX_f98ce0d210aa9f91b729d44780"`); + await queryRunner.query(`ALTER TABLE "equipment" RENAME TO "temporary_equipment"`); + await queryRunner.query( + `CREATE TABLE "equipment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "serialNumber" varchar NOT NULL, "manufacturedYear" numeric, "initialCost" numeric, "currency" varchar NOT NULL, "maxSharePeriod" numeric, "autoApproveShare" boolean NOT NULL, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ab80a66282582ae8b0282508e7" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f98ce0d210aa9f91b729d447806" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fb6808468066849ab7b7454d5f3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "equipment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment"` + ); + await queryRunner.query(`DROP TABLE "temporary_equipment"`); + await queryRunner.query(`CREATE INDEX "IDX_d8452bfe9f18ced4ce76c4b70b" ON "equipment" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_39e1b443404ea7fa42b3d36ccb" ON "equipment" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_fb6808468066849ab7b7454d5f" ON "equipment" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_f98ce0d210aa9f91b729d44780" ON "equipment" ("organizationId") `); + await queryRunner.query(`DROP INDEX "IDX_a734598f5637cf1501288331e3"`); + await queryRunner.query(`DROP INDEX "IDX_70ff31cefa0f578f6fa82d2bcc"`); + await queryRunner.query(`DROP INDEX "IDX_fa525e61fb3d8d9efec0f364a4"`); + await queryRunner.query(`DROP INDEX "IDX_ea9254be07ae4a8604f0aaab19"`); + await queryRunner.query(`DROP INDEX "IDX_acad51a6362806fc499e583e40"`); + await queryRunner.query(`DROP INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10"`); + await queryRunner.query(`ALTER TABLE "equipment_sharing" RENAME TO "temporary_equipment_sharing"`); + await queryRunner.query( + `CREATE TABLE "equipment_sharing" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "shareRequestDay" datetime, "shareStartDay" datetime, "shareEndDay" datetime, "status" integer NOT NULL, "createdBy" varchar, "createdByName" varchar, "equipmentId" varchar, "equipmentSharingPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ecfe0ce0cd2b197249d5f1c105" FOREIGN KEY ("equipmentSharingPolicyId") REFERENCES "equipment_sharing_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_acad51a6362806fc499e583e402" FOREIGN KEY ("equipmentId") REFERENCES "equipment" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ea9254be07ae4a8604f0aaab196" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa525e61fb3d8d9efec0f364a4b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "equipment_sharing"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment_sharing"` + ); + await queryRunner.query(`DROP TABLE "temporary_equipment_sharing"`); + await queryRunner.query(`CREATE INDEX "IDX_a734598f5637cf1501288331e3" ON "equipment_sharing" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_70ff31cefa0f578f6fa82d2bcc" ON "equipment_sharing" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_fa525e61fb3d8d9efec0f364a4" ON "equipment_sharing" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_ea9254be07ae4a8604f0aaab19" ON "equipment_sharing" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_acad51a6362806fc499e583e40" ON "equipment_sharing" ("equipmentId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10" ON "equipment_sharing" ("equipmentSharingPolicyId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b0fc293cf47f31ba512fd29bf0"`); + await queryRunner.query(`DROP INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae"`); + await queryRunner.query(`DROP INDEX "IDX_5443ca8ed830626656d8cfecef"`); + await queryRunner.query(`DROP INDEX "IDX_5311a833ff255881454bd5b3b5"`); + await queryRunner.query(`DROP INDEX "IDX_04c9e514ed70897f6ad8cadc3c"`); + await queryRunner.query( + `ALTER TABLE "equipment_sharing_policy" RENAME TO "temporary_equipment_sharing_policy"` + ); + await queryRunner.query( + `CREATE TABLE "equipment_sharing_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5443ca8ed830626656d8cfecef7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "equipment_sharing_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment_sharing_policy"` + ); + await queryRunner.query(`DROP TABLE "temporary_equipment_sharing_policy"`); + await queryRunner.query( + `CREATE INDEX "IDX_b0fc293cf47f31ba512fd29bf0" ON "equipment_sharing_policy" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae" ON "equipment_sharing_policy" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5443ca8ed830626656d8cfecef" ON "equipment_sharing_policy" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5311a833ff255881454bd5b3b5" ON "equipment_sharing_policy" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_04c9e514ed70897f6ad8cadc3c" ON "equipment_sharing_policy" ("name") ` + ); + await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); + await queryRunner.query(`DROP INDEX "IDX_1c0c1370ecd98040259625e17e"`); + await queryRunner.query(`DROP INDEX "IDX_f4b0d329c4a3cf79ffe9d56504"`); + await queryRunner.query(`DROP INDEX "IDX_96dfbcaa2990df01fe5bb39ccc"`); + await queryRunner.query(`DROP INDEX "IDX_c6a48286f3aa8ae903bee0d1e7"`); + await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); + await queryRunner.query(`DROP INDEX "IDX_510cb87f5da169e57e694d1a5c"`); + await queryRunner.query(`DROP INDEX "IDX_175b7be641928a31521224daa8"`); + await queryRunner.query(`ALTER TABLE "employee" RENAME TO "temporary_employee"`); + await queryRunner.query( + `CREATE TABLE "employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "valueDate" datetime, "isActive" boolean DEFAULT (1), "short_description" varchar(200), "description" varchar, "startedWorkOn" datetime, "endWork" datetime, "payPeriod" varchar, "billRateValue" integer, "billRateCurrency" varchar, "reWeeklyLimit" integer, "offerDate" datetime, "acceptDate" datetime, "rejectDate" datetime, "employeeLevel" varchar(500), "anonymousBonus" boolean, "averageIncome" numeric, "averageBonus" numeric, "totalWorkHours" numeric DEFAULT (0), "averageExpenses" numeric, "show_anonymous_bonus" boolean, "show_average_bonus" boolean, "show_average_expenses" boolean, "show_average_income" boolean, "show_billrate" boolean, "show_payperiod" boolean, "show_start_work_on" boolean, "isJobSearchActive" boolean, "linkedInUrl" varchar, "facebookUrl" varchar, "instagramUrl" varchar, "twitterUrl" varchar, "githubUrl" varchar, "gitlabUrl" varchar, "upworkUrl" varchar, "stackoverflowUrl" varchar, "isVerified" boolean, "isVetted" boolean, "totalJobs" numeric, "jobSuccess" numeric, "profile_link" varchar, "userId" varchar NOT NULL, "contactId" varchar, "organizationPositionId" varchar, "isTrackingEnabled" boolean DEFAULT (0), "deletedAt" datetime, "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "upworkId" varchar, "linkedInId" varchar, "isOnline" boolean DEFAULT (0), "isTrackingTime" boolean DEFAULT (0), "minimumBillingRate" integer, "isAway" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "fix_relational_custom_fields" boolean, CONSTRAINT "REL_f4b0d329c4a3cf79ffe9d56504" UNIQUE ("userId"), CONSTRAINT "REL_1c0c1370ecd98040259625e17e" UNIQUE ("contactId"), CONSTRAINT "FK_4b3303a6b7eb92d237a4379734e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6a48286f3aa8ae903bee0d1e72" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f4b0d329c4a3cf79ffe9d565047" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c0c1370ecd98040259625e17e2" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields" FROM "temporary_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); + await queryRunner.query(`CREATE INDEX "IDX_f4b0d329c4a3cf79ffe9d56504" ON "employee" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_96dfbcaa2990df01fe5bb39ccc" ON "employee" ("profile_link") `); + await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_510cb87f5da169e57e694d1a5c" ON "employee" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_175b7be641928a31521224daa8" ON "employee" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_01237d04f882cf1ea794678e8d"`); + await queryRunner.query(`DROP INDEX "IDX_48fae30026b4e166a3445fee6d"`); + await queryRunner.query(`DROP INDEX "IDX_9516a627a131626d2a5738a05a"`); + await queryRunner.query(`DROP INDEX "IDX_56e96cd218a185ed59b5a8e786"`); + await queryRunner.query(`DROP INDEX "IDX_9537fae454ebebc98ee5adb3a2"`); + await queryRunner.query(`DROP INDEX "IDX_710c71526edb89b2a7033abcdf"`); + await queryRunner.query(`DROP INDEX "IDX_95ea18af6ef8123503d332240c"`); + await queryRunner.query(`ALTER TABLE "employee_setting" RENAME TO "temporary_employee_setting"`); + await queryRunner.query( + `CREATE TABLE "employee_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "month" integer NOT NULL, "year" integer NOT NULL, "settingType" varchar NOT NULL, "value" integer NOT NULL, "currency" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_95ea18af6ef8123503d332240c2" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_56e96cd218a185ed59b5a8e7869" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9516a627a131626d2a5738a05a8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_setting"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_setting"`); + await queryRunner.query(`CREATE INDEX "IDX_01237d04f882cf1ea794678e8d" ON "employee_setting" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_48fae30026b4e166a3445fee6d" ON "employee_setting" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_9516a627a131626d2a5738a05a" ON "employee_setting" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_56e96cd218a185ed59b5a8e786" ON "employee_setting" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_9537fae454ebebc98ee5adb3a2" ON "employee_setting" ("settingType") `); + await queryRunner.query(`CREATE INDEX "IDX_710c71526edb89b2a7033abcdf" ON "employee_setting" ("currency") `); + await queryRunner.query(`CREATE INDEX "IDX_95ea18af6ef8123503d332240c" ON "employee_setting" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_3980b0fe1e757b092ea5323656"`); + await queryRunner.query(`DROP INDEX "IDX_25f8915182128f377d84b60d26"`); + await queryRunner.query(`DROP INDEX "IDX_0ac8526c48a3daa267c86225fb"`); + await queryRunner.query(`DROP INDEX "IDX_6e570174fda71e97616e9d2eea"`); + await queryRunner.query(`DROP INDEX "IDX_739f8cdce21cc72d400559ce00"`); + await queryRunner.query(`DROP INDEX "IDX_a4b5a2ea2afecf1ee254f1a704"`); + await queryRunner.query(`DROP INDEX "IDX_3ee5147bb1fde625fa33c0e956"`); + await queryRunner.query(`DROP INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6"`); + await queryRunner.query( + `ALTER TABLE "employee_recurring_expense" RENAME TO "temporary_employee_recurring_expense"` + ); + await queryRunner.query( + `CREATE TABLE "employee_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "parentRecurringExpenseId" varchar, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3ee5147bb1fde625fa33c0e956b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5fde7be40b3c03bc0fdac0c2f66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_recurring_expense"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_recurring_expense"`); + await queryRunner.query( + `CREATE INDEX "IDX_3980b0fe1e757b092ea5323656" ON "employee_recurring_expense" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25f8915182128f377d84b60d26" ON "employee_recurring_expense" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ac8526c48a3daa267c86225fb" ON "employee_recurring_expense" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6e570174fda71e97616e9d2eea" ON "employee_recurring_expense" ("parentRecurringExpenseId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_739f8cdce21cc72d400559ce00" ON "employee_recurring_expense" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a4b5a2ea2afecf1ee254f1a704" ON "employee_recurring_expense" ("categoryName") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3ee5147bb1fde625fa33c0e956" ON "employee_recurring_expense" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6" ON "employee_recurring_expense" ("tenantId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_aa98ea786d490db300d3dbbdb6"`); + await queryRunner.query(`DROP INDEX "IDX_587d11ffbd87adb6dff367f3cd"`); + await queryRunner.query(`DROP INDEX "IDX_d543336994b1f764c449e0b1d3"`); + await queryRunner.query(`DROP INDEX "IDX_0f9cefa604913e1ab322591546"`); + await queryRunner.query(`DROP INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef"`); + await queryRunner.query(`DROP INDEX "IDX_329ebd01a757d1a0c3c4d628e2"`); + await queryRunner.query(`ALTER TABLE "employee_phone" RENAME TO "temporary_employee_phone"`); + await queryRunner.query( + `CREATE TABLE "employee_phone" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "type" varchar, "phoneNumber" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_329ebd01a757d1a0c3c4d628e29" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0f9cefa604913e1ab3225915469" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d543336994b1f764c449e0b1d3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_phone"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_phone"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_phone"`); + await queryRunner.query(`CREATE INDEX "IDX_aa98ea786d490db300d3dbbdb6" ON "employee_phone" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_587d11ffbd87adb6dff367f3cd" ON "employee_phone" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d543336994b1f764c449e0b1d3" ON "employee_phone" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_0f9cefa604913e1ab322591546" ON "employee_phone" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef" ON "employee_phone" ("phoneNumber") `); + await queryRunner.query(`CREATE INDEX "IDX_329ebd01a757d1a0c3c4d628e2" ON "employee_phone" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_88a58d149404145ed7b3385387"`); + await queryRunner.query(`DROP INDEX "IDX_90bd442869709bae9d1b18e489"`); + await queryRunner.query(`DROP INDEX "IDX_d3fc52d497bc44d6f493dbedc3"`); + await queryRunner.query(`DROP INDEX "IDX_c4668533292bf4526e61aedf74"`); + await queryRunner.query(`ALTER TABLE "employee_level" RENAME TO "temporary_employee_level"`); + await queryRunner.query( + `CREATE TABLE "employee_level" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c4668533292bf4526e61aedf74a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d3fc52d497bc44d6f493dbedc3a" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_level"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_level"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_level"`); + await queryRunner.query(`CREATE INDEX "IDX_88a58d149404145ed7b3385387" ON "employee_level" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_90bd442869709bae9d1b18e489" ON "employee_level" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_d3fc52d497bc44d6f493dbedc3" ON "employee_level" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_c4668533292bf4526e61aedf74" ON "employee_level" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_8fb47e8bfd26340ddaeabd24e5"`); + await queryRunner.query(`DROP INDEX "IDX_c07390f325c847be7df93d0d17"`); + await queryRunner.query(`DROP INDEX "IDX_91e0f7efcd17d20b5029fb1342"`); + await queryRunner.query(`DROP INDEX "IDX_caf8363b0ed7d5f24ae866ba3b"`); + await queryRunner.query(`DROP INDEX "IDX_6912685bbb0e303eab392978d9"`); + await queryRunner.query(`DROP INDEX "IDX_0c5266f3f488add404f92d56ec"`); + await queryRunner.query(`ALTER TABLE "employee_award" RENAME TO "temporary_employee_award"`); + await queryRunner.query( + `CREATE TABLE "employee_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0c5266f3f488add404f92d56ec7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_caf8363b0ed7d5f24ae866ba3bb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91e0f7efcd17d20b5029fb1342d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_award"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_award"`); + await queryRunner.query(`CREATE INDEX "IDX_8fb47e8bfd26340ddaeabd24e5" ON "employee_award" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_c07390f325c847be7df93d0d17" ON "employee_award" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_91e0f7efcd17d20b5029fb1342" ON "employee_award" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_caf8363b0ed7d5f24ae866ba3b" ON "employee_award" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_6912685bbb0e303eab392978d9" ON "employee_award" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_0c5266f3f488add404f92d56ec" ON "employee_award" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_64c83df9d37d9ada96edb66557"`); + await queryRunner.query(`DROP INDEX "IDX_d0219ada2359ede9e7b0d511ba"`); + await queryRunner.query(`DROP INDEX "IDX_a35637bb659c59e18adb4f38f8"`); + await queryRunner.query(`DROP INDEX "IDX_86cf36c137712e779dd7e2301e"`); + await queryRunner.query(`ALTER TABLE "employee_appointment" RENAME TO "temporary_employee_appointment"`); + await queryRunner.query( + `CREATE TABLE "employee_appointment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar, "agenda" varchar NOT NULL, "description" varchar, "location" varchar, "startDateTime" datetime NOT NULL, "endDateTime" datetime NOT NULL, "bufferTimeStart" boolean, "bufferTimeEnd" boolean, "bufferTimeInMins" integer, "breakTimeInMins" integer, "breakStartTime" datetime, "emails" varchar, "status" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2f58132c57108540887dc3e88eb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86cf36c137712e779dd7e2301e6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a35637bb659c59e18adb4f38f87" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "employee_appointment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_appointment"` + ); + await queryRunner.query(`DROP TABLE "temporary_employee_appointment"`); + await queryRunner.query( + `CREATE INDEX "IDX_64c83df9d37d9ada96edb66557" ON "employee_appointment" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d0219ada2359ede9e7b0d511ba" ON "employee_appointment" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a35637bb659c59e18adb4f38f8" ON "employee_appointment" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_86cf36c137712e779dd7e2301e" ON "employee_appointment" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_29d60114e1968c0cd68a19e3c5"`); + await queryRunner.query(`DROP INDEX "IDX_e4932e0a726b9b07d81d8b6905"`); + await queryRunner.query(`DROP INDEX "IDX_753e005a45556b5909e11937aa"`); + await queryRunner.query(`DROP INDEX "IDX_c160fe6234675fac031aa3e7c5"`); + await queryRunner.query(`DROP INDEX "IDX_274708db64fcce5448f2c4541c"`); + await queryRunner.query(`DROP INDEX "IDX_7e688e6613930ba721b841db43"`); + await queryRunner.query(`ALTER TABLE "email_template" RENAME TO "temporary_email_template"`); + await queryRunner.query( + `CREATE TABLE "email_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c160fe6234675fac031aa3e7c50" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_753e005a45556b5909e11937aaf" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "email_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt" FROM "temporary_email_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_email_template"`); + await queryRunner.query(`CREATE INDEX "IDX_29d60114e1968c0cd68a19e3c5" ON "email_template" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e4932e0a726b9b07d81d8b6905" ON "email_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_753e005a45556b5909e11937aa" ON "email_template" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_c160fe6234675fac031aa3e7c5" ON "email_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_274708db64fcce5448f2c4541c" ON "email_template" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_7e688e6613930ba721b841db43" ON "email_template" ("languageCode") `); + await queryRunner.query(`DROP INDEX "IDX_13247a755d17e7905d5bb4cfda"`); + await queryRunner.query(`DROP INDEX "IDX_e3321e3575289b7ee1e8eb1042"`); + await queryRunner.query(`DROP INDEX "IDX_4ac734f2a1a3c055dca04fba99"`); + await queryRunner.query(`DROP INDEX "IDX_93799dfaeff51de06f1e02ac41"`); + await queryRunner.query(`DROP INDEX "IDX_03d16a2fd43d7c601743440212"`); + await queryRunner.query(`DROP INDEX "IDX_4be518a169bbcbfe92025ac574"`); + await queryRunner.query(`DROP INDEX "IDX_9e80c9ec749dfda6dbe2cd9704"`); + await queryRunner.query(`DROP INDEX "IDX_e37af4ab2ba0bf268bfd982634"`); + await queryRunner.query(`ALTER TABLE "email_reset" RENAME TO "temporary_email_reset"`); + await queryRunner.query( + `CREATE TABLE "email_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "email" varchar NOT NULL, "oldEmail" varchar NOT NULL, "code" varchar NOT NULL, "userId" varchar, "token" varchar, "expiredAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_93799dfaeff51de06f1e02ac414" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e37af4ab2ba0bf268bfd9826345" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "email_reset"("id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt" FROM "temporary_email_reset"` + ); + await queryRunner.query(`DROP TABLE "temporary_email_reset"`); + await queryRunner.query(`CREATE INDEX "IDX_13247a755d17e7905d5bb4cfda" ON "email_reset" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e3321e3575289b7ee1e8eb1042" ON "email_reset" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4ac734f2a1a3c055dca04fba99" ON "email_reset" ("token") `); + await queryRunner.query(`CREATE INDEX "IDX_93799dfaeff51de06f1e02ac41" ON "email_reset" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_03d16a2fd43d7c601743440212" ON "email_reset" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_4be518a169bbcbfe92025ac574" ON "email_reset" ("oldEmail") `); + await queryRunner.query(`CREATE INDEX "IDX_9e80c9ec749dfda6dbe2cd9704" ON "email_reset" ("code") `); + await queryRunner.query(`CREATE INDEX "IDX_e37af4ab2ba0bf268bfd982634" ON "email_reset" ("userId") `); + await queryRunner.query(`DROP INDEX "IDX_5956ce758c01ebf8a539e8d4f0"`); + await queryRunner.query(`DROP INDEX "IDX_9033faf41b23c61ba201c48796"`); + await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); + await queryRunner.query(`DROP INDEX "IDX_0af511c44de7a16beb45cc3785"`); + await queryRunner.query(`DROP INDEX "IDX_525f4873c6edc3d94559f88900"`); + await queryRunner.query(`DROP INDEX "IDX_953df0eb0df3035baf140399f6"`); + await queryRunner.query(`DROP INDEX "IDX_1261c457b3035b77719556995b"`); + await queryRunner.query(`DROP INDEX "IDX_d825bc6da1c52a3900a9373260"`); + await queryRunner.query(`DROP INDEX "IDX_9a69f7077e0333d2c848895a1b"`); + await queryRunner.query(`ALTER TABLE "email_sent" RENAME TO "temporary_email_sent"`); + await queryRunner.query( + `CREATE TABLE "email_sent" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "content" varchar, "email" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "userId" varchar, "emailTemplateId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "status" varchar CHECK( "status" IN ('SENT','FAILED') ), "deletedAt" datetime, CONSTRAINT "FK_1261c457b3035b77719556995bf" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_525f4873c6edc3d94559f88900c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0af511c44de7a16beb45cc37852" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9033faf41b23c61ba201c487969" FOREIGN KEY ("emailTemplateId") REFERENCES "email_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "email_sent"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt" FROM "temporary_email_sent"` + ); + await queryRunner.query(`DROP TABLE "temporary_email_sent"`); + await queryRunner.query(`CREATE INDEX "IDX_5956ce758c01ebf8a539e8d4f0" ON "email_sent" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_9033faf41b23c61ba201c48796" ON "email_sent" ("emailTemplateId") `); + await queryRunner.query(`CREATE INDEX "IDX_a954fda57cca81dc48446e73b8" ON "email_sent" ("email") `); + await queryRunner.query(`CREATE INDEX "IDX_0af511c44de7a16beb45cc3785" ON "email_sent" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_525f4873c6edc3d94559f88900" ON "email_sent" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_953df0eb0df3035baf140399f6" ON "email_sent" ("name") `); + await queryRunner.query(`CREATE INDEX "IDX_1261c457b3035b77719556995b" ON "email_sent" ("userId") `); + await queryRunner.query(`CREATE INDEX "IDX_d825bc6da1c52a3900a9373260" ON "email_sent" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_9a69f7077e0333d2c848895a1b" ON "email_sent" ("isArchived") `); + await queryRunner.query(`DROP INDEX "IDX_443c561d45f6c57f3790a759ba"`); + await queryRunner.query(`DROP INDEX "IDX_0d8c964237e5061627de82df80"`); + await queryRunner.query(`DROP INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0"`); + await queryRunner.query(`DROP INDEX "IDX_38fb85abdf9995efcf217f5955"`); + await queryRunner.query(`DROP INDEX "IDX_4b1ff44e6bae5065429dbab554"`); + await queryRunner.query(`DROP INDEX "IDX_9211f5b62988df6e95522be7da"`); + await queryRunner.query(`ALTER TABLE "deal" RENAME TO "temporary_deal"`); + await queryRunner.query( + `CREATE TABLE "deal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "probability" integer NOT NULL, "createdByUserId" varchar NOT NULL, "stageId" varchar NOT NULL, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_1ae3abc0ae1dcf6c13f49b62b5" UNIQUE ("clientId"), CONSTRAINT "FK_1ae3abc0ae1dcf6c13f49b62b56" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9211f5b62988df6e95522be7daa" FOREIGN KEY ("stageId") REFERENCES "pipeline_stage" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4b1ff44e6bae5065429dbab554b" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38fb85abdf9995efcf217f59554" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_46a3c00bfc3e36b4412d8bcdb08" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "deal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt" FROM "temporary_deal"` + ); + await queryRunner.query(`DROP TABLE "temporary_deal"`); + await queryRunner.query(`CREATE INDEX "IDX_443c561d45f6c57f3790a759ba" ON "deal" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_0d8c964237e5061627de82df80" ON "deal" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0" ON "deal" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_38fb85abdf9995efcf217f5955" ON "deal" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_4b1ff44e6bae5065429dbab554" ON "deal" ("createdByUserId") `); + await queryRunner.query(`CREATE INDEX "IDX_9211f5b62988df6e95522be7da" ON "deal" ("stageId") `); + await queryRunner.query(`DROP INDEX "IDX_f10372f9d038d0954d5b20635a"`); + await queryRunner.query(`DROP INDEX "IDX_e2c7d28bb07adc915d74437c7b"`); + await queryRunner.query(`DROP INDEX "IDX_15a1306132d66c63ef31f7288c"`); + await queryRunner.query(`DROP INDEX "IDX_2aa3fc8daa25beec4788d2be26"`); + await queryRunner.query(`ALTER TABLE "custom_smtp" RENAME TO "temporary_custom_smtp"`); + await queryRunner.query( + `CREATE TABLE "custom_smtp" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "host" varchar NOT NULL, "port" integer NOT NULL, "secure" boolean NOT NULL, "username" varchar NOT NULL, "password" varchar NOT NULL, "isValidate" boolean NOT NULL DEFAULT (0), "fromAddress" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2aa3fc8daa25beec4788d2be26c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_15a1306132d66c63ef31f7288c1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "custom_smtp"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt" FROM "temporary_custom_smtp"` + ); + await queryRunner.query(`DROP TABLE "temporary_custom_smtp"`); + await queryRunner.query(`CREATE INDEX "IDX_f10372f9d038d0954d5b20635a" ON "custom_smtp" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_e2c7d28bb07adc915d74437c7b" ON "custom_smtp" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_15a1306132d66c63ef31f7288c" ON "custom_smtp" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_2aa3fc8daa25beec4788d2be26" ON "custom_smtp" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_8203f1410475748bbbc6d3029d"`); + await queryRunner.query(`DROP INDEX "IDX_03cc024ddc2f196dca7fead7cb"`); + await queryRunner.query(`DROP INDEX "IDX_0b0fbda74f6c82c943e706a3cc"`); + await queryRunner.query(`ALTER TABLE "currency" RENAME TO "temporary_currency"`); + await queryRunner.query( + `CREATE TABLE "currency" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "currency" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "currency"("id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt" FROM "temporary_currency"` + ); + await queryRunner.query(`DROP TABLE "temporary_currency"`); + await queryRunner.query(`CREATE INDEX "IDX_8203f1410475748bbbc6d3029d" ON "currency" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_03cc024ddc2f196dca7fead7cb" ON "currency" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_0b0fbda74f6c82c943e706a3cc" ON "currency" ("isoCode") `); + await queryRunner.query(`DROP INDEX "IDX_6cd9b7ea6818e862217035436c"`); + await queryRunner.query(`DROP INDEX "IDX_97ebcd8db30a408b5f907d6ff4"`); + await queryRunner.query(`DROP INDEX "IDX_6eba1a52ee121d100c8a0a6510"`); + await queryRunner.query(`ALTER TABLE "country" RENAME TO "temporary_country"`); + await queryRunner.query( + `CREATE TABLE "country" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "country" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` + ); + await queryRunner.query( + `INSERT INTO "country"("id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt" FROM "temporary_country"` + ); + await queryRunner.query(`DROP TABLE "temporary_country"`); + await queryRunner.query(`CREATE INDEX "IDX_6cd9b7ea6818e862217035436c" ON "country" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_97ebcd8db30a408b5f907d6ff4" ON "country" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6eba1a52ee121d100c8a0a6510" ON "country" ("isoCode") `); + await queryRunner.query(`DROP INDEX "IDX_4164bd34bdcce8754641f0e567"`); + await queryRunner.query(`DROP INDEX "IDX_05831d37eabeb6150f99c69784"`); + await queryRunner.query(`DROP INDEX "IDX_7719d73cd16a9f57ecc6ac24b3"`); + await queryRunner.query(`DROP INDEX "IDX_60468af1ce34043a900809c84f"`); + await queryRunner.query(`ALTER TABLE "contact" RENAME TO "temporary_contact"`); + await queryRunner.query( + `CREATE TABLE "contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "firstName" varchar, "lastName" varchar, "country" varchar, "city" varchar, "address" varchar, "address2" varchar, "postcode" varchar, "latitude" numeric, "longitude" numeric, "regionCode" varchar, "fax" varchar, "fiscalInformation" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_60468af1ce34043a900809c84f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7719d73cd16a9f57ecc6ac24b3d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` + ); + await queryRunner.query( + `INSERT INTO "contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt" FROM "temporary_contact"` + ); + await queryRunner.query(`DROP TABLE "temporary_contact"`); + await queryRunner.query(`CREATE INDEX "IDX_4164bd34bdcce8754641f0e567" ON "contact" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_05831d37eabeb6150f99c69784" ON "contact" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_7719d73cd16a9f57ecc6ac24b3" ON "contact" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_60468af1ce34043a900809c84f" ON "contact" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_af835b66fa10279103bd89e225"`); + await queryRunner.query(`DROP INDEX "IDX_2b8091376a529383e23ba3356a"`); + await queryRunner.query(`DROP INDEX "IDX_8b900e8a39f76125e610ab30c0"`); + await queryRunner.query(`DROP INDEX "IDX_77ac426e04553ff1654421bce4"`); + await queryRunner.query(`DROP INDEX "IDX_16fb27ffd1a99c6506c92ad57a"`); + await queryRunner.query(`DROP INDEX "IDX_b674793a804b7d69d74c8f6c5b"`); + await queryRunner.query(`DROP INDEX "IDX_1e3e8228e7df634fa4cec6322c"`); + await queryRunner.query(`DROP INDEX "IDX_4ea108fd8b089237964d5f98fb"`); + await queryRunner.query(`DROP INDEX "IDX_3930aa71e0fa24f09201811b1b"`); + await queryRunner.query(`ALTER TABLE "candidate" RENAME TO "temporary_candidate"`); + await queryRunner.query( + `CREATE TABLE "candidate" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" numeric, "valueDate" datetime, "appliedDate" datetime, "hiredDate" datetime, "status" varchar DEFAULT ('APPLIED'), "rejectDate" datetime, "candidateLevel" varchar(500), "reWeeklyLimit" integer, "billRateCurrency" varchar(255), "billRateValue" integer, "payPeriod" varchar, "cvUrl" varchar, "isArchived" boolean DEFAULT (0), "contactId" varchar, "organizationPositionId" varchar, "sourceId" varchar, "userId" varchar NOT NULL, "employeeId" varchar, "minimumBillingRate" integer, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "REL_3930aa71e0fa24f09201811b1b" UNIQUE ("userId"), CONSTRAINT "REL_4ea108fd8b089237964d5f98fb" UNIQUE ("sourceId"), CONSTRAINT "REL_b674793a804b7d69d74c8f6c5b" UNIQUE ("contactId"), CONSTRAINT "UQ_91b20077aa92f9115764033cd06" UNIQUE ("employeeId"), CONSTRAINT "FK_3930aa71e0fa24f09201811b1bb" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4ea108fd8b089237964d5f98fba" FOREIGN KEY ("sourceId") REFERENCES "candidate_source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1e3e8228e7df634fa4cec6322c7" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b674793a804b7d69d74c8f6c5ba" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16fb27ffd1a99c6506c92ad57a7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_77ac426e04553ff1654421bce4d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt" FROM "temporary_candidate"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate"`); + await queryRunner.query(`CREATE INDEX "IDX_af835b66fa10279103bd89e225" ON "candidate" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_2b8091376a529383e23ba3356a" ON "candidate" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8b900e8a39f76125e610ab30c0" ON "candidate" ("employeeId") `); + await queryRunner.query(`CREATE INDEX "IDX_77ac426e04553ff1654421bce4" ON "candidate" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_16fb27ffd1a99c6506c92ad57a" ON "candidate" ("organizationId") `); + await queryRunner.query(`CREATE INDEX "IDX_b674793a804b7d69d74c8f6c5b" ON "candidate" ("contactId") `); + await queryRunner.query( + `CREATE INDEX "IDX_1e3e8228e7df634fa4cec6322c" ON "candidate" ("organizationPositionId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_4ea108fd8b089237964d5f98fb" ON "candidate" ("sourceId") `); + await queryRunner.query(`CREATE INDEX "IDX_3930aa71e0fa24f09201811b1b" ON "candidate" ("userId") `); + await queryRunner.query(`DROP INDEX "IDX_97aa0328b72e1bf919e61bccdc"`); + await queryRunner.query(`DROP INDEX "IDX_199ca43300fa4e64239656a677"`); + await queryRunner.query(`DROP INDEX "IDX_a6fecb615b07987b480defac64"`); + await queryRunner.query(`DROP INDEX "IDX_9d46b8c5382acd4d4514bc5c62"`); + await queryRunner.query(`DROP INDEX "IDX_063663c7e61e45d172d1b83265"`); + await queryRunner.query(`ALTER TABLE "candidate_technology" RENAME TO "temporary_candidate_technology"`); + await queryRunner.query( + `CREATE TABLE "candidate_technology" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_063663c7e61e45d172d1b832656" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9d46b8c5382acd4d4514bc5c62e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a6fecb615b07987b480defac647" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_technology"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_technology"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_technology"`); + await queryRunner.query( + `CREATE INDEX "IDX_97aa0328b72e1bf919e61bccdc" ON "candidate_technology" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_199ca43300fa4e64239656a677" ON "candidate_technology" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a6fecb615b07987b480defac64" ON "candidate_technology" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d46b8c5382acd4d4514bc5c62" ON "candidate_technology" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_063663c7e61e45d172d1b83265" ON "candidate_technology" ("interviewId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_509101ab1a46a5934ee278d447"`); + await queryRunner.query(`DROP INDEX "IDX_2be9182096747fb18cb8afb1f0"`); + await queryRunner.query(`DROP INDEX "IDX_b2a1ba27a76dd819cd8294cce3"`); + await queryRunner.query(`DROP INDEX "IDX_e92027b5280828cadd7cd6ea71"`); + await queryRunner.query(`ALTER TABLE "candidate_source" RENAME TO "temporary_candidate_source"`); + await queryRunner.query( + `CREATE TABLE "candidate_source" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e92027b5280828cadd7cd6ea719" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b2a1ba27a76dd819cd8294cce38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_source"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_source"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_source"`); + await queryRunner.query(`CREATE INDEX "IDX_509101ab1a46a5934ee278d447" ON "candidate_source" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_2be9182096747fb18cb8afb1f0" ON "candidate_source" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_b2a1ba27a76dd819cd8294cce3" ON "candidate_source" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_e92027b5280828cadd7cd6ea71" ON "candidate_source" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347"`); + await queryRunner.query(`DROP INDEX "IDX_6907163d0bb8e9f0440b9bf2a7"`); + await queryRunner.query(`DROP INDEX "IDX_8a07f780c6fce2b82830ab0687"`); + await queryRunner.query(`DROP INDEX "IDX_d7986743e7f11720349a6c9557"`); + await queryRunner.query(`ALTER TABLE "candidate_skill" RENAME TO "temporary_candidate_skill"`); + await queryRunner.query( + `CREATE TABLE "candidate_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_492548e6c176f5655adfae9f5ea" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d7986743e7f11720349a6c95572" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a07f780c6fce2b82830ab06877" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_skill"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_skill"`); + await queryRunner.query(`CREATE INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347" ON "candidate_skill" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_6907163d0bb8e9f0440b9bf2a7" ON "candidate_skill" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_8a07f780c6fce2b82830ab0687" ON "candidate_skill" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d7986743e7f11720349a6c9557" ON "candidate_skill" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_ff6776d92db4ef71edbfba9903"`); + await queryRunner.query(`DROP INDEX "IDX_afe01503d4337c9623c06f22df"`); + await queryRunner.query(`DROP INDEX "IDX_045de7c208adcd0c68c0a65174"`); + await queryRunner.query(`DROP INDEX "IDX_d321f4547ed467d07cce1e7d9a"`); + await queryRunner.query(`DROP INDEX "IDX_a0d171f45bdbcf2b990c0c37c3"`); + await queryRunner.query( + `ALTER TABLE "candidate_personal_quality" RENAME TO "temporary_candidate_personal_quality"` + ); + await queryRunner.query( + `CREATE TABLE "candidate_personal_quality" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a0d171f45bdbcf2b990c0c37c32" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d321f4547ed467d07cce1e7d9a5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_045de7c208adcd0c68c0a651748" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_personal_quality"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_personal_quality"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_personal_quality"`); + await queryRunner.query( + `CREATE INDEX "IDX_ff6776d92db4ef71edbfba9903" ON "candidate_personal_quality" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_afe01503d4337c9623c06f22df" ON "candidate_personal_quality" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_045de7c208adcd0c68c0a65174" ON "candidate_personal_quality" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d321f4547ed467d07cce1e7d9a" ON "candidate_personal_quality" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a0d171f45bdbcf2b990c0c37c3" ON "candidate_personal_quality" ("interviewId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2043abff09f084fb8690009fb8"`); + await queryRunner.query(`DROP INDEX "IDX_b9132118c3a98c4c48e417c0c5"`); + await queryRunner.query(`DROP INDEX "IDX_f0ca69c78eea92c95d9044764a"`); + await queryRunner.query(`DROP INDEX "IDX_5f1e315db848990dfffa72817c"`); + await queryRunner.query(`DROP INDEX "IDX_ecb65075e94b47bbab11cfa5a1"`); + await queryRunner.query(`DROP INDEX "IDX_9e7b20eb3dfa082b83b198fdad"`); + await queryRunner.query(`ALTER TABLE "candidate_interviewer" RENAME TO "temporary_candidate_interviewer"`); + await queryRunner.query( + `CREATE TABLE "candidate_interviewer" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "interviewId" varchar NOT NULL, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9e7b20eb3dfa082b83b198fdad4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb65075e94b47bbab11cfa5a1e" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5f1e315db848990dfffa72817ca" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f0ca69c78eea92c95d9044764a2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_interviewer"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_interviewer"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_interviewer"`); + await queryRunner.query( + `CREATE INDEX "IDX_2043abff09f084fb8690009fb8" ON "candidate_interviewer" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b9132118c3a98c4c48e417c0c5" ON "candidate_interviewer" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f0ca69c78eea92c95d9044764a" ON "candidate_interviewer" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_5f1e315db848990dfffa72817c" ON "candidate_interviewer" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ecb65075e94b47bbab11cfa5a1" ON "candidate_interviewer" ("interviewId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9e7b20eb3dfa082b83b198fdad" ON "candidate_interviewer" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_7b49ce2928b327213f2de66b95"`); + await queryRunner.query(`DROP INDEX "IDX_b9191cf49f8cd1f192cb74233c"`); + await queryRunner.query(`DROP INDEX "IDX_91996439c4baafee8395d3df15"`); + await queryRunner.query(`DROP INDEX "IDX_03be41e88b1fecfe4e24d6b04b"`); + await queryRunner.query(`DROP INDEX "IDX_59b765e6d13d83dba4852a43eb"`); + await queryRunner.query(`ALTER TABLE "candidate_interview" RENAME TO "temporary_candidate_interview"`); + await queryRunner.query( + `CREATE TABLE "candidate_interview" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "startTime" datetime, "endTime" datetime, "location" varchar, "note" varchar, "isArchived" boolean DEFAULT (0), "rating" numeric, "candidateId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "FK_59b765e6d13d83dba4852a43eb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_03be41e88b1fecfe4e24d6b04b2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91996439c4baafee8395d3df153" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_interview"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt" FROM "temporary_candidate_interview"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_interview"`); + await queryRunner.query( + `CREATE INDEX "IDX_7b49ce2928b327213f2de66b95" ON "candidate_interview" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_b9191cf49f8cd1f192cb74233c" ON "candidate_interview" ("isActive") `); + await queryRunner.query( + `CREATE INDEX "IDX_91996439c4baafee8395d3df15" ON "candidate_interview" ("candidateId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_03be41e88b1fecfe4e24d6b04b" ON "candidate_interview" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_59b765e6d13d83dba4852a43eb" ON "candidate_interview" ("tenantId") `); + await queryRunner.query(`DROP INDEX "IDX_05ed49a5ebdd5ec533f913b620"`); + await queryRunner.query(`DROP INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb"`); + await queryRunner.query(`DROP INDEX "IDX_6cb21fa0f65ff69679966c836f"`); + await queryRunner.query(`DROP INDEX "IDX_3a6928f8501fce33820721a8fe"`); + await queryRunner.query(`DROP INDEX "IDX_98c008fd8cf597e83dcdccfd16"`); + await queryRunner.query(`DROP INDEX "IDX_0862c274d336126b951bfe009a"`); + await queryRunner.query(`ALTER TABLE "candidate_feedback" RENAME TO "temporary_candidate_feedback"`); + await queryRunner.query( + `CREATE TABLE "candidate_feedback" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "rating" numeric, "status" varchar, "candidateId" varchar, "interviewId" varchar, "interviewerId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_44f3d80c3293e1de038c87f115" UNIQUE ("interviewerId"), CONSTRAINT "FK_44f3d80c3293e1de038c87f115d" FOREIGN KEY ("interviewerId") REFERENCES "candidate_interviewer" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0862c274d336126b951bfe009a7" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_98c008fd8cf597e83dcdccfd161" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3a6928f8501fce33820721a8fe8" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6cb21fa0f65ff69679966c836f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_feedback"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_feedback"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_feedback"`); + await queryRunner.query( + `CREATE INDEX "IDX_05ed49a5ebdd5ec533f913b620" ON "candidate_feedback" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb" ON "candidate_feedback" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_6cb21fa0f65ff69679966c836f" ON "candidate_feedback" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_3a6928f8501fce33820721a8fe" ON "candidate_feedback" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_98c008fd8cf597e83dcdccfd16" ON "candidate_feedback" ("candidateId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0862c274d336126b951bfe009a" ON "candidate_feedback" ("interviewId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_c24bce6dd33e56ef8e8dacef1a"`); + await queryRunner.query(`DROP INDEX "IDX_dafa68d060cf401d5f62a57ad4"`); + await queryRunner.query(`DROP INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf"`); + await queryRunner.query(`DROP INDEX "IDX_a50eb955f940ca93e044d175c6"`); + await queryRunner.query(`ALTER TABLE "candidate_experience" RENAME TO "temporary_candidate_experience"`); + await queryRunner.query( + `CREATE TABLE "candidate_experience" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "occupation" varchar NOT NULL, "duration" varchar NOT NULL, "description" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_cf75465b3663652a28cf1841ce2" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a50eb955f940ca93e044d175c62" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dcf5fc8bc7f77a80b0fc648bfc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_experience"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_experience"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_experience"`); + await queryRunner.query( + `CREATE INDEX "IDX_c24bce6dd33e56ef8e8dacef1a" ON "candidate_experience" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_dafa68d060cf401d5f62a57ad4" ON "candidate_experience" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf" ON "candidate_experience" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a50eb955f940ca93e044d175c6" ON "candidate_experience" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_b443c78c3796f2e9aab05a2bb9"`); + await queryRunner.query(`DROP INDEX "IDX_336eb14606016757d2302efa4d"`); + await queryRunner.query(`DROP INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd"`); + await queryRunner.query(`DROP INDEX "IDX_f660af89b2c69fea2334508cbb"`); + await queryRunner.query(`ALTER TABLE "candidate_education" RENAME TO "temporary_candidate_education"`); + await queryRunner.query( + `CREATE TABLE "candidate_education" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "schoolName" varchar NOT NULL, "degree" varchar NOT NULL, "field" varchar NOT NULL, "completionDate" datetime NOT NULL, "notes" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_59b61ba52a58851cfc85b1e6c66" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f660af89b2c69fea2334508cbbd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_00cdd9ed7571be8e2c8d09e7cd4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_education"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_education"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_education"`); + await queryRunner.query( + `CREATE INDEX "IDX_b443c78c3796f2e9aab05a2bb9" ON "candidate_education" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_336eb14606016757d2302efa4d" ON "candidate_education" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd" ON "candidate_education" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_f660af89b2c69fea2334508cbb" ON "candidate_education" ("organizationId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3ed4bac12d0ca32eada4ea5a49"`); + await queryRunner.query(`DROP INDEX "IDX_bf8070715e42b3afe9730e7b30"`); + await queryRunner.query(`DROP INDEX "IDX_4d9b7ab09f9f9517d488b5fed1"`); + await queryRunner.query(`DROP INDEX "IDX_d108a827199fda86a9ec216989"`); + await queryRunner.query(`DROP INDEX "IDX_3f9053719c9d11ebdea03e5a2d"`); + await queryRunner.query(`ALTER TABLE "candidate_document" RENAME TO "temporary_candidate_document"`); + await queryRunner.query( + `CREATE TABLE "candidate_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3f9053719c9d11ebdea03e5a2d4" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d108a827199fda86a9ec216989a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4d9b7ab09f9f9517d488b5fed1e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_document"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_document"`); + await queryRunner.query( + `CREATE INDEX "IDX_3ed4bac12d0ca32eada4ea5a49" ON "candidate_document" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_bf8070715e42b3afe9730e7b30" ON "candidate_document" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_4d9b7ab09f9f9517d488b5fed1" ON "candidate_document" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d108a827199fda86a9ec216989" ON "candidate_document" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3f9053719c9d11ebdea03e5a2d" ON "candidate_document" ("candidateId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_fcab96cef60fd8bccac610ccef"`); + await queryRunner.query(`DROP INDEX "IDX_0a417dafb1dd14eb92a69fa641"`); + await queryRunner.query(`DROP INDEX "IDX_9d5bd131452ef689df2b46551b"`); + await queryRunner.query(`DROP INDEX "IDX_b106406e94bb7317493efc2c98"`); + await queryRunner.query(`DROP INDEX "IDX_d1d16bc87d3afaf387f34cdceb"`); + await queryRunner.query(`DROP INDEX "IDX_ba4c376b2069aa82745d4e9682"`); + await queryRunner.query(`DROP INDEX "IDX_159f821dd214792f1d2ad9cff7"`); + await queryRunner.query( + `ALTER TABLE "candidate_criterion_rating" RENAME TO "temporary_candidate_criterion_rating"` + ); + await queryRunner.query( + `CREATE TABLE "candidate_criterion_rating" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" integer NOT NULL, "technologyId" varchar, "personalQualityId" varchar, "feedbackId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_159f821dd214792f1d2ad9cff7c" FOREIGN KEY ("feedbackId") REFERENCES "candidate_feedback" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ba4c376b2069aa82745d4e96822" FOREIGN KEY ("personalQualityId") REFERENCES "candidate_personal_quality" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d1d16bc87d3afaf387f34cdceb7" FOREIGN KEY ("technologyId") REFERENCES "candidate_technology" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b106406e94bb7317493efc2c989" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9d5bd131452ef689df2b46551b4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "candidate_criterion_rating"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_criterion_rating"` + ); + await queryRunner.query(`DROP TABLE "temporary_candidate_criterion_rating"`); + await queryRunner.query( + `CREATE INDEX "IDX_fcab96cef60fd8bccac610ccef" ON "candidate_criterion_rating" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0a417dafb1dd14eb92a69fa641" ON "candidate_criterion_rating" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d5bd131452ef689df2b46551b" ON "candidate_criterion_rating" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_b106406e94bb7317493efc2c98" ON "candidate_criterion_rating" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_d1d16bc87d3afaf387f34cdceb" ON "candidate_criterion_rating" ("technologyId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_ba4c376b2069aa82745d4e9682" ON "candidate_criterion_rating" ("personalQualityId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_159f821dd214792f1d2ad9cff7" ON "candidate_criterion_rating" ("feedbackId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_a2eb41b1d6ee72de9486558199"`); + await queryRunner.query(`DROP INDEX "IDX_1d8e3566b66fbad38b6e2290a2"`); + await queryRunner.query(`DROP INDEX "IDX_a3b32d609a4c884a776ab883be"`); + await queryRunner.query(`DROP INDEX "IDX_e8b7694e86fe9534778832f90c"`); + await queryRunner.query(`ALTER TABLE "social_account" RENAME TO "temporary_social_account"`); + await queryRunner.query( + `CREATE TABLE "social_account" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "provider" varchar NOT NULL, "providerAccountId" varchar NOT NULL, "userId" varchar NOT NULL, CONSTRAINT "FK_e8b7694e86fe9534778832f90c0" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a3b32d609a4c884a776ab883be3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "social_account"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId" FROM "temporary_social_account"` + ); + await queryRunner.query(`DROP TABLE "temporary_social_account"`); + await queryRunner.query(`CREATE INDEX "IDX_a2eb41b1d6ee72de9486558199" ON "social_account" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1d8e3566b66fbad38b6e2290a2" ON "social_account" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_a3b32d609a4c884a776ab883be" ON "social_account" ("tenantId") `); + await queryRunner.query(`CREATE INDEX "IDX_e8b7694e86fe9534778832f90c" ON "social_account" ("userId") `); + await queryRunner.query(`DROP INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca"`); + await queryRunner.query(`DROP INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe"`); + await queryRunner.query(`DROP INDEX "IDX_f008a481cb4eed547704bb9d83"`); + await queryRunner.query(`DROP INDEX "IDX_d544bd3a63634a4438509ac958"`); + await queryRunner.query(`DROP INDEX "IDX_46ed3c2287423f5dc089100fee"`); + await queryRunner.query(`ALTER TABLE "availability_slot" RENAME TO "temporary_availability_slot"`); + await queryRunner.query( + `CREATE TABLE "availability_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startTime" datetime NOT NULL, "endTime" datetime NOT NULL, "allDay" boolean NOT NULL, "type" text, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_46ed3c2287423f5dc089100feeb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d544bd3a63634a4438509ac958d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f008a481cb4eed547704bb9d839" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "availability_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_availability_slot"` + ); + await queryRunner.query(`DROP TABLE "temporary_availability_slot"`); + await queryRunner.query(`CREATE INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca" ON "availability_slot" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe" ON "availability_slot" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_f008a481cb4eed547704bb9d83" ON "availability_slot" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_d544bd3a63634a4438509ac958" ON "availability_slot" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_46ed3c2287423f5dc089100fee" ON "availability_slot" ("employeeId") `); + await queryRunner.query(`DROP INDEX "IDX_f50ce5a39d610cfcd9da9652b1"`); + await queryRunner.query(`DROP INDEX "IDX_338364927c68961167606e989c"`); + await queryRunner.query(`DROP INDEX "IDX_1462391059ebe137645098d727"`); + await queryRunner.query(`DROP INDEX "IDX_dfe3b357df3ce136917b1f0984"`); + await queryRunner.query(`DROP INDEX "IDX_45f32a5a12d42fba17fe62a279"`); + await queryRunner.query(`ALTER TABLE "approval_policy" RENAME TO "temporary_approval_policy"`); + await queryRunner.query( + `CREATE TABLE "approval_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "approvalType" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_dfe3b357df3ce136917b1f09843" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1462391059ebe137645098d7276" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "approval_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt" FROM "temporary_approval_policy"` + ); + await queryRunner.query(`DROP TABLE "temporary_approval_policy"`); + await queryRunner.query(`CREATE INDEX "IDX_f50ce5a39d610cfcd9da9652b1" ON "approval_policy" ("isArchived") `); + await queryRunner.query(`CREATE INDEX "IDX_338364927c68961167606e989c" ON "approval_policy" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_1462391059ebe137645098d727" ON "approval_policy" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_dfe3b357df3ce136917b1f0984" ON "approval_policy" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_45f32a5a12d42fba17fe62a279" ON "approval_policy" ("name") `); + await queryRunner.query(`DROP INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3"`); + await queryRunner.query(`DROP INDEX "IDX_379af16b0aeed6a4d8f15c53bc"`); + await queryRunner.query(`DROP INDEX "IDX_2c0494466d5a7e1165cea3dca9"`); + await queryRunner.query(`DROP INDEX "IDX_3c3a62226896345c4716bfe1d9"`); + await queryRunner.query(`DROP INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba"`); + await queryRunner.query(`DROP INDEX "IDX_e9ca170a0fae05e44a9bd137d8"`); + await queryRunner.query(`ALTER TABLE "appointment_employee" RENAME TO "temporary_appointment_employee"`); + await queryRunner.query( + `CREATE TABLE "appointment_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "appointmentId" varchar NOT NULL, "employeeId" varchar NOT NULL, "employeeAppointmentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e9ca170a0fae05e44a9bd137d8b" FOREIGN KEY ("employeeAppointmentId") REFERENCES "employee_appointment" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0ddc50b7521b9a905d9ca8c8ba3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3c3a62226896345c4716bfe1d96" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2c0494466d5a7e1165cea3dca98" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "appointment_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt" FROM "temporary_appointment_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_appointment_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3" ON "appointment_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_379af16b0aeed6a4d8f15c53bc" ON "appointment_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2c0494466d5a7e1165cea3dca9" ON "appointment_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3c3a62226896345c4716bfe1d9" ON "appointment_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba" ON "appointment_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_e9ca170a0fae05e44a9bd137d8" ON "appointment_employee" ("employeeAppointmentId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_7ac2c1c487dd77fe38c2d571ea"`); + await queryRunner.query(`DROP INDEX "IDX_5cf7c007fc9c83bee748f08806"`); + await queryRunner.query(`DROP INDEX "IDX_2ca6a49062a4ed884e413bf572"`); + await queryRunner.query(`DROP INDEX "IDX_e66511b175393255c6c4e7b007"`); + await queryRunner.query(`DROP INDEX "IDX_968c1c9a131a61a3720b3a72f6"`); + await queryRunner.query(`DROP INDEX "IDX_a841eabc6b656c965d8846223e"`); + await queryRunner.query(`ALTER TABLE "accounting_template" RENAME TO "temporary_accounting_template"`); + await queryRunner.query( + `CREATE TABLE "accounting_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "templateType" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e66511b175393255c6c4e7b007f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ca6a49062a4ed884e413bf572e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "accounting_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt" FROM "temporary_accounting_template"` + ); + await queryRunner.query(`DROP TABLE "temporary_accounting_template"`); + await queryRunner.query( + `CREATE INDEX "IDX_7ac2c1c487dd77fe38c2d571ea" ON "accounting_template" ("isArchived") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_5cf7c007fc9c83bee748f08806" ON "accounting_template" ("isActive") `); + await queryRunner.query(`CREATE INDEX "IDX_2ca6a49062a4ed884e413bf572" ON "accounting_template" ("tenantId") `); + await queryRunner.query( + `CREATE INDEX "IDX_e66511b175393255c6c4e7b007" ON "accounting_template" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_968c1c9a131a61a3720b3a72f6" ON "accounting_template" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_a841eabc6b656c965d8846223e" ON "accounting_template" ("languageCode") ` + ); + } /** * MySQL Up Migration From c5b5f235a75daac11f0e8e0e699ae2314b9cdd28 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 10:53:30 +0200 Subject: [PATCH 05/47] feat: add mysql migration --- ...1-AlterOrganizationProjectAndBaseEntity.ts | 856 +++++++++++++++++- 1 file changed, 854 insertions(+), 2 deletions(-) diff --git a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts index b948b2aaceb..979d67dbd5e 100644 --- a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts +++ b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts @@ -8928,12 +8928,864 @@ export class AlterOrganizationProjectAndBaseEntity1725775971501 implements Migra * * @param queryRunner */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`accounting_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`approval_policy\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`availability_slot\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`social_account\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_document\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_education\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_experience\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_interview\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_skill\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_source\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate_technology\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`candidate\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`contact\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`country\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`currency\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`custom_smtp\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`deal\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`email_sent\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`email_reset\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`email_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_appointment\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_award\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_level\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_phone\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`equipment\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`estimate_email\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`event_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`expense_category\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`expense\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`import-history\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`import-record\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`feature_organization\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`feature\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal_general_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal_kpi\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal_time_frame\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`goal\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`image_asset\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`income\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_map\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_tenant\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`integration\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`invite\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`invoice\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`key_result_update\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`key_result\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`language\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`merchant\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_award\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_department\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_document\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_employment_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_language\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_position\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`status\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`icon\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archiveTasksIn\` decimal NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`closeTasksIn\` decimal NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`managerId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`defaultAssigneeId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_module\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_sprint\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_team\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_vendor\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`password_reset\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`payment\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`pipeline_stage\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`pipeline\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_category_translation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_category\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_option_group\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_option_translation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_option\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_variant_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_type_translation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_variant_price\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_variant\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_translation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`report_category\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`report_organization\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`report\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`request_approval\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`role_permission\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`role\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`skill\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`tag\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`daily_plan\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`issue_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_priority\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_size\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_status\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`task_version\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`tenant_setting\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`tenant\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`time_off_policy\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`activity\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`screenshot\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`time_log\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`time_slot\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`time_slot_minute\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`timesheet\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`user_organization\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`user\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`warehouse\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`changelog\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_github_repository\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` ADD \`archivedAt\` datetime NULL` + ); + await queryRunner.query(`ALTER TABLE \`proposal\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`job_search_occupation\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`job_search_category\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD \`archivedAt\` datetime NULL` + ); + await queryRunner.query(`ALTER TABLE \`job_preset\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD \`archivedAt\` datetime NULL` + ); + await queryRunner.query(`ALTER TABLE \`knowledge_base\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`product_review\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query( + `CREATE INDEX \`IDX_5d74a3f25e6acfb6caec05ec65\` ON \`accounting_template\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_e0c6443e0d2d5630067bc10ccf\` ON \`appointment_employee\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_829e02292a572f25476c4e426c\` ON \`approval_policy\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ada776a231239b8e99f78bf64\` ON \`availability_slot\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_c323aa830e10a871854d0a0408\` ON \`social_account\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_75bd5526e43c8801085225ffa9\` ON \`candidate_criterion_rating\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_4985a92870282574f6fec8dd98\` ON \`candidate_document\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_745780f5553e56a3ca19bccf86\` ON \`candidate_education\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_bb09aa3130d0e54007a98523c5\` ON \`candidate_experience\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_89ff7e0a8c37fdf7770b753776\` ON \`candidate_feedback\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_09f72a1a309aae91e0cd83949a\` ON \`candidate_interview\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_54b281d06e1a4e7e6ff640dab4\` ON \`candidate_interviewer\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_fa411cb89c9c6848d192d7f2e6\` ON \`candidate_personal_quality\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f651e72ab42727f28c29441f1b\` ON \`candidate_skill\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_df0a9a4b6ae0e3cab9c4f35436\` ON \`candidate_source\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_5cb080756923318f19f1d2eabe\` ON \`candidate_technology\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_ac765cfc390ec77d765dd48b61\` ON \`candidate\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_67a4423093e3c311cb76275659\` ON \`contact\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_711fd0159178a0102abc4db336\` ON \`country\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_e99bb270f0fa89ea715a457d29\` ON \`currency\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_36106478339961c8a17674a031\` ON \`custom_smtp\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_284658fe519bca6048fd73ff72\` ON \`deal\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_753f4b022ec98a0c8f38b370c0\` ON \`email_sent\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_35ac91a92c521b68277e780e6e\` ON \`email_reset\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_ce96229ae8d1d1af61348730da\` ON \`email_template\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_e69d60f1adcded4445095c4787\` ON \`employee_appointment\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_cee87c9b8743f0e81db8152f68\` ON \`employee_award\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_9dff154a1be222c66c179ad14b\` ON \`employee_level\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_08e391262cb3d4fbe9db97ecf8\` ON \`employee_phone\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_185b880550575c61d4212896e2\` ON \`employee_recurring_expense\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a8e048dfb4d618068376407c86\` ON \`employee_setting\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_c17e703a7008f6b9c2770a5cba\` ON \`employee\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_0c5508f4c86446f84d609e3b76\` ON \`equipment_sharing_policy\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_21bb7aec28dbb12ebc58a41d02\` ON \`equipment_sharing\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_7ed01d2a28f6cc9acb72c5fcf8\` ON \`equipment\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_c029854e57e273cb30445e6417\` ON \`estimate_email\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_e261b3b6ed4c6e79901fb3e1bc\` ON \`event_type\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_0edbfb90f0bc4c28eb57892900\` ON \`expense_category\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_6620af16ccd56e7e52b6ad914d\` ON \`expense\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_ca5fc2af0a26e454779d014a6a\` ON \`import-history\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_b1669a96371cbdb8fd8d4724d6\` ON \`import-record\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_c795b7a18f1213b980bcc91ffe\` ON \`feature_organization\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_3c0aa9d1eabc26757fbddc2bb9\` ON \`feature\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_03dbd727034c431934185d1d6f\` ON \`goal_general_setting\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_84a5a399408725b9c8612767e0\` ON \`goal_kpi_template\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_dae34450bed722e897370e2aec\` ON \`goal_kpi\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_25e0f8060ed921994873391253\` ON \`goal_template\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_cc3487eb32dd8baa86a8043540\` ON \`goal_time_frame\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_265b5cbc3e414bb3bb2facbb22\` ON \`goal\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_2a8cd17a33093bb6afed97e9d3\` ON \`image_asset\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_263e874cebea17ad3f2ba39e11\` ON \`income\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_2a9f9f6fa9064b328e277063a1\` ON \`integration_entity_setting_tied\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_5053bf22f9e0a5e9e8df7850da\` ON \`integration_entity_setting\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_3907c6f563fc45d824558d239d\` ON \`integration_map\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_02f667ad727ca0975d5022e695\` ON \`integration_setting\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_b6654519fbad729cdb490069be\` ON \`integration_tenant\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_842e81def8eef9f71a97496ff1\` ON \`integration_type\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_90aec772805c7fd508d71bedfe\` ON \`integration\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_00a3c849694b6f8be7b193c888\` ON \`invite\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_599de8ec6ea69550c6d49c4ae1\` ON \`invoice_estimate_history\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_457cbab434fc9a031f03eb6211\` ON \`invoice_item\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_40ee7b28c0ea835534a93b54bf\` ON \`invoice\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_04b8ef5663b40baa58e1b65160\` ON \`key_result_template\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_c5df67196c2aca0a7fb6ffd274\` ON \`key_result_update\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_30bf8575f0744aa3b68b611985\` ON \`key_result\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_745828269219870069b3b46a7f\` ON \`language\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_ebff440aec581d4893ad743c7e\` ON \`merchant\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_20aebc4219b9f9196f5ca2344d\` ON \`organization_award\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_cdf46b38fd75cd7baebce81cc6\` ON \`organization_contact\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_8cf81262c7cddfcf3fedcbc106\` ON \`organization_department\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_bf9a2edebcda9ac2c59e4439cb\` ON \`organization_document\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_8a11abe644b2cb5810bb65c8f9\` ON \`organization_employment_type\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_94330f9121dd1e72fe31fdb3c5\` ON \`organization_language\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1bff92d7a3b4b1f1a0e62a5122\` ON \`organization_position\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_fdd58e4f13a3f4a92c70bcdb30\` ON \`organization_project\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\` (\`status\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\` (\`managerId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\` (\`defaultAssigneeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_21510dbb86b763f55a8bf4ec93\` ON \`organization_project_module\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_636a95bda1eaf9fab00849dec2\` ON \`organization_recurring_expense\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_cbb3f1eb241abc47103df48f83\` ON \`organization_sprint\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_60683da6db3f64a0767d40b291\` ON \`organization_task_setting\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_d109b8470a4cf2662bec0a672b\` ON \`organization_team_employee\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_5deae148453dfaf555b24d151f\` ON \`organization_team_join_request\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_af48bbfa76f6261a5520e5e90f\` ON \`organization_team\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6c41095093c47ac91434a1bdf9\` ON \`organization_vendor\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_3c5fdf6c34ed7a20fae6c9ae94\` ON \`organization\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_7f8ba01a73690cbabe6c6ab93c\` ON \`password_reset\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_523b77d9dcbace8377fbca05ae\` ON \`payment\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_c5075efc6dab483721af36616f\` ON \`pipeline_stage\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_8b0d255d8f0ec4ca22e36249a8\` ON \`pipeline\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_2dce278beac80aebe7e179d7c9\` ON \`product_category_translation\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_89d6d92ce60b7b6de00449b30d\` ON \`product_category\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_e69de0d6c91d71407822a95bc9\` ON \`product_option_group\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_fdca637f69b879c6e95525a01f\` ON \`product_option_group_translation\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_eed2b389448b96ec1118ca38ef\` ON \`product_option_translation\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_41bff03b05f43a4e22e54cb83e\` ON \`product_option\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_18a46a61494103f9db1c42285d\` ON \`product_variant_setting\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_7c3776ae0d403baebc8a9387d8\` ON \`product_type_translation\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_577cfbbd0e9dedad955108df36\` ON \`product_type\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_3041f4d50857a4bc37dd72f233\` ON \`product_variant_price\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_0eb547a970dfecff424eb2098b\` ON \`product_variant\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_98c2019d4a108469e30b265972\` ON \`product\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_12de5ef2de583b2e92a1dfee3d\` ON \`product_translation\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_0ad88d687468141532bef9cc5e\` ON \`report_category\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_3619176cb8845c5c03803caf9d\` ON \`report_organization\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_5a453f466165d928a495e158ac\` ON \`report\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_f6c789158e91e7a6242174aaae\` ON \`request_approval_employee\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1c02d6337074841598e6952fed\` ON \`request_approval_team\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_aac7b3092d5d02d80deb5808b3\` ON \`request_approval\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_8cdc64dbd7f2ed3f8850bd2592\` ON \`role_permission\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_6c388c8d50b4238ab077fdc800\` ON \`role\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_0d379f40301224bfa5043dc7cc\` ON \`skill\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_1ddd19850ad49f4e61ad727018\` ON \`tag\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_1255e02d6dddd4e09a5ddb10d4\` ON \`daily_plan\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_da2990e3e7d2047d950ab8edea\` ON \`task_estimation\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_2ff61d100d00793724c099b86c\` ON \`issue_type\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_93bb4c9fb014dda0d984e9060a\` ON \`task\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_024d5a6727f6f4804d8cecfe32\` ON \`task_linked_issues\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f9fdc26bc564bf9f7963489f23\` ON \`task_priority\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_d1689daf93e2cb6029a9ff96d2\` ON \`task_related_issue_type\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_c364d9cb885e274666950b1afc\` ON \`task_size\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_259cb3e6d0d59edad2798b0ac3\` ON \`task_status\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_526e175838190ccc3c350df01a\` ON \`task_version\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_6e8dc5c9992499a05248237e58\` ON \`tenant_setting\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_10ede978ae7c1b67755932eac6\` ON \`tenant\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_21aa702abacf7dabe11da12818\` ON \`time_off_policy\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a5c6d8b62974fb9e4161e09499\` ON \`time_off_request\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_83df5ca85dae51ff9341e47785\` ON \`activity\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_afad5ae421b31768c4232f7224\` ON \`screenshot\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_2cbd790171893d994992116f19\` ON \`time_log\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_b520b83e91a6d3c8ef33675efe\` ON \`time_slot\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_bb9f95f639ced2a5b71395169e\` ON \`time_slot_minute\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_43f3709ff2b8dcc90c1809b023\` ON \`timesheet\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_6f87e00eb9e37242f01e6e5566\` ON \`user_organization\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_e49cb4b6b256bd4a5edab1e4dd\` ON \`user\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_fa9bdc44b90c4f32e658938a2d\` ON \`warehouse_product\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_21bba7ad2249260cc9d0022af9\` ON \`warehouse_product_variant\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_66abaca4fc9c367203403310aa\` ON \`warehouse\` (\`archivedAt\`)`); + await queryRunner.query(`CREATE INDEX \`IDX_888ffe5a395d1cf7afb001dc3a\` ON \`changelog\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_55dbb0b04712921d3c5dd7664e\` ON \`organization_github_repository\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_290ccd540d1e1f450c408539a1\` ON \`organization_github_repository_issue\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_811cc78a6e4df2ae75d237e40e\` ON \`proposal\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_6b73b978dcd27856a83df0d23c\` ON \`employee_proposal_template\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_551be2742a129d5d8ff461e9fe\` ON \`job_search_occupation\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_4b69eac7a9f1b9e93eebe3a850\` ON \`job_search_category\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_0d66c27013f4c34b339738f210\` ON \`employee_upwork_job_search_criterion\` (\`archivedAt\`)` + ); + await queryRunner.query(`CREATE INDEX \`IDX_c271c2698e24de252f1fd148f0\` ON \`job_preset\` (\`archivedAt\`)`); + await queryRunner.query( + `CREATE INDEX \`IDX_84a641af24ce125f296142216b\` ON \`job_preset_upwork_job_search_criterion\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_407463aef81b89c8bc5943ac8a\` ON \`knowledge_base\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_bd8360d2c539ae6b351129c86d\` ON \`knowledge_base_article\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_eb418dd0f3234df01222bcf438\` ON \`knowledge_base_author\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_c94775caea731394d690d67db1\` ON \`product_review\` (\`archivedAt\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_05edb214d298384f9f918d6b5d2\` FOREIGN KEY (\`managerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_489012234f53089d4b508f4aa12\` FOREIGN KEY (\`defaultAssigneeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } /** * MySQL Down Migration * * @param queryRunner */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_489012234f53089d4b508f4aa12\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_05edb214d298384f9f918d6b5d2\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_c94775caea731394d690d67db1\` ON \`product_review\``); + await queryRunner.query(`DROP INDEX \`IDX_eb418dd0f3234df01222bcf438\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_bd8360d2c539ae6b351129c86d\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_407463aef81b89c8bc5943ac8a\` ON \`knowledge_base\``); + await queryRunner.query( + `DROP INDEX \`IDX_84a641af24ce125f296142216b\` ON \`job_preset_upwork_job_search_criterion\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_c271c2698e24de252f1fd148f0\` ON \`job_preset\``); + await queryRunner.query( + `DROP INDEX \`IDX_0d66c27013f4c34b339738f210\` ON \`employee_upwork_job_search_criterion\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_4b69eac7a9f1b9e93eebe3a850\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_551be2742a129d5d8ff461e9fe\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_6b73b978dcd27856a83df0d23c\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_811cc78a6e4df2ae75d237e40e\` ON \`proposal\``); + await queryRunner.query( + `DROP INDEX \`IDX_290ccd540d1e1f450c408539a1\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_55dbb0b04712921d3c5dd7664e\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_888ffe5a395d1cf7afb001dc3a\` ON \`changelog\``); + await queryRunner.query(`DROP INDEX \`IDX_66abaca4fc9c367203403310aa\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_21bba7ad2249260cc9d0022af9\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_fa9bdc44b90c4f32e658938a2d\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_e49cb4b6b256bd4a5edab1e4dd\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_6f87e00eb9e37242f01e6e5566\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_43f3709ff2b8dcc90c1809b023\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_bb9f95f639ced2a5b71395169e\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_b520b83e91a6d3c8ef33675efe\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_2cbd790171893d994992116f19\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_afad5ae421b31768c4232f7224\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_83df5ca85dae51ff9341e47785\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_a5c6d8b62974fb9e4161e09499\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_21aa702abacf7dabe11da12818\` ON \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_10ede978ae7c1b67755932eac6\` ON \`tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_6e8dc5c9992499a05248237e58\` ON \`tenant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_526e175838190ccc3c350df01a\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_259cb3e6d0d59edad2798b0ac3\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_c364d9cb885e274666950b1afc\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_d1689daf93e2cb6029a9ff96d2\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_f9fdc26bc564bf9f7963489f23\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_024d5a6727f6f4804d8cecfe32\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_93bb4c9fb014dda0d984e9060a\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_2ff61d100d00793724c099b86c\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_da2990e3e7d2047d950ab8edea\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_1255e02d6dddd4e09a5ddb10d4\` ON \`daily_plan\``); + await queryRunner.query(`DROP INDEX \`IDX_1ddd19850ad49f4e61ad727018\` ON \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_0d379f40301224bfa5043dc7cc\` ON \`skill\``); + await queryRunner.query(`DROP INDEX \`IDX_6c388c8d50b4238ab077fdc800\` ON \`role\``); + await queryRunner.query(`DROP INDEX \`IDX_8cdc64dbd7f2ed3f8850bd2592\` ON \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_aac7b3092d5d02d80deb5808b3\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_1c02d6337074841598e6952fed\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_f6c789158e91e7a6242174aaae\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_5a453f466165d928a495e158ac\` ON \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_3619176cb8845c5c03803caf9d\` ON \`report_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_0ad88d687468141532bef9cc5e\` ON \`report_category\``); + await queryRunner.query(`DROP INDEX \`IDX_12de5ef2de583b2e92a1dfee3d\` ON \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_98c2019d4a108469e30b265972\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_0eb547a970dfecff424eb2098b\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_3041f4d50857a4bc37dd72f233\` ON \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_577cfbbd0e9dedad955108df36\` ON \`product_type\``); + await queryRunner.query(`DROP INDEX \`IDX_7c3776ae0d403baebc8a9387d8\` ON \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_18a46a61494103f9db1c42285d\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_41bff03b05f43a4e22e54cb83e\` ON \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_eed2b389448b96ec1118ca38ef\` ON \`product_option_translation\``); + await queryRunner.query( + `DROP INDEX \`IDX_fdca637f69b879c6e95525a01f\` ON \`product_option_group_translation\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_e69de0d6c91d71407822a95bc9\` ON \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_89d6d92ce60b7b6de00449b30d\` ON \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_2dce278beac80aebe7e179d7c9\` ON \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_8b0d255d8f0ec4ca22e36249a8\` ON \`pipeline\``); + await queryRunner.query(`DROP INDEX \`IDX_c5075efc6dab483721af36616f\` ON \`pipeline_stage\``); + await queryRunner.query(`DROP INDEX \`IDX_523b77d9dcbace8377fbca05ae\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_7f8ba01a73690cbabe6c6ab93c\` ON \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_3c5fdf6c34ed7a20fae6c9ae94\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_6c41095093c47ac91434a1bdf9\` ON \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_af48bbfa76f6261a5520e5e90f\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_5deae148453dfaf555b24d151f\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_d109b8470a4cf2662bec0a672b\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_60683da6db3f64a0767d40b291\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_cbb3f1eb241abc47103df48f83\` ON \`organization_sprint\``); + await queryRunner.query(`DROP INDEX \`IDX_636a95bda1eaf9fab00849dec2\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_21510dbb86b763f55a8bf4ec93\` ON \`organization_project_module\``); + await queryRunner.query(`DROP INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_fdd58e4f13a3f4a92c70bcdb30\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_1bff92d7a3b4b1f1a0e62a5122\` ON \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_94330f9121dd1e72fe31fdb3c5\` ON \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_8a11abe644b2cb5810bb65c8f9\` ON \`organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_bf9a2edebcda9ac2c59e4439cb\` ON \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_8cf81262c7cddfcf3fedcbc106\` ON \`organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_cdf46b38fd75cd7baebce81cc6\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_20aebc4219b9f9196f5ca2344d\` ON \`organization_award\``); + await queryRunner.query(`DROP INDEX \`IDX_ebff440aec581d4893ad743c7e\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_745828269219870069b3b46a7f\` ON \`language\``); + await queryRunner.query(`DROP INDEX \`IDX_30bf8575f0744aa3b68b611985\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_c5df67196c2aca0a7fb6ffd274\` ON \`key_result_update\``); + await queryRunner.query(`DROP INDEX \`IDX_04b8ef5663b40baa58e1b65160\` ON \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_40ee7b28c0ea835534a93b54bf\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_457cbab434fc9a031f03eb6211\` ON \`invoice_item\``); + await queryRunner.query(`DROP INDEX \`IDX_599de8ec6ea69550c6d49c4ae1\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_00a3c849694b6f8be7b193c888\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_90aec772805c7fd508d71bedfe\` ON \`integration\``); + await queryRunner.query(`DROP INDEX \`IDX_842e81def8eef9f71a97496ff1\` ON \`integration_type\``); + await queryRunner.query(`DROP INDEX \`IDX_b6654519fbad729cdb490069be\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_02f667ad727ca0975d5022e695\` ON \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_3907c6f563fc45d824558d239d\` ON \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_5053bf22f9e0a5e9e8df7850da\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_2a9f9f6fa9064b328e277063a1\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_263e874cebea17ad3f2ba39e11\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_2a8cd17a33093bb6afed97e9d3\` ON \`image_asset\``); + await queryRunner.query(`DROP INDEX \`IDX_265b5cbc3e414bb3bb2facbb22\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_cc3487eb32dd8baa86a8043540\` ON \`goal_time_frame\``); + await queryRunner.query(`DROP INDEX \`IDX_25e0f8060ed921994873391253\` ON \`goal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_dae34450bed722e897370e2aec\` ON \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_84a5a399408725b9c8612767e0\` ON \`goal_kpi_template\``); + await queryRunner.query(`DROP INDEX \`IDX_03dbd727034c431934185d1d6f\` ON \`goal_general_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_3c0aa9d1eabc26757fbddc2bb9\` ON \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_c795b7a18f1213b980bcc91ffe\` ON \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_b1669a96371cbdb8fd8d4724d6\` ON \`import-record\``); + await queryRunner.query(`DROP INDEX \`IDX_ca5fc2af0a26e454779d014a6a\` ON \`import-history\``); + await queryRunner.query(`DROP INDEX \`IDX_6620af16ccd56e7e52b6ad914d\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_0edbfb90f0bc4c28eb57892900\` ON \`expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_e261b3b6ed4c6e79901fb3e1bc\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_c029854e57e273cb30445e6417\` ON \`estimate_email\``); + await queryRunner.query(`DROP INDEX \`IDX_7ed01d2a28f6cc9acb72c5fcf8\` ON \`equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_21bb7aec28dbb12ebc58a41d02\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_0c5508f4c86446f84d609e3b76\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_c17e703a7008f6b9c2770a5cba\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a8e048dfb4d618068376407c86\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_185b880550575c61d4212896e2\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_08e391262cb3d4fbe9db97ecf8\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_9dff154a1be222c66c179ad14b\` ON \`employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_cee87c9b8743f0e81db8152f68\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_e69d60f1adcded4445095c4787\` ON \`employee_appointment\``); + await queryRunner.query(`DROP INDEX \`IDX_ce96229ae8d1d1af61348730da\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_35ac91a92c521b68277e780e6e\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_753f4b022ec98a0c8f38b370c0\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_284658fe519bca6048fd73ff72\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_36106478339961c8a17674a031\` ON \`custom_smtp\``); + await queryRunner.query(`DROP INDEX \`IDX_e99bb270f0fa89ea715a457d29\` ON \`currency\``); + await queryRunner.query(`DROP INDEX \`IDX_711fd0159178a0102abc4db336\` ON \`country\``); + await queryRunner.query(`DROP INDEX \`IDX_67a4423093e3c311cb76275659\` ON \`contact\``); + await queryRunner.query(`DROP INDEX \`IDX_ac765cfc390ec77d765dd48b61\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_5cb080756923318f19f1d2eabe\` ON \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_df0a9a4b6ae0e3cab9c4f35436\` ON \`candidate_source\``); + await queryRunner.query(`DROP INDEX \`IDX_f651e72ab42727f28c29441f1b\` ON \`candidate_skill\``); + await queryRunner.query(`DROP INDEX \`IDX_fa411cb89c9c6848d192d7f2e6\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_54b281d06e1a4e7e6ff640dab4\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_09f72a1a309aae91e0cd83949a\` ON \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`IDX_89ff7e0a8c37fdf7770b753776\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_bb09aa3130d0e54007a98523c5\` ON \`candidate_experience\``); + await queryRunner.query(`DROP INDEX \`IDX_745780f5553e56a3ca19bccf86\` ON \`candidate_education\``); + await queryRunner.query(`DROP INDEX \`IDX_4985a92870282574f6fec8dd98\` ON \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_75bd5526e43c8801085225ffa9\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_c323aa830e10a871854d0a0408\` ON \`social_account\``); + await queryRunner.query(`DROP INDEX \`IDX_2ada776a231239b8e99f78bf64\` ON \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_829e02292a572f25476c4e426c\` ON \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_e0c6443e0d2d5630067bc10ccf\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_5d74a3f25e6acfb6caec05ec65\` ON \`accounting_template\``); + await queryRunner.query(`ALTER TABLE \`product_review\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`job_preset\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`job_search_category\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`job_search_occupation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`proposal\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_github_repository\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`changelog\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`warehouse\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`user\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`user_organization\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`timesheet\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`time_slot\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`screenshot\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`tenant\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`tenant_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_version\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_status\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_size\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_priority\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`daily_plan\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`tag\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`skill\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`role\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`role_permission\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`request_approval\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`report\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`report_organization\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`report_category\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_translation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_variant_price\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_type_translation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_variant_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_option\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_option_translation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_option_group\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_category\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`product_category_translation\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`pipeline\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`password_reset\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_vendor\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_team\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_sprint\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_module\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`defaultAssigneeId\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`managerId\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`closeTasksIn\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archiveTasksIn\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`icon\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`status\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_position\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_language\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_employment_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_document\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_department\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_award\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`merchant\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`language\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`key_result_update\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`invoice\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`invite\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_tenant\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_map\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`income\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`image_asset\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal_template\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`goal_general_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`feature\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`feature_organization\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`import-record\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`import-history\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`expense_category\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`event_type\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`equipment\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_level\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_award\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`employee_appointment\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`email_template\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`email_reset\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`email_sent\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`currency\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`country\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`contact\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_technology\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_interview\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_experience\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_education\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_document\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`social_account\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`availability_slot\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`accounting_template\` DROP COLUMN \`archivedAt\``); + } } From 541bbb2c9dc03fc0ca3896ae48e8039c0c8ce7c0 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 16:50:16 +0200 Subject: [PATCH 06/47] feat: refact project employee relations and APIs --- packages/contracts/src/employee.model.ts | 1 - .../src/organization-projects.model.ts | 15 ++- packages/core/src/core/entities/index.ts | 2 + packages/core/src/core/entities/internal.ts | 1 + packages/core/src/employee/employee.entity.ts | 9 -- .../organization-project-employee.entity.ts | 72 +++++++++++ .../organization-project.entity.ts | 23 ---- .../organization-project.module.ts | 21 ++- .../organization-project.service.ts | 120 ++++++++++++++++-- .../organization-project/repository/index.ts | 2 + ...rganization-project-employee.repository.ts | 4 + ...rganization-project-employee.repository.ts | 13 ++ 12 files changed, 231 insertions(+), 52 deletions(-) create mode 100644 packages/core/src/organization-project/organization-project-employee.entity.ts create mode 100644 packages/core/src/organization-project/repository/mikro-orm-organization-project-employee.repository.ts create mode 100644 packages/core/src/organization-project/repository/type-orm-organization-project-employee.repository.ts diff --git a/packages/contracts/src/employee.model.ts b/packages/contracts/src/employee.model.ts index 1d38dbb21b3..678713a6c1c 100644 --- a/packages/contracts/src/employee.model.ts +++ b/packages/contracts/src/employee.model.ts @@ -57,7 +57,6 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel { organizationDepartments?: IOrganizationDepartment[]; organizationContacts?: IOrganizationContact[]; projects?: IOrganizationProject[]; - managedProjects?: IOrganizationProject[]; projectDefaultAssignments?: IOrganizationProject[]; organizationPosition?: IOrganizationPosition; tags?: ITag[]; diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index 8e484a5ff4f..d4c66005feb 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -1,4 +1,4 @@ -import { IEmployee } from './employee.model'; +import { IEmployee, IRelationalEmployee } from './employee.model'; import { IOrganizationContact, IRelationalOrganizationContact } from './organization-contact.model'; import { CrudActionEnum, ProjectBillingEnum, ProjectOwnerEnum } from './organization.model'; import { ITag } from './tag.model'; @@ -13,6 +13,7 @@ import { IOrganizationTeam } from './organization-team.model'; import { CustomFieldsObject } from './shared-types'; import { IOrganizationProjectModule } from './organization-project-module.model'; import { TaskStatusEnum } from './task-status.model'; +import { IRelationalRole } from './role.model'; export interface IRelationalOrganizationProject { project?: IOrganizationProject; @@ -65,9 +66,6 @@ export interface IOrganizationProject budgetType?: OrganizationProjectBudgetTypeEnum; membersCount?: number; imageUrl?: string; - // Project manager - manager?: IEmployee; - managerId?: ID; // Default project assignee defaultAssignee?: IEmployee; defaultAssigneeId?: ID; @@ -107,6 +105,7 @@ export interface IOrganizationProjectCreateInput billing?: ProjectBillingEnum; currency?: CurrenciesEnum; members?: IEmployee[]; + managers?: IOrganizationProjectEmployee[]; public?: boolean; icon?: string; tags?: ITag[]; @@ -121,8 +120,6 @@ export interface IOrganizationProjectCreateInput projectUrl?: string; openSourceProjectUrl?: string; taskListType?: TaskListTypeEnum; - manager?: IEmployee; - managerId?: ID; defaultAssignee?: IEmployee; defaultAssigneeId?: ID; archiveTasksIn?: number; @@ -137,3 +134,9 @@ export interface IOrganizationProjectStoreState { project: IOrganizationProject; action: CrudActionEnum; } + +export interface IOrganizationProjectEmployee + extends IBasePerTenantAndOrganizationEntityModel, + IRelationalOrganizationProject, + IRelationalEmployee, + IRelationalRole {} diff --git a/packages/core/src/core/entities/index.ts b/packages/core/src/core/entities/index.ts index dc83a1d0b40..c522077dfde 100644 --- a/packages/core/src/core/entities/index.ts +++ b/packages/core/src/core/entities/index.ts @@ -77,6 +77,7 @@ import { OrganizationLanguage, OrganizationPosition, OrganizationProject, + OrganizationProjectEmployee, OrganizationProjectModule, OrganizationRecurringExpense, OrganizationSprint, @@ -216,6 +217,7 @@ export const coreEntities = [ OrganizationLanguage, OrganizationPosition, OrganizationProject, + OrganizationProjectEmployee, OrganizationProjectModule, OrganizationRecurringExpense, OrganizationSprint, diff --git a/packages/core/src/core/entities/internal.ts b/packages/core/src/core/entities/internal.ts index 467077d8fde..959eeb1fd0e 100644 --- a/packages/core/src/core/entities/internal.ts +++ b/packages/core/src/core/entities/internal.ts @@ -80,6 +80,7 @@ export * from '../../organization-employment-type/organization-employment-type.e export * from '../../organization-language/organization-language.entity'; export * from '../../organization-position/organization-position.entity'; export * from '../../organization-project/organization-project.entity'; +export * from '../../organization-project/organization-project-employee.entity'; export * from '../../organization-project-module/organization-project-module.entity'; export * from '../../organization-recurring-expense/organization-recurring-expense.entity'; export * from '../../organization-sprint/organization-sprint.entity'; diff --git a/packages/core/src/employee/employee.entity.ts b/packages/core/src/employee/employee.entity.ts index 5cf6ef317d9..fcbc708c4da 100644 --- a/packages/core/src/employee/employee.entity.ts +++ b/packages/core/src/employee/employee.entity.ts @@ -526,15 +526,6 @@ export class Employee extends TenantOrganizationBaseEntity implements IEmployee, }) dailyPlans?: IDailyPlan[]; - /** - * Managed projects - */ - @ApiPropertyOptional({ type: () => OrganizationProject, isArray: true }) - @MultiORMOneToMany(() => OrganizationProject, (project) => project.manager, { - cascade: true - }) - managedProjects?: IOrganizationProject[]; - /** * Projects for whom employee is default assigned */ diff --git a/packages/core/src/organization-project/organization-project-employee.entity.ts b/packages/core/src/organization-project/organization-project-employee.entity.ts new file mode 100644 index 00000000000..d71ba30d7ea --- /dev/null +++ b/packages/core/src/organization-project/organization-project-employee.entity.ts @@ -0,0 +1,72 @@ +import { RelationId } from 'typeorm'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsNotEmpty, IsOptional, IsUUID } from 'class-validator'; +import { ID, IEmployee, IOrganizationProjectEmployee, IRole } from '@gauzy/contracts'; +import { Employee, OrganizationProject, Role, TenantOrganizationBaseEntity } from '../core/entities/internal'; +import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToOne } from './../core/decorators/entity'; +import { MikroOrmOrganizationProjectEmployeeRepository } from './repository/mikro-orm-organization-project-employee.repository'; + +@MultiORMEntity('organization_project_employee', { + mikroOrmRepository: () => MikroOrmOrganizationProjectEmployeeRepository +}) +export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity implements IOrganizationProjectEmployee { + /* + |-------------------------------------------------------------------------- + | @ManyToOne + |-------------------------------------------------------------------------- + */ + + /** + * OrganizationProject + */ + @MultiORMManyToOne(() => OrganizationProject, (it) => it.members, { + /** Database cascade action on delete. */ + onDelete: 'CASCADE' + }) + organizationProject!: IOrganizationProjectEmployee; + + @ApiProperty({ type: () => String }) + @IsNotEmpty() + @IsUUID() + @RelationId((it: OrganizationProjectEmployee) => it.organizationProject) + @ColumnIndex() + @MultiORMColumn({ relationId: true }) + organizationProjectId: ID; + + /** + * Employee + */ + @MultiORMManyToOne(() => Employee, (it) => it.projects, { + /** Database cascade action on delete. */ + onDelete: 'CASCADE' + }) + employee: IEmployee; + + @ApiProperty({ type: () => String }) + @IsNotEmpty() + @IsUUID() + @RelationId((it: OrganizationProjectEmployee) => it.employee) + @ColumnIndex() + @MultiORMColumn({ relationId: true }) + employeeId: ID; + + /** + * Role + */ + @MultiORMManyToOne(() => Role, { + /** Indicates if relation column value can be nullable or not. */ + nullable: true, + + /** Database cascade action on delete. */ + onDelete: 'CASCADE' + }) + role?: IRole; + + @ApiPropertyOptional({ type: () => String }) + @IsOptional() + @IsUUID() + @RelationId((it: OrganizationProjectEmployee) => it.role) + @ColumnIndex() + @MultiORMColumn({ nullable: true, relationId: true }) + roleId?: ID; +} diff --git a/packages/core/src/organization-project/organization-project.entity.ts b/packages/core/src/organization-project/organization-project.entity.ts index 1e870d06498..76d8db383c8 100644 --- a/packages/core/src/organization-project/organization-project.entity.ts +++ b/packages/core/src/organization-project/organization-project.entity.ts @@ -246,29 +246,6 @@ export class OrganizationProject @MultiORMColumn({ nullable: true, relationId: true }) imageId?: ID; - /** - * Project Manager - */ - @ApiPropertyOptional({ type: () => Object }) - @IsOptional() - @IsObject() - @MultiORMManyToOne(() => Employee, (it) => it.managedProjects, { - /** Indicates if the relation column value can be nullable or not. */ - nullable: true, - - /** Defines the database cascade action on delete. */ - onDelete: 'CASCADE' - }) - manager?: IEmployee; - - @ApiPropertyOptional({ type: () => String }) - @IsOptional() - @IsUUID() - @RelationId((it: OrganizationProject) => it.manager) - @ColumnIndex() - @MultiORMColumn({ nullable: true, relationId: true }) - managerId?: ID; - /** * Project default member assignee */ diff --git a/packages/core/src/organization-project/organization-project.module.ts b/packages/core/src/organization-project/organization-project.module.ts index 1b4fad13f83..d16b738b868 100644 --- a/packages/core/src/organization-project/organization-project.module.ts +++ b/packages/core/src/organization-project/organization-project.module.ts @@ -1,14 +1,16 @@ import { CqrsModule } from '@nestjs/cqrs'; -import { forwardRef, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { RouterModule } from '@nestjs/core'; import { TypeOrmModule } from '@nestjs/typeorm'; import { MikroOrmModule } from '@mikro-orm/nestjs'; import { OrganizationProject } from './organization-project.entity'; +import { OrganizationProjectEmployee } from './organization-project-employee.entity'; import { OrganizationProjectController } from './organization-project.controller'; import { OrganizationProjectService } from './organization-project.service'; import { CommandHandlers } from './commands/handlers'; import { RolePermissionModule } from '../role-permission/role-permission.module'; import { TypeOrmOrganizationProjectRepository } from './repository/type-orm-organization-project.repository'; +import { TypeOrmOrganizationProjectEmployeeRepository } from './repository/type-orm-organization-project-employee.repository'; @Module({ imports: [ @@ -20,11 +22,24 @@ import { TypeOrmOrganizationProjectRepository } from './repository/type-orm-orga ]), TypeOrmModule.forFeature([OrganizationProject]), MikroOrmModule.forFeature([OrganizationProject]), + TypeOrmModule.forFeature([OrganizationProjectEmployee]), + MikroOrmModule.forFeature([OrganizationProjectEmployee]), RolePermissionModule, CqrsModule ], controllers: [OrganizationProjectController], - providers: [OrganizationProjectService, TypeOrmOrganizationProjectRepository, ...CommandHandlers], - exports: [TypeOrmModule, MikroOrmModule, OrganizationProjectService, TypeOrmOrganizationProjectRepository] + providers: [ + OrganizationProjectService, + TypeOrmOrganizationProjectRepository, + TypeOrmOrganizationProjectEmployeeRepository, + ...CommandHandlers + ], + exports: [ + TypeOrmModule, + MikroOrmModule, + OrganizationProjectService, + TypeOrmOrganizationProjectRepository, + TypeOrmOrganizationProjectEmployeeRepository + ] }) export class OrganizationProjectModule {} diff --git a/packages/core/src/organization-project/organization-project.service.ts b/packages/core/src/organization-project/organization-project.service.ts index e517279cf3e..fc3a221fade 100644 --- a/packages/core/src/organization-project/organization-project.service.ts +++ b/packages/core/src/organization-project/organization-project.service.ts @@ -1,30 +1,133 @@ -import { Injectable } from '@nestjs/common'; +import { BadRequestException, Injectable } from '@nestjs/common'; import { Brackets, In, IsNull, SelectQueryBuilder, WhereExpressionBuilder } from 'typeorm'; import { ID, - IEmployee, IOrganizationGithubRepository, IOrganizationProject, + IOrganizationProjectCreateInput, IOrganizationProjectsFindInput, - IPagination + IPagination, + RolesEnum } from '@gauzy/contracts'; import { getConfig } from '@gauzy/config'; import { CustomEmbeddedFieldConfig, isNotEmpty } from '@gauzy/common'; +import { Employee, OrganizationProjectEmployee } from '../core/entities/internal'; import { PaginationParams, TenantAwareCrudService } from '../core/crud'; import { RequestContext } from '../core/context'; +import { RoleService } from '../role/role.service'; import { OrganizationProject } from './organization-project.entity'; import { prepareSQLQuery as p } from './../database/database.helper'; -import { MikroOrmOrganizationProjectRepository, TypeOrmOrganizationProjectRepository } from './repository'; +import { TypeOrmEmployeeRepository } from '../employee/repository'; +import { + MikroOrmOrganizationProjectEmployeeRepository, + MikroOrmOrganizationProjectRepository, + TypeOrmOrganizationProjectEmployeeRepository, + TypeOrmOrganizationProjectRepository +} from './repository'; @Injectable() export class OrganizationProjectService extends TenantAwareCrudService { constructor( - typeOrmOrganizationProjectRepository: TypeOrmOrganizationProjectRepository, - mikroOrmOrganizationProjectRepository: MikroOrmOrganizationProjectRepository + readonly typeOrmOrganizationProjectRepository: TypeOrmOrganizationProjectRepository, + readonly mikroOrmOrganizationProjectRepository: MikroOrmOrganizationProjectRepository, + readonly typeOrmOrganizationProjectEmployeeRepository: TypeOrmOrganizationProjectEmployeeRepository, + readonly mikroOrmOrganizationProjectEmployeeRepository: MikroOrmOrganizationProjectEmployeeRepository, + private readonly typeOrmEmployeeRepository: TypeOrmEmployeeRepository, + private readonly roleService: RoleService ) { super(typeOrmOrganizationProjectRepository, mikroOrmOrganizationProjectRepository); } + /** + * Retrieves a collection of employees based on specified criteria. + * @param memberIds - Array of member IDs to include in the query. + * @param managerIds - Array of manager IDs to include in the query. + * @param organizationId - The organization ID for filtering. + * @param tenantId - The tenant ID for filtering. + * @returns A Promise resolving to an array of Employee entities with associated user information. + */ + async retrieveEmployees(memberIds: ID[], managerIds: ID[], organizationId: ID, tenantId: ID): Promise { + try { + // Filter out falsy values (e.g., null or undefined) from the union of memberIds and managerIds + const filteredIds = [...memberIds, ...managerIds].filter(Boolean); + + // Retrieve employees based on specified criteria + const employees = await this.typeOrmEmployeeRepository.findBy({ + id: In(filteredIds), // Filtering by employee IDs (union of memberIds and managerIds) + organizationId, // Filtering by organizationId + tenantId // Filtering by tenantId + }); + + return employees; + } catch (error) { + // Handle any potential errors during the retrieval process + throw new Error(`Failed to retrieve employees: ${error}`); + } + } + + /** + * Creates an organization project based on the provided input. + * @param input - Input data for creating the organization project. + * @returns A Promise resolving to the created organization project. + * @throws BadRequestException if there is an error in the creation process. + */ + async create(input: IOrganizationProjectCreateInput): Promise { + const { tags = [], members = [], managers = [], ...entity } = input; + const { organizationId } = entity; + try { + // Retrive members and managers IDs + const managerIds = managers.map((manager) => manager.id); + const memberIds = members.map((member) => member.id); + + const tenantId = RequestContext.currentTenantId(); + const employeeId = RequestContext.currentEmployeeId(); + const currentRoleId = RequestContext.currentRoleId(); + + // If, employee create project, default add as a manager + try { + // Check if the current role is EMPLOYEE + await this.roleService.findOneByIdString(currentRoleId, { + where: { name: RolesEnum.EMPLOYEE } + }); + // Check if the employeeId is not already included in the managerIds array + if (!managerIds.includes(employeeId)) { + // If not included, add the employeeId to the managerIds array + managerIds.push(employeeId); + } + } catch (error) {} + // Retrieves a collection of employees based on specified criteria. + const employees = await this.retrieveEmployees(memberIds, managerIds, organizationId, tenantId); + + // Find the manager role + const managerRole = await this.roleService.findOneByWhereOptions({ name: RolesEnum.MANAGER }); + + // Create a Set for faster membership checks + const managerIdsSet = new Set(managerIds); + + // Use destructuring to directly extract 'id' from 'employee' + const projectMembers = employees.map( + ({ id: employeeId }) => + new OrganizationProjectEmployee({ + employee: { id: employeeId }, + organization: { id: organizationId }, + tenant: { id: tenantId }, + role: managerIdsSet.has(employeeId) ? managerRole : null + }) + ); + + // Create the organization team with the prepared members + return await super.create({ + ...entity, + organization: { id: organizationId }, + tenant: { id: tenantId }, + tags, + members: projectMembers + }); + } catch (error) { + throw new BadRequestException(`Failed to create project: ${error}`); + } + } + /** * Find employee assigned projects * @@ -32,10 +135,7 @@ export class OrganizationProjectService extends TenantAwareCrudService { + async findByEmployee(employeeId: ID, options: IOrganizationProjectsFindInput): Promise { const query = this.typeOrmRepository.createQueryBuilder(this.tableName); query.setFindOptions({ select: { diff --git a/packages/core/src/organization-project/repository/index.ts b/packages/core/src/organization-project/repository/index.ts index b6fa20a5750..2117a5c113e 100644 --- a/packages/core/src/organization-project/repository/index.ts +++ b/packages/core/src/organization-project/repository/index.ts @@ -1,2 +1,4 @@ export * from './mikro-orm-organization-project.repository'; export * from './type-orm-organization-project.repository'; +export * from './mikro-orm-organization-project-employee.repository'; +export * from './type-orm-organization-project-employee.repository'; diff --git a/packages/core/src/organization-project/repository/mikro-orm-organization-project-employee.repository.ts b/packages/core/src/organization-project/repository/mikro-orm-organization-project-employee.repository.ts new file mode 100644 index 00000000000..e45d8232de0 --- /dev/null +++ b/packages/core/src/organization-project/repository/mikro-orm-organization-project-employee.repository.ts @@ -0,0 +1,4 @@ +import { MikroOrmBaseEntityRepository } from '../../core/repository/mikro-orm-base-entity.repository'; +import { OrganizationProjectEmployee } from '../organization-project-employee.entity'; + +export class MikroOrmOrganizationProjectEmployeeRepository extends MikroOrmBaseEntityRepository {} diff --git a/packages/core/src/organization-project/repository/type-orm-organization-project-employee.repository.ts b/packages/core/src/organization-project/repository/type-orm-organization-project-employee.repository.ts new file mode 100644 index 00000000000..64010bc7e63 --- /dev/null +++ b/packages/core/src/organization-project/repository/type-orm-organization-project-employee.repository.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { OrganizationProjectEmployee } from '../organization-project-employee.entity'; + +@Injectable() +export class TypeOrmOrganizationProjectEmployeeRepository extends Repository { + constructor( + @InjectRepository(OrganizationProjectEmployee) readonly repository: Repository + ) { + super(repository.target, repository.manager, repository.queryRunner); + } +} From b7afb62fa540f662dc27a77e6ac37f1c217bb92b Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 17:11:46 +0200 Subject: [PATCH 07/47] feat: update project API --- .../organization-project.service.ts | 166 +++++++++++++++++- 1 file changed, 164 insertions(+), 2 deletions(-) diff --git a/packages/core/src/organization-project/organization-project.service.ts b/packages/core/src/organization-project/organization-project.service.ts index fc3a221fade..e218da14b53 100644 --- a/packages/core/src/organization-project/organization-project.service.ts +++ b/packages/core/src/organization-project/organization-project.service.ts @@ -1,17 +1,20 @@ -import { BadRequestException, Injectable } from '@nestjs/common'; +import { BadRequestException, ForbiddenException, Injectable } from '@nestjs/common'; import { Brackets, In, IsNull, SelectQueryBuilder, WhereExpressionBuilder } from 'typeorm'; import { ID, + IEmployee, IOrganizationGithubRepository, IOrganizationProject, IOrganizationProjectCreateInput, IOrganizationProjectsFindInput, + IOrganizationProjectUpdateInput, IPagination, + PermissionsEnum, RolesEnum } from '@gauzy/contracts'; import { getConfig } from '@gauzy/config'; import { CustomEmbeddedFieldConfig, isNotEmpty } from '@gauzy/common'; -import { Employee, OrganizationProjectEmployee } from '../core/entities/internal'; +import { Employee, OrganizationProjectEmployee, Role } from '../core/entities/internal'; import { PaginationParams, TenantAwareCrudService } from '../core/crud'; import { RequestContext } from '../core/context'; import { RoleService } from '../role/role.service'; @@ -128,6 +131,165 @@ export class OrganizationProjectService extends TenantAwareCrudService { + const tenantId = RequestContext.currentTenantId() || input.tenantId; + const { managers, members, organizationId } = input; + + let organizationProject = await super.findOneByIdString(id, { + where: { organizationId, tenantId } + }); + + // Check permission for CHANGE_SELECTED_EMPLOYEE + if (!RequestContext.hasPermission(PermissionsEnum.CHANGE_SELECTED_EMPLOYEE)) { + try { + const employeeId = RequestContext.currentEmployeeId(); + // If employee ID is present, restrict update to manager role + if (employeeId) { + organizationProject = await super.findOneByIdString(id, { + where: { + organizationId, + tenantId, + members: { + employeeId, + tenantId, + organizationId, + role: { name: RolesEnum.MANAGER } + } + } + }); + } + } catch (error) { + throw new ForbiddenException(); + } + } + + try { + // Retrive members and managers IDs + const managerIds = managers.map((manager) => manager.id); + const memberIds = members.map((member) => member.id); + if (isNotEmpty(memberIds) || isNotEmpty(managerIds)) { + // Find the manager role + const role = await this.roleService.findOneByWhereOptions({ + name: RolesEnum.MANAGER + }); + + // Retrieves a collection of employees based on specified criteria. + const projectMembers = await this.retrieveEmployees(memberIds, managerIds, organizationId, tenantId); + + // Update nested entity + await this.updateOrganizationProject(id, organizationId, projectMembers, role, managerIds, memberIds); + } + + const { id: organizationProjectId } = organizationProject; + + // Update the organization project with the prepared members + return await super.create({ + ...input, + organizationId, + tenantId, + id: organizationProjectId + }); + } catch (error) { + throw new BadRequestException(error); + } + } + + /** + * Delete project members by IDs. + * + * @param memberIds - Array of member IDs to delete + * @returns A promise that resolves when all deletions are complete + */ + async deleteMemberByIds(memberIds: ID[]): Promise { + // Map member IDs to deletion promises + const deletePromises = memberIds.map((memberId: string) => + this.typeOrmOrganizationProjectEmployeeRepository.delete(memberId) + ); + + // Wait for all deletions to complete + await Promise.all(deletePromises); + } + + /** + * Update organization project by managing its members and their roles. + * + * @param organizationTeamId - ID of the organization project + * @param organizationId - ID of the organization + * @param employees - Array of employees to be assigned to the project + * @param role - The role to assign to managers in the project + * @param managerIds - Array of employee IDs to be assigned as managers + * @param memberIds - Array of employee IDs to be assigned as members + * @returns Promise + */ + async updateOrganizationProject( + organizationProjectId: ID, + organizationId: ID, + employees: IEmployee[], + role: Role, + managerIds: string[], + memberIds: string[] + ): Promise { + const tenantId = RequestContext.currentTenantId(); + const membersToUpdate = [...managerIds, ...memberIds]; + + // Fetch existing team members with their roles + const projectMembers = await this.typeOrmOrganizationProjectEmployeeRepository.find({ + where: { tenantId, organizationId, organizationProjectId }, + relations: { role: true } + }); + + // Create a map for fast lookup of current project members + const existingMemberMap = new Map(projectMembers.map((member) => [member.employeeId, member])); + + // Separate members to remove and to update + const removedMembers = projectMembers.filter((member) => !membersToUpdate.includes(member.employeeId)); + const updatedMembers = projectMembers.filter((member) => membersToUpdate.includes(member.employeeId)); + + // 1. Remove members who are no longer in the team + if (removedMembers.length > 0) { + const removedMemberIds = removedMembers.map((member) => member.id); + await this.deleteMemberByIds(removedMemberIds); + } + + // 2. Update role for existing members + for (const member of updatedMembers) { + const isManager = managerIds.includes(member.employeeId); + const newRole = isManager ? role : member.role?.id === role.id ? member.role : null; + + // Only update if the role is different + if (newRole && newRole.id !== member.roleId) { + await this.typeOrmOrganizationProjectEmployeeRepository.update(member.id, { role: newRole }); + } + } + + // 3. Add new members to the project + const newMembers = employees.filter((employee) => !existingMemberMap.has(employee.id)); + + if (newMembers.length > 0) { + const newTeamMembers = newMembers.map( + (employee) => + new OrganizationProjectEmployee({ + organizationProjectId, + employeeId: employee.id, + tenantId, + organizationId, + roleId: managerIds.includes(employee.id) ? role.id : null + }) + ); + + await this.typeOrmRepository.save(newTeamMembers); + } + } + /** * Find employee assigned projects * From f3efe50c9d7c12bc30766de7d6846f6b6c82bb62 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 17:22:50 +0200 Subject: [PATCH 08/47] fix: missing module injection --- .../src/organization-project/organization-project.module.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/organization-project/organization-project.module.ts b/packages/core/src/organization-project/organization-project.module.ts index d16b738b868..59de3dcb49d 100644 --- a/packages/core/src/organization-project/organization-project.module.ts +++ b/packages/core/src/organization-project/organization-project.module.ts @@ -9,6 +9,8 @@ import { OrganizationProjectController } from './organization-project.controller import { OrganizationProjectService } from './organization-project.service'; import { CommandHandlers } from './commands/handlers'; import { RolePermissionModule } from '../role-permission/role-permission.module'; +import { RoleModule } from './../role/role.module'; +import { EmployeeModule } from './../employee/employee.module'; import { TypeOrmOrganizationProjectRepository } from './repository/type-orm-organization-project.repository'; import { TypeOrmOrganizationProjectEmployeeRepository } from './repository/type-orm-organization-project-employee.repository'; @@ -24,6 +26,8 @@ import { TypeOrmOrganizationProjectEmployeeRepository } from './repository/type- MikroOrmModule.forFeature([OrganizationProject]), TypeOrmModule.forFeature([OrganizationProjectEmployee]), MikroOrmModule.forFeature([OrganizationProjectEmployee]), + RoleModule, + EmployeeModule, RolePermissionModule, CqrsModule ], From c9f2b68f33567122a0311c0489dc5aff13d3d66f Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Sun, 8 Sep 2024 18:30:51 +0200 Subject: [PATCH 09/47] feat: organization project migrations --- ...lterOrganizationProjectEmployeeRelation.ts | 707 ++++++++++++++++++ .../organization-project.service.ts | 4 +- 2 files changed, 709 insertions(+), 2 deletions(-) create mode 100644 packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts diff --git a/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts b/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts new file mode 100644 index 00000000000..ba88edc6419 --- /dev/null +++ b/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts @@ -0,0 +1,707 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AlterOrganizationProjectEmployeeRelation1725809437414 implements MigrationInterface { + name = 'AlterOrganizationProjectEmployeeRelation1725809437414'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_05edb214d298384f9f918d6b5d2"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_05edb214d298384f9f918d6b5d"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "managerId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("id", "employeeId")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "id", "organizationProjectId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_472eee165488bb8d0e7597e935"`); + await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "organizationId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "tenantId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isArchived"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "managerId" uuid`); + await queryRunner.query( + `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); // refers + + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_472eee165488bb8d0e7597e935"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_472eee165488bb8d0e7597e935"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + } + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_05edb214d298384f9f918d6b5d2\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`managerId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_472eee165488bb8d0e7597e935\` ON \`organization_project_employee\` (\`archivedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_472eee165488bb8d0e7597e935\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`managerId\` varchar(255) NULL`); + await queryRunner.query( + `CREATE INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\` (\`managerId\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_05edb214d298384f9f918d6b5d2\` FOREIGN KEY (\`managerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } +} diff --git a/packages/core/src/organization-project/organization-project.service.ts b/packages/core/src/organization-project/organization-project.service.ts index e218da14b53..74e913837be 100644 --- a/packages/core/src/organization-project/organization-project.service.ts +++ b/packages/core/src/organization-project/organization-project.service.ts @@ -78,7 +78,7 @@ export class OrganizationProjectService extends TenantAwareCrudService manager.id); const memberIds = members.map((member) => member.id); @@ -173,7 +173,7 @@ export class OrganizationProjectService extends TenantAwareCrudService manager.id); const memberIds = members.map((member) => member.id); if (isNotEmpty(memberIds) || isNotEmpty(managerIds)) { From 8bddfa9c52c1e922c71f69b379170d21d704fd31 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Mon, 9 Sep 2024 08:45:00 +0200 Subject: [PATCH 10/47] refact: postgres migration --- packages/contracts/src/base-entity.model.ts | 2 +- .../core/src/core/entities/base.entity.ts | 20 +- ...1-AlterOrganizationProjectAndBaseEntity.ts | 9791 ----------------- ...lterOrganizationProjectEmployeeRelation.ts | 707 -- ...ationProjectAndProjectEmployeeAddFields.ts | 275 + 5 files changed, 286 insertions(+), 10509 deletions(-) delete mode 100644 packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts delete mode 100644 packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts create mode 100644 packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts diff --git a/packages/contracts/src/base-entity.model.ts b/packages/contracts/src/base-entity.model.ts index f72fbcb872d..4393285b1b9 100644 --- a/packages/contracts/src/base-entity.model.ts +++ b/packages/contracts/src/base-entity.model.ts @@ -29,7 +29,7 @@ export interface IBaseEntityModel extends IBaseSoftDeleteEntityModel { isActive?: boolean; // Indicates if the record is currently active isArchived?: boolean; // Indicates if the record is archived - archivedAt?: Date; // Date when the record was archived + // archivedAt?: Date; // Date when the record was archived } // Common properties for entities associated with a tenant diff --git a/packages/core/src/core/entities/base.entity.ts b/packages/core/src/core/entities/base.entity.ts index 47b9344d0e7..43a2c90d5a1 100644 --- a/packages/core/src/core/entities/base.entity.ts +++ b/packages/core/src/core/entities/base.entity.ts @@ -107,14 +107,14 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas isArchived?: boolean; // Indicates the date when record was archived - @ApiPropertyOptional({ - type: 'string', - format: 'date-time', - example: '2018-11-21T06:20:32.232Z' - }) - @IsOptional() - @IsDateString() - @ColumnIndex() - @MultiORMColumn({ nullable: true }) - archivedAt?: Date; + // @ApiPropertyOptional({ + // type: 'string', + // format: 'date-time', + // example: '2018-11-21T06:20:32.232Z' + // }) + // @IsOptional() + // @IsDateString() + // @ColumnIndex() + // @MultiORMColumn({ nullable: true }) + // archivedAt?: Date; } diff --git a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts b/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts deleted file mode 100644 index 979d67dbd5e..00000000000 --- a/packages/core/src/database/migrations/1725775971501-AlterOrganizationProjectAndBaseEntity.ts +++ /dev/null @@ -1,9791 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { yellow } from 'chalk'; -import { DatabaseTypeEnum } from '@gauzy/config'; - -export class AlterOrganizationProjectAndBaseEntity1725775971501 implements MigrationInterface { - name = 'AlterOrganizationProjectAndBaseEntity1725775971501'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "accounting_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "appointment_employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "approval_policy" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "availability_slot" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "social_account" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_criterion_rating" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_document" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_education" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_experience" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_feedback" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_interview" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_interviewer" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_personal_quality" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_skill" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_source" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate_technology" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "candidate" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "contact" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "country" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "currency" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "custom_smtp" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "deal" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "email_sent" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "email_reset" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "email_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_appointment" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_award" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_level" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_phone" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_recurring_expense" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "equipment_sharing" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "equipment" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "estimate_email" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "event_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "expense_category" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "expense" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "import-history" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "import-record" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "feature_organization" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "feature" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal_general_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal_kpi_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal_kpi" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal_time_frame" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "goal" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "image_asset" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "income" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_entity_setting_tied" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_entity_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_map" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_tenant" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "integration" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "invite" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "invoice_estimate_history" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "invoice_item" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "invoice" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "key_result_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "key_result_update" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "key_result" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "language" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "merchant" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_award" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_contact" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_department" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_document" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_employment_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_language" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_position" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "status" character varying`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "icon" character varying`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "archiveTasksIn" numeric`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "closeTasksIn" numeric`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "managerId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "defaultAssigneeId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_module" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_recurring_expense" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_sprint" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_task_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_team_employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_team_join_request" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_team" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_vendor" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "password_reset" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "payment" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "pipeline_stage" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "pipeline" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_category_translation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_category" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_option_group" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_option_group_translation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_option_translation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_option" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_variant_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_type_translation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_variant_price" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_variant" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_translation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "report_category" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "report_organization" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "report" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "request_approval_employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "request_approval_team" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "request_approval" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "role_permission" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "role" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "skill" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "tag" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "daily_plan" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_estimation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "issue_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_linked_issues" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_priority" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_related_issue_type" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_size" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_status" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "task_version" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "tenant_setting" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "tenant" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "time_off_policy" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "time_off_request" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "activity" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "screenshot" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "time_log" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "time_slot" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "time_slot_minute" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "timesheet" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "user_organization" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "user" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "warehouse_product" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "warehouse_product_variant" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "warehouse" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "changelog" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_github_repository" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_github_repository_issue" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "proposal" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_proposal_template" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "job_search_occupation" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "job_search_category" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "employee_upwork_job_search_criterion" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "job_preset" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "job_preset_upwork_job_search_criterion" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "knowledge_base" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "knowledge_base_article" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "knowledge_base_author" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "product_review" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query( - `CREATE INDEX "IDX_5d74a3f25e6acfb6caec05ec65" ON "accounting_template" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e0c6443e0d2d5630067bc10ccf" ON "appointment_employee" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_829e02292a572f25476c4e426c" ON "approval_policy" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2ada776a231239b8e99f78bf64" ON "availability_slot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c323aa830e10a871854d0a0408" ON "social_account" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_75bd5526e43c8801085225ffa9" ON "candidate_criterion_rating" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4985a92870282574f6fec8dd98" ON "candidate_document" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_745780f5553e56a3ca19bccf86" ON "candidate_education" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bb09aa3130d0e54007a98523c5" ON "candidate_experience" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_89ff7e0a8c37fdf7770b753776" ON "candidate_feedback" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_09f72a1a309aae91e0cd83949a" ON "candidate_interview" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_54b281d06e1a4e7e6ff640dab4" ON "candidate_interviewer" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fa411cb89c9c6848d192d7f2e6" ON "candidate_personal_quality" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f651e72ab42727f28c29441f1b" ON "candidate_skill" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436" ON "candidate_source" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_5cb080756923318f19f1d2eabe" ON "candidate_technology" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_ac765cfc390ec77d765dd48b61" ON "candidate" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_67a4423093e3c311cb76275659" ON "contact" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_711fd0159178a0102abc4db336" ON "country" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e99bb270f0fa89ea715a457d29" ON "currency" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_36106478339961c8a17674a031" ON "custom_smtp" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_284658fe519bca6048fd73ff72" ON "deal" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_753f4b022ec98a0c8f38b370c0" ON "email_sent" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_35ac91a92c521b68277e780e6e" ON "email_reset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ce96229ae8d1d1af61348730da" ON "email_template" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_e69d60f1adcded4445095c4787" ON "employee_appointment" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_cee87c9b8743f0e81db8152f68" ON "employee_award" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_9dff154a1be222c66c179ad14b" ON "employee_level" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_08e391262cb3d4fbe9db97ecf8" ON "employee_phone" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_185b880550575c61d4212896e2" ON "employee_recurring_expense" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_a8e048dfb4d618068376407c86" ON "employee_setting" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c17e703a7008f6b9c2770a5cba" ON "employee" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_0c5508f4c86446f84d609e3b76" ON "equipment_sharing_policy" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_21bb7aec28dbb12ebc58a41d02" ON "equipment_sharing" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8" ON "equipment" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c029854e57e273cb30445e6417" ON "estimate_email" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc" ON "event_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0edbfb90f0bc4c28eb57892900" ON "expense_category" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6620af16ccd56e7e52b6ad914d" ON "expense" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ca5fc2af0a26e454779d014a6a" ON "import-history" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b1669a96371cbdb8fd8d4724d6" ON "import-record" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_c795b7a18f1213b980bcc91ffe" ON "feature_organization" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9" ON "feature" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_03dbd727034c431934185d1d6f" ON "goal_general_setting" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_84a5a399408725b9c8612767e0" ON "goal_kpi_template" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_dae34450bed722e897370e2aec" ON "goal_kpi" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_25e0f8060ed921994873391253" ON "goal_template" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_cc3487eb32dd8baa86a8043540" ON "goal_time_frame" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_265b5cbc3e414bb3bb2facbb22" ON "goal" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2a8cd17a33093bb6afed97e9d3" ON "image_asset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_263e874cebea17ad3f2ba39e11" ON "income" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_2a9f9f6fa9064b328e277063a1" ON "integration_entity_setting_tied" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5053bf22f9e0a5e9e8df7850da" ON "integration_entity_setting" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3907c6f563fc45d824558d239d" ON "integration_map" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_02f667ad727ca0975d5022e695" ON "integration_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b6654519fbad729cdb490069be" ON "integration_tenant" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_842e81def8eef9f71a97496ff1" ON "integration_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_90aec772805c7fd508d71bedfe" ON "integration" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_00a3c849694b6f8be7b193c888" ON "invite" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_599de8ec6ea69550c6d49c4ae1" ON "invoice_estimate_history" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_457cbab434fc9a031f03eb6211" ON "invoice_item" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_40ee7b28c0ea835534a93b54bf" ON "invoice" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_04b8ef5663b40baa58e1b65160" ON "key_result_template" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c5df67196c2aca0a7fb6ffd274" ON "key_result_update" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_30bf8575f0744aa3b68b611985" ON "key_result" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_745828269219870069b3b46a7f" ON "language" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ebff440aec581d4893ad743c7e" ON "merchant" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_20aebc4219b9f9196f5ca2344d" ON "organization_award" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cdf46b38fd75cd7baebce81cc6" ON "organization_contact" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8cf81262c7cddfcf3fedcbc106" ON "organization_department" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bf9a2edebcda9ac2c59e4439cb" ON "organization_document" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a11abe644b2cb5810bb65c8f9" ON "organization_employment_type" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_94330f9121dd1e72fe31fdb3c5" ON "organization_language" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122" ON "organization_position" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_21510dbb86b763f55a8bf4ec93" ON "organization_project_module" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_636a95bda1eaf9fab00849dec2" ON "organization_recurring_expense" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cbb3f1eb241abc47103df48f83" ON "organization_sprint" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_60683da6db3f64a0767d40b291" ON "organization_task_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d109b8470a4cf2662bec0a672b" ON "organization_team_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5deae148453dfaf555b24d151f" ON "organization_team_join_request" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_af48bbfa76f6261a5520e5e90f" ON "organization_team" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_6c41095093c47ac91434a1bdf9" ON "organization_vendor" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94" ON "organization" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_7f8ba01a73690cbabe6c6ab93c" ON "password_reset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_523b77d9dcbace8377fbca05ae" ON "payment" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c5075efc6dab483721af36616f" ON "pipeline_stage" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_8b0d255d8f0ec4ca22e36249a8" ON "pipeline" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_2dce278beac80aebe7e179d7c9" ON "product_category_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_89d6d92ce60b7b6de00449b30d" ON "product_category" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_e69de0d6c91d71407822a95bc9" ON "product_option_group" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fdca637f69b879c6e95525a01f" ON "product_option_group_translation" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_eed2b389448b96ec1118ca38ef" ON "product_option_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_41bff03b05f43a4e22e54cb83e" ON "product_option" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_18a46a61494103f9db1c42285d" ON "product_variant_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7c3776ae0d403baebc8a9387d8" ON "product_type_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_577cfbbd0e9dedad955108df36" ON "product_type" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_3041f4d50857a4bc37dd72f233" ON "product_variant_price" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0eb547a970dfecff424eb2098b" ON "product_variant" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_98c2019d4a108469e30b265972" ON "product" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_12de5ef2de583b2e92a1dfee3d" ON "product_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0ad88d687468141532bef9cc5e" ON "report_category" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_3619176cb8845c5c03803caf9d" ON "report_organization" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_5a453f466165d928a495e158ac" ON "report" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_f6c789158e91e7a6242174aaae" ON "request_approval_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c02d6337074841598e6952fed" ON "request_approval_team" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_aac7b3092d5d02d80deb5808b3" ON "request_approval" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592" ON "role_permission" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6c388c8d50b4238ab077fdc800" ON "role" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0d379f40301224bfa5043dc7cc" ON "skill" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_1ddd19850ad49f4e61ad727018" ON "tag" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_1255e02d6dddd4e09a5ddb10d4" ON "daily_plan" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_da2990e3e7d2047d950ab8edea" ON "task_estimation" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2ff61d100d00793724c099b86c" ON "issue_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_93bb4c9fb014dda0d984e9060a" ON "task" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_024d5a6727f6f4804d8cecfe32" ON "task_linked_issues" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f9fdc26bc564bf9f7963489f23" ON "task_priority" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_d1689daf93e2cb6029a9ff96d2" ON "task_related_issue_type" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c364d9cb885e274666950b1afc" ON "task_size" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_259cb3e6d0d59edad2798b0ac3" ON "task_status" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_526e175838190ccc3c350df01a" ON "task_version" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6e8dc5c9992499a05248237e58" ON "tenant_setting" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_10ede978ae7c1b67755932eac6" ON "tenant" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_21aa702abacf7dabe11da12818" ON "time_off_policy" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_a5c6d8b62974fb9e4161e09499" ON "time_off_request" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_83df5ca85dae51ff9341e47785" ON "activity" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_afad5ae421b31768c4232f7224" ON "screenshot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2cbd790171893d994992116f19" ON "time_log" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b520b83e91a6d3c8ef33675efe" ON "time_slot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_bb9f95f639ced2a5b71395169e" ON "time_slot_minute" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_43f3709ff2b8dcc90c1809b023" ON "timesheet" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6f87e00eb9e37242f01e6e5566" ON "user_organization" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd" ON "user" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_fa9bdc44b90c4f32e658938a2d" ON "warehouse_product" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_21bba7ad2249260cc9d0022af9" ON "warehouse_product_variant" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_66abaca4fc9c367203403310aa" ON "warehouse" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_888ffe5a395d1cf7afb001dc3a" ON "changelog" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_55dbb0b04712921d3c5dd7664e" ON "organization_github_repository" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_290ccd540d1e1f450c408539a1" ON "organization_github_repository_issue" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_811cc78a6e4df2ae75d237e40e" ON "proposal" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_6b73b978dcd27856a83df0d23c" ON "employee_proposal_template" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_551be2742a129d5d8ff461e9fe" ON "job_search_occupation" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4b69eac7a9f1b9e93eebe3a850" ON "job_search_category" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0d66c27013f4c34b339738f210" ON "employee_upwork_job_search_criterion" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c271c2698e24de252f1fd148f0" ON "job_preset" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_84a641af24ce125f296142216b" ON "job_preset_upwork_job_search_criterion" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_407463aef81b89c8bc5943ac8a" ON "knowledge_base" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_bd8360d2c539ae6b351129c86d" ON "knowledge_base_article" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_eb418dd0f3234df01222bcf438" ON "knowledge_base_author" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c94775caea731394d690d67db1" ON "product_review" ("archivedAt") `); - await queryRunner.query( - `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_489012234f53089d4b508f4aa12"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_05edb214d298384f9f918d6b5d2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c94775caea731394d690d67db1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_eb418dd0f3234df01222bcf438"`); - await queryRunner.query(`DROP INDEX "public"."IDX_bd8360d2c539ae6b351129c86d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_407463aef81b89c8bc5943ac8a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_84a641af24ce125f296142216b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c271c2698e24de252f1fd148f0"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0d66c27013f4c34b339738f210"`); - await queryRunner.query(`DROP INDEX "public"."IDX_4b69eac7a9f1b9e93eebe3a850"`); - await queryRunner.query(`DROP INDEX "public"."IDX_551be2742a129d5d8ff461e9fe"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6b73b978dcd27856a83df0d23c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_811cc78a6e4df2ae75d237e40e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_290ccd540d1e1f450c408539a1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_55dbb0b04712921d3c5dd7664e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_888ffe5a395d1cf7afb001dc3a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_66abaca4fc9c367203403310aa"`); - await queryRunner.query(`DROP INDEX "public"."IDX_21bba7ad2249260cc9d0022af9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_fa9bdc44b90c4f32e658938a2d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e49cb4b6b256bd4a5edab1e4dd"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6f87e00eb9e37242f01e6e5566"`); - await queryRunner.query(`DROP INDEX "public"."IDX_43f3709ff2b8dcc90c1809b023"`); - await queryRunner.query(`DROP INDEX "public"."IDX_bb9f95f639ced2a5b71395169e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b520b83e91a6d3c8ef33675efe"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2cbd790171893d994992116f19"`); - await queryRunner.query(`DROP INDEX "public"."IDX_afad5ae421b31768c4232f7224"`); - await queryRunner.query(`DROP INDEX "public"."IDX_83df5ca85dae51ff9341e47785"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a5c6d8b62974fb9e4161e09499"`); - await queryRunner.query(`DROP INDEX "public"."IDX_21aa702abacf7dabe11da12818"`); - await queryRunner.query(`DROP INDEX "public"."IDX_10ede978ae7c1b67755932eac6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6e8dc5c9992499a05248237e58"`); - await queryRunner.query(`DROP INDEX "public"."IDX_526e175838190ccc3c350df01a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_259cb3e6d0d59edad2798b0ac3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c364d9cb885e274666950b1afc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d1689daf93e2cb6029a9ff96d2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f9fdc26bc564bf9f7963489f23"`); - await queryRunner.query(`DROP INDEX "public"."IDX_024d5a6727f6f4804d8cecfe32"`); - await queryRunner.query(`DROP INDEX "public"."IDX_93bb4c9fb014dda0d984e9060a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2ff61d100d00793724c099b86c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_da2990e3e7d2047d950ab8edea"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1255e02d6dddd4e09a5ddb10d4"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1ddd19850ad49f4e61ad727018"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0d379f40301224bfa5043dc7cc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6c388c8d50b4238ab077fdc800"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8cdc64dbd7f2ed3f8850bd2592"`); - await queryRunner.query(`DROP INDEX "public"."IDX_aac7b3092d5d02d80deb5808b3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1c02d6337074841598e6952fed"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f6c789158e91e7a6242174aaae"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5a453f466165d928a495e158ac"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3619176cb8845c5c03803caf9d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0ad88d687468141532bef9cc5e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_12de5ef2de583b2e92a1dfee3d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_98c2019d4a108469e30b265972"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0eb547a970dfecff424eb2098b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3041f4d50857a4bc37dd72f233"`); - await queryRunner.query(`DROP INDEX "public"."IDX_577cfbbd0e9dedad955108df36"`); - await queryRunner.query(`DROP INDEX "public"."IDX_7c3776ae0d403baebc8a9387d8"`); - await queryRunner.query(`DROP INDEX "public"."IDX_18a46a61494103f9db1c42285d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_41bff03b05f43a4e22e54cb83e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_eed2b389448b96ec1118ca38ef"`); - await queryRunner.query(`DROP INDEX "public"."IDX_fdca637f69b879c6e95525a01f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e69de0d6c91d71407822a95bc9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_89d6d92ce60b7b6de00449b30d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2dce278beac80aebe7e179d7c9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8b0d255d8f0ec4ca22e36249a8"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c5075efc6dab483721af36616f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_523b77d9dcbace8377fbca05ae"`); - await queryRunner.query(`DROP INDEX "public"."IDX_7f8ba01a73690cbabe6c6ab93c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3c5fdf6c34ed7a20fae6c9ae94"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6c41095093c47ac91434a1bdf9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_af48bbfa76f6261a5520e5e90f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5deae148453dfaf555b24d151f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d109b8470a4cf2662bec0a672b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_60683da6db3f64a0767d40b291"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cbb3f1eb241abc47103df48f83"`); - await queryRunner.query(`DROP INDEX "public"."IDX_636a95bda1eaf9fab00849dec2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_21510dbb86b763f55a8bf4ec93"`); - await queryRunner.query(`DROP INDEX "public"."IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_05edb214d298384f9f918d6b5d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "public"."IDX_fdd58e4f13a3f4a92c70bcdb30"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1bff92d7a3b4b1f1a0e62a5122"`); - await queryRunner.query(`DROP INDEX "public"."IDX_94330f9121dd1e72fe31fdb3c5"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8a11abe644b2cb5810bb65c8f9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_bf9a2edebcda9ac2c59e4439cb"`); - await queryRunner.query(`DROP INDEX "public"."IDX_8cf81262c7cddfcf3fedcbc106"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cdf46b38fd75cd7baebce81cc6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_20aebc4219b9f9196f5ca2344d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ebff440aec581d4893ad743c7e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_745828269219870069b3b46a7f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_30bf8575f0744aa3b68b611985"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c5df67196c2aca0a7fb6ffd274"`); - await queryRunner.query(`DROP INDEX "public"."IDX_04b8ef5663b40baa58e1b65160"`); - await queryRunner.query(`DROP INDEX "public"."IDX_40ee7b28c0ea835534a93b54bf"`); - await queryRunner.query(`DROP INDEX "public"."IDX_457cbab434fc9a031f03eb6211"`); - await queryRunner.query(`DROP INDEX "public"."IDX_599de8ec6ea69550c6d49c4ae1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_00a3c849694b6f8be7b193c888"`); - await queryRunner.query(`DROP INDEX "public"."IDX_90aec772805c7fd508d71bedfe"`); - await queryRunner.query(`DROP INDEX "public"."IDX_842e81def8eef9f71a97496ff1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b6654519fbad729cdb490069be"`); - await queryRunner.query(`DROP INDEX "public"."IDX_02f667ad727ca0975d5022e695"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3907c6f563fc45d824558d239d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5053bf22f9e0a5e9e8df7850da"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2a9f9f6fa9064b328e277063a1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_263e874cebea17ad3f2ba39e11"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2a8cd17a33093bb6afed97e9d3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_265b5cbc3e414bb3bb2facbb22"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cc3487eb32dd8baa86a8043540"`); - await queryRunner.query(`DROP INDEX "public"."IDX_25e0f8060ed921994873391253"`); - await queryRunner.query(`DROP INDEX "public"."IDX_dae34450bed722e897370e2aec"`); - await queryRunner.query(`DROP INDEX "public"."IDX_84a5a399408725b9c8612767e0"`); - await queryRunner.query(`DROP INDEX "public"."IDX_03dbd727034c431934185d1d6f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_3c0aa9d1eabc26757fbddc2bb9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c795b7a18f1213b980bcc91ffe"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b1669a96371cbdb8fd8d4724d6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ca5fc2af0a26e454779d014a6a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6620af16ccd56e7e52b6ad914d"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0edbfb90f0bc4c28eb57892900"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e261b3b6ed4c6e79901fb3e1bc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c029854e57e273cb30445e6417"`); - await queryRunner.query(`DROP INDEX "public"."IDX_7ed01d2a28f6cc9acb72c5fcf8"`); - await queryRunner.query(`DROP INDEX "public"."IDX_21bb7aec28dbb12ebc58a41d02"`); - await queryRunner.query(`DROP INDEX "public"."IDX_0c5508f4c86446f84d609e3b76"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c17e703a7008f6b9c2770a5cba"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a8e048dfb4d618068376407c86"`); - await queryRunner.query(`DROP INDEX "public"."IDX_185b880550575c61d4212896e2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_08e391262cb3d4fbe9db97ecf8"`); - await queryRunner.query(`DROP INDEX "public"."IDX_9dff154a1be222c66c179ad14b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_cee87c9b8743f0e81db8152f68"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e69d60f1adcded4445095c4787"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ce96229ae8d1d1af61348730da"`); - await queryRunner.query(`DROP INDEX "public"."IDX_35ac91a92c521b68277e780e6e"`); - await queryRunner.query(`DROP INDEX "public"."IDX_753f4b022ec98a0c8f38b370c0"`); - await queryRunner.query(`DROP INDEX "public"."IDX_284658fe519bca6048fd73ff72"`); - await queryRunner.query(`DROP INDEX "public"."IDX_36106478339961c8a17674a031"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e99bb270f0fa89ea715a457d29"`); - await queryRunner.query(`DROP INDEX "public"."IDX_711fd0159178a0102abc4db336"`); - await queryRunner.query(`DROP INDEX "public"."IDX_67a4423093e3c311cb76275659"`); - await queryRunner.query(`DROP INDEX "public"."IDX_ac765cfc390ec77d765dd48b61"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5cb080756923318f19f1d2eabe"`); - await queryRunner.query(`DROP INDEX "public"."IDX_df0a9a4b6ae0e3cab9c4f35436"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f651e72ab42727f28c29441f1b"`); - await queryRunner.query(`DROP INDEX "public"."IDX_fa411cb89c9c6848d192d7f2e6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_54b281d06e1a4e7e6ff640dab4"`); - await queryRunner.query(`DROP INDEX "public"."IDX_09f72a1a309aae91e0cd83949a"`); - await queryRunner.query(`DROP INDEX "public"."IDX_89ff7e0a8c37fdf7770b753776"`); - await queryRunner.query(`DROP INDEX "public"."IDX_bb09aa3130d0e54007a98523c5"`); - await queryRunner.query(`DROP INDEX "public"."IDX_745780f5553e56a3ca19bccf86"`); - await queryRunner.query(`DROP INDEX "public"."IDX_4985a92870282574f6fec8dd98"`); - await queryRunner.query(`DROP INDEX "public"."IDX_75bd5526e43c8801085225ffa9"`); - await queryRunner.query(`DROP INDEX "public"."IDX_c323aa830e10a871854d0a0408"`); - await queryRunner.query(`DROP INDEX "public"."IDX_2ada776a231239b8e99f78bf64"`); - await queryRunner.query(`DROP INDEX "public"."IDX_829e02292a572f25476c4e426c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e0c6443e0d2d5630067bc10ccf"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5d74a3f25e6acfb6caec05ec65"`); - await queryRunner.query(`ALTER TABLE "product_review" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "knowledge_base_author" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "knowledge_base_article" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "knowledge_base" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "job_preset_upwork_job_search_criterion" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "job_preset" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_upwork_job_search_criterion" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "job_search_category" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "job_search_occupation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_proposal_template" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "proposal" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_github_repository_issue" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_github_repository" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "changelog" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "warehouse" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "warehouse_product_variant" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "warehouse_product" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "user_organization" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "timesheet" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "time_slot_minute" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "time_slot" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "time_log" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "screenshot" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "activity" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "time_off_request" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "time_off_policy" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "tenant" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "tenant_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_version" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_status" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_size" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_related_issue_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_priority" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_linked_issues" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "issue_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "task_estimation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "daily_plan" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "tag" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "skill" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "role_permission" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "request_approval" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "request_approval_team" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "request_approval_employee" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "report" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "report_organization" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "report_category" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_translation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_variant" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_variant_price" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_type_translation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_variant_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_option" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_option_translation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_option_group_translation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_option_group" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_category" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "product_category_translation" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "pipeline" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "pipeline_stage" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "payment" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "password_reset" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_vendor" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_team" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_team_join_request" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_team_employee" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_task_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_sprint" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_recurring_expense" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_module" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "defaultAssigneeId"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "managerId"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "closeTasksIn"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archiveTasksIn"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "icon"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "status"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_position" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_language" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_employment_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_document" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_department" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_contact" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_award" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "merchant" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "language" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "key_result" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "key_result_update" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "key_result_template" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "invoice" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "invoice_item" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "invoice_estimate_history" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "invite" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_tenant" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_map" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_entity_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "integration_entity_setting_tied" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "income" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "image_asset" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal_time_frame" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal_template" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal_kpi" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal_kpi_template" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "goal_general_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "feature" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "feature_organization" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "import-record" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "import-history" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "expense" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "expense_category" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "event_type" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "estimate_email" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "equipment" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "equipment_sharing" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "equipment_sharing_policy" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_setting" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_recurring_expense" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_phone" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_level" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_award" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "employee_appointment" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "email_template" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "email_reset" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "email_sent" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "deal" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "custom_smtp" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "currency" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "country" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "contact" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_technology" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_source" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_skill" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_personal_quality" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_interviewer" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_interview" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_feedback" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_experience" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_education" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_document" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "candidate_criterion_rating" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "social_account" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "availability_slot" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "approval_policy" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "appointment_employee" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "accounting_template" DROP COLUMN "archivedAt"`); - } - - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_a841eabc6b656c965d8846223e"`); - await queryRunner.query(`DROP INDEX "IDX_968c1c9a131a61a3720b3a72f6"`); - await queryRunner.query(`DROP INDEX "IDX_e66511b175393255c6c4e7b007"`); - await queryRunner.query(`DROP INDEX "IDX_2ca6a49062a4ed884e413bf572"`); - await queryRunner.query(`DROP INDEX "IDX_5cf7c007fc9c83bee748f08806"`); - await queryRunner.query(`DROP INDEX "IDX_7ac2c1c487dd77fe38c2d571ea"`); - await queryRunner.query( - `CREATE TABLE "temporary_accounting_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "templateType" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e66511b175393255c6c4e7b007f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ca6a49062a4ed884e413bf572e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_accounting_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt" FROM "accounting_template"` - ); - await queryRunner.query(`DROP TABLE "accounting_template"`); - await queryRunner.query(`ALTER TABLE "temporary_accounting_template" RENAME TO "accounting_template"`); - await queryRunner.query( - `CREATE INDEX "IDX_a841eabc6b656c965d8846223e" ON "accounting_template" ("languageCode") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_968c1c9a131a61a3720b3a72f6" ON "accounting_template" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_e66511b175393255c6c4e7b007" ON "accounting_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_2ca6a49062a4ed884e413bf572" ON "accounting_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_5cf7c007fc9c83bee748f08806" ON "accounting_template" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_7ac2c1c487dd77fe38c2d571ea" ON "accounting_template" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e9ca170a0fae05e44a9bd137d8"`); - await queryRunner.query(`DROP INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba"`); - await queryRunner.query(`DROP INDEX "IDX_3c3a62226896345c4716bfe1d9"`); - await queryRunner.query(`DROP INDEX "IDX_2c0494466d5a7e1165cea3dca9"`); - await queryRunner.query(`DROP INDEX "IDX_379af16b0aeed6a4d8f15c53bc"`); - await queryRunner.query(`DROP INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3"`); - await queryRunner.query( - `CREATE TABLE "temporary_appointment_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "appointmentId" varchar NOT NULL, "employeeId" varchar NOT NULL, "employeeAppointmentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e9ca170a0fae05e44a9bd137d8b" FOREIGN KEY ("employeeAppointmentId") REFERENCES "employee_appointment" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0ddc50b7521b9a905d9ca8c8ba3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3c3a62226896345c4716bfe1d96" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2c0494466d5a7e1165cea3dca98" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_appointment_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt" FROM "appointment_employee"` - ); - await queryRunner.query(`DROP TABLE "appointment_employee"`); - await queryRunner.query(`ALTER TABLE "temporary_appointment_employee" RENAME TO "appointment_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_e9ca170a0fae05e44a9bd137d8" ON "appointment_employee" ("employeeAppointmentId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba" ON "appointment_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3c3a62226896345c4716bfe1d9" ON "appointment_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2c0494466d5a7e1165cea3dca9" ON "appointment_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_379af16b0aeed6a4d8f15c53bc" ON "appointment_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3" ON "appointment_employee" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_45f32a5a12d42fba17fe62a279"`); - await queryRunner.query(`DROP INDEX "IDX_dfe3b357df3ce136917b1f0984"`); - await queryRunner.query(`DROP INDEX "IDX_1462391059ebe137645098d727"`); - await queryRunner.query(`DROP INDEX "IDX_338364927c68961167606e989c"`); - await queryRunner.query(`DROP INDEX "IDX_f50ce5a39d610cfcd9da9652b1"`); - await queryRunner.query( - `CREATE TABLE "temporary_approval_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "approvalType" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_dfe3b357df3ce136917b1f09843" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1462391059ebe137645098d7276" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_approval_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt" FROM "approval_policy"` - ); - await queryRunner.query(`DROP TABLE "approval_policy"`); - await queryRunner.query(`ALTER TABLE "temporary_approval_policy" RENAME TO "approval_policy"`); - await queryRunner.query(`CREATE INDEX "IDX_45f32a5a12d42fba17fe62a279" ON "approval_policy" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_dfe3b357df3ce136917b1f0984" ON "approval_policy" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1462391059ebe137645098d727" ON "approval_policy" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_338364927c68961167606e989c" ON "approval_policy" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f50ce5a39d610cfcd9da9652b1" ON "approval_policy" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_46ed3c2287423f5dc089100fee"`); - await queryRunner.query(`DROP INDEX "IDX_d544bd3a63634a4438509ac958"`); - await queryRunner.query(`DROP INDEX "IDX_f008a481cb4eed547704bb9d83"`); - await queryRunner.query(`DROP INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe"`); - await queryRunner.query(`DROP INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca"`); - await queryRunner.query( - `CREATE TABLE "temporary_availability_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startTime" datetime NOT NULL, "endTime" datetime NOT NULL, "allDay" boolean NOT NULL, "type" text, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_46ed3c2287423f5dc089100feeb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d544bd3a63634a4438509ac958d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f008a481cb4eed547704bb9d839" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_availability_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt" FROM "availability_slot"` - ); - await queryRunner.query(`DROP TABLE "availability_slot"`); - await queryRunner.query(`ALTER TABLE "temporary_availability_slot" RENAME TO "availability_slot"`); - await queryRunner.query(`CREATE INDEX "IDX_46ed3c2287423f5dc089100fee" ON "availability_slot" ("employeeId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d544bd3a63634a4438509ac958" ON "availability_slot" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f008a481cb4eed547704bb9d83" ON "availability_slot" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe" ON "availability_slot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca" ON "availability_slot" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_e8b7694e86fe9534778832f90c"`); - await queryRunner.query(`DROP INDEX "IDX_a3b32d609a4c884a776ab883be"`); - await queryRunner.query(`DROP INDEX "IDX_1d8e3566b66fbad38b6e2290a2"`); - await queryRunner.query(`DROP INDEX "IDX_a2eb41b1d6ee72de9486558199"`); - await queryRunner.query( - `CREATE TABLE "temporary_social_account" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "provider" varchar NOT NULL, "providerAccountId" varchar NOT NULL, "userId" varchar NOT NULL, "archivedAt" datetime, CONSTRAINT "FK_e8b7694e86fe9534778832f90c0" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a3b32d609a4c884a776ab883be3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_social_account"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId" FROM "social_account"` - ); - await queryRunner.query(`DROP TABLE "social_account"`); - await queryRunner.query(`ALTER TABLE "temporary_social_account" RENAME TO "social_account"`); - await queryRunner.query(`CREATE INDEX "IDX_e8b7694e86fe9534778832f90c" ON "social_account" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_a3b32d609a4c884a776ab883be" ON "social_account" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_1d8e3566b66fbad38b6e2290a2" ON "social_account" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_a2eb41b1d6ee72de9486558199" ON "social_account" ("isActive") `); - await queryRunner.query(`DROP INDEX "IDX_159f821dd214792f1d2ad9cff7"`); - await queryRunner.query(`DROP INDEX "IDX_ba4c376b2069aa82745d4e9682"`); - await queryRunner.query(`DROP INDEX "IDX_d1d16bc87d3afaf387f34cdceb"`); - await queryRunner.query(`DROP INDEX "IDX_b106406e94bb7317493efc2c98"`); - await queryRunner.query(`DROP INDEX "IDX_9d5bd131452ef689df2b46551b"`); - await queryRunner.query(`DROP INDEX "IDX_0a417dafb1dd14eb92a69fa641"`); - await queryRunner.query(`DROP INDEX "IDX_fcab96cef60fd8bccac610ccef"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_criterion_rating" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" integer NOT NULL, "technologyId" varchar, "personalQualityId" varchar, "feedbackId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_159f821dd214792f1d2ad9cff7c" FOREIGN KEY ("feedbackId") REFERENCES "candidate_feedback" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ba4c376b2069aa82745d4e96822" FOREIGN KEY ("personalQualityId") REFERENCES "candidate_personal_quality" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d1d16bc87d3afaf387f34cdceb7" FOREIGN KEY ("technologyId") REFERENCES "candidate_technology" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b106406e94bb7317493efc2c989" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9d5bd131452ef689df2b46551b4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_criterion_rating"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt" FROM "candidate_criterion_rating"` - ); - await queryRunner.query(`DROP TABLE "candidate_criterion_rating"`); - await queryRunner.query( - `ALTER TABLE "temporary_candidate_criterion_rating" RENAME TO "candidate_criterion_rating"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_159f821dd214792f1d2ad9cff7" ON "candidate_criterion_rating" ("feedbackId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ba4c376b2069aa82745d4e9682" ON "candidate_criterion_rating" ("personalQualityId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d1d16bc87d3afaf387f34cdceb" ON "candidate_criterion_rating" ("technologyId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b106406e94bb7317493efc2c98" ON "candidate_criterion_rating" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d5bd131452ef689df2b46551b" ON "candidate_criterion_rating" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0a417dafb1dd14eb92a69fa641" ON "candidate_criterion_rating" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fcab96cef60fd8bccac610ccef" ON "candidate_criterion_rating" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3f9053719c9d11ebdea03e5a2d"`); - await queryRunner.query(`DROP INDEX "IDX_d108a827199fda86a9ec216989"`); - await queryRunner.query(`DROP INDEX "IDX_4d9b7ab09f9f9517d488b5fed1"`); - await queryRunner.query(`DROP INDEX "IDX_bf8070715e42b3afe9730e7b30"`); - await queryRunner.query(`DROP INDEX "IDX_3ed4bac12d0ca32eada4ea5a49"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3f9053719c9d11ebdea03e5a2d4" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d108a827199fda86a9ec216989a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4d9b7ab09f9f9517d488b5fed1e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_document"` - ); - await queryRunner.query(`DROP TABLE "candidate_document"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_document" RENAME TO "candidate_document"`); - await queryRunner.query( - `CREATE INDEX "IDX_3f9053719c9d11ebdea03e5a2d" ON "candidate_document" ("candidateId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d108a827199fda86a9ec216989" ON "candidate_document" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_4d9b7ab09f9f9517d488b5fed1" ON "candidate_document" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_bf8070715e42b3afe9730e7b30" ON "candidate_document" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_3ed4bac12d0ca32eada4ea5a49" ON "candidate_document" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f660af89b2c69fea2334508cbb"`); - await queryRunner.query(`DROP INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd"`); - await queryRunner.query(`DROP INDEX "IDX_336eb14606016757d2302efa4d"`); - await queryRunner.query(`DROP INDEX "IDX_b443c78c3796f2e9aab05a2bb9"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_education" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "schoolName" varchar NOT NULL, "degree" varchar NOT NULL, "field" varchar NOT NULL, "completionDate" datetime NOT NULL, "notes" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_59b61ba52a58851cfc85b1e6c66" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f660af89b2c69fea2334508cbbd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_00cdd9ed7571be8e2c8d09e7cd4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_education"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_education"` - ); - await queryRunner.query(`DROP TABLE "candidate_education"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_education" RENAME TO "candidate_education"`); - await queryRunner.query( - `CREATE INDEX "IDX_f660af89b2c69fea2334508cbb" ON "candidate_education" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd" ON "candidate_education" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_336eb14606016757d2302efa4d" ON "candidate_education" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_b443c78c3796f2e9aab05a2bb9" ON "candidate_education" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a50eb955f940ca93e044d175c6"`); - await queryRunner.query(`DROP INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf"`); - await queryRunner.query(`DROP INDEX "IDX_dafa68d060cf401d5f62a57ad4"`); - await queryRunner.query(`DROP INDEX "IDX_c24bce6dd33e56ef8e8dacef1a"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_experience" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "occupation" varchar NOT NULL, "duration" varchar NOT NULL, "description" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cf75465b3663652a28cf1841ce2" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a50eb955f940ca93e044d175c62" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dcf5fc8bc7f77a80b0fc648bfc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_experience"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_experience"` - ); - await queryRunner.query(`DROP TABLE "candidate_experience"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_experience" RENAME TO "candidate_experience"`); - await queryRunner.query( - `CREATE INDEX "IDX_a50eb955f940ca93e044d175c6" ON "candidate_experience" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf" ON "candidate_experience" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_dafa68d060cf401d5f62a57ad4" ON "candidate_experience" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c24bce6dd33e56ef8e8dacef1a" ON "candidate_experience" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_0862c274d336126b951bfe009a"`); - await queryRunner.query(`DROP INDEX "IDX_98c008fd8cf597e83dcdccfd16"`); - await queryRunner.query(`DROP INDEX "IDX_3a6928f8501fce33820721a8fe"`); - await queryRunner.query(`DROP INDEX "IDX_6cb21fa0f65ff69679966c836f"`); - await queryRunner.query(`DROP INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb"`); - await queryRunner.query(`DROP INDEX "IDX_05ed49a5ebdd5ec533f913b620"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_feedback" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "rating" numeric, "status" varchar, "candidateId" varchar, "interviewId" varchar, "interviewerId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_44f3d80c3293e1de038c87f115" UNIQUE ("interviewerId"), CONSTRAINT "FK_44f3d80c3293e1de038c87f115d" FOREIGN KEY ("interviewerId") REFERENCES "candidate_interviewer" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0862c274d336126b951bfe009a7" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_98c008fd8cf597e83dcdccfd161" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3a6928f8501fce33820721a8fe8" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6cb21fa0f65ff69679966c836f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_feedback"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt" FROM "candidate_feedback"` - ); - await queryRunner.query(`DROP TABLE "candidate_feedback"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_feedback" RENAME TO "candidate_feedback"`); - await queryRunner.query( - `CREATE INDEX "IDX_0862c274d336126b951bfe009a" ON "candidate_feedback" ("interviewId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_98c008fd8cf597e83dcdccfd16" ON "candidate_feedback" ("candidateId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3a6928f8501fce33820721a8fe" ON "candidate_feedback" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_6cb21fa0f65ff69679966c836f" ON "candidate_feedback" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb" ON "candidate_feedback" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_05ed49a5ebdd5ec533f913b620" ON "candidate_feedback" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_59b765e6d13d83dba4852a43eb"`); - await queryRunner.query(`DROP INDEX "IDX_03be41e88b1fecfe4e24d6b04b"`); - await queryRunner.query(`DROP INDEX "IDX_91996439c4baafee8395d3df15"`); - await queryRunner.query(`DROP INDEX "IDX_b9191cf49f8cd1f192cb74233c"`); - await queryRunner.query(`DROP INDEX "IDX_7b49ce2928b327213f2de66b95"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_interview" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "startTime" datetime, "endTime" datetime, "location" varchar, "note" varchar, "isArchived" boolean DEFAULT (0), "rating" numeric, "candidateId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_59b765e6d13d83dba4852a43eb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_03be41e88b1fecfe4e24d6b04b2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91996439c4baafee8395d3df153" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_interview"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt" FROM "candidate_interview"` - ); - await queryRunner.query(`DROP TABLE "candidate_interview"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_interview" RENAME TO "candidate_interview"`); - await queryRunner.query(`CREATE INDEX "IDX_59b765e6d13d83dba4852a43eb" ON "candidate_interview" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_03be41e88b1fecfe4e24d6b04b" ON "candidate_interview" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_91996439c4baafee8395d3df15" ON "candidate_interview" ("candidateId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b9191cf49f8cd1f192cb74233c" ON "candidate_interview" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_7b49ce2928b327213f2de66b95" ON "candidate_interview" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_9e7b20eb3dfa082b83b198fdad"`); - await queryRunner.query(`DROP INDEX "IDX_ecb65075e94b47bbab11cfa5a1"`); - await queryRunner.query(`DROP INDEX "IDX_5f1e315db848990dfffa72817c"`); - await queryRunner.query(`DROP INDEX "IDX_f0ca69c78eea92c95d9044764a"`); - await queryRunner.query(`DROP INDEX "IDX_b9132118c3a98c4c48e417c0c5"`); - await queryRunner.query(`DROP INDEX "IDX_2043abff09f084fb8690009fb8"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_interviewer" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "interviewId" varchar NOT NULL, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9e7b20eb3dfa082b83b198fdad4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb65075e94b47bbab11cfa5a1e" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5f1e315db848990dfffa72817ca" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f0ca69c78eea92c95d9044764a2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_interviewer"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "candidate_interviewer"` - ); - await queryRunner.query(`DROP TABLE "candidate_interviewer"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_interviewer" RENAME TO "candidate_interviewer"`); - await queryRunner.query( - `CREATE INDEX "IDX_9e7b20eb3dfa082b83b198fdad" ON "candidate_interviewer" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ecb65075e94b47bbab11cfa5a1" ON "candidate_interviewer" ("interviewId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5f1e315db848990dfffa72817c" ON "candidate_interviewer" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f0ca69c78eea92c95d9044764a" ON "candidate_interviewer" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b9132118c3a98c4c48e417c0c5" ON "candidate_interviewer" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2043abff09f084fb8690009fb8" ON "candidate_interviewer" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a0d171f45bdbcf2b990c0c37c3"`); - await queryRunner.query(`DROP INDEX "IDX_d321f4547ed467d07cce1e7d9a"`); - await queryRunner.query(`DROP INDEX "IDX_045de7c208adcd0c68c0a65174"`); - await queryRunner.query(`DROP INDEX "IDX_afe01503d4337c9623c06f22df"`); - await queryRunner.query(`DROP INDEX "IDX_ff6776d92db4ef71edbfba9903"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_personal_quality" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a0d171f45bdbcf2b990c0c37c32" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d321f4547ed467d07cce1e7d9a5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_045de7c208adcd0c68c0a651748" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_personal_quality"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "candidate_personal_quality"` - ); - await queryRunner.query(`DROP TABLE "candidate_personal_quality"`); - await queryRunner.query( - `ALTER TABLE "temporary_candidate_personal_quality" RENAME TO "candidate_personal_quality"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a0d171f45bdbcf2b990c0c37c3" ON "candidate_personal_quality" ("interviewId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d321f4547ed467d07cce1e7d9a" ON "candidate_personal_quality" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_045de7c208adcd0c68c0a65174" ON "candidate_personal_quality" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_afe01503d4337c9623c06f22df" ON "candidate_personal_quality" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ff6776d92db4ef71edbfba9903" ON "candidate_personal_quality" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_d7986743e7f11720349a6c9557"`); - await queryRunner.query(`DROP INDEX "IDX_8a07f780c6fce2b82830ab0687"`); - await queryRunner.query(`DROP INDEX "IDX_6907163d0bb8e9f0440b9bf2a7"`); - await queryRunner.query(`DROP INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_492548e6c176f5655adfae9f5ea" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d7986743e7f11720349a6c95572" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a07f780c6fce2b82830ab06877" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt" FROM "candidate_skill"` - ); - await queryRunner.query(`DROP TABLE "candidate_skill"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_skill" RENAME TO "candidate_skill"`); - await queryRunner.query( - `CREATE INDEX "IDX_d7986743e7f11720349a6c9557" ON "candidate_skill" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_8a07f780c6fce2b82830ab0687" ON "candidate_skill" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_6907163d0bb8e9f0440b9bf2a7" ON "candidate_skill" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347" ON "candidate_skill" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_e92027b5280828cadd7cd6ea71"`); - await queryRunner.query(`DROP INDEX "IDX_b2a1ba27a76dd819cd8294cce3"`); - await queryRunner.query(`DROP INDEX "IDX_2be9182096747fb18cb8afb1f0"`); - await queryRunner.query(`DROP INDEX "IDX_509101ab1a46a5934ee278d447"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_source" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e92027b5280828cadd7cd6ea719" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b2a1ba27a76dd819cd8294cce38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_source"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "candidate_source"` - ); - await queryRunner.query(`DROP TABLE "candidate_source"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_source" RENAME TO "candidate_source"`); - await queryRunner.query( - `CREATE INDEX "IDX_e92027b5280828cadd7cd6ea71" ON "candidate_source" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b2a1ba27a76dd819cd8294cce3" ON "candidate_source" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_2be9182096747fb18cb8afb1f0" ON "candidate_source" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_509101ab1a46a5934ee278d447" ON "candidate_source" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_063663c7e61e45d172d1b83265"`); - await queryRunner.query(`DROP INDEX "IDX_9d46b8c5382acd4d4514bc5c62"`); - await queryRunner.query(`DROP INDEX "IDX_a6fecb615b07987b480defac64"`); - await queryRunner.query(`DROP INDEX "IDX_199ca43300fa4e64239656a677"`); - await queryRunner.query(`DROP INDEX "IDX_97aa0328b72e1bf919e61bccdc"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate_technology" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_063663c7e61e45d172d1b832656" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9d46b8c5382acd4d4514bc5c62e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a6fecb615b07987b480defac647" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate_technology"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "candidate_technology"` - ); - await queryRunner.query(`DROP TABLE "candidate_technology"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate_technology" RENAME TO "candidate_technology"`); - await queryRunner.query( - `CREATE INDEX "IDX_063663c7e61e45d172d1b83265" ON "candidate_technology" ("interviewId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d46b8c5382acd4d4514bc5c62" ON "candidate_technology" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a6fecb615b07987b480defac64" ON "candidate_technology" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_199ca43300fa4e64239656a677" ON "candidate_technology" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_97aa0328b72e1bf919e61bccdc" ON "candidate_technology" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3930aa71e0fa24f09201811b1b"`); - await queryRunner.query(`DROP INDEX "IDX_4ea108fd8b089237964d5f98fb"`); - await queryRunner.query(`DROP INDEX "IDX_1e3e8228e7df634fa4cec6322c"`); - await queryRunner.query(`DROP INDEX "IDX_b674793a804b7d69d74c8f6c5b"`); - await queryRunner.query(`DROP INDEX "IDX_16fb27ffd1a99c6506c92ad57a"`); - await queryRunner.query(`DROP INDEX "IDX_77ac426e04553ff1654421bce4"`); - await queryRunner.query(`DROP INDEX "IDX_8b900e8a39f76125e610ab30c0"`); - await queryRunner.query(`DROP INDEX "IDX_2b8091376a529383e23ba3356a"`); - await queryRunner.query(`DROP INDEX "IDX_af835b66fa10279103bd89e225"`); - await queryRunner.query( - `CREATE TABLE "temporary_candidate" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" numeric, "valueDate" datetime, "appliedDate" datetime, "hiredDate" datetime, "status" varchar DEFAULT ('APPLIED'), "rejectDate" datetime, "candidateLevel" varchar(500), "reWeeklyLimit" integer, "billRateCurrency" varchar(255), "billRateValue" integer, "payPeriod" varchar, "cvUrl" varchar, "isArchived" boolean DEFAULT (0), "contactId" varchar, "organizationPositionId" varchar, "sourceId" varchar, "userId" varchar NOT NULL, "employeeId" varchar, "minimumBillingRate" integer, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_3930aa71e0fa24f09201811b1b" UNIQUE ("userId"), CONSTRAINT "REL_4ea108fd8b089237964d5f98fb" UNIQUE ("sourceId"), CONSTRAINT "REL_b674793a804b7d69d74c8f6c5b" UNIQUE ("contactId"), CONSTRAINT "UQ_91b20077aa92f9115764033cd06" UNIQUE ("employeeId"), CONSTRAINT "FK_3930aa71e0fa24f09201811b1bb" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4ea108fd8b089237964d5f98fba" FOREIGN KEY ("sourceId") REFERENCES "candidate_source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1e3e8228e7df634fa4cec6322c7" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b674793a804b7d69d74c8f6c5ba" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16fb27ffd1a99c6506c92ad57a7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_77ac426e04553ff1654421bce4d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_candidate"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt" FROM "candidate"` - ); - await queryRunner.query(`DROP TABLE "candidate"`); - await queryRunner.query(`ALTER TABLE "temporary_candidate" RENAME TO "candidate"`); - await queryRunner.query(`CREATE INDEX "IDX_3930aa71e0fa24f09201811b1b" ON "candidate" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_4ea108fd8b089237964d5f98fb" ON "candidate" ("sourceId") `); - await queryRunner.query( - `CREATE INDEX "IDX_1e3e8228e7df634fa4cec6322c" ON "candidate" ("organizationPositionId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b674793a804b7d69d74c8f6c5b" ON "candidate" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_16fb27ffd1a99c6506c92ad57a" ON "candidate" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_77ac426e04553ff1654421bce4" ON "candidate" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_8b900e8a39f76125e610ab30c0" ON "candidate" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_2b8091376a529383e23ba3356a" ON "candidate" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_af835b66fa10279103bd89e225" ON "candidate" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_60468af1ce34043a900809c84f"`); - await queryRunner.query(`DROP INDEX "IDX_7719d73cd16a9f57ecc6ac24b3"`); - await queryRunner.query(`DROP INDEX "IDX_05831d37eabeb6150f99c69784"`); - await queryRunner.query(`DROP INDEX "IDX_4164bd34bdcce8754641f0e567"`); - await queryRunner.query( - `CREATE TABLE "temporary_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "firstName" varchar, "lastName" varchar, "country" varchar, "city" varchar, "address" varchar, "address2" varchar, "postcode" varchar, "latitude" numeric, "longitude" numeric, "regionCode" varchar, "fax" varchar, "fiscalInformation" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_60468af1ce34043a900809c84f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7719d73cd16a9f57ecc6ac24b3d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt" FROM "contact"` - ); - await queryRunner.query(`DROP TABLE "contact"`); - await queryRunner.query(`ALTER TABLE "temporary_contact" RENAME TO "contact"`); - await queryRunner.query(`CREATE INDEX "IDX_60468af1ce34043a900809c84f" ON "contact" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_7719d73cd16a9f57ecc6ac24b3" ON "contact" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_05831d37eabeb6150f99c69784" ON "contact" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4164bd34bdcce8754641f0e567" ON "contact" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_6eba1a52ee121d100c8a0a6510"`); - await queryRunner.query(`DROP INDEX "IDX_97ebcd8db30a408b5f907d6ff4"`); - await queryRunner.query(`DROP INDEX "IDX_6cd9b7ea6818e862217035436c"`); - await queryRunner.query( - `CREATE TABLE "temporary_country" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "country" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "temporary_country"("id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt" FROM "country"` - ); - await queryRunner.query(`DROP TABLE "country"`); - await queryRunner.query(`ALTER TABLE "temporary_country" RENAME TO "country"`); - await queryRunner.query(`CREATE INDEX "IDX_6eba1a52ee121d100c8a0a6510" ON "country" ("isoCode") `); - await queryRunner.query(`CREATE INDEX "IDX_97ebcd8db30a408b5f907d6ff4" ON "country" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6cd9b7ea6818e862217035436c" ON "country" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_0b0fbda74f6c82c943e706a3cc"`); - await queryRunner.query(`DROP INDEX "IDX_03cc024ddc2f196dca7fead7cb"`); - await queryRunner.query(`DROP INDEX "IDX_8203f1410475748bbbc6d3029d"`); - await queryRunner.query( - `CREATE TABLE "temporary_currency" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "currency" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "temporary_currency"("id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt" FROM "currency"` - ); - await queryRunner.query(`DROP TABLE "currency"`); - await queryRunner.query(`ALTER TABLE "temporary_currency" RENAME TO "currency"`); - await queryRunner.query(`CREATE INDEX "IDX_0b0fbda74f6c82c943e706a3cc" ON "currency" ("isoCode") `); - await queryRunner.query(`CREATE INDEX "IDX_03cc024ddc2f196dca7fead7cb" ON "currency" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8203f1410475748bbbc6d3029d" ON "currency" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_2aa3fc8daa25beec4788d2be26"`); - await queryRunner.query(`DROP INDEX "IDX_15a1306132d66c63ef31f7288c"`); - await queryRunner.query(`DROP INDEX "IDX_e2c7d28bb07adc915d74437c7b"`); - await queryRunner.query(`DROP INDEX "IDX_f10372f9d038d0954d5b20635a"`); - await queryRunner.query( - `CREATE TABLE "temporary_custom_smtp" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "host" varchar NOT NULL, "port" integer NOT NULL, "secure" boolean NOT NULL, "username" varchar NOT NULL, "password" varchar NOT NULL, "isValidate" boolean NOT NULL DEFAULT (0), "fromAddress" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2aa3fc8daa25beec4788d2be26c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_15a1306132d66c63ef31f7288c1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_custom_smtp"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt" FROM "custom_smtp"` - ); - await queryRunner.query(`DROP TABLE "custom_smtp"`); - await queryRunner.query(`ALTER TABLE "temporary_custom_smtp" RENAME TO "custom_smtp"`); - await queryRunner.query(`CREATE INDEX "IDX_2aa3fc8daa25beec4788d2be26" ON "custom_smtp" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_15a1306132d66c63ef31f7288c" ON "custom_smtp" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_e2c7d28bb07adc915d74437c7b" ON "custom_smtp" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f10372f9d038d0954d5b20635a" ON "custom_smtp" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_9211f5b62988df6e95522be7da"`); - await queryRunner.query(`DROP INDEX "IDX_4b1ff44e6bae5065429dbab554"`); - await queryRunner.query(`DROP INDEX "IDX_38fb85abdf9995efcf217f5955"`); - await queryRunner.query(`DROP INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0"`); - await queryRunner.query(`DROP INDEX "IDX_0d8c964237e5061627de82df80"`); - await queryRunner.query(`DROP INDEX "IDX_443c561d45f6c57f3790a759ba"`); - await queryRunner.query( - `CREATE TABLE "temporary_deal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "probability" integer NOT NULL, "createdByUserId" varchar NOT NULL, "stageId" varchar NOT NULL, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_1ae3abc0ae1dcf6c13f49b62b5" UNIQUE ("clientId"), CONSTRAINT "FK_1ae3abc0ae1dcf6c13f49b62b56" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9211f5b62988df6e95522be7daa" FOREIGN KEY ("stageId") REFERENCES "pipeline_stage" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4b1ff44e6bae5065429dbab554b" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38fb85abdf9995efcf217f59554" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_46a3c00bfc3e36b4412d8bcdb08" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_deal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt" FROM "deal"` - ); - await queryRunner.query(`DROP TABLE "deal"`); - await queryRunner.query(`ALTER TABLE "temporary_deal" RENAME TO "deal"`); - await queryRunner.query(`CREATE INDEX "IDX_9211f5b62988df6e95522be7da" ON "deal" ("stageId") `); - await queryRunner.query(`CREATE INDEX "IDX_4b1ff44e6bae5065429dbab554" ON "deal" ("createdByUserId") `); - await queryRunner.query(`CREATE INDEX "IDX_38fb85abdf9995efcf217f5955" ON "deal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0" ON "deal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_0d8c964237e5061627de82df80" ON "deal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_443c561d45f6c57f3790a759ba" ON "deal" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_9a69f7077e0333d2c848895a1b"`); - await queryRunner.query(`DROP INDEX "IDX_d825bc6da1c52a3900a9373260"`); - await queryRunner.query(`DROP INDEX "IDX_1261c457b3035b77719556995b"`); - await queryRunner.query(`DROP INDEX "IDX_953df0eb0df3035baf140399f6"`); - await queryRunner.query(`DROP INDEX "IDX_525f4873c6edc3d94559f88900"`); - await queryRunner.query(`DROP INDEX "IDX_0af511c44de7a16beb45cc3785"`); - await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); - await queryRunner.query(`DROP INDEX "IDX_9033faf41b23c61ba201c48796"`); - await queryRunner.query(`DROP INDEX "IDX_5956ce758c01ebf8a539e8d4f0"`); - await queryRunner.query( - `CREATE TABLE "temporary_email_sent" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "content" varchar, "email" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "userId" varchar, "emailTemplateId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "status" varchar CHECK( "status" IN ('SENT','FAILED') ), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_1261c457b3035b77719556995bf" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_525f4873c6edc3d94559f88900c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0af511c44de7a16beb45cc37852" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9033faf41b23c61ba201c487969" FOREIGN KEY ("emailTemplateId") REFERENCES "email_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_email_sent"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt" FROM "email_sent"` - ); - await queryRunner.query(`DROP TABLE "email_sent"`); - await queryRunner.query(`ALTER TABLE "temporary_email_sent" RENAME TO "email_sent"`); - await queryRunner.query(`CREATE INDEX "IDX_9a69f7077e0333d2c848895a1b" ON "email_sent" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_d825bc6da1c52a3900a9373260" ON "email_sent" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1261c457b3035b77719556995b" ON "email_sent" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_953df0eb0df3035baf140399f6" ON "email_sent" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_525f4873c6edc3d94559f88900" ON "email_sent" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_0af511c44de7a16beb45cc3785" ON "email_sent" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_a954fda57cca81dc48446e73b8" ON "email_sent" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_9033faf41b23c61ba201c48796" ON "email_sent" ("emailTemplateId") `); - await queryRunner.query(`CREATE INDEX "IDX_5956ce758c01ebf8a539e8d4f0" ON "email_sent" ("status") `); - await queryRunner.query(`DROP INDEX "IDX_e37af4ab2ba0bf268bfd982634"`); - await queryRunner.query(`DROP INDEX "IDX_9e80c9ec749dfda6dbe2cd9704"`); - await queryRunner.query(`DROP INDEX "IDX_4be518a169bbcbfe92025ac574"`); - await queryRunner.query(`DROP INDEX "IDX_03d16a2fd43d7c601743440212"`); - await queryRunner.query(`DROP INDEX "IDX_93799dfaeff51de06f1e02ac41"`); - await queryRunner.query(`DROP INDEX "IDX_4ac734f2a1a3c055dca04fba99"`); - await queryRunner.query(`DROP INDEX "IDX_e3321e3575289b7ee1e8eb1042"`); - await queryRunner.query(`DROP INDEX "IDX_13247a755d17e7905d5bb4cfda"`); - await queryRunner.query( - `CREATE TABLE "temporary_email_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "email" varchar NOT NULL, "oldEmail" varchar NOT NULL, "code" varchar NOT NULL, "userId" varchar, "token" varchar, "expiredAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_93799dfaeff51de06f1e02ac414" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e37af4ab2ba0bf268bfd9826345" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_email_reset"("id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt" FROM "email_reset"` - ); - await queryRunner.query(`DROP TABLE "email_reset"`); - await queryRunner.query(`ALTER TABLE "temporary_email_reset" RENAME TO "email_reset"`); - await queryRunner.query(`CREATE INDEX "IDX_e37af4ab2ba0bf268bfd982634" ON "email_reset" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_9e80c9ec749dfda6dbe2cd9704" ON "email_reset" ("code") `); - await queryRunner.query(`CREATE INDEX "IDX_4be518a169bbcbfe92025ac574" ON "email_reset" ("oldEmail") `); - await queryRunner.query(`CREATE INDEX "IDX_03d16a2fd43d7c601743440212" ON "email_reset" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_93799dfaeff51de06f1e02ac41" ON "email_reset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_4ac734f2a1a3c055dca04fba99" ON "email_reset" ("token") `); - await queryRunner.query(`CREATE INDEX "IDX_e3321e3575289b7ee1e8eb1042" ON "email_reset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_13247a755d17e7905d5bb4cfda" ON "email_reset" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_7e688e6613930ba721b841db43"`); - await queryRunner.query(`DROP INDEX "IDX_274708db64fcce5448f2c4541c"`); - await queryRunner.query(`DROP INDEX "IDX_c160fe6234675fac031aa3e7c5"`); - await queryRunner.query(`DROP INDEX "IDX_753e005a45556b5909e11937aa"`); - await queryRunner.query(`DROP INDEX "IDX_e4932e0a726b9b07d81d8b6905"`); - await queryRunner.query(`DROP INDEX "IDX_29d60114e1968c0cd68a19e3c5"`); - await queryRunner.query( - `CREATE TABLE "temporary_email_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c160fe6234675fac031aa3e7c50" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_753e005a45556b5909e11937aaf" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_email_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt" FROM "email_template"` - ); - await queryRunner.query(`DROP TABLE "email_template"`); - await queryRunner.query(`ALTER TABLE "temporary_email_template" RENAME TO "email_template"`); - await queryRunner.query(`CREATE INDEX "IDX_7e688e6613930ba721b841db43" ON "email_template" ("languageCode") `); - await queryRunner.query(`CREATE INDEX "IDX_274708db64fcce5448f2c4541c" ON "email_template" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c160fe6234675fac031aa3e7c5" ON "email_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_753e005a45556b5909e11937aa" ON "email_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e4932e0a726b9b07d81d8b6905" ON "email_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_29d60114e1968c0cd68a19e3c5" ON "email_template" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_86cf36c137712e779dd7e2301e"`); - await queryRunner.query(`DROP INDEX "IDX_a35637bb659c59e18adb4f38f8"`); - await queryRunner.query(`DROP INDEX "IDX_d0219ada2359ede9e7b0d511ba"`); - await queryRunner.query(`DROP INDEX "IDX_64c83df9d37d9ada96edb66557"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_appointment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar, "agenda" varchar NOT NULL, "description" varchar, "location" varchar, "startDateTime" datetime NOT NULL, "endDateTime" datetime NOT NULL, "bufferTimeStart" boolean, "bufferTimeEnd" boolean, "bufferTimeInMins" integer, "breakTimeInMins" integer, "breakStartTime" datetime, "emails" varchar, "status" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2f58132c57108540887dc3e88eb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86cf36c137712e779dd7e2301e6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a35637bb659c59e18adb4f38f87" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_appointment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt" FROM "employee_appointment"` - ); - await queryRunner.query(`DROP TABLE "employee_appointment"`); - await queryRunner.query(`ALTER TABLE "temporary_employee_appointment" RENAME TO "employee_appointment"`); - await queryRunner.query( - `CREATE INDEX "IDX_86cf36c137712e779dd7e2301e" ON "employee_appointment" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a35637bb659c59e18adb4f38f8" ON "employee_appointment" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d0219ada2359ede9e7b0d511ba" ON "employee_appointment" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_64c83df9d37d9ada96edb66557" ON "employee_appointment" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_0c5266f3f488add404f92d56ec"`); - await queryRunner.query(`DROP INDEX "IDX_6912685bbb0e303eab392978d9"`); - await queryRunner.query(`DROP INDEX "IDX_caf8363b0ed7d5f24ae866ba3b"`); - await queryRunner.query(`DROP INDEX "IDX_91e0f7efcd17d20b5029fb1342"`); - await queryRunner.query(`DROP INDEX "IDX_c07390f325c847be7df93d0d17"`); - await queryRunner.query(`DROP INDEX "IDX_8fb47e8bfd26340ddaeabd24e5"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0c5266f3f488add404f92d56ec7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_caf8363b0ed7d5f24ae866ba3bb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91e0f7efcd17d20b5029fb1342d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_award"` - ); - await queryRunner.query(`DROP TABLE "employee_award"`); - await queryRunner.query(`ALTER TABLE "temporary_employee_award" RENAME TO "employee_award"`); - await queryRunner.query(`CREATE INDEX "IDX_0c5266f3f488add404f92d56ec" ON "employee_award" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_6912685bbb0e303eab392978d9" ON "employee_award" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_caf8363b0ed7d5f24ae866ba3b" ON "employee_award" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_91e0f7efcd17d20b5029fb1342" ON "employee_award" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c07390f325c847be7df93d0d17" ON "employee_award" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8fb47e8bfd26340ddaeabd24e5" ON "employee_award" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_c4668533292bf4526e61aedf74"`); - await queryRunner.query(`DROP INDEX "IDX_d3fc52d497bc44d6f493dbedc3"`); - await queryRunner.query(`DROP INDEX "IDX_90bd442869709bae9d1b18e489"`); - await queryRunner.query(`DROP INDEX "IDX_88a58d149404145ed7b3385387"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_level" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c4668533292bf4526e61aedf74a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d3fc52d497bc44d6f493dbedc3a" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_level"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt" FROM "employee_level"` - ); - await queryRunner.query(`DROP TABLE "employee_level"`); - await queryRunner.query(`ALTER TABLE "temporary_employee_level" RENAME TO "employee_level"`); - await queryRunner.query( - `CREATE INDEX "IDX_c4668533292bf4526e61aedf74" ON "employee_level" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_d3fc52d497bc44d6f493dbedc3" ON "employee_level" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_90bd442869709bae9d1b18e489" ON "employee_level" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_88a58d149404145ed7b3385387" ON "employee_level" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_329ebd01a757d1a0c3c4d628e2"`); - await queryRunner.query(`DROP INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef"`); - await queryRunner.query(`DROP INDEX "IDX_0f9cefa604913e1ab322591546"`); - await queryRunner.query(`DROP INDEX "IDX_d543336994b1f764c449e0b1d3"`); - await queryRunner.query(`DROP INDEX "IDX_587d11ffbd87adb6dff367f3cd"`); - await queryRunner.query(`DROP INDEX "IDX_aa98ea786d490db300d3dbbdb6"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_phone" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "type" varchar, "phoneNumber" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_329ebd01a757d1a0c3c4d628e29" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0f9cefa604913e1ab3225915469" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d543336994b1f764c449e0b1d3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_phone"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_phone"` - ); - await queryRunner.query(`DROP TABLE "employee_phone"`); - await queryRunner.query(`ALTER TABLE "temporary_employee_phone" RENAME TO "employee_phone"`); - await queryRunner.query(`CREATE INDEX "IDX_329ebd01a757d1a0c3c4d628e2" ON "employee_phone" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef" ON "employee_phone" ("phoneNumber") `); - await queryRunner.query( - `CREATE INDEX "IDX_0f9cefa604913e1ab322591546" ON "employee_phone" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_d543336994b1f764c449e0b1d3" ON "employee_phone" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_587d11ffbd87adb6dff367f3cd" ON "employee_phone" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_aa98ea786d490db300d3dbbdb6" ON "employee_phone" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6"`); - await queryRunner.query(`DROP INDEX "IDX_3ee5147bb1fde625fa33c0e956"`); - await queryRunner.query(`DROP INDEX "IDX_a4b5a2ea2afecf1ee254f1a704"`); - await queryRunner.query(`DROP INDEX "IDX_739f8cdce21cc72d400559ce00"`); - await queryRunner.query(`DROP INDEX "IDX_6e570174fda71e97616e9d2eea"`); - await queryRunner.query(`DROP INDEX "IDX_0ac8526c48a3daa267c86225fb"`); - await queryRunner.query(`DROP INDEX "IDX_25f8915182128f377d84b60d26"`); - await queryRunner.query(`DROP INDEX "IDX_3980b0fe1e757b092ea5323656"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "parentRecurringExpenseId" varchar, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3ee5147bb1fde625fa33c0e956b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5fde7be40b3c03bc0fdac0c2f66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_recurring_expense"` - ); - await queryRunner.query(`DROP TABLE "employee_recurring_expense"`); - await queryRunner.query( - `ALTER TABLE "temporary_employee_recurring_expense" RENAME TO "employee_recurring_expense"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6" ON "employee_recurring_expense" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3ee5147bb1fde625fa33c0e956" ON "employee_recurring_expense" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a4b5a2ea2afecf1ee254f1a704" ON "employee_recurring_expense" ("categoryName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_739f8cdce21cc72d400559ce00" ON "employee_recurring_expense" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6e570174fda71e97616e9d2eea" ON "employee_recurring_expense" ("parentRecurringExpenseId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0ac8526c48a3daa267c86225fb" ON "employee_recurring_expense" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25f8915182128f377d84b60d26" ON "employee_recurring_expense" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3980b0fe1e757b092ea5323656" ON "employee_recurring_expense" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_95ea18af6ef8123503d332240c"`); - await queryRunner.query(`DROP INDEX "IDX_710c71526edb89b2a7033abcdf"`); - await queryRunner.query(`DROP INDEX "IDX_9537fae454ebebc98ee5adb3a2"`); - await queryRunner.query(`DROP INDEX "IDX_56e96cd218a185ed59b5a8e786"`); - await queryRunner.query(`DROP INDEX "IDX_9516a627a131626d2a5738a05a"`); - await queryRunner.query(`DROP INDEX "IDX_48fae30026b4e166a3445fee6d"`); - await queryRunner.query(`DROP INDEX "IDX_01237d04f882cf1ea794678e8d"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "month" integer NOT NULL, "year" integer NOT NULL, "settingType" varchar NOT NULL, "value" integer NOT NULL, "currency" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_95ea18af6ef8123503d332240c2" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_56e96cd218a185ed59b5a8e7869" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9516a627a131626d2a5738a05a8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_setting"` - ); - await queryRunner.query(`DROP TABLE "employee_setting"`); - await queryRunner.query(`ALTER TABLE "temporary_employee_setting" RENAME TO "employee_setting"`); - await queryRunner.query(`CREATE INDEX "IDX_95ea18af6ef8123503d332240c" ON "employee_setting" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_710c71526edb89b2a7033abcdf" ON "employee_setting" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_9537fae454ebebc98ee5adb3a2" ON "employee_setting" ("settingType") `); - await queryRunner.query( - `CREATE INDEX "IDX_56e96cd218a185ed59b5a8e786" ON "employee_setting" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9516a627a131626d2a5738a05a" ON "employee_setting" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_48fae30026b4e166a3445fee6d" ON "employee_setting" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_01237d04f882cf1ea794678e8d" ON "employee_setting" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_175b7be641928a31521224daa8"`); - await queryRunner.query(`DROP INDEX "IDX_510cb87f5da169e57e694d1a5c"`); - await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); - await queryRunner.query(`DROP INDEX "IDX_c6a48286f3aa8ae903bee0d1e7"`); - await queryRunner.query(`DROP INDEX "IDX_96dfbcaa2990df01fe5bb39ccc"`); - await queryRunner.query(`DROP INDEX "IDX_f4b0d329c4a3cf79ffe9d56504"`); - await queryRunner.query(`DROP INDEX "IDX_1c0c1370ecd98040259625e17e"`); - await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "valueDate" datetime, "isActive" boolean DEFAULT (1), "short_description" varchar(200), "description" varchar, "startedWorkOn" datetime, "endWork" datetime, "payPeriod" varchar, "billRateValue" integer, "billRateCurrency" varchar, "reWeeklyLimit" integer, "offerDate" datetime, "acceptDate" datetime, "rejectDate" datetime, "employeeLevel" varchar(500), "anonymousBonus" boolean, "averageIncome" numeric, "averageBonus" numeric, "totalWorkHours" numeric DEFAULT (0), "averageExpenses" numeric, "show_anonymous_bonus" boolean, "show_average_bonus" boolean, "show_average_expenses" boolean, "show_average_income" boolean, "show_billrate" boolean, "show_payperiod" boolean, "show_start_work_on" boolean, "isJobSearchActive" boolean, "linkedInUrl" varchar, "facebookUrl" varchar, "instagramUrl" varchar, "twitterUrl" varchar, "githubUrl" varchar, "gitlabUrl" varchar, "upworkUrl" varchar, "stackoverflowUrl" varchar, "isVerified" boolean, "isVetted" boolean, "totalJobs" numeric, "jobSuccess" numeric, "profile_link" varchar, "userId" varchar NOT NULL, "contactId" varchar, "organizationPositionId" varchar, "isTrackingEnabled" boolean DEFAULT (0), "deletedAt" datetime, "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "upworkId" varchar, "linkedInId" varchar, "isOnline" boolean DEFAULT (0), "isTrackingTime" boolean DEFAULT (0), "minimumBillingRate" integer, "isAway" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "fix_relational_custom_fields" boolean, "archivedAt" datetime, CONSTRAINT "REL_f4b0d329c4a3cf79ffe9d56504" UNIQUE ("userId"), CONSTRAINT "REL_1c0c1370ecd98040259625e17e" UNIQUE ("contactId"), CONSTRAINT "FK_4b3303a6b7eb92d237a4379734e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6a48286f3aa8ae903bee0d1e72" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f4b0d329c4a3cf79ffe9d565047" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c0c1370ecd98040259625e17e2" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields" FROM "employee"` - ); - await queryRunner.query(`DROP TABLE "employee"`); - await queryRunner.query(`ALTER TABLE "temporary_employee" RENAME TO "employee"`); - await queryRunner.query(`CREATE INDEX "IDX_175b7be641928a31521224daa8" ON "employee" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_510cb87f5da169e57e694d1a5c" ON "employee" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_96dfbcaa2990df01fe5bb39ccc" ON "employee" ("profile_link") `); - await queryRunner.query(`CREATE INDEX "IDX_f4b0d329c4a3cf79ffe9d56504" ON "employee" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); - await queryRunner.query( - `CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_04c9e514ed70897f6ad8cadc3c"`); - await queryRunner.query(`DROP INDEX "IDX_5311a833ff255881454bd5b3b5"`); - await queryRunner.query(`DROP INDEX "IDX_5443ca8ed830626656d8cfecef"`); - await queryRunner.query(`DROP INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae"`); - await queryRunner.query(`DROP INDEX "IDX_b0fc293cf47f31ba512fd29bf0"`); - await queryRunner.query( - `CREATE TABLE "temporary_equipment_sharing_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5443ca8ed830626656d8cfecef7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_equipment_sharing_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt" FROM "equipment_sharing_policy"` - ); - await queryRunner.query(`DROP TABLE "equipment_sharing_policy"`); - await queryRunner.query( - `ALTER TABLE "temporary_equipment_sharing_policy" RENAME TO "equipment_sharing_policy"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_04c9e514ed70897f6ad8cadc3c" ON "equipment_sharing_policy" ("name") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5311a833ff255881454bd5b3b5" ON "equipment_sharing_policy" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5443ca8ed830626656d8cfecef" ON "equipment_sharing_policy" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae" ON "equipment_sharing_policy" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b0fc293cf47f31ba512fd29bf0" ON "equipment_sharing_policy" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10"`); - await queryRunner.query(`DROP INDEX "IDX_acad51a6362806fc499e583e40"`); - await queryRunner.query(`DROP INDEX "IDX_ea9254be07ae4a8604f0aaab19"`); - await queryRunner.query(`DROP INDEX "IDX_fa525e61fb3d8d9efec0f364a4"`); - await queryRunner.query(`DROP INDEX "IDX_70ff31cefa0f578f6fa82d2bcc"`); - await queryRunner.query(`DROP INDEX "IDX_a734598f5637cf1501288331e3"`); - await queryRunner.query( - `CREATE TABLE "temporary_equipment_sharing" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "shareRequestDay" datetime, "shareStartDay" datetime, "shareEndDay" datetime, "status" integer NOT NULL, "createdBy" varchar, "createdByName" varchar, "equipmentId" varchar, "equipmentSharingPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ecfe0ce0cd2b197249d5f1c105" FOREIGN KEY ("equipmentSharingPolicyId") REFERENCES "equipment_sharing_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_acad51a6362806fc499e583e402" FOREIGN KEY ("equipmentId") REFERENCES "equipment" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ea9254be07ae4a8604f0aaab196" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa525e61fb3d8d9efec0f364a4b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_equipment_sharing"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt" FROM "equipment_sharing"` - ); - await queryRunner.query(`DROP TABLE "equipment_sharing"`); - await queryRunner.query(`ALTER TABLE "temporary_equipment_sharing" RENAME TO "equipment_sharing"`); - await queryRunner.query( - `CREATE INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10" ON "equipment_sharing" ("equipmentSharingPolicyId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_acad51a6362806fc499e583e40" ON "equipment_sharing" ("equipmentId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ea9254be07ae4a8604f0aaab19" ON "equipment_sharing" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_fa525e61fb3d8d9efec0f364a4" ON "equipment_sharing" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_70ff31cefa0f578f6fa82d2bcc" ON "equipment_sharing" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a734598f5637cf1501288331e3" ON "equipment_sharing" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_f98ce0d210aa9f91b729d44780"`); - await queryRunner.query(`DROP INDEX "IDX_fb6808468066849ab7b7454d5f"`); - await queryRunner.query(`DROP INDEX "IDX_39e1b443404ea7fa42b3d36ccb"`); - await queryRunner.query(`DROP INDEX "IDX_d8452bfe9f18ced4ce76c4b70b"`); - await queryRunner.query( - `CREATE TABLE "temporary_equipment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "serialNumber" varchar NOT NULL, "manufacturedYear" numeric, "initialCost" numeric, "currency" varchar NOT NULL, "maxSharePeriod" numeric, "autoApproveShare" boolean NOT NULL, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0ab80a66282582ae8b0282508e7" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f98ce0d210aa9f91b729d447806" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fb6808468066849ab7b7454d5f3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_equipment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt" FROM "equipment"` - ); - await queryRunner.query(`DROP TABLE "equipment"`); - await queryRunner.query(`ALTER TABLE "temporary_equipment" RENAME TO "equipment"`); - await queryRunner.query(`CREATE INDEX "IDX_f98ce0d210aa9f91b729d44780" ON "equipment" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_fb6808468066849ab7b7454d5f" ON "equipment" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_39e1b443404ea7fa42b3d36ccb" ON "equipment" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d8452bfe9f18ced4ce76c4b70b" ON "equipment" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_233c1d351d63441aeb039d1164"`); - await queryRunner.query(`DROP INDEX "IDX_391d3f83244fea73c619aecadd"`); - await queryRunner.query(`DROP INDEX "IDX_1a4bd2a8034bb1309b4ea87882"`); - await queryRunner.query(`DROP INDEX "IDX_f1fac79e17c475f00daa4db3d2"`); - await queryRunner.query( - `CREATE TABLE "temporary_estimate_email" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "expireDate" datetime NOT NULL, "convertAcceptedEstimates" boolean, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_233c1d351d63441aeb039d1164f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_391d3f83244fea73c619aecadd9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_estimate_email"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt" FROM "estimate_email"` - ); - await queryRunner.query(`DROP TABLE "estimate_email"`); - await queryRunner.query(`ALTER TABLE "temporary_estimate_email" RENAME TO "estimate_email"`); - await queryRunner.query( - `CREATE INDEX "IDX_233c1d351d63441aeb039d1164" ON "estimate_email" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_391d3f83244fea73c619aecadd" ON "estimate_email" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_1a4bd2a8034bb1309b4ea87882" ON "estimate_email" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f1fac79e17c475f00daa4db3d2" ON "estimate_email" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_24d905ec9e127ade23754a363d"`); - await queryRunner.query(`DROP INDEX "IDX_5bde7aeb2c7fb3a421b175871e"`); - await queryRunner.query(`DROP INDEX "IDX_43459c650957e478203c738574"`); - await queryRunner.query(`DROP INDEX "IDX_9d5980ff1064e2edb77509d312"`); - await queryRunner.query(`DROP INDEX "IDX_4b02d8616129f39fca2b10e98b"`); - await queryRunner.query(`DROP INDEX "IDX_fc8818d6fde74370ec703a0135"`); - await queryRunner.query(`DROP INDEX "IDX_92fc62260c0c7ff108622850bf"`); - await queryRunner.query(`DROP INDEX "IDX_f14eee32875b112fab1139b332"`); - await queryRunner.query(`DROP INDEX "IDX_613cfa5783e164cad10dc27e58"`); - await queryRunner.query( - `CREATE TABLE "temporary_event_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" numeric NOT NULL, "durationUnit" varchar, "title" varchar, "description" varchar, "isActive" boolean DEFAULT (1), "employeeId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_24d905ec9e127ade23754a363dd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fc8818d6fde74370ec703a01352" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_92fc62260c0c7ff108622850bff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_event_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt" FROM "event_type"` - ); - await queryRunner.query(`DROP TABLE "event_type"`); - await queryRunner.query(`ALTER TABLE "temporary_event_type" RENAME TO "event_type"`); - await queryRunner.query(`CREATE INDEX "IDX_24d905ec9e127ade23754a363d" ON "event_type" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_5bde7aeb2c7fb3a421b175871e" ON "event_type" ("description") `); - await queryRunner.query(`CREATE INDEX "IDX_43459c650957e478203c738574" ON "event_type" ("title") `); - await queryRunner.query(`CREATE INDEX "IDX_9d5980ff1064e2edb77509d312" ON "event_type" ("durationUnit") `); - await queryRunner.query(`CREATE INDEX "IDX_4b02d8616129f39fca2b10e98b" ON "event_type" ("duration") `); - await queryRunner.query(`CREATE INDEX "IDX_fc8818d6fde74370ec703a0135" ON "event_type" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_92fc62260c0c7ff108622850bf" ON "event_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f14eee32875b112fab1139b332" ON "event_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_613cfa5783e164cad10dc27e58" ON "event_type" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_9c9bfe5baaf83f53533ff035fc"`); - await queryRunner.query(`DROP INDEX "IDX_37504e920ee5ca46a4000b89da"`); - await queryRunner.query(`DROP INDEX "IDX_8376e41fd82aba147a433dc097"`); - await queryRunner.query(`DROP INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc"`); - await queryRunner.query( - `CREATE TABLE "temporary_expense_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9c9bfe5baaf83f53533ff035fc0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_37504e920ee5ca46a4000b89da5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_expense_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "expense_category"` - ); - await queryRunner.query(`DROP TABLE "expense_category"`); - await queryRunner.query(`ALTER TABLE "temporary_expense_category" RENAME TO "expense_category"`); - await queryRunner.query( - `CREATE INDEX "IDX_9c9bfe5baaf83f53533ff035fc" ON "expense_category" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37504e920ee5ca46a4000b89da" ON "expense_category" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_8376e41fd82aba147a433dc097" ON "expense_category" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc" ON "expense_category" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_6d171c9d5f81095436b99da5e6"`); - await queryRunner.query(`DROP INDEX "IDX_c5fb146726ff128e600f23d0a1"`); - await queryRunner.query(`DROP INDEX "IDX_846a933af451a33b95b7b198c6"`); - await queryRunner.query(`DROP INDEX "IDX_b5bb8f62d401475fcc8c2ba35e"`); - await queryRunner.query(`DROP INDEX "IDX_3826d6ca74a08a8498fa17d330"`); - await queryRunner.query(`DROP INDEX "IDX_89508d119b1a279c037d9da151"`); - await queryRunner.query(`DROP INDEX "IDX_cbfebdb1419f9b8036a8b0546e"`); - await queryRunner.query(`DROP INDEX "IDX_dd8ab9312fb8d787982b9feebf"`); - await queryRunner.query(`DROP INDEX "IDX_0006d3025b6c92fbd4089b9465"`); - await queryRunner.query(`DROP INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9"`); - await queryRunner.query(`DROP INDEX "IDX_5f57d077c28b378a6c885e81c5"`); - await queryRunner.query(`DROP INDEX "IDX_5e7b197dbac69012dbdb4964f3"`); - await queryRunner.query(`DROP INDEX "IDX_eacb116ab0521ad9b96f2bb53b"`); - await queryRunner.query(`DROP INDEX "IDX_42eea5debc63f4d1bf89881c10"`); - await queryRunner.query(`DROP INDEX "IDX_9971c4171ae051e74b833984a3"`); - await queryRunner.query(`DROP INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4"`); - await queryRunner.query(`DROP INDEX "IDX_1aa0e5fd480214ae4851471e3c"`); - await queryRunner.query(`DROP INDEX "IDX_d77aeb93f2439ebdf4babaab4c"`); - await queryRunner.query( - `CREATE TABLE "temporary_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "typeOfExpense" varchar, "notes" varchar, "currency" varchar NOT NULL, "valueDate" datetime, "purpose" varchar, "taxType" varchar, "taxLabel" varchar, "rateValue" numeric, "receipt" varchar, "splitExpense" boolean, "reference" varchar, "status" varchar, "employeeId" varchar, "vendorId" varchar, "categoryId" varchar, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a" FOREIGN KEY ("categoryId") REFERENCES "expense_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba" FOREIGN KEY ("vendorId") REFERENCES "organization_vendor" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6d171c9d5f81095436b99da5e62" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c5fb146726ff128e600f23d0a1b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5e7b197dbac69012dbdb4964f37" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9971c4171ae051e74b833984a30" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_047b8b5c0782d5a6d4c8bfc1a4e" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "expense"` - ); - await queryRunner.query(`DROP TABLE "expense"`); - await queryRunner.query(`ALTER TABLE "temporary_expense" RENAME TO "expense"`); - await queryRunner.query(`CREATE INDEX "IDX_6d171c9d5f81095436b99da5e6" ON "expense" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c5fb146726ff128e600f23d0a1" ON "expense" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_846a933af451a33b95b7b198c6" ON "expense" ("amount") `); - await queryRunner.query(`CREATE INDEX "IDX_b5bb8f62d401475fcc8c2ba35e" ON "expense" ("typeOfExpense") `); - await queryRunner.query(`CREATE INDEX "IDX_3826d6ca74a08a8498fa17d330" ON "expense" ("notes") `); - await queryRunner.query(`CREATE INDEX "IDX_89508d119b1a279c037d9da151" ON "expense" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_cbfebdb1419f9b8036a8b0546e" ON "expense" ("purpose") `); - await queryRunner.query(`CREATE INDEX "IDX_dd8ab9312fb8d787982b9feebf" ON "expense" ("taxType") `); - await queryRunner.query(`CREATE INDEX "IDX_0006d3025b6c92fbd4089b9465" ON "expense" ("taxLabel") `); - await queryRunner.query(`CREATE INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9" ON "expense" ("rateValue") `); - await queryRunner.query(`CREATE INDEX "IDX_5f57d077c28b378a6c885e81c5" ON "expense" ("receipt") `); - await queryRunner.query(`CREATE INDEX "IDX_5e7b197dbac69012dbdb4964f3" ON "expense" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_eacb116ab0521ad9b96f2bb53b" ON "expense" ("vendorId") `); - await queryRunner.query(`CREATE INDEX "IDX_42eea5debc63f4d1bf89881c10" ON "expense" ("categoryId") `); - await queryRunner.query(`CREATE INDEX "IDX_9971c4171ae051e74b833984a3" ON "expense" ("projectId") `); - await queryRunner.query( - `CREATE INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4" ON "expense" ("organizationContactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1aa0e5fd480214ae4851471e3c" ON "expense" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d77aeb93f2439ebdf4babaab4c" ON "expense" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_54868607115e2fee3b0b764eec"`); - await queryRunner.query(`DROP INDEX "IDX_e339340014a6c4e2f57be00b0c"`); - await queryRunner.query(`DROP INDEX "IDX_d6a626bee6cddf4bc53a493bc3"`); - await queryRunner.query( - `CREATE TABLE "temporary_import-history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "file" varchar NOT NULL, "path" varchar NOT NULL, "size" integer, "status" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_54868607115e2fee3b0b764eec2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_import-history"("id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt" FROM "import-history"` - ); - await queryRunner.query(`DROP TABLE "import-history"`); - await queryRunner.query(`ALTER TABLE "temporary_import-history" RENAME TO "import-history"`); - await queryRunner.query(`CREATE INDEX "IDX_54868607115e2fee3b0b764eec" ON "import-history" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e339340014a6c4e2f57be00b0c" ON "import-history" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d6a626bee6cddf4bc53a493bc3" ON "import-history" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_a43b235c35c2c4d3263ada770c"`); - await queryRunner.query(`DROP INDEX "IDX_b90957ef81e74c43d6ae037560"`); - await queryRunner.query(`DROP INDEX "IDX_339328a7247aa09d061c642ae1"`); - await queryRunner.query( - `CREATE TABLE "temporary_import-record" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "entityType" varchar NOT NULL, "sourceId" varchar NOT NULL, "destinationId" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a43b235c35c2c4d3263ada770c6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_import-record"("id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt" FROM "import-record"` - ); - await queryRunner.query(`DROP TABLE "import-record"`); - await queryRunner.query(`ALTER TABLE "temporary_import-record" RENAME TO "import-record"`); - await queryRunner.query(`CREATE INDEX "IDX_a43b235c35c2c4d3263ada770c" ON "import-record" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_b90957ef81e74c43d6ae037560" ON "import-record" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_339328a7247aa09d061c642ae1" ON "import-record" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_6d413f9fdd5366b1b9add46483"`); - await queryRunner.query(`DROP INDEX "IDX_6a94e6b0a572f591288ac44a42"`); - await queryRunner.query(`DROP INDEX "IDX_8f71803d96dcdbcc6b19bb28d3"`); - await queryRunner.query(`DROP INDEX "IDX_4ee685760ddb60ff71f763d8f6"`); - await queryRunner.query(`DROP INDEX "IDX_e4c142f37091b47056012d34ba"`); - await queryRunner.query( - `CREATE TABLE "temporary_feature_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isEnabled" boolean NOT NULL DEFAULT (1), "featureId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_6d413f9fdd5366b1b9add464836" FOREIGN KEY ("featureId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a94e6b0a572f591288ac44a421" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8f71803d96dcdbcc6b19bb28d38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_feature_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt" FROM "feature_organization"` - ); - await queryRunner.query(`DROP TABLE "feature_organization"`); - await queryRunner.query(`ALTER TABLE "temporary_feature_organization" RENAME TO "feature_organization"`); - await queryRunner.query( - `CREATE INDEX "IDX_6d413f9fdd5366b1b9add46483" ON "feature_organization" ("featureId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6a94e6b0a572f591288ac44a42" ON "feature_organization" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8f71803d96dcdbcc6b19bb28d3" ON "feature_organization" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4ee685760ddb60ff71f763d8f6" ON "feature_organization" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e4c142f37091b47056012d34ba" ON "feature_organization" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_d4a28a8e70d450a412bf0cfb52"`); - await queryRunner.query(`DROP INDEX "IDX_c30465b5a6e0fae1c8ee7e3120"`); - await queryRunner.query(`DROP INDEX "IDX_4832be692a2dc63d67e8e93c75"`); - await queryRunner.query(`DROP INDEX "IDX_5405b67f1df904831a358df7c4"`); - await queryRunner.query(`DROP INDEX "IDX_a26cc341268d22bd55f06e3ef6"`); - await queryRunner.query( - `CREATE TABLE "temporary_feature" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar NOT NULL, "isPaid" boolean NOT NULL DEFAULT (0), "description" varchar, "image" varchar, "link" varchar NOT NULL, "status" varchar, "icon" varchar, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d4a28a8e70d450a412bf0cfb52a" FOREIGN KEY ("parentId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_feature"("id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt" FROM "feature"` - ); - await queryRunner.query(`DROP TABLE "feature"`); - await queryRunner.query(`ALTER TABLE "temporary_feature" RENAME TO "feature"`); - await queryRunner.query(`CREATE INDEX "IDX_d4a28a8e70d450a412bf0cfb52" ON "feature" ("parentId") `); - await queryRunner.query(`CREATE INDEX "IDX_c30465b5a6e0fae1c8ee7e3120" ON "feature" ("code") `); - await queryRunner.query(`CREATE INDEX "IDX_4832be692a2dc63d67e8e93c75" ON "feature" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_5405b67f1df904831a358df7c4" ON "feature" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a26cc341268d22bd55f06e3ef6" ON "feature" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_e35d0f7b794ca8850669d12c78"`); - await queryRunner.query(`DROP INDEX "IDX_d17a5159d888ac6320459eda39"`); - await queryRunner.query(`DROP INDEX "IDX_bdee8704ebeb79368ff6154fc7"`); - await queryRunner.query(`DROP INDEX "IDX_4a44905db4ca1e40b62021fdfb"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal_general_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "maxObjectives" integer NOT NULL, "maxKeyResults" integer NOT NULL, "employeeCanCreateObjective" boolean NOT NULL, "canOwnObjectives" varchar NOT NULL, "canOwnKeyResult" varchar NOT NULL, "krTypeKPI" boolean NOT NULL, "krTypeTask" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e35d0f7b794ca8850669d12c78c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d17a5159d888ac6320459eda392" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal_general_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt" FROM "goal_general_setting"` - ); - await queryRunner.query(`DROP TABLE "goal_general_setting"`); - await queryRunner.query(`ALTER TABLE "temporary_goal_general_setting" RENAME TO "goal_general_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_e35d0f7b794ca8850669d12c78" ON "goal_general_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d17a5159d888ac6320459eda39" ON "goal_general_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bdee8704ebeb79368ff6154fc7" ON "goal_general_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4a44905db4ca1e40b62021fdfb" ON "goal_general_setting" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_df7ab026698c02859ff7540809"`); - await queryRunner.query(`DROP INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf"`); - await queryRunner.query(`DROP INDEX "IDX_b4f4701ddb0e973602445ed1c6"`); - await queryRunner.query(`DROP INDEX "IDX_26311c417ba945c901c65d515d"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal_kpi_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f69e740b066c6469d1c68a4a28b" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_df7ab026698c02859ff75408093" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cc72d4e8e4284dcc8ffbf96caf4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal_kpi_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "goal_kpi_template"` - ); - await queryRunner.query(`DROP TABLE "goal_kpi_template"`); - await queryRunner.query(`ALTER TABLE "temporary_goal_kpi_template" RENAME TO "goal_kpi_template"`); - await queryRunner.query( - `CREATE INDEX "IDX_df7ab026698c02859ff7540809" ON "goal_kpi_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf" ON "goal_kpi_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_b4f4701ddb0e973602445ed1c6" ON "goal_kpi_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_26311c417ba945c901c65d515d" ON "goal_kpi_template" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d4f093ca4eb7c40db68d9a789d"`); - await queryRunner.query(`DROP INDEX "IDX_e49e37fe88a2725a38a3b05849"`); - await queryRunner.query(`DROP INDEX "IDX_43aa2985216560cd9fa93f501e"`); - await queryRunner.query(`DROP INDEX "IDX_cfc393bd9835d8259e73019226"`); - await queryRunner.query(`DROP INDEX "IDX_a96c22c51607f878c8a98bc488"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal_kpi" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d4f093ca4eb7c40db68d9a789d0" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e49e37fe88a2725a38a3b058493" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_43aa2985216560cd9fa93f501e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal_kpi"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "goal_kpi"` - ); - await queryRunner.query(`DROP TABLE "goal_kpi"`); - await queryRunner.query(`ALTER TABLE "temporary_goal_kpi" RENAME TO "goal_kpi"`); - await queryRunner.query(`CREATE INDEX "IDX_d4f093ca4eb7c40db68d9a789d" ON "goal_kpi" ("leadId") `); - await queryRunner.query(`CREATE INDEX "IDX_e49e37fe88a2725a38a3b05849" ON "goal_kpi" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_43aa2985216560cd9fa93f501e" ON "goal_kpi" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_cfc393bd9835d8259e73019226" ON "goal_kpi" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a96c22c51607f878c8a98bc488" ON "goal_kpi" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_5708fe06608c72fc77b65ae651"`); - await queryRunner.query(`DROP INDEX "IDX_774bf82989475befe301fe1bca"`); - await queryRunner.query(`DROP INDEX "IDX_cd91c5925942061527b1bc112c"`); - await queryRunner.query(`DROP INDEX "IDX_056e869152a335f88c38c5b693"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "level" varchar NOT NULL, "category" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5708fe06608c72fc77b65ae6519" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_774bf82989475befe301fe1bca5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt" FROM "goal_template"` - ); - await queryRunner.query(`DROP TABLE "goal_template"`); - await queryRunner.query(`ALTER TABLE "temporary_goal_template" RENAME TO "goal_template"`); - await queryRunner.query(`CREATE INDEX "IDX_5708fe06608c72fc77b65ae651" ON "goal_template" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_774bf82989475befe301fe1bca" ON "goal_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_cd91c5925942061527b1bc112c" ON "goal_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_056e869152a335f88c38c5b693" ON "goal_template" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_405bc5bba9ed71aefef84a29f1"`); - await queryRunner.query(`DROP INDEX "IDX_b56723b53a76ca1c171890c479"`); - await queryRunner.query(`DROP INDEX "IDX_646565982726362cc2ca4fb807"`); - await queryRunner.query(`DROP INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal_time_frame" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" varchar NOT NULL, "startDate" datetime NOT NULL, "endDate" datetime NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_405bc5bba9ed71aefef84a29f10" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b56723b53a76ca1c171890c479b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal_time_frame"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt" FROM "goal_time_frame"` - ); - await queryRunner.query(`DROP TABLE "goal_time_frame"`); - await queryRunner.query(`ALTER TABLE "temporary_goal_time_frame" RENAME TO "goal_time_frame"`); - await queryRunner.query( - `CREATE INDEX "IDX_405bc5bba9ed71aefef84a29f1" ON "goal_time_frame" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b56723b53a76ca1c171890c479" ON "goal_time_frame" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_646565982726362cc2ca4fb807" ON "goal_time_frame" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2" ON "goal_time_frame" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_4c8b4e887a994182fd6132e640"`); - await queryRunner.query(`DROP INDEX "IDX_af0a11734e70412b742ac339c8"`); - await queryRunner.query(`DROP INDEX "IDX_35526ff1063ab5fa2b20e71bd6"`); - await queryRunner.query(`DROP INDEX "IDX_ac161c1a0c0ff8e83554f097e5"`); - await queryRunner.query(`DROP INDEX "IDX_c6e8ae55a4db3584686cbf6afe"`); - await queryRunner.query(`DROP INDEX "IDX_6b4758a5442713070c9a366d0e"`); - await queryRunner.query(`DROP INDEX "IDX_72641ffde44e1a1627aa2d040f"`); - await queryRunner.query(`DROP INDEX "IDX_4a2c00a44350a063d75be80ba9"`); - await queryRunner.query( - `CREATE TABLE "temporary_goal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "deadline" varchar NOT NULL, "level" varchar NOT NULL, "progress" integer NOT NULL, "ownerTeamId" varchar, "ownerEmployeeId" varchar, "leadId" varchar, "alignedKeyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_4c8b4e887a994182fd6132e6400" FOREIGN KEY ("alignedKeyResultId") REFERENCES "key_result" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_af0a11734e70412b742ac339c88" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_35526ff1063ab5fa2b20e71bd66" FOREIGN KEY ("ownerEmployeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ac161c1a0c0ff8e83554f097e5e" FOREIGN KEY ("ownerTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6e8ae55a4db3584686cbf6afe1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b4758a5442713070c9a366d0e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_goal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt" FROM "goal"` - ); - await queryRunner.query(`DROP TABLE "goal"`); - await queryRunner.query(`ALTER TABLE "temporary_goal" RENAME TO "goal"`); - await queryRunner.query(`CREATE INDEX "IDX_4c8b4e887a994182fd6132e640" ON "goal" ("alignedKeyResultId") `); - await queryRunner.query(`CREATE INDEX "IDX_af0a11734e70412b742ac339c8" ON "goal" ("leadId") `); - await queryRunner.query(`CREATE INDEX "IDX_35526ff1063ab5fa2b20e71bd6" ON "goal" ("ownerEmployeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_ac161c1a0c0ff8e83554f097e5" ON "goal" ("ownerTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_c6e8ae55a4db3584686cbf6afe" ON "goal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_6b4758a5442713070c9a366d0e" ON "goal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_72641ffde44e1a1627aa2d040f" ON "goal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4a2c00a44350a063d75be80ba9" ON "goal" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_01856a9a730b7e79d70aa661cb"`); - await queryRunner.query(`DROP INDEX "IDX_d3675304df9971cccf96d9a7c3"`); - await queryRunner.query(`DROP INDEX "IDX_9d44ce9eb8689e578b941a6a54"`); - await queryRunner.query(`DROP INDEX "IDX_af1a212cb378bb0eed51c1b2bc"`); - await queryRunner.query( - `CREATE TABLE "temporary_image_asset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "url" varchar NOT NULL, "width" integer NOT NULL DEFAULT (0), "height" integer NOT NULL DEFAULT (0), "isFeatured" boolean NOT NULL DEFAULT (0), "thumb" varchar, "size" numeric, "externalProviderId" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_01856a9a730b7e79d70aa661cb0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d3675304df9971cccf96d9a7c34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_image_asset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived" FROM "image_asset"` - ); - await queryRunner.query(`DROP TABLE "image_asset"`); - await queryRunner.query(`ALTER TABLE "temporary_image_asset" RENAME TO "image_asset"`); - await queryRunner.query(`CREATE INDEX "IDX_01856a9a730b7e79d70aa661cb" ON "image_asset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d3675304df9971cccf96d9a7c3" ON "image_asset" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_9d44ce9eb8689e578b941a6a54" ON "image_asset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_af1a212cb378bb0eed51c1b2bc" ON "image_asset" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_29fbd3a17710a27e6f856072c0"`); - await queryRunner.query(`DROP INDEX "IDX_a05d52b7ffe89140f9cbcf114b"`); - await queryRunner.query(`DROP INDEX "IDX_20207d9f915066dfbc2210bcf1"`); - await queryRunner.query(`DROP INDEX "IDX_86b5a121b3775a1b0b7fa75680"`); - await queryRunner.query(`DROP INDEX "IDX_bd39a647a2843177723ddf733e"`); - await queryRunner.query(`DROP INDEX "IDX_64409de4711cd14e2c43371cc0"`); - await queryRunner.query(`DROP INDEX "IDX_8608b275644cfc7a0f3f585081"`); - await queryRunner.query(`DROP INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb"`); - await queryRunner.query(`DROP INDEX "IDX_aedb8b1d10c498309bed9edf53"`); - await queryRunner.query( - `CREATE TABLE "temporary_income" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "currency" varchar NOT NULL, "valueDate" datetime, "notes" varchar, "isBonus" boolean, "reference" varchar, "employeeId" varchar, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_29fbd3a17710a27e6f856072c01" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a05d52b7ffe89140f9cbcf114b3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_64409de4711cd14e2c43371cc02" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8608b275644cfc7a0f3f5850814" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_income"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt" FROM "income"` - ); - await queryRunner.query(`DROP TABLE "income"`); - await queryRunner.query(`ALTER TABLE "temporary_income" RENAME TO "income"`); - await queryRunner.query(`CREATE INDEX "IDX_29fbd3a17710a27e6f856072c0" ON "income" ("clientId") `); - await queryRunner.query(`CREATE INDEX "IDX_a05d52b7ffe89140f9cbcf114b" ON "income" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_20207d9f915066dfbc2210bcf1" ON "income" ("notes") `); - await queryRunner.query(`CREATE INDEX "IDX_86b5a121b3775a1b0b7fa75680" ON "income" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_bd39a647a2843177723ddf733e" ON "income" ("amount") `); - await queryRunner.query(`CREATE INDEX "IDX_64409de4711cd14e2c43371cc0" ON "income" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_8608b275644cfc7a0f3f585081" ON "income" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb" ON "income" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_aedb8b1d10c498309bed9edf53" ON "income" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_b208a754c7a538cb3422f39f5b"`); - await queryRunner.query(`DROP INDEX "IDX_d5ac36aa3d5919908414154fca"`); - await queryRunner.query(`DROP INDEX "IDX_3fb863167095805e33f38a0fdc"`); - await queryRunner.query(`DROP INDEX "IDX_6d43cc33c80221dbe4854b38e6"`); - await queryRunner.query(`DROP INDEX "IDX_101cd83aa75949cfb5b8eec084"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_entity_setting_tied" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationEntitySettingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3fb863167095805e33f38a0fdcc" FOREIGN KEY ("integrationEntitySettingId") REFERENCES "integration_entity_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b208a754c7a538cb3422f39f5b9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d5ac36aa3d5919908414154fca0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_entity_setting_tied"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt" FROM "integration_entity_setting_tied"` - ); - await queryRunner.query(`DROP TABLE "integration_entity_setting_tied"`); - await queryRunner.query( - `ALTER TABLE "temporary_integration_entity_setting_tied" RENAME TO "integration_entity_setting_tied"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b208a754c7a538cb3422f39f5b" ON "integration_entity_setting_tied" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5ac36aa3d5919908414154fca" ON "integration_entity_setting_tied" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3fb863167095805e33f38a0fdc" ON "integration_entity_setting_tied" ("integrationEntitySettingId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6d43cc33c80221dbe4854b38e6" ON "integration_entity_setting_tied" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_101cd83aa75949cfb5b8eec084" ON "integration_entity_setting_tied" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_23e9cfcf1bfff07dcc3254378d"`); - await queryRunner.query(`DROP INDEX "IDX_c6c01e38eebd8b26b9214b9044"`); - await queryRunner.query(`DROP INDEX "IDX_f80ff4ebbf0b33a67dce598911"`); - await queryRunner.query(`DROP INDEX "IDX_e3d407c5532edaceaa4df34623"`); - await queryRunner.query(`DROP INDEX "IDX_1c653ebceca3b9c8766131db91"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_entity_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f80ff4ebbf0b33a67dce5989117" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_23e9cfcf1bfff07dcc3254378df" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6c01e38eebd8b26b9214b90441" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_entity_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_entity_setting"` - ); - await queryRunner.query(`DROP TABLE "integration_entity_setting"`); - await queryRunner.query( - `ALTER TABLE "temporary_integration_entity_setting" RENAME TO "integration_entity_setting"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_23e9cfcf1bfff07dcc3254378d" ON "integration_entity_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c6c01e38eebd8b26b9214b9044" ON "integration_entity_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f80ff4ebbf0b33a67dce598911" ON "integration_entity_setting" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e3d407c5532edaceaa4df34623" ON "integration_entity_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c653ebceca3b9c8766131db91" ON "integration_entity_setting" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_eec3d6064578610ddc609dd360"`); - await queryRunner.query(`DROP INDEX "IDX_7022dafd72c1b92f7d50691441"`); - await queryRunner.query(`DROP INDEX "IDX_c327ea26bda3d349a1eceb5658"`); - await queryRunner.query(`DROP INDEX "IDX_c79464c4ccf7e5195d69675c15"`); - await queryRunner.query(`DROP INDEX "IDX_e63f4791631e7572ca213ac4a4"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_map" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sourceId" varchar NOT NULL, "gauzyId" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c327ea26bda3d349a1eceb5658e" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eec3d6064578610ddc609dd360e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7022dafd72c1b92f7d506914411" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_map"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_map"` - ); - await queryRunner.query(`DROP TABLE "integration_map"`); - await queryRunner.query(`ALTER TABLE "temporary_integration_map" RENAME TO "integration_map"`); - await queryRunner.query(`CREATE INDEX "IDX_eec3d6064578610ddc609dd360" ON "integration_map" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7022dafd72c1b92f7d50691441" ON "integration_map" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c327ea26bda3d349a1eceb5658" ON "integration_map" ("integrationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c79464c4ccf7e5195d69675c15" ON "integration_map" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e63f4791631e7572ca213ac4a4" ON "integration_map" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_34daf030004ad37b88f1f3d863"`); - await queryRunner.query(`DROP INDEX "IDX_369eaafb13afe9903a170077ed"`); - await queryRunner.query(`DROP INDEX "IDX_954c6b05297814776d9cb66ca7"`); - await queryRunner.query(`DROP INDEX "IDX_97c0d54aae21ccdbb5c3581642"`); - await queryRunner.query(`DROP INDEX "IDX_f515574f1251562c52fe25b6a3"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "settingsName" varchar NOT NULL, "settingsValue" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_34daf030004ad37b88f1f3d863c" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_369eaafb13afe9903a170077edb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_954c6b05297814776d9cb66ca77" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt" FROM "integration_setting"` - ); - await queryRunner.query(`DROP TABLE "integration_setting"`); - await queryRunner.query(`ALTER TABLE "temporary_integration_setting" RENAME TO "integration_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_34daf030004ad37b88f1f3d863" ON "integration_setting" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_369eaafb13afe9903a170077ed" ON "integration_setting" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_954c6b05297814776d9cb66ca7" ON "integration_setting" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_97c0d54aae21ccdbb5c3581642" ON "integration_setting" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_f515574f1251562c52fe25b6a3" ON "integration_setting" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_5487f9197c106d774bae20991c"`); - await queryRunner.query(`DROP INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46"`); - await queryRunner.query(`DROP INDEX "IDX_33ab224e7755a46fff5bc1e64e"`); - await queryRunner.query(`DROP INDEX "IDX_24e37d03ef224f1a16a35069c2"`); - await queryRunner.query(`DROP INDEX "IDX_0d6ddc27d687ca879042c5f3ce"`); - await queryRunner.query(`DROP INDEX "IDX_d0532ed8020981736b58748de6"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "integrationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "lastSyncedAt" datetime DEFAULT (CURRENT_TIMESTAMP), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_33ab224e7755a46fff5bc1e64e5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_24e37d03ef224f1a16a35069c2c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0d6ddc27d687ca879042c5f3ce3" FOREIGN KEY ("integrationId") REFERENCES "integration" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_tenant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt" FROM "integration_tenant"` - ); - await queryRunner.query(`DROP TABLE "integration_tenant"`); - await queryRunner.query(`ALTER TABLE "temporary_integration_tenant" RENAME TO "integration_tenant"`); - await queryRunner.query( - `CREATE INDEX "IDX_5487f9197c106d774bae20991c" ON "integration_tenant" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46" ON "integration_tenant" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_33ab224e7755a46fff5bc1e64e" ON "integration_tenant" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_24e37d03ef224f1a16a35069c2" ON "integration_tenant" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_0d6ddc27d687ca879042c5f3ce" ON "integration_tenant" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d0532ed8020981736b58748de6" ON "integration_tenant" ("lastSyncedAt") ` - ); - await queryRunner.query(`DROP INDEX "IDX_34a49d941459e1031c766b941f"`); - await queryRunner.query(`DROP INDEX "IDX_e7b65ef60492b1c34007736f99"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "groupName" varchar NOT NULL, "order" integer NOT NULL, "description" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_be0d67f4df84f036fab2ed89c47" UNIQUE ("name"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration_type"("id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt" FROM "integration_type"` - ); - await queryRunner.query(`DROP TABLE "integration_type"`); - await queryRunner.query(`ALTER TABLE "temporary_integration_type" RENAME TO "integration_type"`); - await queryRunner.query(`CREATE INDEX "IDX_34a49d941459e1031c766b941f" ON "integration_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e7b65ef60492b1c34007736f99" ON "integration_type" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_24981cd300007cf88601c2d616"`); - await queryRunner.query(`DROP INDEX "IDX_85d7b0f07f3e3707b4586670a9"`); - await queryRunner.query( - `CREATE TABLE "temporary_integration" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "imgSrc" varchar, "isComingSoon" boolean NOT NULL DEFAULT (0), "isPaid" boolean NOT NULL DEFAULT (0), "version" varchar, "docUrl" varchar, "isFreeTrial" boolean NOT NULL DEFAULT (0), "freeTrialPeriod" numeric DEFAULT (0), "order" integer, "provider" varchar, "redirectUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_938c19d92ad3f290ff5fc163531" UNIQUE ("name"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_integration"("id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt" FROM "integration"` - ); - await queryRunner.query(`DROP TABLE "integration"`); - await queryRunner.query(`ALTER TABLE "temporary_integration" RENAME TO "integration"`); - await queryRunner.query(`CREATE INDEX "IDX_24981cd300007cf88601c2d616" ON "integration" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_85d7b0f07f3e3707b4586670a9" ON "integration" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_7c2328f76efb850b8114797247"`); - await queryRunner.query(`DROP INDEX "IDX_68eef4ab86b67747f24f288a16"`); - await queryRunner.query(`DROP INDEX "IDX_5a182e8b3e225b14ddf6df7e6c"`); - await queryRunner.query(`DROP INDEX "IDX_900a3ed40499c79c1c289fec28"`); - await queryRunner.query(`DROP INDEX "IDX_91bfeec7a9574f458e5b592472"`); - await queryRunner.query(`DROP INDEX "IDX_bd44bcb10034bc0c5fe4427b3e"`); - await queryRunner.query(`DROP INDEX "IDX_3cef860504647ccd52d39d7dc2"`); - await queryRunner.query( - `CREATE TABLE "temporary_invite" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "status" varchar NOT NULL, "expireDate" datetime, "actionDate" datetime, "invitedById" varchar, "roleId" varchar, "code" varchar, "fullName" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7c2328f76efb850b81147972476" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_68eef4ab86b67747f24f288a16c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5a182e8b3e225b14ddf6df7e6c3" FOREIGN KEY ("invitedById") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_900a3ed40499c79c1c289fec284" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91bfeec7a9574f458e5b592472d" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_invite"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt" FROM "invite"` - ); - await queryRunner.query(`DROP TABLE "invite"`); - await queryRunner.query(`ALTER TABLE "temporary_invite" RENAME TO "invite"`); - await queryRunner.query(`CREATE INDEX "IDX_7c2328f76efb850b8114797247" ON "invite" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_68eef4ab86b67747f24f288a16" ON "invite" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_5a182e8b3e225b14ddf6df7e6c" ON "invite" ("invitedById") `); - await queryRunner.query(`CREATE INDEX "IDX_900a3ed40499c79c1c289fec28" ON "invite" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_91bfeec7a9574f458e5b592472" ON "invite" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_bd44bcb10034bc0c5fe4427b3e" ON "invite" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_3cef860504647ccd52d39d7dc2" ON "invite" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_8106063f79cce8e67790d79092"`); - await queryRunner.query(`DROP INDEX "IDX_483eb296a94d821ebedb375858"`); - await queryRunner.query(`DROP INDEX "IDX_31ec3d5a6b0985cec544c64217"`); - await queryRunner.query(`DROP INDEX "IDX_da2893697d57368470952a76f6"`); - await queryRunner.query(`DROP INDEX "IDX_856f24297f120604f8ae294276"`); - await queryRunner.query(`DROP INDEX "IDX_cc0ac824ba89deda98bb418e8c"`); - await queryRunner.query( - `CREATE TABLE "temporary_invoice_estimate_history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" varchar NOT NULL, "userId" varchar, "invoiceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "title" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cc0ac824ba89deda98bb418e8ca" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_856f24297f120604f8ae2942769" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da2893697d57368470952a76f65" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_31ec3d5a6b0985cec544c642178" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_invoice_estimate_history"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt" FROM "invoice_estimate_history"` - ); - await queryRunner.query(`DROP TABLE "invoice_estimate_history"`); - await queryRunner.query( - `ALTER TABLE "temporary_invoice_estimate_history" RENAME TO "invoice_estimate_history"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8106063f79cce8e67790d79092" ON "invoice_estimate_history" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_483eb296a94d821ebedb375858" ON "invoice_estimate_history" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_31ec3d5a6b0985cec544c64217" ON "invoice_estimate_history" ("invoiceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_da2893697d57368470952a76f6" ON "invoice_estimate_history" ("userId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_856f24297f120604f8ae294276" ON "invoice_estimate_history" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cc0ac824ba89deda98bb418e8c" ON "invoice_estimate_history" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e89749c8e8258b2ec110c0776f"`); - await queryRunner.query(`DROP INDEX "IDX_f78214cd9de76e80fe8a6305f5"`); - await queryRunner.query(`DROP INDEX "IDX_e2835fd8776ae5d56d892e087e"`); - await queryRunner.query(`DROP INDEX "IDX_b7da14d2b61cf1dd5c65188b9c"`); - await queryRunner.query( - `CREATE TABLE "temporary_invoice_item" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "price" numeric NOT NULL, "quantity" numeric NOT NULL, "totalValue" numeric NOT NULL, "applyTax" boolean, "applyDiscount" boolean, "expenseId" varchar, "invoiceId" varchar, "taskId" varchar, "employeeId" varchar, "projectId" varchar, "productId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e558df60d7d9a3e412ef0bbb844" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16f1d0e74b4d33e59c0eabdaac7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d4d92abde074b3da8054d7cfbc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62d486728b272e3b4d23a6b5db6" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_553d5aac210d22fdca5c8d48ead" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_897c33b49a04cf3db7acd336afc" FOREIGN KEY ("expenseId") REFERENCES "expense" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e89749c8e8258b2ec110c0776ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f78214cd9de76e80fe8a6305f52" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_invoice_item"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt" FROM "invoice_item"` - ); - await queryRunner.query(`DROP TABLE "invoice_item"`); - await queryRunner.query(`ALTER TABLE "temporary_invoice_item" RENAME TO "invoice_item"`); - await queryRunner.query(`CREATE INDEX "IDX_e89749c8e8258b2ec110c0776f" ON "invoice_item" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f78214cd9de76e80fe8a6305f5" ON "invoice_item" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e2835fd8776ae5d56d892e087e" ON "invoice_item" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_b7da14d2b61cf1dd5c65188b9c" ON "invoice_item" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d9e965da0f63c94983d3a1006a"`); - await queryRunner.query(`DROP INDEX "IDX_b5c33892e630b66c65d623baf8"`); - await queryRunner.query(`DROP INDEX "IDX_058ef835f99e28fc6717cd7c80"`); - await queryRunner.query(`DROP INDEX "IDX_7fb52a5f267f53b7d93af3d8c3"`); - await queryRunner.query(`DROP INDEX "IDX_850ca385c1985c1808cd4ea241"`); - await queryRunner.query(`DROP INDEX "IDX_eabacf7474d75e53d7b7046f3e"`); - await queryRunner.query( - `CREATE TABLE "temporary_invoice" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "invoiceDate" datetime, "invoiceNumber" numeric, "dueDate" datetime, "currency" varchar NOT NULL, "discountValue" numeric NOT NULL, "paid" boolean, "tax" numeric, "tax2" numeric, "terms" varchar NOT NULL, "totalValue" numeric, "status" varchar NOT NULL, "isEstimate" boolean, "isAccepted" boolean, "discountType" varchar, "taxType" varchar, "tax2Type" varchar, "invoiceType" varchar, "sentTo" varchar, "organizationContactId" varchar, "internalNote" varchar, "alreadyPaid" numeric, "amountDue" numeric, "hasRemainingAmountInvoiced" boolean, "token" varchar, "isArchived" boolean DEFAULT (0), "fromOrganizationId" varchar NOT NULL, "toContactId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_d7bed97fb47876e03fd7d7c285a" UNIQUE ("invoiceNumber"), CONSTRAINT "FK_d9e965da0f63c94983d3a1006ac" FOREIGN KEY ("toContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b5c33892e630b66c65d623baf8e" FOREIGN KEY ("fromOrganizationId") REFERENCES "organization" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_058ef835f99e28fc6717cd7c80f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7fb52a5f267f53b7d93af3d8c3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_invoice"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt" FROM "invoice"` - ); - await queryRunner.query(`DROP TABLE "invoice"`); - await queryRunner.query(`ALTER TABLE "temporary_invoice" RENAME TO "invoice"`); - await queryRunner.query(`CREATE INDEX "IDX_d9e965da0f63c94983d3a1006a" ON "invoice" ("toContactId") `); - await queryRunner.query(`CREATE INDEX "IDX_b5c33892e630b66c65d623baf8" ON "invoice" ("fromOrganizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_058ef835f99e28fc6717cd7c80" ON "invoice" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_7fb52a5f267f53b7d93af3d8c3" ON "invoice" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_850ca385c1985c1808cd4ea241" ON "invoice" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_eabacf7474d75e53d7b7046f3e" ON "invoice" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_46426ea45456e240a092b73204"`); - await queryRunner.query(`DROP INDEX "IDX_fab6b6200b9ed6fd002c1ff62a"`); - await queryRunner.query(`DROP INDEX "IDX_86c09eb673b0e66129dbdc7211"`); - await queryRunner.query(`DROP INDEX "IDX_f4e813d72dc732f16497ee2c52"`); - await queryRunner.query(`DROP INDEX "IDX_aa0e9b0cfcba1926925b025512"`); - await queryRunner.query( - `CREATE TABLE "temporary_key_result_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "unit" varchar, "targetValue" integer, "initialValue" integer, "deadline" varchar NOT NULL, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_46426ea45456e240a092b732047" FOREIGN KEY ("goalId") REFERENCES "goal_template" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bc62c3d2ffdd6f9c7f8b3dcd1c" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_fab6b6200b9ed6fd002c1ff62ab" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_86c09eb673b0e66129dbdc72111" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_key_result_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "key_result_template"` - ); - await queryRunner.query(`DROP TABLE "key_result_template"`); - await queryRunner.query(`ALTER TABLE "temporary_key_result_template" RENAME TO "key_result_template"`); - await queryRunner.query(`CREATE INDEX "IDX_46426ea45456e240a092b73204" ON "key_result_template" ("goalId") `); - await queryRunner.query( - `CREATE INDEX "IDX_fab6b6200b9ed6fd002c1ff62a" ON "key_result_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_86c09eb673b0e66129dbdc7211" ON "key_result_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f4e813d72dc732f16497ee2c52" ON "key_result_template" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_aa0e9b0cfcba1926925b025512" ON "key_result_template" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_fd4b0cb7a44ed914acdda55e29"`); - await queryRunner.query(`DROP INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65"`); - await queryRunner.query(`DROP INDEX "IDX_12b8b54f416ec9f5ec002f0a83"`); - await queryRunner.query(`DROP INDEX "IDX_94aad97b26aede6545a3226fb3"`); - await queryRunner.query( - `CREATE TABLE "temporary_key_result_update" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "owner" varchar NOT NULL, "status" varchar NOT NULL, "keyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7497a70a581e5f56f792015dd37" FOREIGN KEY ("keyResultId") REFERENCES "key_result" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fd4b0cb7a44ed914acdda55e29c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cd9cbc0d5b6d62dbb63c3b3a65b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_key_result_update"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt" FROM "key_result_update"` - ); - await queryRunner.query(`DROP TABLE "key_result_update"`); - await queryRunner.query(`ALTER TABLE "temporary_key_result_update" RENAME TO "key_result_update"`); - await queryRunner.query( - `CREATE INDEX "IDX_fd4b0cb7a44ed914acdda55e29" ON "key_result_update" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65" ON "key_result_update" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_12b8b54f416ec9f5ec002f0a83" ON "key_result_update" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_94aad97b26aede6545a3226fb3" ON "key_result_update" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_3e1d08761a717c1dd71fe67249"`); - await queryRunner.query(`DROP INDEX "IDX_4e1e975124c1d717814a4bb2ec"`); - await queryRunner.query(`DROP INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a"`); - await queryRunner.query(`DROP INDEX "IDX_38dc003f3484eff4b59918e9ae"`); - await queryRunner.query(`DROP INDEX "IDX_c89adeff0de3aedb2e772a5bf4"`); - await queryRunner.query(`DROP INDEX "IDX_5880347716f9ec5056ec15112c"`); - await queryRunner.query(`DROP INDEX "IDX_d1f45ca98f17bd84a5e430feaf"`); - await queryRunner.query(`DROP INDEX "IDX_8ac2c6b487d03157adda874789"`); - await queryRunner.query(`DROP INDEX "IDX_9b62dd2dddcde032f46a981733"`); - await queryRunner.query(`DROP INDEX "IDX_8889e2618366faefa575a8049b"`); - await queryRunner.query( - `CREATE TABLE "temporary_key_result" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "type" varchar NOT NULL, "targetValue" integer, "initialValue" integer, "unit" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "deadline" varchar NOT NULL, "hardDeadline" datetime, "softDeadline" datetime, "status" varchar NOT NULL, "weight" varchar, "ownerId" varchar NOT NULL, "leadId" varchar, "projectId" varchar, "taskId" varchar, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3e1d08761a717c1dd71fe67249b" FOREIGN KEY ("goalId") REFERENCES "goal" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4e1e975124c1d717814a4bb2ec8" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d8547e21ccb8e37ac9f0d69c1af" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38dc003f3484eff4b59918e9ae3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c89adeff0de3aedb2e772a5bf4c" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_5880347716f9ec5056ec15112cc" FOREIGN KEY ("ownerId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d1f45ca98f17bd84a5e430feaf4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8ac2c6b487d03157adda874789f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_key_result"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "key_result"` - ); - await queryRunner.query(`DROP TABLE "key_result"`); - await queryRunner.query(`ALTER TABLE "temporary_key_result" RENAME TO "key_result"`); - await queryRunner.query(`CREATE INDEX "IDX_3e1d08761a717c1dd71fe67249" ON "key_result" ("goalId") `); - await queryRunner.query(`CREATE INDEX "IDX_4e1e975124c1d717814a4bb2ec" ON "key_result" ("kpiId") `); - await queryRunner.query(`CREATE INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a" ON "key_result" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_38dc003f3484eff4b59918e9ae" ON "key_result" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_c89adeff0de3aedb2e772a5bf4" ON "key_result" ("leadId") `); - await queryRunner.query(`CREATE INDEX "IDX_5880347716f9ec5056ec15112c" ON "key_result" ("ownerId") `); - await queryRunner.query(`CREATE INDEX "IDX_d1f45ca98f17bd84a5e430feaf" ON "key_result" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_8ac2c6b487d03157adda874789" ON "key_result" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9b62dd2dddcde032f46a981733" ON "key_result" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8889e2618366faefa575a8049b" ON "key_result" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_3a7abee35dfa3c90ed491583eb"`); - await queryRunner.query(`DROP INDEX "IDX_15fcb8179bc7b0642ca78da69e"`); - await queryRunner.query( - `CREATE TABLE "temporary_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar, "is_system" boolean DEFAULT (1), "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_language"("id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt" FROM "language"` - ); - await queryRunner.query(`DROP TABLE "language"`); - await queryRunner.query(`ALTER TABLE "temporary_language" RENAME TO "language"`); - await queryRunner.query(`CREATE INDEX "IDX_3a7abee35dfa3c90ed491583eb" ON "language" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_15fcb8179bc7b0642ca78da69e" ON "language" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_20acc3c3a6c900c6ef9fc68199"`); - await queryRunner.query(`DROP INDEX "IDX_e03ddff05652be527e04abdc56"`); - await queryRunner.query(`DROP INDEX "IDX_d306a524b507f72fa8550aeffe"`); - await queryRunner.query(`DROP INDEX "IDX_533144d7ae94180235ea456625"`); - await queryRunner.query(`DROP INDEX "IDX_a03be8a86e528e2720504a041f"`); - await queryRunner.query(`DROP INDEX "IDX_0a0f972564e74c9c4905e3abcb"`); - await queryRunner.query( - `CREATE TABLE "temporary_merchant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "phone" varchar, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "currency" varchar NOT NULL DEFAULT ('USD'), "contactId" varchar, "logoId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_e03ddff05652be527e04abdc56" UNIQUE ("contactId"), CONSTRAINT "FK_20acc3c3a6c900c6ef9fc681996" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e03ddff05652be527e04abdc56f" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d306a524b507f72fa8550aeffe4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_533144d7ae94180235ea456625b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_merchant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt" FROM "merchant"` - ); - await queryRunner.query(`DROP TABLE "merchant"`); - await queryRunner.query(`ALTER TABLE "temporary_merchant" RENAME TO "merchant"`); - await queryRunner.query(`CREATE INDEX "IDX_20acc3c3a6c900c6ef9fc68199" ON "merchant" ("logoId") `); - await queryRunner.query(`CREATE INDEX "IDX_e03ddff05652be527e04abdc56" ON "merchant" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_d306a524b507f72fa8550aeffe" ON "merchant" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_533144d7ae94180235ea456625" ON "merchant" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_a03be8a86e528e2720504a041f" ON "merchant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_0a0f972564e74c9c4905e3abcb" ON "merchant" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_31626e7d39eb95b710d5a2d80f"`); - await queryRunner.query(`DROP INDEX "IDX_2e0d21aab892b5993abaac09bc"`); - await queryRunner.query(`DROP INDEX "IDX_af6423760433da72002a7f369e"`); - await queryRunner.query(`DROP INDEX "IDX_4062b5d54aa740aaff9a6c5fbb"`); - await queryRunner.query(`DROP INDEX "IDX_34c6749e2bc94b2e52e9572f32"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2e0d21aab892b5993abaac09bcd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_af6423760433da72002a7f369eb" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt" FROM "organization_award"` - ); - await queryRunner.query(`DROP TABLE "organization_award"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_award" RENAME TO "organization_award"`); - await queryRunner.query(`CREATE INDEX "IDX_31626e7d39eb95b710d5a2d80f" ON "organization_award" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_2e0d21aab892b5993abaac09bc" ON "organization_award" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_af6423760433da72002a7f369e" ON "organization_award" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_4062b5d54aa740aaff9a6c5fbb" ON "organization_award" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_34c6749e2bc94b2e52e9572f32" ON "organization_award" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd"`); - await queryRunner.query(`DROP INDEX "IDX_a86d2e378b953cb39261f457d2"`); - await queryRunner.query(`DROP INDEX "IDX_de33f92e042365d196d959e774"`); - await queryRunner.query(`DROP INDEX "IDX_6200736cb4d3617b004e5b647f"`); - await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); - await queryRunner.query(`DROP INDEX "IDX_53627a383c9817dbf1164d7dc6"`); - await queryRunner.query(`DROP INDEX "IDX_f91783c7a8565c648b65635efc"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "primaryEmail" varchar, "primaryPhone" varchar, "inviteStatus" varchar, "notes" varchar, "contactType" varchar CHECK( "contactType" IN ('CLIENT','CUSTOMER','LEAD') ) NOT NULL DEFAULT ('CLIENT'), "imageUrl" varchar(500), "budget" integer, "budgetType" varchar CHECK( "budgetType" IN ('hours','cost') ) DEFAULT ('cost'), "createdBy" varchar, "contactId" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_a86d2e378b953cb39261f457d2" UNIQUE ("contactId"), CONSTRAINT "FK_8cfcdc6bc8fb55e273d9ace5fd5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a86d2e378b953cb39261f457d26" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6200736cb4d3617b004e5b647ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e68c43e315ad3aaea4e99cf461d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt" FROM "organization_contact"` - ); - await queryRunner.query(`DROP TABLE "organization_contact"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_contact" RENAME TO "organization_contact"`); - await queryRunner.query(`CREATE INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd" ON "organization_contact" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_6200736cb4d3617b004e5b647f" ON "organization_contact" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e68c43e315ad3aaea4e99cf461" ON "organization_contact" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_53627a383c9817dbf1164d7dc6" ON "organization_contact" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f91783c7a8565c648b65635efc" ON "organization_contact" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_91b652409dc1fb2f712590dd21"`); - await queryRunner.query(`DROP INDEX "IDX_c61a562a2379d1c0077fe7de33"`); - await queryRunner.query(`DROP INDEX "IDX_b3644ff7cd65239e29d292a41d"`); - await queryRunner.query(`DROP INDEX "IDX_6139cd4c620e81aefd4895d370"`); - await queryRunner.query(`DROP INDEX "IDX_b65059949804b20048b1c86c3d"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_department" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c61a562a2379d1c0077fe7de332" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3644ff7cd65239e29d292a41d1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_department"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_department"` - ); - await queryRunner.query(`DROP TABLE "organization_department"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_department" RENAME TO "organization_department"`); - await queryRunner.query(`CREATE INDEX "IDX_91b652409dc1fb2f712590dd21" ON "organization_department" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c61a562a2379d1c0077fe7de33" ON "organization_department" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b3644ff7cd65239e29d292a41d" ON "organization_department" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6139cd4c620e81aefd4895d370" ON "organization_department" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b65059949804b20048b1c86c3d" ON "organization_department" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_c129dee7d1cb84e01e69b5e2c6"`); - await queryRunner.query(`DROP INDEX "IDX_4bc83945c022a862a33629ff1e"`); - await queryRunner.query(`DROP INDEX "IDX_1057ec001a4c6b258658143047"`); - await queryRunner.query(`DROP INDEX "IDX_e5edb48261db95f46c3b4d34a5"`); - await queryRunner.query(`DROP INDEX "IDX_72c6a8ad9de5c04b2b689fd229"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "documentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c129dee7d1cb84e01e69b5e2c66" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4bc83945c022a862a33629ff1e1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1057ec001a4c6b258658143047a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt" FROM "organization_document"` - ); - await queryRunner.query(`DROP TABLE "organization_document"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_document" RENAME TO "organization_document"`); - await queryRunner.query( - `CREATE INDEX "IDX_c129dee7d1cb84e01e69b5e2c6" ON "organization_document" ("documentId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4bc83945c022a862a33629ff1e" ON "organization_document" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1057ec001a4c6b258658143047" ON "organization_document" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e5edb48261db95f46c3b4d34a5" ON "organization_document" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_72c6a8ad9de5c04b2b689fd229" ON "organization_document" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a583cfe32f492f5ba99b7bb205"`); - await queryRunner.query(`DROP INDEX "IDX_227b5bd9867287cbbeece8f6ba"`); - await queryRunner.query(`DROP INDEX "IDX_880f3cce5e03f42bec3da6e6dc"`); - await queryRunner.query(`DROP INDEX "IDX_cc096d49e2399e89cdf32297da"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_employment_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a583cfe32f492f5ba99b7bb2050" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_227b5bd9867287cbbeece8f6ba9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_employment_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_employment_type"` - ); - await queryRunner.query(`DROP TABLE "organization_employment_type"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_employment_type" RENAME TO "organization_employment_type"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a583cfe32f492f5ba99b7bb205" ON "organization_employment_type" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_227b5bd9867287cbbeece8f6ba" ON "organization_employment_type" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_880f3cce5e03f42bec3da6e6dc" ON "organization_employment_type" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cc096d49e2399e89cdf32297da" ON "organization_employment_type" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_020516e74a57cb85d75381e841"`); - await queryRunner.query(`DROP INDEX "IDX_4513931e2d530f78d7144c8c7c"`); - await queryRunner.query(`DROP INDEX "IDX_225e476592214e32e117a85213"`); - await queryRunner.query(`DROP INDEX "IDX_b79e8d45a3ef5503579643f5de"`); - await queryRunner.query(`DROP INDEX "IDX_6577ec9ca4cef331a507264d44"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "languageCode" varchar NOT NULL, "name" varchar NOT NULL, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_020516e74a57cb85d75381e841a" FOREIGN KEY ("languageCode") REFERENCES "language" ("code") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4513931e2d530f78d7144c8c7cd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_225e476592214e32e117a85213c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_language"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt" FROM "organization_language"` - ); - await queryRunner.query(`DROP TABLE "organization_language"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_language" RENAME TO "organization_language"`); - await queryRunner.query( - `CREATE INDEX "IDX_020516e74a57cb85d75381e841" ON "organization_language" ("languageCode") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4513931e2d530f78d7144c8c7c" ON "organization_language" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_225e476592214e32e117a85213" ON "organization_language" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b79e8d45a3ef5503579643f5de" ON "organization_language" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6577ec9ca4cef331a507264d44" ON "organization_language" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3f02c20145af9997253531349c"`); - await queryRunner.query(`DROP INDEX "IDX_a0409e39f23ff6d418f2c03df5"`); - await queryRunner.query(`DROP INDEX "IDX_a8f497b1006ec967964abb0d49"`); - await queryRunner.query(`DROP INDEX "IDX_7317abf7a05a169783b6aa7932"`); - await queryRunner.query(`DROP INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_position" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a0409e39f23ff6d418f2c03df58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a8f497b1006ec967964abb0d497" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_position"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "organization_position"` - ); - await queryRunner.query(`DROP TABLE "organization_position"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_position" RENAME TO "organization_position"`); - await queryRunner.query(`CREATE INDEX "IDX_3f02c20145af9997253531349c" ON "organization_position" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_a0409e39f23ff6d418f2c03df5" ON "organization_position" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a8f497b1006ec967964abb0d49" ON "organization_position" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7317abf7a05a169783b6aa7932" ON "organization_position" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f" ON "organization_position" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "organization_project"` - ); - await queryRunner.query(`DROP TABLE "organization_project"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query(`DROP INDEX "IDX_e6b6555e5fc6c5120110a0195c"`); - await queryRunner.query(`DROP INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0"`); - await queryRunner.query(`DROP INDEX "IDX_7fd3c8f54c01943b283080aefa"`); - await queryRunner.query(`DROP INDEX "IDX_86438fbaa1d857f32f66b24885"`); - await queryRunner.query(`DROP INDEX "IDX_cd928adcb5ebb00c9f2c57e390"`); - await queryRunner.query(`DROP INDEX "IDX_8a7a4d4206c003c3827c5afe5d"`); - await queryRunner.query(`DROP INDEX "IDX_a56086e95fb2627ba2a3dd2eaa"`); - await queryRunner.query(`DROP INDEX "IDX_f33638d289aff2306328c32a8c"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_module" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" text, "status" varchar, "startDate" datetime, "endDate" datetime, "public" boolean DEFAULT (0), "isFavorite" boolean DEFAULT (0), "parentId" varchar, "projectId" varchar, "creatorId" varchar, "managerId" varchar, "archivedAt" datetime, CONSTRAINT "FK_e6b6555e5fc6c5120110a0195cd" FOREIGN KEY ("managerId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f2054a6a2d4b9c17624b9c8a01" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd3c8f54c01943b283080aefa3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bb6fbfa64cf5d5977c2e5346a9" FOREIGN KEY ("parentId") REFERENCES "organization_project_module" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_cd928adcb5ebb00c9f2c57e3908" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a7a4d4206c003c3827c5afe5dc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_module"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId" FROM "organization_project_module"` - ); - await queryRunner.query(`DROP TABLE "organization_project_module"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_module" RENAME TO "organization_project_module"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e6b6555e5fc6c5120110a0195c" ON "organization_project_module" ("managerId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0" ON "organization_project_module" ("creatorId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7fd3c8f54c01943b283080aefa" ON "organization_project_module" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_86438fbaa1d857f32f66b24885" ON "organization_project_module" ("status") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cd928adcb5ebb00c9f2c57e390" ON "organization_project_module" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a7a4d4206c003c3827c5afe5d" ON "organization_project_module" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a56086e95fb2627ba2a3dd2eaa" ON "organization_project_module" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f33638d289aff2306328c32a8c" ON "organization_project_module" ("isActive") ` - ); - await queryRunner.query(`DROP INDEX "IDX_637ac2c467df4bc3b71795a866"`); - await queryRunner.query(`DROP INDEX "IDX_61387780d015923453f4b015b4"`); - await queryRunner.query(`DROP INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b"`); - await queryRunner.query(`DROP INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e"`); - await queryRunner.query(`DROP INDEX "IDX_0b19a287858af40661bd3eb741"`); - await queryRunner.query(`DROP INDEX "IDX_9ad08dbc039d08279dae2dd94e"`); - await queryRunner.query(`DROP INDEX "IDX_f3ef2000abb9762b138cc5a1b3"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "splitExpense" boolean, "parentRecurringExpenseId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_8a12e7a0d47d3c6a6b35f7984e3" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0b19a287858af40661bd3eb7411" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt" FROM "organization_recurring_expense"` - ); - await queryRunner.query(`DROP TABLE "organization_recurring_expense"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_recurring_expense" RENAME TO "organization_recurring_expense"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_637ac2c467df4bc3b71795a866" ON "organization_recurring_expense" ("parentRecurringExpenseId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_61387780d015923453f4b015b4" ON "organization_recurring_expense" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b" ON "organization_recurring_expense" ("categoryName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e" ON "organization_recurring_expense" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0b19a287858af40661bd3eb741" ON "organization_recurring_expense" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9ad08dbc039d08279dae2dd94e" ON "organization_recurring_expense" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3ef2000abb9762b138cc5a1b3" ON "organization_recurring_expense" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_8a1fe8afb3aa672bae5993fbe7"`); - await queryRunner.query(`DROP INDEX "IDX_f57ad03c4e471bd8530494ea63"`); - await queryRunner.query(`DROP INDEX "IDX_5596b4fa7fb2ceb0955580becd"`); - await queryRunner.query(`DROP INDEX "IDX_76e53f9609ca05477d50980743"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_sprint" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "projectId" varchar NOT NULL, "goal" varchar, "length" integer NOT NULL DEFAULT (7), "startDate" datetime, "endDate" datetime, "dayStart" integer, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a140b7e30ff3455551a0fd599fb" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8a1fe8afb3aa672bae5993fbe7d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f57ad03c4e471bd8530494ea63d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_sprint"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt" FROM "organization_sprint"` - ); - await queryRunner.query(`DROP TABLE "organization_sprint"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_sprint" RENAME TO "organization_sprint"`); - await queryRunner.query( - `CREATE INDEX "IDX_8a1fe8afb3aa672bae5993fbe7" ON "organization_sprint" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f57ad03c4e471bd8530494ea63" ON "organization_sprint" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_5596b4fa7fb2ceb0955580becd" ON "organization_sprint" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_76e53f9609ca05477d50980743" ON "organization_sprint" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_20a290f166c0810eafbf271717"`); - await queryRunner.query(`DROP INDEX "IDX_19ab7adf33199bc6f913db277d"`); - await queryRunner.query(`DROP INDEX "IDX_5830901876e426adfc15fb7341"`); - await queryRunner.query(`DROP INDEX "IDX_582768159ef0c749e8552ea9bc"`); - await queryRunner.query(`DROP INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3"`); - await queryRunner.query(`DROP INDEX "IDX_b7be7e61daf2b5af3232c9c4d6"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_task_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isTasksPrivacyEnabled" boolean NOT NULL DEFAULT (1), "isTasksMultipleAssigneesEnabled" boolean NOT NULL DEFAULT (1), "isTasksManualTimeEnabled" boolean NOT NULL DEFAULT (1), "isTasksGroupEstimationEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInHoursEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInStoryPointsEnabled" boolean NOT NULL DEFAULT (1), "isTasksProofOfCompletionEnabled" boolean NOT NULL DEFAULT (1), "tasksProofOfCompletionType" varchar NOT NULL DEFAULT ('PRIVATE'), "isTasksLinkedEnabled" boolean NOT NULL DEFAULT (1), "isTasksCommentsEnabled" boolean NOT NULL DEFAULT (1), "isTasksHistoryEnabled" boolean NOT NULL DEFAULT (1), "isTasksAcceptanceCriteriaEnabled" boolean NOT NULL DEFAULT (1), "isTasksDraftsEnabled" boolean NOT NULL DEFAULT (1), "isTasksNotifyLeftEnabled" boolean NOT NULL DEFAULT (1), "tasksNotifyLeftPeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoCloseEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoClosePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoArchiveEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoArchivePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoStatusEnabled" boolean NOT NULL DEFAULT (1), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_20a290f166c0810eafbf2717171" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_19ab7adf33199bc6f913db277d7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5830901876e426adfc15fb7341b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_582768159ef0c749e8552ea9bcd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_task_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "organization_task_setting"` - ); - await queryRunner.query(`DROP TABLE "organization_task_setting"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_task_setting" RENAME TO "organization_task_setting"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_20a290f166c0810eafbf271717" ON "organization_task_setting" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_19ab7adf33199bc6f913db277d" ON "organization_task_setting" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5830901876e426adfc15fb7341" ON "organization_task_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_582768159ef0c749e8552ea9bc" ON "organization_task_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3" ON "organization_task_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b7be7e61daf2b5af3232c9c4d6" ON "organization_task_setting" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_752d7a0fe6597ee6bbc6502a12"`); - await queryRunner.query(`DROP INDEX "IDX_70fcc451944fbde73d223c2af3"`); - await queryRunner.query(`DROP INDEX "IDX_fe12e1b76bbb76209134d9bdc2"`); - await queryRunner.query(`DROP INDEX "IDX_d8eba1c0e500c60be1b69c1e77"`); - await queryRunner.query(`DROP INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0"`); - await queryRunner.query(`DROP INDEX "IDX_a2a5601d799fbfc29c17b99243"`); - await queryRunner.query(`DROP INDEX "IDX_ce83034f38496f5fe3f1979697"`); - await queryRunner.query(`DROP INDEX "IDX_719aeb37fa7a1dd80d25336a0c"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_team_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "organizationTeamId" varchar NOT NULL, "employeeId" varchar NOT NULL, "roleId" varchar, "isTrackingEnabled" boolean DEFAULT (1), "activeTaskId" varchar, "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "order" integer, "archivedAt" datetime, CONSTRAINT "FK_fe12e1b76bbb76209134d9bdc2e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d8eba1c0e500c60be1b69c1e777" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dc83cdd7c519d73afc0d8bdf09" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2a5601d799fbfc29c17b99243f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ce83034f38496f5fe3f19796977" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_719aeb37fa7a1dd80d25336a0cf" FOREIGN KEY ("activeTaskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_team_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order" FROM "organization_team_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_team_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_team_employee" RENAME TO "organization_team_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_752d7a0fe6597ee6bbc6502a12" ON "organization_team_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_70fcc451944fbde73d223c2af3" ON "organization_team_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fe12e1b76bbb76209134d9bdc2" ON "organization_team_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d8eba1c0e500c60be1b69c1e77" ON "organization_team_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0" ON "organization_team_employee" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a2a5601d799fbfc29c17b99243" ON "organization_team_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ce83034f38496f5fe3f1979697" ON "organization_team_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_719aeb37fa7a1dd80d25336a0c" ON "organization_team_employee" ("activeTaskId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_d9529008c733cb90044b8c2ad6"`); - await queryRunner.query(`DROP INDEX "IDX_c15823bf3f63b1fe331d9de662"`); - await queryRunner.query(`DROP INDEX "IDX_5e73656ce0355347477c42ae19"`); - await queryRunner.query(`DROP INDEX "IDX_171b852be7c1f387eca93775aa"`); - await queryRunner.query(`DROP INDEX "IDX_29ece7e3bb764028387cdbc888"`); - await queryRunner.query(`DROP INDEX "IDX_b027ee2cb18245356b8d963d2f"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_team_join_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "email" varchar NOT NULL, "fullName" varchar, "linkAddress" varchar, "position" varchar, "status" varchar, "code" varchar, "token" varchar, "expiredAt" datetime, "userId" varchar, "organizationTeamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_171b852be7c1f387eca93775aad" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e73656ce0355347477c42ae19b" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c15823bf3f63b1fe331d9de6625" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d9529008c733cb90044b8c2ad6b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_team_join_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "organization_team_join_request"` - ); - await queryRunner.query(`DROP TABLE "organization_team_join_request"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_team_join_request" RENAME TO "organization_team_join_request"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d9529008c733cb90044b8c2ad6" ON "organization_team_join_request" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c15823bf3f63b1fe331d9de662" ON "organization_team_join_request" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5e73656ce0355347477c42ae19" ON "organization_team_join_request" ("userId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_171b852be7c1f387eca93775aa" ON "organization_team_join_request" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_29ece7e3bb764028387cdbc888" ON "organization_team_join_request" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b027ee2cb18245356b8d963d2f" ON "organization_team_join_request" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e22ab0f1236b1a07785b641727"`); - await queryRunner.query(`DROP INDEX "IDX_176f5ed3c4534f3110d423d569"`); - await queryRunner.query(`DROP INDEX "IDX_eef1c19a0cb5321223cfe3286c"`); - await queryRunner.query(`DROP INDEX "IDX_103ae3eb65f4b091efc55cb532"`); - await queryRunner.query(`DROP INDEX "IDX_da625f694eb1e23e585f301008"`); - await queryRunner.query(`DROP INDEX "IDX_51e91be110fa0b8e70066f5727"`); - await queryRunner.query(`DROP INDEX "IDX_722d648e0b83267d4a66332ccb"`); - await queryRunner.query(`DROP INDEX "IDX_38f1d96e8c2d59e4f0f84209ab"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "prefix" varchar, "createdById" varchar, "public" boolean DEFAULT (0), "profile_link" varchar, "logo" varchar, "imageId" varchar, "color" varchar, "emoji" varchar, "teamSize" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "shareProfileView" boolean DEFAULT (1), "requirePlanToTrack" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_176f5ed3c4534f3110d423d5690" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eef1c19a0cb5321223cfe3286c4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da625f694eb1e23e585f3010082" FOREIGN KEY ("createdById") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_51e91be110fa0b8e70066f5727f" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack" FROM "organization_team"` - ); - await queryRunner.query(`DROP TABLE "organization_team"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_team" RENAME TO "organization_team"`); - await queryRunner.query( - `CREATE INDEX "IDX_e22ab0f1236b1a07785b641727" ON "organization_team" ("profile_link") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_176f5ed3c4534f3110d423d569" ON "organization_team" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_eef1c19a0cb5321223cfe3286c" ON "organization_team" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_103ae3eb65f4b091efc55cb532" ON "organization_team" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_da625f694eb1e23e585f301008" ON "organization_team" ("createdById") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_51e91be110fa0b8e70066f5727" ON "organization_team" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_722d648e0b83267d4a66332ccb" ON "organization_team" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_38f1d96e8c2d59e4f0f84209ab" ON "organization_team" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_e56e80136b07ecd52545368611"`); - await queryRunner.query(`DROP INDEX "IDX_56dd132aa3743cfa9b034d020e"`); - await queryRunner.query(`DROP INDEX "IDX_7e0bf6063e1728c9813d5da7ca"`); - await queryRunner.query(`DROP INDEX "IDX_04c6320f910056ecb11b147ac8"`); - await queryRunner.query(`DROP INDEX "IDX_266972cd6ff9656eec8818e12d"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_vendor" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "email" varchar, "phone" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_56dd132aa3743cfa9b034d020eb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e0bf6063e1728c9813d5da7caa" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_vendor"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt" FROM "organization_vendor"` - ); - await queryRunner.query(`DROP TABLE "organization_vendor"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_vendor" RENAME TO "organization_vendor"`); - await queryRunner.query(`CREATE INDEX "IDX_e56e80136b07ecd52545368611" ON "organization_vendor" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_56dd132aa3743cfa9b034d020e" ON "organization_vendor" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_7e0bf6063e1728c9813d5da7ca" ON "organization_vendor" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_04c6320f910056ecb11b147ac8" ON "organization_vendor" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_266972cd6ff9656eec8818e12d" ON "organization_vendor" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b2091c1795f1d0d919b278ab23"`); - await queryRunner.query(`DROP INDEX "IDX_6de52b8f3de32abee3df2628a3"`); - await queryRunner.query(`DROP INDEX "IDX_745a293c8b2c750bc421fa0633"`); - await queryRunner.query(`DROP INDEX "IDX_c21e615583a3ebbb0977452afb"`); - await queryRunner.query(`DROP INDEX "IDX_03e5eecc2328eb545ff748cbdd"`); - await queryRunner.query(`DROP INDEX "IDX_40460ab803bf6e5a62b75a35c5"`); - await queryRunner.query(`DROP INDEX "IDX_6cc2b2052744e352834a4c9e78"`); - await queryRunner.query(`DROP INDEX "IDX_b03a8a28f6ebdb6df8f630216b"`); - await queryRunner.query(`DROP INDEX "IDX_f37d866c3326eca5f579cef35c"`); - await queryRunner.query(`DROP INDEX "IDX_c75285bf286b17c7ca5537857b"`); - await queryRunner.query(`DROP INDEX "IDX_9ea70bf5c390b00e7bb96b86ed"`); - await queryRunner.query(`DROP INDEX "IDX_15458cef74076623c270500053"`); - await queryRunner.query(`DROP INDEX "IDX_2360aa7a4b5ab99e026584f305"`); - await queryRunner.query(`DROP INDEX "IDX_7965db2b12872551b586f76dd7"`); - await queryRunner.query(`DROP INDEX "IDX_47b6a97e09895a06606a4a8042"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isDefault" boolean NOT NULL DEFAULT (0), "profile_link" varchar, "banner" varchar, "totalEmployees" integer, "short_description" varchar, "client_focus" varchar, "overview" varchar, "imageUrl" varchar(500), "currency" varchar NOT NULL, "valueDate" datetime, "defaultValueDateType" varchar CHECK( "defaultValueDateType" IN ('TODAY','END_OF_MONTH','START_OF_MONTH') ) DEFAULT ('TODAY'), "isActive" boolean DEFAULT (1), "defaultAlignmentType" varchar, "timeZone" varchar, "regionCode" varchar, "brandColor" varchar, "dateFormat" varchar, "officialName" varchar, "startWeekOn" varchar, "taxId" varchar, "numberFormat" varchar, "minimumProjectSize" varchar, "bonusType" varchar, "bonusPercentage" integer, "invitesAllowed" boolean DEFAULT (1), "show_income" boolean, "show_profits" boolean, "show_bonuses_paid" boolean, "show_total_hours" boolean, "show_minimum_project_size" boolean, "show_projects_count" boolean, "show_clients_count" boolean, "show_clients" boolean, "show_employees_count" boolean, "inviteExpiryPeriod" integer, "fiscalStartDate" datetime, "fiscalEndDate" datetime, "registrationDate" datetime, "futureDateAllowed" boolean, "allowManualTime" boolean NOT NULL DEFAULT (1), "allowModifyTime" boolean NOT NULL DEFAULT (1), "allowDeleteTime" boolean NOT NULL DEFAULT (1), "requireReason" boolean NOT NULL DEFAULT (0), "requireDescription" boolean NOT NULL DEFAULT (0), "requireProject" boolean NOT NULL DEFAULT (0), "requireTask" boolean NOT NULL DEFAULT (0), "requireClient" boolean NOT NULL DEFAULT (0), "timeFormat" integer NOT NULL DEFAULT (12), "separateInvoiceItemTaxAndDiscount" boolean, "website" varchar, "fiscalInformation" varchar, "currencyPosition" varchar NOT NULL DEFAULT ('LEFT'), "discountAfterTax" boolean, "defaultStartTime" varchar, "defaultEndTime" varchar, "defaultInvoiceEstimateTerms" varchar, "convertAcceptedEstimates" boolean, "daysUntilDue" integer, "contactId" varchar, "allowTrackInactivity" boolean NOT NULL DEFAULT (1), "inactivityTimeLimit" integer NOT NULL DEFAULT (10), "activityProofDuration" integer NOT NULL DEFAULT (1), "isRemoveIdleTime" boolean NOT NULL DEFAULT (0), "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "imageId" varchar, "upworkOrganizationId" varchar, "upworkOrganizationName" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "randomScreenshot" boolean DEFAULT (0), "trackOnSleep" boolean DEFAULT (0), "screenshotFrequency" numeric NOT NULL DEFAULT (10), "enforced" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_745a293c8b2c750bc421fa06332" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7965db2b12872551b586f76dd79" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_47b6a97e09895a06606a4a80421" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization"("id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced" FROM "organization"` - ); - await queryRunner.query(`DROP TABLE "organization"`); - await queryRunner.query(`ALTER TABLE "temporary_organization" RENAME TO "organization"`); - await queryRunner.query(`CREATE INDEX "IDX_b2091c1795f1d0d919b278ab23" ON "organization" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_6de52b8f3de32abee3df2628a3" ON "organization" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_745a293c8b2c750bc421fa0633" ON "organization" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c21e615583a3ebbb0977452afb" ON "organization" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_03e5eecc2328eb545ff748cbdd" ON "organization" ("isDefault") `); - await queryRunner.query(`CREATE INDEX "IDX_40460ab803bf6e5a62b75a35c5" ON "organization" ("profile_link") `); - await queryRunner.query(`CREATE INDEX "IDX_6cc2b2052744e352834a4c9e78" ON "organization" ("banner") `); - await queryRunner.query(`CREATE INDEX "IDX_b03a8a28f6ebdb6df8f630216b" ON "organization" ("totalEmployees") `); - await queryRunner.query( - `CREATE INDEX "IDX_f37d866c3326eca5f579cef35c" ON "organization" ("short_description") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c75285bf286b17c7ca5537857b" ON "organization" ("client_focus") `); - await queryRunner.query(`CREATE INDEX "IDX_9ea70bf5c390b00e7bb96b86ed" ON "organization" ("overview") `); - await queryRunner.query(`CREATE INDEX "IDX_15458cef74076623c270500053" ON "organization" ("currency") `); - await queryRunner.query( - `CREATE INDEX "IDX_2360aa7a4b5ab99e026584f305" ON "organization" ("defaultValueDateType") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_7965db2b12872551b586f76dd7" ON "organization" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_47b6a97e09895a06606a4a8042" ON "organization" ("imageId") `); - await queryRunner.query(`DROP INDEX "IDX_1fa632f2d12a06ef8dcc00858f"`); - await queryRunner.query(`DROP INDEX "IDX_e71a736d52820b568f6b0ca203"`); - await queryRunner.query(`DROP INDEX "IDX_380c03025a41ad032191f1ef2d"`); - await queryRunner.query(`DROP INDEX "IDX_1c88db6e50f0704688d1f1978c"`); - await queryRunner.query(`DROP INDEX "IDX_36e929b98372d961bb63bd4b4e"`); - await queryRunner.query( - `CREATE TABLE "temporary_password_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "email" varchar NOT NULL, "token" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "tenantId" varchar, "archivedAt" datetime, CONSTRAINT "FK_1fa632f2d12a06ef8dcc00858ff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_password_reset"("id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId") SELECT "id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId" FROM "password_reset"` - ); - await queryRunner.query(`DROP TABLE "password_reset"`); - await queryRunner.query(`ALTER TABLE "temporary_password_reset" RENAME TO "password_reset"`); - await queryRunner.query(`CREATE INDEX "IDX_1fa632f2d12a06ef8dcc00858f" ON "password_reset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e71a736d52820b568f6b0ca203" ON "password_reset" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_380c03025a41ad032191f1ef2d" ON "password_reset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1c88db6e50f0704688d1f1978c" ON "password_reset" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_36e929b98372d961bb63bd4b4e" ON "password_reset" ("token") `); - await queryRunner.query(`DROP INDEX "IDX_82753b9e315af84b20eaf84d77"`); - await queryRunner.query(`DROP INDEX "IDX_8846e403ec45e1ad8c309f91a3"`); - await queryRunner.query(`DROP INDEX "IDX_3f13c738eff604a85700746ec7"`); - await queryRunner.query(`DROP INDEX "IDX_87223c7f1d4c2ca51cf6992784"`); - await queryRunner.query(`DROP INDEX "IDX_62ef561a3bb084a7d12dad8a2d"`); - await queryRunner.query(`DROP INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9"`); - await queryRunner.query(`DROP INDEX "IDX_6959c37c3acf0832103a253570"`); - await queryRunner.query(`DROP INDEX "IDX_16a49d62227bf23686b77b5a21"`); - await queryRunner.query(`DROP INDEX "IDX_8c4018eab11e92c3b09583495f"`); - await queryRunner.query( - `CREATE TABLE "temporary_payment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "paymentDate" datetime, "amount" numeric, "note" varchar, "currency" varchar NOT NULL, "paymentMethod" varchar, "overdue" boolean, "employeeId" varchar, "invoiceId" varchar, "recordedById" varchar NOT NULL, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_82753b9e315af84b20eaf84d778" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_8846e403ec45e1ad8c309f91a37" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3f13c738eff604a85700746ec7d" FOREIGN KEY ("recordedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_87223c7f1d4c2ca51cf69927844" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62ef561a3bb084a7d12dad8a2d9" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_be7fcc9fb8cd5a74cb602ec6c9b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6959c37c3acf0832103a2535703" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_payment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "payment"` - ); - await queryRunner.query(`DROP TABLE "payment"`); - await queryRunner.query(`ALTER TABLE "temporary_payment" RENAME TO "payment"`); - await queryRunner.query( - `CREATE INDEX "IDX_82753b9e315af84b20eaf84d77" ON "payment" ("organizationContactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_8846e403ec45e1ad8c309f91a3" ON "payment" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_3f13c738eff604a85700746ec7" ON "payment" ("recordedById") `); - await queryRunner.query(`CREATE INDEX "IDX_87223c7f1d4c2ca51cf6992784" ON "payment" ("invoiceId") `); - await queryRunner.query(`CREATE INDEX "IDX_62ef561a3bb084a7d12dad8a2d" ON "payment" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9" ON "payment" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_6959c37c3acf0832103a253570" ON "payment" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_16a49d62227bf23686b77b5a21" ON "payment" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8c4018eab11e92c3b09583495f" ON "payment" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_04d16bdd72668de12c3e41a85a"`); - await queryRunner.query(`DROP INDEX "IDX_28965bf63ad4c0976892d0fd5e"`); - await queryRunner.query(`DROP INDEX "IDX_a6acee4ad726734b73f3886c14"`); - await queryRunner.query(`DROP INDEX "IDX_074caa106ee22d5d675a696a98"`); - await queryRunner.query( - `CREATE TABLE "temporary_pipeline_stage" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "index" integer NOT NULL, "name" varchar NOT NULL, "pipelineId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_73ec3158bf224b485fd715cb3a6" FOREIGN KEY ("pipelineId") REFERENCES "pipeline" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_04d16bdd72668de12c3e41a85a6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_28965bf63ad4c0976892d0fd5e8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_pipeline_stage"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt" FROM "pipeline_stage"` - ); - await queryRunner.query(`DROP TABLE "pipeline_stage"`); - await queryRunner.query(`ALTER TABLE "temporary_pipeline_stage" RENAME TO "pipeline_stage"`); - await queryRunner.query( - `CREATE INDEX "IDX_04d16bdd72668de12c3e41a85a" ON "pipeline_stage" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_28965bf63ad4c0976892d0fd5e" ON "pipeline_stage" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_a6acee4ad726734b73f3886c14" ON "pipeline_stage" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_074caa106ee22d5d675a696a98" ON "pipeline_stage" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_873ade98fbd6ca71c8b4d1bbca"`); - await queryRunner.query(`DROP INDEX "IDX_683274c59fb08b21249096e305"`); - await queryRunner.query(`DROP INDEX "IDX_f3027eabd451ec18b93fab7ed5"`); - await queryRunner.query(`DROP INDEX "IDX_1adf9f97094bc93e176ede2482"`); - await queryRunner.query( - `CREATE TABLE "temporary_pipeline" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_873ade98fbd6ca71c8b4d1bbcac" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_683274c59fb08b21249096e305c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_pipeline"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt" FROM "pipeline"` - ); - await queryRunner.query(`DROP TABLE "pipeline"`); - await queryRunner.query(`ALTER TABLE "temporary_pipeline" RENAME TO "pipeline"`); - await queryRunner.query(`CREATE INDEX "IDX_873ade98fbd6ca71c8b4d1bbca" ON "pipeline" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_683274c59fb08b21249096e305" ON "pipeline" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f3027eabd451ec18b93fab7ed5" ON "pipeline" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1adf9f97094bc93e176ede2482" ON "pipeline" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_586294149d24cd835678878ef1"`); - await queryRunner.query(`DROP INDEX "IDX_e46203bf1dbf3291d174f02cb3"`); - await queryRunner.query(`DROP INDEX "IDX_27d71aa2e843f07fbf36329be3"`); - await queryRunner.query(`DROP INDEX "IDX_e690dd59b69e74a6bb5d94f32b"`); - await queryRunner.query(`DROP INDEX "IDX_d32c5d5e4451acf44fd5b212ce"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_category_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_586294149d24cd835678878ef12" FOREIGN KEY ("referenceId") REFERENCES "product_category" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e46203bf1dbf3291d174f02cb34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_27d71aa2e843f07fbf36329be3f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_category_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_category_translation"` - ); - await queryRunner.query(`DROP TABLE "product_category_translation"`); - await queryRunner.query( - `ALTER TABLE "temporary_product_category_translation" RENAME TO "product_category_translation"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_586294149d24cd835678878ef1" ON "product_category_translation" ("referenceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e46203bf1dbf3291d174f02cb3" ON "product_category_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_27d71aa2e843f07fbf36329be3" ON "product_category_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e690dd59b69e74a6bb5d94f32b" ON "product_category_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d32c5d5e4451acf44fd5b212ce" ON "product_category_translation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f38e86bd280ff9c9c7d9cb7839"`); - await queryRunner.query(`DROP INDEX "IDX_0a0cf25cd8232a154d1cce2641"`); - await queryRunner.query(`DROP INDEX "IDX_853302351eaa4daa39920c270a"`); - await queryRunner.query(`DROP INDEX "IDX_198fba43f049ea621407e7d188"`); - await queryRunner.query(`DROP INDEX "IDX_06cd3959f09e0b12793a763515"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "imageUrl" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f38e86bd280ff9c9c7d9cb78393" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0a0cf25cd8232a154d1cce2641c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_853302351eaa4daa39920c270a9" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt" FROM "product_category"` - ); - await queryRunner.query(`DROP TABLE "product_category"`); - await queryRunner.query(`ALTER TABLE "temporary_product_category" RENAME TO "product_category"`); - await queryRunner.query(`CREATE INDEX "IDX_f38e86bd280ff9c9c7d9cb7839" ON "product_category" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_0a0cf25cd8232a154d1cce2641" ON "product_category" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_853302351eaa4daa39920c270a" ON "product_category" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_198fba43f049ea621407e7d188" ON "product_category" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_06cd3959f09e0b12793a763515" ON "product_category" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_a6e91739227bf4d442f23c52c7"`); - await queryRunner.query(`DROP INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5"`); - await queryRunner.query(`DROP INDEX "IDX_462a7fd3ce68935cf973c6709f"`); - await queryRunner.query(`DROP INDEX "IDX_0fc743f2bc16502dbc5e85420c"`); - await queryRunner.query(`DROP INDEX "IDX_76bda4c33c83614617278617ae"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_option_group" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "productId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a6e91739227bf4d442f23c52c75" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4a1430a01b71ecdfcd54b2b6c5c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_462a7fd3ce68935cf973c6709f9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_option_group"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt" FROM "product_option_group"` - ); - await queryRunner.query(`DROP TABLE "product_option_group"`); - await queryRunner.query(`ALTER TABLE "temporary_product_option_group" RENAME TO "product_option_group"`); - await queryRunner.query( - `CREATE INDEX "IDX_a6e91739227bf4d442f23c52c7" ON "product_option_group" ("productId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5" ON "product_option_group" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_462a7fd3ce68935cf973c6709f" ON "product_option_group" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0fc743f2bc16502dbc5e85420c" ON "product_option_group" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_76bda4c33c83614617278617ae" ON "product_option_group" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_c9ce1da98b6d93293daafee63a"`); - await queryRunner.query(`DROP INDEX "IDX_0e2fcc31743e20a45fc3cf0211"`); - await queryRunner.query(`DROP INDEX "IDX_fd6b39f1fd1db026b5dcc3c795"`); - await queryRunner.query(`DROP INDEX "IDX_75b7065234a6d32fbd03d8703f"`); - await queryRunner.query(`DROP INDEX "IDX_e9e50109d3054fb81205c0a74e"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_option_group_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c9ce1da98b6d93293daafee63aa" FOREIGN KEY ("referenceId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0e2fcc31743e20a45fc3cf0211d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fd6b39f1fd1db026b5dcc3c7953" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_option_group_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_option_group_translation"` - ); - await queryRunner.query(`DROP TABLE "product_option_group_translation"`); - await queryRunner.query( - `ALTER TABLE "temporary_product_option_group_translation" RENAME TO "product_option_group_translation"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c9ce1da98b6d93293daafee63a" ON "product_option_group_translation" ("referenceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0e2fcc31743e20a45fc3cf0211" ON "product_option_group_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fd6b39f1fd1db026b5dcc3c795" ON "product_option_group_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75b7065234a6d32fbd03d8703f" ON "product_option_group_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e9e50109d3054fb81205c0a74e" ON "product_option_group_translation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f43c46e12db0580af320db7738"`); - await queryRunner.query(`DROP INDEX "IDX_4dc2f466cfa3d0b7fef19d1273"`); - await queryRunner.query(`DROP INDEX "IDX_9869d7680f48487e584f5d2fca"`); - await queryRunner.query(`DROP INDEX "IDX_f284f666950392c55afa0806c8"`); - await queryRunner.query(`DROP INDEX "IDX_2f581c3477a5c7a66de5d7f264"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_option_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f43c46e12db0580af320db77381" FOREIGN KEY ("referenceId") REFERENCES "product_option" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4dc2f466cfa3d0b7fef19d12731" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9869d7680f48487e584f5d2fca7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_option_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_option_translation"` - ); - await queryRunner.query(`DROP TABLE "product_option_translation"`); - await queryRunner.query( - `ALTER TABLE "temporary_product_option_translation" RENAME TO "product_option_translation"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f43c46e12db0580af320db7738" ON "product_option_translation" ("referenceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4dc2f466cfa3d0b7fef19d1273" ON "product_option_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9869d7680f48487e584f5d2fca" ON "product_option_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f284f666950392c55afa0806c8" ON "product_option_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2f581c3477a5c7a66de5d7f264" ON "product_option_translation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a6debf9198e2fbfa006aa10d71"`); - await queryRunner.query(`DROP INDEX "IDX_47ffb82a65c43f102b7e0efa41"`); - await queryRunner.query(`DROP INDEX "IDX_985d235aa5394937c4493262c7"`); - await queryRunner.query(`DROP INDEX "IDX_d81028785f188c253e0bd49a03"`); - await queryRunner.query(`DROP INDEX "IDX_35d083f4ecfe72cce72ee88f58"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_option" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar, "groupId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a6debf9198e2fbfa006aa10d710" FOREIGN KEY ("groupId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_47ffb82a65c43f102b7e0efa41a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_985d235aa5394937c4493262c7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_option"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt" FROM "product_option"` - ); - await queryRunner.query(`DROP TABLE "product_option"`); - await queryRunner.query(`ALTER TABLE "temporary_product_option" RENAME TO "product_option"`); - await queryRunner.query(`CREATE INDEX "IDX_a6debf9198e2fbfa006aa10d71" ON "product_option" ("groupId") `); - await queryRunner.query( - `CREATE INDEX "IDX_47ffb82a65c43f102b7e0efa41" ON "product_option" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_985d235aa5394937c4493262c7" ON "product_option" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d81028785f188c253e0bd49a03" ON "product_option" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_35d083f4ecfe72cce72ee88f58" ON "product_option" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_bed9d45e15866d9b8e87e7a7bf"`); - await queryRunner.query(`DROP INDEX "IDX_2efe48435d4ba480a4bb8b96fa"`); - await queryRunner.query(`DROP INDEX "IDX_ad107ba78e487cd8b13313593b"`); - await queryRunner.query(`DROP INDEX "IDX_ae78776111e1906accfd61511d"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_variant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isSubscription" boolean NOT NULL DEFAULT (0), "isPurchaseAutomatically" boolean NOT NULL DEFAULT (0), "canBeSold" boolean NOT NULL DEFAULT (1), "canBePurchased" boolean NOT NULL DEFAULT (1), "canBeCharged" boolean NOT NULL DEFAULT (0), "canBeRented" boolean NOT NULL DEFAULT (0), "isEquipment" boolean NOT NULL DEFAULT (0), "trackInventory" boolean NOT NULL DEFAULT (0), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_b0d86990fe7160a5f3e4011fb2" UNIQUE ("productVariantId"), CONSTRAINT "FK_b0d86990fe7160a5f3e4011fb23" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed9d45e15866d9b8e87e7a7bfe" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2efe48435d4ba480a4bb8b96fa6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_variant_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "product_variant_setting"` - ); - await queryRunner.query(`DROP TABLE "product_variant_setting"`); - await queryRunner.query(`ALTER TABLE "temporary_product_variant_setting" RENAME TO "product_variant_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_bed9d45e15866d9b8e87e7a7bf" ON "product_variant_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2efe48435d4ba480a4bb8b96fa" ON "product_variant_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ad107ba78e487cd8b13313593b" ON "product_variant_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ae78776111e1906accfd61511d" ON "product_variant_setting" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f4b767c43b4e9130c63382c9b2"`); - await queryRunner.query(`DROP INDEX "IDX_2dd271bdeb602b8c3956287e33"`); - await queryRunner.query(`DROP INDEX "IDX_30aafca59cdb456bf5231f9e46"`); - await queryRunner.query(`DROP INDEX "IDX_e9dca49bad996f1761db3b2f56"`); - await queryRunner.query(`DROP INDEX "IDX_65874d6bab7fefcaeccd2252c1"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_type_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f4b767c43b4e9130c63382c9b28" FOREIGN KEY ("referenceId") REFERENCES "product_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2dd271bdeb602b8c3956287e33c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_30aafca59cdb456bf5231f9e463" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_type_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_type_translation"` - ); - await queryRunner.query(`DROP TABLE "product_type_translation"`); - await queryRunner.query( - `ALTER TABLE "temporary_product_type_translation" RENAME TO "product_type_translation"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f4b767c43b4e9130c63382c9b2" ON "product_type_translation" ("referenceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2dd271bdeb602b8c3956287e33" ON "product_type_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_30aafca59cdb456bf5231f9e46" ON "product_type_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e9dca49bad996f1761db3b2f56" ON "product_type_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_65874d6bab7fefcaeccd2252c1" ON "product_type_translation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e4e4120b0c19d3a207ce38d758"`); - await queryRunner.query(`DROP INDEX "IDX_f206c807fc7e41fc8a8b6679ae"`); - await queryRunner.query(`DROP INDEX "IDX_90cc635a1065702ed3b79da6ec"`); - await queryRunner.query(`DROP INDEX "IDX_49064ee0f3acd5882f4d893f3d"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_e4e4120b0c19d3a207ce38d7581" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f206c807fc7e41fc8a8b6679ae0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt" FROM "product_type"` - ); - await queryRunner.query(`DROP TABLE "product_type"`); - await queryRunner.query(`ALTER TABLE "temporary_product_type" RENAME TO "product_type"`); - await queryRunner.query(`CREATE INDEX "IDX_e4e4120b0c19d3a207ce38d758" ON "product_type" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f206c807fc7e41fc8a8b6679ae" ON "product_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_90cc635a1065702ed3b79da6ec" ON "product_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_49064ee0f3acd5882f4d893f3d" ON "product_type" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_0cfba32db58a952f58b1e35cf1"`); - await queryRunner.query(`DROP INDEX "IDX_7052eaf00a5795afa5ebf35995"`); - await queryRunner.query(`DROP INDEX "IDX_562ef5984b6d4bed640bfcc6a2"`); - await queryRunner.query(`DROP INDEX "IDX_24ac11e35221577e4ba4fdd229"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_variant_price" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "unitCost" integer NOT NULL DEFAULT (0), "unitCostCurrency" varchar NOT NULL DEFAULT ('USD'), "retailPrice" integer NOT NULL DEFAULT (0), "retailPriceCurrency" varchar NOT NULL DEFAULT ('USD'), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_5842f603bd85d924127d63d73c" UNIQUE ("productVariantId"), CONSTRAINT "FK_5842f603bd85d924127d63d73cd" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cfba32db58a952f58b1e35cf1c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7052eaf00a5795afa5ebf359950" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_variant_price"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "product_variant_price"` - ); - await queryRunner.query(`DROP TABLE "product_variant_price"`); - await queryRunner.query(`ALTER TABLE "temporary_product_variant_price" RENAME TO "product_variant_price"`); - await queryRunner.query( - `CREATE INDEX "IDX_0cfba32db58a952f58b1e35cf1" ON "product_variant_price" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7052eaf00a5795afa5ebf35995" ON "product_variant_price" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_562ef5984b6d4bed640bfcc6a2" ON "product_variant_price" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_24ac11e35221577e4ba4fdd229" ON "product_variant_price" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b83f23626741630a8629960715"`); - await queryRunner.query(`DROP INDEX "IDX_6e420052844edf3a5506d863ce"`); - await queryRunner.query(`DROP INDEX "IDX_6a289b10030ae86903406e3c9b"`); - await queryRunner.query(`DROP INDEX "IDX_9121e00c4dc3500dc610cf8722"`); - await queryRunner.query(`DROP INDEX "IDX_e0d896cadbc695a490f64bb7e7"`); - await queryRunner.query(`DROP INDEX "IDX_e0005cbdabb760488f66f3fbba"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "taxes" integer NOT NULL DEFAULT (0), "notes" varchar, "quantity" integer NOT NULL DEFAULT (0), "billingInvoicingPolicy" varchar NOT NULL DEFAULT ('Quantity ordered'), "internalReference" varchar, "enabled" boolean NOT NULL DEFAULT (1), "productId" varchar, "imageId" varchar, "priceId" varchar, "settingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_9f0fd369dfeb275415c649d110" UNIQUE ("settingId"), CONSTRAINT "REL_41b31a71dda350cfe5da07e0e4" UNIQUE ("priceId"), CONSTRAINT "FK_b83f23626741630a86299607156" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6e420052844edf3a5506d863ce6" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9f0fd369dfeb275415c649d110b" FOREIGN KEY ("settingId") REFERENCES "product_variant_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_41b31a71dda350cfe5da07e0e4f" FOREIGN KEY ("priceId") REFERENCES "product_variant_price" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a289b10030ae86903406e3c9bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9121e00c4dc3500dc610cf8722e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_variant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt" FROM "product_variant"` - ); - await queryRunner.query(`DROP TABLE "product_variant"`); - await queryRunner.query(`ALTER TABLE "temporary_product_variant" RENAME TO "product_variant"`); - await queryRunner.query(`CREATE INDEX "IDX_b83f23626741630a8629960715" ON "product_variant" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_6e420052844edf3a5506d863ce" ON "product_variant" ("productId") `); - await queryRunner.query( - `CREATE INDEX "IDX_6a289b10030ae86903406e3c9b" ON "product_variant" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9121e00c4dc3500dc610cf8722" ON "product_variant" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e0d896cadbc695a490f64bb7e7" ON "product_variant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e0005cbdabb760488f66f3fbba" ON "product_variant" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_618194d24a7ea86a165d7ec628"`); - await queryRunner.query(`DROP INDEX "IDX_374bfd0d1b0e1398d7206456d9"`); - await queryRunner.query(`DROP INDEX "IDX_4627873dbc1af07d732e6eec7b"`); - await queryRunner.query(`DROP INDEX "IDX_32a4bdd261ec81f4ca6b3abe26"`); - await queryRunner.query(`DROP INDEX "IDX_08293ca31a601d3cd0228120bc"`); - await queryRunner.query(`DROP INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4"`); - await queryRunner.query(`DROP INDEX "IDX_6f58935aa2175d930e47e97c9f"`); - await queryRunner.query( - `CREATE TABLE "temporary_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "enabled" boolean NOT NULL DEFAULT (1), "code" varchar NOT NULL, "imageUrl" varchar, "featuredImageId" varchar, "productTypeId" varchar, "productCategoryId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_618194d24a7ea86a165d7ec628e" FOREIGN KEY ("productCategoryId") REFERENCES "product_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_374bfd0d1b0e1398d7206456d98" FOREIGN KEY ("productTypeId") REFERENCES "product_type" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4627873dbc1af07d732e6eec7be" FOREIGN KEY ("featuredImageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_32a4bdd261ec81f4ca6b3abe262" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_08293ca31a601d3cd0228120bc9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt" FROM "product"` - ); - await queryRunner.query(`DROP TABLE "product"`); - await queryRunner.query(`ALTER TABLE "temporary_product" RENAME TO "product"`); - await queryRunner.query(`CREATE INDEX "IDX_618194d24a7ea86a165d7ec628" ON "product" ("productCategoryId") `); - await queryRunner.query(`CREATE INDEX "IDX_374bfd0d1b0e1398d7206456d9" ON "product" ("productTypeId") `); - await queryRunner.query(`CREATE INDEX "IDX_4627873dbc1af07d732e6eec7b" ON "product" ("featuredImageId") `); - await queryRunner.query(`CREATE INDEX "IDX_32a4bdd261ec81f4ca6b3abe26" ON "product" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_08293ca31a601d3cd0228120bc" ON "product" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4" ON "product" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6f58935aa2175d930e47e97c9f" ON "product" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d24bc28e54f1dc296452a25591"`); - await queryRunner.query(`DROP INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2"`); - await queryRunner.query(`DROP INDEX "IDX_7533fd275bfb3219ce9eb4004c"`); - await queryRunner.query(`DROP INDEX "IDX_1d9ca23c7e1c606061fec8bb74"`); - await queryRunner.query(`DROP INDEX "IDX_96413a8061ff4ccdc418d4e16a"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d24bc28e54f1dc296452a255917" FOREIGN KEY ("referenceId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e6abcacc3d3a4f9cf5ca97f2b28" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7533fd275bfb3219ce9eb4004c7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "product_translation"` - ); - await queryRunner.query(`DROP TABLE "product_translation"`); - await queryRunner.query(`ALTER TABLE "temporary_product_translation" RENAME TO "product_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_d24bc28e54f1dc296452a25591" ON "product_translation" ("referenceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2" ON "product_translation" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_7533fd275bfb3219ce9eb4004c" ON "product_translation" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_1d9ca23c7e1c606061fec8bb74" ON "product_translation" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_96413a8061ff4ccdc418d4e16a" ON "product_translation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_fa278d337ba5e200d44ade6697"`); - await queryRunner.query(`DROP INDEX "IDX_dd9fcd7916d0a22189ecea6a36"`); - await queryRunner.query(`DROP INDEX "IDX_656f05f951faa13d7195853424"`); - await queryRunner.query( - `CREATE TABLE "temporary_report_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "iconClass" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "temporary_report_category"("id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt" FROM "report_category"` - ); - await queryRunner.query(`DROP TABLE "report_category"`); - await queryRunner.query(`ALTER TABLE "temporary_report_category" RENAME TO "report_category"`); - await queryRunner.query(`CREATE INDEX "IDX_fa278d337ba5e200d44ade6697" ON "report_category" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_dd9fcd7916d0a22189ecea6a36" ON "report_category" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_656f05f951faa13d7195853424" ON "report_category" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_5193788a3ebc1143bedb74cf72"`); - await queryRunner.query(`DROP INDEX "IDX_edf9bd011d7f08e3e18a5becb8"`); - await queryRunner.query(`DROP INDEX "IDX_a6bde8f44e18f17b1ca603e150"`); - await queryRunner.query(`DROP INDEX "IDX_40459267d68604655aa6df4251"`); - await queryRunner.query( - `CREATE TABLE "temporary_report_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "reportId" varchar NOT NULL, "isEnabled" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a085d6f9bcfd19f8bae1dbfe135" FOREIGN KEY ("reportId") REFERENCES "report" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5193788a3ebc1143bedb74cf725" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_edf9bd011d7f08e3e18a5becb8b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_report_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt" FROM "report_organization"` - ); - await queryRunner.query(`DROP TABLE "report_organization"`); - await queryRunner.query(`ALTER TABLE "temporary_report_organization" RENAME TO "report_organization"`); - await queryRunner.query( - `CREATE INDEX "IDX_5193788a3ebc1143bedb74cf72" ON "report_organization" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_edf9bd011d7f08e3e18a5becb8" ON "report_organization" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_a6bde8f44e18f17b1ca603e150" ON "report_organization" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_40459267d68604655aa6df4251" ON "report_organization" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_230652e48daa99c50c000fc5d1"`); - await queryRunner.query(`DROP INDEX "IDX_ef16fed5f7e6951027502e6458"`); - await queryRunner.query(`DROP INDEX "IDX_6f9ee54eb839117e83b937648d"`); - await queryRunner.query(`DROP INDEX "IDX_143ead1a6ac5f73125d8c4c3aa"`); - await queryRunner.query(`DROP INDEX "IDX_1316fdd7b9a2926437a13271bf"`); - await queryRunner.query( - `CREATE TABLE "temporary_report" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "categoryId" varchar NOT NULL, "name" varchar NOT NULL, "slug" varchar, "description" varchar, "image" varchar, "iconClass" varchar, "showInMenu" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_230652e48daa99c50c000fc5d10" FOREIGN KEY ("categoryId") REFERENCES "report_category" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_report"("id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt" FROM "report"` - ); - await queryRunner.query(`DROP TABLE "report"`); - await queryRunner.query(`ALTER TABLE "temporary_report" RENAME TO "report"`); - await queryRunner.query(`CREATE INDEX "IDX_230652e48daa99c50c000fc5d1" ON "report" ("categoryId") `); - await queryRunner.query(`CREATE INDEX "IDX_ef16fed5f7e6951027502e6458" ON "report" ("slug") `); - await queryRunner.query(`CREATE INDEX "IDX_6f9ee54eb839117e83b937648d" ON "report" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_143ead1a6ac5f73125d8c4c3aa" ON "report" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1316fdd7b9a2926437a13271bf" ON "report" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_ce2113039f070b3f003aa0db61"`); - await queryRunner.query(`DROP INDEX "IDX_563fec5539b89a57f40731f985"`); - await queryRunner.query(`DROP INDEX "IDX_4071f027554eefff65ac8123e6"`); - await queryRunner.query(`DROP INDEX "IDX_a5445b38b780b29b09369e36a9"`); - await queryRunner.query(`DROP INDEX "IDX_2634ff04775e659c4792325f38"`); - await queryRunner.query(`DROP INDEX "IDX_3d66190c19b9fe69a8bbb300df"`); - await queryRunner.query( - `CREATE TABLE "temporary_request_approval_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_ce2113039f070b3f003aa0db611" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_563fec5539b89a57f40731f9858" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4071f027554eefff65ac8123e6e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a5445b38b780b29b09369e36a9b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_request_approval_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "request_approval_employee"` - ); - await queryRunner.query(`DROP TABLE "request_approval_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_request_approval_employee" RENAME TO "request_approval_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ce2113039f070b3f003aa0db61" ON "request_approval_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_563fec5539b89a57f40731f985" ON "request_approval_employee" ("requestApprovalId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4071f027554eefff65ac8123e6" ON "request_approval_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a5445b38b780b29b09369e36a9" ON "request_approval_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2634ff04775e659c4792325f38" ON "request_approval_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3d66190c19b9fe69a8bbb300df" ON "request_approval_employee" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_9ccdaee6c5c62cda8f7375e841"`); - await queryRunner.query(`DROP INDEX "IDX_6c75d8a8c609e88896b2653cc4"`); - await queryRunner.query(`DROP INDEX "IDX_77e1050669b32cfff482f96016"`); - await queryRunner.query(`DROP INDEX "IDX_94b2a3d0f17c9549dea1493dc9"`); - await queryRunner.query(`DROP INDEX "IDX_34b2e8f794e0336b9ac410d8bd"`); - await queryRunner.query(`DROP INDEX "IDX_bdcb4ea389bdb794bae75b0170"`); - await queryRunner.query( - `CREATE TABLE "temporary_request_approval_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "teamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_9ccdaee6c5c62cda8f7375e8417" FOREIGN KEY ("teamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6c75d8a8c609e88896b2653cc41" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_77e1050669b32cfff482f960169" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_94b2a3d0f17c9549dea1493dc96" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_request_approval_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt" FROM "request_approval_team"` - ); - await queryRunner.query(`DROP TABLE "request_approval_team"`); - await queryRunner.query(`ALTER TABLE "temporary_request_approval_team" RENAME TO "request_approval_team"`); - await queryRunner.query(`CREATE INDEX "IDX_9ccdaee6c5c62cda8f7375e841" ON "request_approval_team" ("teamId") `); - await queryRunner.query( - `CREATE INDEX "IDX_6c75d8a8c609e88896b2653cc4" ON "request_approval_team" ("requestApprovalId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_77e1050669b32cfff482f96016" ON "request_approval_team" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_94b2a3d0f17c9549dea1493dc9" ON "request_approval_team" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_34b2e8f794e0336b9ac410d8bd" ON "request_approval_team" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bdcb4ea389bdb794bae75b0170" ON "request_approval_team" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`); - await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`); - await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`); - await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`); - await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`); - await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`); - await queryRunner.query( - `CREATE TABLE "temporary_request_approval" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" integer, "createdBy" varchar, "createdByName" varchar, "min_count" integer, "requestId" varchar, "requestType" varchar, "approvalPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_request_approval"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt" FROM "request_approval"` - ); - await queryRunner.query(`DROP TABLE "request_approval"`); - await queryRunner.query(`ALTER TABLE "temporary_request_approval" RENAME TO "request_approval"`); - await queryRunner.query( - `CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_cbd053921056e77c0a8e03122a"`); - await queryRunner.query(`DROP INDEX "IDX_8307c5c44a4ad6210b767b17a9"`); - await queryRunner.query(`DROP INDEX "IDX_e3130a39c1e4a740d044e68573"`); - await queryRunner.query(`DROP INDEX "IDX_78f93dbb42a97f6785bcf53efd"`); - await queryRunner.query(`DROP INDEX "IDX_5c36df1a5c85016952e90d760f"`); - await queryRunner.query( - `CREATE TABLE "temporary_role_permission" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "permission" varchar NOT NULL, "enabled" boolean DEFAULT (0), "roleId" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_cbd053921056e77c0a8e03122af" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e3130a39c1e4a740d044e685730" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_role_permission"("id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt" FROM "role_permission"` - ); - await queryRunner.query(`DROP TABLE "role_permission"`); - await queryRunner.query(`ALTER TABLE "temporary_role_permission" RENAME TO "role_permission"`); - await queryRunner.query(`CREATE INDEX "IDX_cbd053921056e77c0a8e03122a" ON "role_permission" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_8307c5c44a4ad6210b767b17a9" ON "role_permission" ("permission") `); - await queryRunner.query(`CREATE INDEX "IDX_e3130a39c1e4a740d044e68573" ON "role_permission" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_78f93dbb42a97f6785bcf53efd" ON "role_permission" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_5c36df1a5c85016952e90d760f" ON "role_permission" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_1751a572e91385a09d41c62471"`); - await queryRunner.query(`DROP INDEX "IDX_ae4578dcaed5adff96595e6166"`); - await queryRunner.query(`DROP INDEX "IDX_c5f75cd3367769b6f22b298d29"`); - await queryRunner.query(`DROP INDEX "IDX_09868c0733ba37a4753ff8931f"`); - await queryRunner.query( - `CREATE TABLE "temporary_role" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_1751a572e91385a09d41c624714" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_role"("id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt" FROM "role"` - ); - await queryRunner.query(`DROP TABLE "role"`); - await queryRunner.query(`ALTER TABLE "temporary_role" RENAME TO "role"`); - await queryRunner.query(`CREATE INDEX "IDX_1751a572e91385a09d41c62471" ON "role" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_ae4578dcaed5adff96595e6166" ON "role" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_c5f75cd3367769b6f22b298d29" ON "role" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_09868c0733ba37a4753ff8931f" ON "role" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_b2923d394f3636671ff9b3c3e8"`); - await queryRunner.query(`DROP INDEX "IDX_8e502eac7ed1347c71c26beae8"`); - await queryRunner.query(`DROP INDEX "IDX_f4cdbe61d68413f4d6a671f8c2"`); - await queryRunner.query(`DROP INDEX "IDX_ca52119f9e4857399706d723e9"`); - await queryRunner.query( - `CREATE TABLE "temporary_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_b2923d394f3636671ff9b3c3e81" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8e502eac7ed1347c71c26beae81" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt" FROM "skill"` - ); - await queryRunner.query(`DROP TABLE "skill"`); - await queryRunner.query(`ALTER TABLE "temporary_skill" RENAME TO "skill"`); - await queryRunner.query(`CREATE INDEX "IDX_b2923d394f3636671ff9b3c3e8" ON "skill" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_8e502eac7ed1347c71c26beae8" ON "skill" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f4cdbe61d68413f4d6a671f8c2" ON "skill" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_ca52119f9e4857399706d723e9" ON "skill" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_58876ee26a90170551027459bf"`); - await queryRunner.query(`DROP INDEX "IDX_1f22c73374bcca1ea84a4dca59"`); - await queryRunner.query(`DROP INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9"`); - await queryRunner.query(`DROP INDEX "IDX_b08dd29fb6a8acdf83c83d8988"`); - await queryRunner.query(`DROP INDEX "IDX_49746602acc4e5e8721062b69e"`); - await queryRunner.query( - `CREATE TABLE "temporary_tag" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "icon" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "textColor" varchar, "fix_relational_custom_fields" boolean, "archivedAt" datetime, CONSTRAINT "FK_c2f6bec0b39eaa3a6d90903ae99" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b08dd29fb6a8acdf83c83d8988f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_49746602acc4e5e8721062b69ec" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_tag"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields" FROM "tag"` - ); - await queryRunner.query(`DROP TABLE "tag"`); - await queryRunner.query(`ALTER TABLE "temporary_tag" RENAME TO "tag"`); - await queryRunner.query(`CREATE INDEX "IDX_58876ee26a90170551027459bf" ON "tag" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1f22c73374bcca1ea84a4dca59" ON "tag" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9" ON "tag" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_b08dd29fb6a8acdf83c83d8988" ON "tag" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_49746602acc4e5e8721062b69e" ON "tag" ("organizationTeamId") `); - await queryRunner.query(`DROP INDEX "IDX_b022c2b684c35dcc63c22850f1"`); - await queryRunner.query(`DROP INDEX "IDX_903b08cd4c8025e73316342452"`); - await queryRunner.query(`DROP INDEX "IDX_ce5e588780497b05cd6267e20e"`); - await queryRunner.query(`DROP INDEX "IDX_ecb357a3764a7344c633a257d7"`); - await queryRunner.query(`DROP INDEX "IDX_9779a35ef1338bafb7b90714f1"`); - await queryRunner.query(`DROP INDEX "IDX_f2cf366f3f08e31784b056df88"`); - await queryRunner.query( - `CREATE TABLE "temporary_daily_plan" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "date" datetime NOT NULL, "workTimePlanned" decimal NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationTeamId" varchar, "archivedAt" datetime, CONSTRAINT "FK_b022c2b684c35dcc63c22850f13" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb357a3764a7344c633a257d76" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9779a35ef1338bafb7b90714f16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2cf366f3f08e31784b056df880" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_daily_plan"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId" FROM "daily_plan"` - ); - await queryRunner.query(`DROP TABLE "daily_plan"`); - await queryRunner.query(`ALTER TABLE "temporary_daily_plan" RENAME TO "daily_plan"`); - await queryRunner.query( - `CREATE INDEX "IDX_b022c2b684c35dcc63c22850f1" ON "daily_plan" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_903b08cd4c8025e73316342452" ON "daily_plan" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_ce5e588780497b05cd6267e20e" ON "daily_plan" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_ecb357a3764a7344c633a257d7" ON "daily_plan" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9779a35ef1338bafb7b90714f1" ON "daily_plan" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f2cf366f3f08e31784b056df88" ON "daily_plan" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_a3ee022203211f678376cd919b"`); - await queryRunner.query(`DROP INDEX "IDX_8f274646f2bdf4e12990feeb04"`); - await queryRunner.query(`DROP INDEX "IDX_16507eb222e3c50be077fb4ace"`); - await queryRunner.query(`DROP INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6"`); - await queryRunner.query(`DROP INDEX "IDX_b1a7086c279309b20e8384d0d9"`); - await queryRunner.query(`DROP INDEX "IDX_1f3ffda4fce02682e76308b476"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_estimation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "estimate" integer NOT NULL, "employeeId" varchar NOT NULL, "taskId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a3ee022203211f678376cd919bb" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f274646f2bdf4e12990feeb040" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16507eb222e3c50be077fb4ace2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_87bfea6d0b9a1ec602ee88e5f68" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_estimation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt" FROM "task_estimation"` - ); - await queryRunner.query(`DROP TABLE "task_estimation"`); - await queryRunner.query(`ALTER TABLE "temporary_task_estimation" RENAME TO "task_estimation"`); - await queryRunner.query(`CREATE INDEX "IDX_a3ee022203211f678376cd919b" ON "task_estimation" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_8f274646f2bdf4e12990feeb04" ON "task_estimation" ("employeeId") `); - await queryRunner.query( - `CREATE INDEX "IDX_16507eb222e3c50be077fb4ace" ON "task_estimation" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6" ON "task_estimation" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_b1a7086c279309b20e8384d0d9" ON "task_estimation" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1f3ffda4fce02682e76308b476" ON "task_estimation" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_1909e9bae7d8b2c920b3e4d859"`); - await queryRunner.query(`DROP INDEX "IDX_722ce5d7535524b96c6d03f7c4"`); - await queryRunner.query(`DROP INDEX "IDX_8b12c913c39c72fe5980427c96"`); - await queryRunner.query(`DROP INDEX "IDX_16dbef9d1b2b422abdce8ee3ae"`); - await queryRunner.query(`DROP INDEX "IDX_4af451ab46a94e94394c72d911"`); - await queryRunner.query(`DROP INDEX "IDX_af2d743ed61571bcdc5d9a27a0"`); - await queryRunner.query(`DROP INDEX "IDX_33779b0395f72af0b50dc526d1"`); - await queryRunner.query(`DROP INDEX "IDX_131331557078611a68b4a5b2e7"`); - await queryRunner.query(`DROP INDEX "IDX_586513cceb16777fd14a17bfe1"`); - await queryRunner.query( - `CREATE TABLE "temporary_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "imageId" varchar, "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isDefault" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_8b12c913c39c72fe5980427c963" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16dbef9d1b2b422abdce8ee3ae2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_33779b0395f72af0b50dc526d1d" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_131331557078611a68b4a5b2e7e" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_586513cceb16777fd14a17bfe10" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault" FROM "issue_type"` - ); - await queryRunner.query(`DROP TABLE "issue_type"`); - await queryRunner.query(`ALTER TABLE "temporary_issue_type" RENAME TO "issue_type"`); - await queryRunner.query(`CREATE INDEX "IDX_1909e9bae7d8b2c920b3e4d859" ON "issue_type" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_722ce5d7535524b96c6d03f7c4" ON "issue_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8b12c913c39c72fe5980427c96" ON "issue_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_16dbef9d1b2b422abdce8ee3ae" ON "issue_type" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4af451ab46a94e94394c72d911" ON "issue_type" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_af2d743ed61571bcdc5d9a27a0" ON "issue_type" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_33779b0395f72af0b50dc526d1" ON "issue_type" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_131331557078611a68b4a5b2e7" ON "issue_type" ("projectId") `); - await queryRunner.query( - `CREATE INDEX "IDX_586513cceb16777fd14a17bfe1" ON "issue_type" ("organizationTeamId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_579534d8e12f22d308d6bd5f42"`); - await queryRunner.query(`DROP INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54"`); - await queryRunner.query(`DROP INDEX "IDX_3e16c81005c389a4db83c0e5e3"`); - await queryRunner.query(`DROP INDEX "taskNumber"`); - await queryRunner.query(`DROP INDEX "IDX_1e1f64696aa3a26d3e12c840e5"`); - await queryRunner.query(`DROP INDEX "IDX_94fe6b3a5aec5f85427df4f8cd"`); - await queryRunner.query(`DROP INDEX "IDX_3797a20ef5553ae87af126bc2f"`); - await queryRunner.query(`DROP INDEX "IDX_5b0272d923a31c972bed1a1ac4"`); - await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); - await queryRunner.query(`DROP INDEX "IDX_2fe7a278e6f08d2be55740a939"`); - await queryRunner.query(`DROP INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1"`); - await queryRunner.query(`DROP INDEX "IDX_7127880d6fae956ecc1c84ac31"`); - await queryRunner.query(`DROP INDEX "IDX_ed5441fb13e82854a994da5a78"`); - await queryRunner.query(`DROP INDEX "IDX_0cbe714983eb0aae5feeee8212"`); - await queryRunner.query(`DROP INDEX "IDX_2f4bdd2593fd6038aaa91fd107"`); - await queryRunner.query(`DROP INDEX "IDX_b8616deefe44d0622233e73fbf"`); - await queryRunner.query( - `CREATE TABLE "temporary_task" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "description" varchar, "status" varchar, "estimate" integer, "dueDate" datetime, "projectId" varchar, "creatorId" varchar, "organizationSprintId" varchar, "number" integer, "prefix" varchar, "priority" varchar, "size" varchar, "public" boolean DEFAULT (1), "startDate" datetime, "resolvedAt" datetime, "version" varchar, "issueType" varchar, "parentId" varchar, "taskStatusId" varchar, "taskSizeId" varchar, "taskPriorityId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "projectModuleId" varchar, "archivedAt" datetime, CONSTRAINT "FK_579534d8e12f22d308d6bd5f428" FOREIGN KEY ("projectModuleId") REFERENCES "organization_project_module" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8c9920b5fb32c3d8453f64b705c" FOREIGN KEY ("parentId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1e1f64696aa3a26d3e12c840e55" FOREIGN KEY ("organizationSprintId") REFERENCES "organization_sprint" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_94fe6b3a5aec5f85427df4f8cd7" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3797a20ef5553ae87af126bc2fe" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b0272d923a31c972bed1a1ac4d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e91cbff3d206f150ccc14d0c3a1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cbe714983eb0aae5feeee8212b" FOREIGN KEY ("taskStatusId") REFERENCES "task_status" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_2f4bdd2593fd6038aaa91fd1076" FOREIGN KEY ("taskSizeId") REFERENCES "task_size" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b8616deefe44d0622233e73fbf9" FOREIGN KEY ("taskPriorityId") REFERENCES "task_priority" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId" FROM "task"` - ); - await queryRunner.query(`DROP TABLE "task"`); - await queryRunner.query(`ALTER TABLE "temporary_task" RENAME TO "task"`); - await queryRunner.query(`CREATE INDEX "IDX_579534d8e12f22d308d6bd5f42" ON "task" ("projectModuleId") `); - await queryRunner.query(`CREATE INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54" ON "task" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_3e16c81005c389a4db83c0e5e3" ON "task" ("isActive") `); - await queryRunner.query(`CREATE UNIQUE INDEX "taskNumber" ON "task" ("projectId", "number") `); - await queryRunner.query(`CREATE INDEX "IDX_1e1f64696aa3a26d3e12c840e5" ON "task" ("organizationSprintId") `); - await queryRunner.query(`CREATE INDEX "IDX_94fe6b3a5aec5f85427df4f8cd" ON "task" ("creatorId") `); - await queryRunner.query(`CREATE INDEX "IDX_3797a20ef5553ae87af126bc2f" ON "task" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_5b0272d923a31c972bed1a1ac4" ON "task" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_e91cbff3d206f150ccc14d0c3a" ON "task" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_2fe7a278e6f08d2be55740a939" ON "task" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1" ON "task" ("priority") `); - await queryRunner.query(`CREATE INDEX "IDX_7127880d6fae956ecc1c84ac31" ON "task" ("size") `); - await queryRunner.query(`CREATE INDEX "IDX_ed5441fb13e82854a994da5a78" ON "task" ("issueType") `); - await queryRunner.query(`CREATE INDEX "IDX_0cbe714983eb0aae5feeee8212" ON "task" ("taskStatusId") `); - await queryRunner.query(`CREATE INDEX "IDX_2f4bdd2593fd6038aaa91fd107" ON "task" ("taskSizeId") `); - await queryRunner.query(`CREATE INDEX "IDX_b8616deefe44d0622233e73fbf" ON "task" ("taskPriorityId") `); - await queryRunner.query(`DROP INDEX "IDX_0848fd2b8c23c0ab55146297cf"`); - await queryRunner.query(`DROP INDEX "IDX_6deea7b3671e45973e191a1502"`); - await queryRunner.query(`DROP INDEX "IDX_24114c4059e6b6991daba541b1"`); - await queryRunner.query(`DROP INDEX "IDX_20b50abc5c97610a75d49ad381"`); - await queryRunner.query(`DROP INDEX "IDX_d49853e18e5bc772f5435b01a5"`); - await queryRunner.query(`DROP INDEX "IDX_88021c0cd9508757d3d90333f8"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_linked_issues" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" integer NOT NULL, "taskFromId" varchar NOT NULL, "taskToId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_0848fd2b8c23c0ab55146297cff" FOREIGN KEY ("taskToId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6deea7b3671e45973e191a1502c" FOREIGN KEY ("taskFromId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_24114c4059e6b6991daba541b1d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_20b50abc5c97610a75d49ad3817" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_linked_issues"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt" FROM "task_linked_issues"` - ); - await queryRunner.query(`DROP TABLE "task_linked_issues"`); - await queryRunner.query(`ALTER TABLE "temporary_task_linked_issues" RENAME TO "task_linked_issues"`); - await queryRunner.query(`CREATE INDEX "IDX_0848fd2b8c23c0ab55146297cf" ON "task_linked_issues" ("taskToId") `); - await queryRunner.query( - `CREATE INDEX "IDX_6deea7b3671e45973e191a1502" ON "task_linked_issues" ("taskFromId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_24114c4059e6b6991daba541b1" ON "task_linked_issues" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_20b50abc5c97610a75d49ad381" ON "task_linked_issues" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d49853e18e5bc772f5435b01a5" ON "task_linked_issues" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_88021c0cd9508757d3d90333f8" ON "task_linked_issues" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_db4237960ca989eb7a48cd433b"`); - await queryRunner.query(`DROP INDEX "IDX_46daede7b19176b6ad959d70da"`); - await queryRunner.query(`DROP INDEX "IDX_7d656b4cba8f11e639dbc5aab3"`); - await queryRunner.query(`DROP INDEX "IDX_7fd1b30d159b608cbf59009f68"`); - await queryRunner.query(`DROP INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d"`); - await queryRunner.query(`DROP INDEX "IDX_52b039cff6a1adf6b7f9e49ee4"`); - await queryRunner.query(`DROP INDEX "IDX_8ddcc5eeaf96314f53ca486821"`); - await queryRunner.query(`DROP INDEX "IDX_e6adb82db368af15f2b8cdd4e8"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_priority" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_52b039cff6a1adf6b7f9e49ee44" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_db4237960ca989eb7a48cd433b1" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1818655f27b8cf4f0d1dbfeb8db" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd1b30d159b608cbf59009f681" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_priority"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_priority"` - ); - await queryRunner.query(`DROP TABLE "task_priority"`); - await queryRunner.query(`ALTER TABLE "temporary_task_priority" RENAME TO "task_priority"`); - await queryRunner.query(`CREATE INDEX "IDX_db4237960ca989eb7a48cd433b" ON "task_priority" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_46daede7b19176b6ad959d70da" ON "task_priority" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_7d656b4cba8f11e639dbc5aab3" ON "task_priority" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_7fd1b30d159b608cbf59009f68" ON "task_priority" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d" ON "task_priority" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_52b039cff6a1adf6b7f9e49ee4" ON "task_priority" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_8ddcc5eeaf96314f53ca486821" ON "task_priority" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e6adb82db368af15f2b8cdd4e8" ON "task_priority" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_4967ebdca0aefb9d43e56695e4"`); - await queryRunner.query(`DROP INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9"`); - await queryRunner.query(`DROP INDEX "IDX_61a7cb4452d9e23f91231b7fd6"`); - await queryRunner.query(`DROP INDEX "IDX_9423f99da972c150f85dbc11c1"`); - await queryRunner.query(`DROP INDEX "IDX_bed691e21fe01cf5aceee72295"`); - await queryRunner.query(`DROP INDEX "IDX_b7b0ea8ac2825fb981c1181d11"`); - await queryRunner.query(`DROP INDEX "IDX_5a341f51d8f5ec12db24ab033f"`); - await queryRunner.query(`DROP INDEX "IDX_8177dd93be8044b37d3bb9285d"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_related_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_4967ebdca0aefb9d43e56695e42" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d99fe5b50dbe5078e0d9a9b6a9d" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed691e21fe01cf5aceee722952" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b7b0ea8ac2825fb981c1181d115" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_related_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_related_issue_type"` - ); - await queryRunner.query(`DROP TABLE "task_related_issue_type"`); - await queryRunner.query(`ALTER TABLE "temporary_task_related_issue_type" RENAME TO "task_related_issue_type"`); - await queryRunner.query( - `CREATE INDEX "IDX_4967ebdca0aefb9d43e56695e4" ON "task_related_issue_type" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9" ON "task_related_issue_type" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_61a7cb4452d9e23f91231b7fd6" ON "task_related_issue_type" ("value") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9423f99da972c150f85dbc11c1" ON "task_related_issue_type" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_bed691e21fe01cf5aceee72295" ON "task_related_issue_type" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b7b0ea8ac2825fb981c1181d11" ON "task_related_issue_type" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5a341f51d8f5ec12db24ab033f" ON "task_related_issue_type" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8177dd93be8044b37d3bb9285d" ON "task_related_issue_type" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_ad6792b26526bd96ab18d63454"`); - await queryRunner.query(`DROP INDEX "IDX_1a7b137d009616a2ff1aa6834f"`); - await queryRunner.query(`DROP INDEX "IDX_90c54f57b29cc8b67edc2738ae"`); - await queryRunner.query(`DROP INDEX "IDX_596512cc6508a482cc23ae6ab7"`); - await queryRunner.query(`DROP INDEX "IDX_f6ec2207e50680a475d71c8979"`); - await queryRunner.query(`DROP INDEX "IDX_f4438327b3c2afb0832569b2a1"`); - await queryRunner.query(`DROP INDEX "IDX_d65afcfe2d64e49d43931579a3"`); - await queryRunner.query(`DROP INDEX "IDX_8f26ffc61abaef417b0f807695"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_size" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_f4438327b3c2afb0832569b2a1e" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ad6792b26526bd96ab18d634544" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f6ec2207e50680a475d71c89793" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_596512cc6508a482cc23ae6ab78" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_size"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_size"` - ); - await queryRunner.query(`DROP TABLE "task_size"`); - await queryRunner.query(`ALTER TABLE "temporary_task_size" RENAME TO "task_size"`); - await queryRunner.query(`CREATE INDEX "IDX_ad6792b26526bd96ab18d63454" ON "task_size" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_1a7b137d009616a2ff1aa6834f" ON "task_size" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_90c54f57b29cc8b67edc2738ae" ON "task_size" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_596512cc6508a482cc23ae6ab7" ON "task_size" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f6ec2207e50680a475d71c8979" ON "task_size" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f4438327b3c2afb0832569b2a1" ON "task_size" ("organizationTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_d65afcfe2d64e49d43931579a3" ON "task_size" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8f26ffc61abaef417b0f807695" ON "task_size" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); - await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); - await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); - await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); - await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); - await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); - await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); - await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isCollapsed" boolean NOT NULL DEFAULT (0), "order" integer, "isTodo" boolean NOT NULL DEFAULT (0), "isInProgress" boolean NOT NULL DEFAULT (0), "isDone" boolean NOT NULL DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone" FROM "task_status"` - ); - await queryRunner.query(`DROP TABLE "task_status"`); - await queryRunner.query(`ALTER TABLE "temporary_task_status" RENAME TO "task_status"`); - await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); - await queryRunner.query(`DROP INDEX "IDX_959e77718a2e76ee56498c1106"`); - await queryRunner.query(`DROP INDEX "IDX_91988120385964f213aec8aa84"`); - await queryRunner.query(`DROP INDEX "IDX_e9fd8df772ad2d955a65f4c68a"`); - await queryRunner.query(`DROP INDEX "IDX_3396dda57286ca17ab61fd3704"`); - await queryRunner.query(`DROP INDEX "IDX_9c845f353378371ee3aa60f686"`); - await queryRunner.query(`DROP INDEX "IDX_379c8bd0ce203341148c1f99ee"`); - await queryRunner.query(`DROP INDEX "IDX_7e509a66367ecaf8e3bc96f263"`); - await queryRunner.query(`DROP INDEX "IDX_313b0e55871c1c9b6c22341536"`); - await queryRunner.query( - `CREATE TABLE "temporary_task_version" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_959e77718a2e76ee56498c1106a" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91988120385964f213aec8aa84c" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9c845f353378371ee3aa60f6865" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_379c8bd0ce203341148c1f99ee7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_task_version"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "task_version"` - ); - await queryRunner.query(`DROP TABLE "task_version"`); - await queryRunner.query(`ALTER TABLE "temporary_task_version" RENAME TO "task_version"`); - await queryRunner.query( - `CREATE INDEX "IDX_959e77718a2e76ee56498c1106" ON "task_version" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_91988120385964f213aec8aa84" ON "task_version" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_e9fd8df772ad2d955a65f4c68a" ON "task_version" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_3396dda57286ca17ab61fd3704" ON "task_version" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_9c845f353378371ee3aa60f686" ON "task_version" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_379c8bd0ce203341148c1f99ee" ON "task_version" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_7e509a66367ecaf8e3bc96f263" ON "task_version" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_313b0e55871c1c9b6c22341536" ON "task_version" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_affdab301e348b892175f30fa3"`); - await queryRunner.query(`DROP INDEX "IDX_1d9975b98d82f385ae14b4d7c6"`); - await queryRunner.query(`DROP INDEX "IDX_a7500f9b1b7917bf10882c820e"`); - await queryRunner.query( - `CREATE TABLE "temporary_tenant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "value" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_affdab301e348b892175f30fa39" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_tenant_setting"("id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt" FROM "tenant_setting"` - ); - await queryRunner.query(`DROP TABLE "tenant_setting"`); - await queryRunner.query(`ALTER TABLE "temporary_tenant_setting" RENAME TO "tenant_setting"`); - await queryRunner.query(`CREATE INDEX "IDX_affdab301e348b892175f30fa3" ON "tenant_setting" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_1d9975b98d82f385ae14b4d7c6" ON "tenant_setting" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a7500f9b1b7917bf10882c820e" ON "tenant_setting" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d154d06dac0d0e0a5d9a083e25"`); - await queryRunner.query(`DROP INDEX "IDX_56211336b5ff35fd944f225917"`); - await queryRunner.query(`DROP INDEX "IDX_b8eb9f3e420aa846f30e291960"`); - await queryRunner.query(`DROP INDEX "IDX_eeedffab85b3534a1068d9270f"`); - await queryRunner.query( - `CREATE TABLE "temporary_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "logo" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d154d06dac0d0e0a5d9a083e253" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_tenant"("id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt" FROM "tenant"` - ); - await queryRunner.query(`DROP TABLE "tenant"`); - await queryRunner.query(`ALTER TABLE "temporary_tenant" RENAME TO "tenant"`); - await queryRunner.query(`CREATE INDEX "IDX_d154d06dac0d0e0a5d9a083e25" ON "tenant" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_b8eb9f3e420aa846f30e291960" ON "tenant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_eeedffab85b3534a1068d9270f" ON "tenant" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_7d7f69c79df4a6f152b0e362b1"`); - await queryRunner.query(`DROP INDEX "IDX_c2744cffeca55c3c9c52bb9789"`); - await queryRunner.query(`DROP INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1"`); - await queryRunner.query(`DROP INDEX "IDX_cf9377d3bcb7cb996f72268941"`); - await queryRunner.query(`DROP INDEX "IDX_22d919e53cf5f6d836b18d407a"`); - await queryRunner.query( - `CREATE TABLE "temporary_time_off_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "requiresApproval" boolean NOT NULL, "paid" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c2744cffeca55c3c9c52bb9789c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1c0ed84d54f8fbe4af10dfcda1c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_time_off_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt" FROM "time_off_policy"` - ); - await queryRunner.query(`DROP TABLE "time_off_policy"`); - await queryRunner.query(`ALTER TABLE "temporary_time_off_policy" RENAME TO "time_off_policy"`); - await queryRunner.query(`CREATE INDEX "IDX_7d7f69c79df4a6f152b0e362b1" ON "time_off_policy" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c2744cffeca55c3c9c52bb9789" ON "time_off_policy" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1" ON "time_off_policy" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_cf9377d3bcb7cb996f72268941" ON "time_off_policy" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_22d919e53cf5f6d836b18d407a" ON "time_off_policy" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_c009cdd795be674c2047062374"`); - await queryRunner.query(`DROP INDEX "IDX_c1f8ae47dc2f1882afc5045c73"`); - await queryRunner.query(`DROP INDEX "IDX_981333982a6df8b815957dcbf2"`); - await queryRunner.query(`DROP INDEX "IDX_4989834dd1c9c8ea3576ed99ce"`); - await queryRunner.query(`DROP INDEX "IDX_45e4bc4476681f4db2097cc2d5"`); - await queryRunner.query(`DROP INDEX "IDX_5ddef92c4694e6d650d9e557b3"`); - await queryRunner.query( - `CREATE TABLE "temporary_time_off_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "documentUrl" varchar, "description" varchar, "start" datetime NOT NULL, "end" datetime NOT NULL, "requestDate" datetime NOT NULL, "status" varchar NOT NULL, "isHoliday" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "policyId" varchar NOT NULL, "documentId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_c009cdd795be674c20470623742" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c1f8ae47dc2f1882afc5045c739" FOREIGN KEY ("policyId") REFERENCES "time_off_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_981333982a6df8b815957dcbf27" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4989834dd1c9c8ea3576ed99ce5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_time_off_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt" FROM "time_off_request"` - ); - await queryRunner.query(`DROP TABLE "time_off_request"`); - await queryRunner.query(`ALTER TABLE "temporary_time_off_request" RENAME TO "time_off_request"`); - await queryRunner.query(`CREATE INDEX "IDX_c009cdd795be674c2047062374" ON "time_off_request" ("documentId") `); - await queryRunner.query(`CREATE INDEX "IDX_c1f8ae47dc2f1882afc5045c73" ON "time_off_request" ("policyId") `); - await queryRunner.query( - `CREATE INDEX "IDX_981333982a6df8b815957dcbf2" ON "time_off_request" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_4989834dd1c9c8ea3576ed99ce" ON "time_off_request" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_45e4bc4476681f4db2097cc2d5" ON "time_off_request" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_5ddef92c4694e6d650d9e557b3" ON "time_off_request" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_ffd736f18ba71b3221e4f835a9"`); - await queryRunner.query(`DROP INDEX "IDX_0e36a2c95e2f1df7f1b3059d24"`); - await queryRunner.query(`DROP INDEX "IDX_f27285af15ef48363745ab2d79"`); - await queryRunner.query(`DROP INDEX "IDX_b5525385e85f7429e233d4a0fa"`); - await queryRunner.query(`DROP INDEX "IDX_302b60a4970ffe94d5223f1c23"`); - await queryRunner.query(`DROP INDEX "IDX_a28a1682ea80f10d1ecc7babaa"`); - await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); - await queryRunner.query(`DROP INDEX "IDX_4e382caaf07ab0923b2e06bf91"`); - await queryRunner.query(`DROP INDEX "IDX_5a898f44fa31ef7916f0c38b01"`); - await queryRunner.query(`DROP INDEX "IDX_a6f74ae99d549932391f0f4460"`); - await queryRunner.query(`DROP INDEX "IDX_fdb3f018c2bba4885bfa5757d1"`); - await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); - await queryRunner.query(`DROP INDEX "IDX_ae6ac57aafef59f561d4db3dd7"`); - await queryRunner.query(`DROP INDEX "IDX_d2d6db7f03da5632687e5d140e"`); - await queryRunner.query( - `CREATE TABLE "temporary_activity" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" varchar, "metaData" text, "date" date, "time" time, "duration" integer NOT NULL DEFAULT (0), "type" varchar, "source" varchar NOT NULL DEFAULT ('BROWSER'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "projectId" varchar, "timeSlotId" varchar, "taskId" varchar, "recordedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, CONSTRAINT "FK_2743f8990fde12f9586287eb09f" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4e382caaf07ab0923b2e06bf918" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5a898f44fa31ef7916f0c38b016" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a6f74ae99d549932391f0f44609" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fdb3f018c2bba4885bfa5757d16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2401d8fdff5d8970dfe30d3aed" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_activity"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived" FROM "activity"` - ); - await queryRunner.query(`DROP TABLE "activity"`); - await queryRunner.query(`ALTER TABLE "temporary_activity" RENAME TO "activity"`); - await queryRunner.query(`CREATE INDEX "IDX_ffd736f18ba71b3221e4f835a9" ON "activity" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0e36a2c95e2f1df7f1b3059d24" ON "activity" ("source") `); - await queryRunner.query(`CREATE INDEX "IDX_f27285af15ef48363745ab2d79" ON "activity" ("type") `); - await queryRunner.query(`CREATE INDEX "IDX_b5525385e85f7429e233d4a0fa" ON "activity" ("time") `); - await queryRunner.query(`CREATE INDEX "IDX_302b60a4970ffe94d5223f1c23" ON "activity" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_a28a1682ea80f10d1ecc7babaa" ON "activity" ("title") `); - await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_5a898f44fa31ef7916f0c38b01" ON "activity" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_a6f74ae99d549932391f0f4460" ON "activity" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_fdb3f018c2bba4885bfa5757d1" ON "activity" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f2401d8fdff5d8970dfe30d3ae" ON "activity" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_ae6ac57aafef59f561d4db3dd7" ON "activity" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d2d6db7f03da5632687e5d140e" ON "activity" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_eea7986acfb827bf5d0622c41f"`); - await queryRunner.query(`DROP INDEX "IDX_1b0867d86ead2332f3d4edba7d"`); - await queryRunner.query(`DROP INDEX "IDX_fa1896dc735403799311968f7e"`); - await queryRunner.query(`DROP INDEX "IDX_5b594d02d98d5defcde323abe5"`); - await queryRunner.query(`DROP INDEX "IDX_0951aacffe3f8d0cff54cf2f34"`); - await queryRunner.query(`DROP INDEX "IDX_235004f3dafac90692cd64d915"`); - await queryRunner.query(`DROP INDEX "IDX_3d7feb5fe793e4811cdb79f983"`); - await queryRunner.query(`DROP INDEX "IDX_2b374e5cdee1145ebb2a832f20"`); - await queryRunner.query(`DROP INDEX "IDX_742688858e0484d66f04e4d4c4"`); - await queryRunner.query(`DROP INDEX "IDX_892e285e1da2b3e61e51e50628"`); - await queryRunner.query( - `CREATE TABLE "temporary_screenshot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "file" varchar NOT NULL, "thumb" varchar, "recordedAt" datetime, "deletedAt" datetime, "timeSlotId" varchar, "storageProvider" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "isWorkRelated" boolean, "description" varchar, "apps" text, "archivedAt" datetime, CONSTRAINT "FK_fa1896dc735403799311968f7ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b594d02d98d5defcde323abe5b" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0951aacffe3f8d0cff54cf2f341" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_235004f3dafac90692cd64d9158" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_screenshot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps" FROM "screenshot"` - ); - await queryRunner.query(`DROP TABLE "screenshot"`); - await queryRunner.query(`ALTER TABLE "temporary_screenshot" RENAME TO "screenshot"`); - await queryRunner.query(`CREATE INDEX "IDX_eea7986acfb827bf5d0622c41f" ON "screenshot" ("description") `); - await queryRunner.query(`CREATE INDEX "IDX_1b0867d86ead2332f3d4edba7d" ON "screenshot" ("isWorkRelated") `); - await queryRunner.query(`CREATE INDEX "IDX_fa1896dc735403799311968f7e" ON "screenshot" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_5b594d02d98d5defcde323abe5" ON "screenshot" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_0951aacffe3f8d0cff54cf2f34" ON "screenshot" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_235004f3dafac90692cd64d915" ON "screenshot" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_3d7feb5fe793e4811cdb79f983" ON "screenshot" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2b374e5cdee1145ebb2a832f20" ON "screenshot" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_742688858e0484d66f04e4d4c4" ON "screenshot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_892e285e1da2b3e61e51e50628" ON "screenshot" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_154e9120e2acb632d8bd9b91ff"`); - await queryRunner.query(`DROP INDEX "IDX_18dcdf754396f0cb0308dc91f4"`); - await queryRunner.query(`DROP INDEX "IDX_d1e8f22c02c5e949453dde7f2d"`); - await queryRunner.query(`DROP INDEX "IDX_1ddf2da35e34378fd845d80a18"`); - await queryRunner.query(`DROP INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5"`); - await queryRunner.query(`DROP INDEX "IDX_e65393bb52aa8275b1392c73f7"`); - await queryRunner.query(`DROP INDEX "IDX_a89a849957e005bafb8e4220bc"`); - await queryRunner.query(`DROP INDEX "IDX_aed2d5cc5680fba9d387c7f931"`); - await queryRunner.query(`DROP INDEX "IDX_fa9018cb248ea0f3b2b30ef143"`); - await queryRunner.query(`DROP INDEX "IDX_189b79acd611870aba62b3594e"`); - await queryRunner.query(`DROP INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec"`); - await queryRunner.query(`DROP INDEX "IDX_e80fb588b1086ce2a4f2244814"`); - await queryRunner.query(`DROP INDEX "IDX_402290e7045e0c10ef97d9f982"`); - await queryRunner.query(`DROP INDEX "IDX_722b9cb3a991c964d86396b6bc"`); - await queryRunner.query(`DROP INDEX "IDX_f447474d185cd70b3015853874"`); - await queryRunner.query(`DROP INDEX "IDX_79001d281ecb766005b3d331c1"`); - await queryRunner.query(`DROP INDEX "IDX_a1910a76044b971609b75ea165"`); - await queryRunner.query(`DROP INDEX "IDX_91a64228fbbe1516730a0cab5d"`); - await queryRunner.query( - `CREATE TABLE "temporary_time_log" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startedAt" datetime, "stoppedAt" datetime, "logType" varchar NOT NULL DEFAULT ('TRACKED'), "source" varchar NOT NULL DEFAULT ('BROWSER'), "description" varchar, "reason" varchar, "isBillable" boolean NOT NULL DEFAULT (0), "deletedAt" datetime, "employeeId" varchar NOT NULL, "timesheetId" varchar, "projectId" varchar, "taskId" varchar, "organizationContactId" varchar, "isRunning" boolean, "version" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_18dcdf754396f0cb0308dc91f4c" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d1e8f22c02c5e949453dde7f2d1" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1ddf2da35e34378fd845d80a18b" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_54776f6f5fd3c13c3bc1fbfac5b" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e65393bb52aa8275b1392c73f72" FOREIGN KEY ("timesheetId") REFERENCES "timesheet" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aed2d5cc5680fba9d387c7f931d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa9018cb248ea0f3b2b30ef143b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a89a849957e005bafb8e4220bc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_time_log"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt" FROM "time_log"` - ); - await queryRunner.query(`DROP TABLE "time_log"`); - await queryRunner.query(`ALTER TABLE "temporary_time_log" RENAME TO "time_log"`); - await queryRunner.query(`CREATE INDEX "IDX_154e9120e2acb632d8bd9b91ff" ON "time_log" ("editedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_18dcdf754396f0cb0308dc91f4" ON "time_log" ("organizationTeamId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d1e8f22c02c5e949453dde7f2d" ON "time_log" ("organizationContactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1ddf2da35e34378fd845d80a18" ON "time_log" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5" ON "time_log" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_e65393bb52aa8275b1392c73f7" ON "time_log" ("timesheetId") `); - await queryRunner.query(`CREATE INDEX "IDX_a89a849957e005bafb8e4220bc" ON "time_log" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_aed2d5cc5680fba9d387c7f931" ON "time_log" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_fa9018cb248ea0f3b2b30ef143" ON "time_log" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_189b79acd611870aba62b3594e" ON "time_log" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec" ON "time_log" ("stoppedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e80fb588b1086ce2a4f2244814" ON "time_log" ("logType") `); - await queryRunner.query(`CREATE INDEX "IDX_402290e7045e0c10ef97d9f982" ON "time_log" ("source") `); - await queryRunner.query(`CREATE INDEX "IDX_722b9cb3a991c964d86396b6bc" ON "time_log" ("isBillable") `); - await queryRunner.query(`CREATE INDEX "IDX_f447474d185cd70b3015853874" ON "time_log" ("isRunning") `); - await queryRunner.query(`CREATE INDEX "IDX_79001d281ecb766005b3d331c1" ON "time_log" ("version") `); - await queryRunner.query(`CREATE INDEX "IDX_a1910a76044b971609b75ea165" ON "time_log" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_91a64228fbbe1516730a0cab5d" ON "time_log" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_7913305b850c7afc89b6ed96a3"`); - await queryRunner.query(`DROP INDEX "IDX_c6e7d1075bfd97eea6643b1479"`); - await queryRunner.query(`DROP INDEX "IDX_f44e721669d5c6bed32cd6a3bf"`); - await queryRunner.query(`DROP INDEX "IDX_0c707825a7c2ecc4e186b07ebf"`); - await queryRunner.query(`DROP INDEX "IDX_b8284109257b5137256b5b3e84"`); - await queryRunner.query(`DROP INDEX "IDX_b407841271245501dd1a8c7551"`); - await queryRunner.query(`DROP INDEX "IDX_645a6bc3f1141d4a111a3166d8"`); - await queryRunner.query(`DROP INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5"`); - await queryRunner.query( - `CREATE TABLE "temporary_time_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_7913305b850c7afc89b6ed96a30" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b8284109257b5137256b5b3e848" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b407841271245501dd1a8c75513" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_time_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt" FROM "time_slot"` - ); - await queryRunner.query(`DROP TABLE "time_slot"`); - await queryRunner.query(`ALTER TABLE "temporary_time_slot" RENAME TO "time_slot"`); - await queryRunner.query(`CREATE INDEX "IDX_7913305b850c7afc89b6ed96a3" ON "time_slot" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_c6e7d1075bfd97eea6643b1479" ON "time_slot" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f44e721669d5c6bed32cd6a3bf" ON "time_slot" ("overall") `); - await queryRunner.query(`CREATE INDEX "IDX_0c707825a7c2ecc4e186b07ebf" ON "time_slot" ("duration") `); - await queryRunner.query(`CREATE INDEX "IDX_b8284109257b5137256b5b3e84" ON "time_slot" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_b407841271245501dd1a8c7551" ON "time_slot" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_645a6bc3f1141d4a111a3166d8" ON "time_slot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5" ON "time_slot" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_9272701d3da8bd8507f316c915"`); - await queryRunner.query(`DROP INDEX "IDX_82c5edbd179359212f16f0d386"`); - await queryRunner.query(`DROP INDEX "IDX_c7f72cb68b22b8ab988158e4d2"`); - await queryRunner.query(`DROP INDEX "IDX_8260fdc7862ca27d8cf10e6290"`); - await queryRunner.query(`DROP INDEX "IDX_a3eeb9629f550c367bb752855e"`); - await queryRunner.query( - `CREATE TABLE "temporary_time_slot_minute" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "datetime" datetime NOT NULL, "timeSlotId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "UQ_0ac1d2777eefcee82db52ca3660" UNIQUE ("timeSlotId", "datetime"), CONSTRAINT "FK_9272701d3da8bd8507f316c9154" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_82c5edbd179359212f16f0d386a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_c7f72cb68b22b8ab988158e4d26" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_time_slot_minute"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt" FROM "time_slot_minute"` - ); - await queryRunner.query(`DROP TABLE "time_slot_minute"`); - await queryRunner.query(`ALTER TABLE "temporary_time_slot_minute" RENAME TO "time_slot_minute"`); - await queryRunner.query(`CREATE INDEX "IDX_9272701d3da8bd8507f316c915" ON "time_slot_minute" ("timeSlotId") `); - await queryRunner.query( - `CREATE INDEX "IDX_82c5edbd179359212f16f0d386" ON "time_slot_minute" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c7f72cb68b22b8ab988158e4d2" ON "time_slot_minute" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_8260fdc7862ca27d8cf10e6290" ON "time_slot_minute" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a3eeb9629f550c367bb752855e" ON "time_slot_minute" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_ea81b5247ecdf5d82cf71fa096"`); - await queryRunner.query(`DROP INDEX "IDX_23fdffa8369387d87101090684"`); - await queryRunner.query(`DROP INDEX "IDX_c828facbb4250117f83416d9f7"`); - await queryRunner.query(`DROP INDEX "IDX_3502c60f98a7cda58dea75bcb5"`); - await queryRunner.query(`DROP INDEX "IDX_3f8fc4b5718fcaa913f9438e27"`); - await queryRunner.query(`DROP INDEX "IDX_6a79eb7534066b11f59243ede1"`); - await queryRunner.query(`DROP INDEX "IDX_f6558fbb3158ab90da1c41d943"`); - await queryRunner.query(`DROP INDEX "IDX_930e2b28de9ecb1ea689d5a97a"`); - await queryRunner.query(`DROP INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7"`); - await queryRunner.query(`DROP INDEX "IDX_aca65a79fe0c1ec9e6a59022c5"`); - await queryRunner.query(`DROP INDEX "IDX_8c8f821cb0fe0dd387491ea7d9"`); - await queryRunner.query(`DROP INDEX "IDX_6c1f81934a3f597b3b1a17f562"`); - await queryRunner.query(`DROP INDEX "IDX_42205a9e6af108364e5cc62dd4"`); - await queryRunner.query(`DROP INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff"`); - await queryRunner.query( - `CREATE TABLE "temporary_timesheet" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime, "stoppedAt" datetime, "approvedAt" datetime, "submittedAt" datetime, "lockedAt" datetime, "isBilled" boolean NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('PENDING'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "approvedById" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_6c1f81934a3f597b3b1a17f5623" FOREIGN KEY ("approvedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_25b8df69c9b7f5752c6a6a6ef7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aca65a79fe0c1ec9e6a59022c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8c8f821cb0fe0dd387491ea7d9e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_timesheet"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt" FROM "timesheet"` - ); - await queryRunner.query(`DROP TABLE "timesheet"`); - await queryRunner.query(`ALTER TABLE "temporary_timesheet" RENAME TO "timesheet"`); - await queryRunner.query(`CREATE INDEX "IDX_ea81b5247ecdf5d82cf71fa096" ON "timesheet" ("editedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_23fdffa8369387d87101090684" ON "timesheet" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_c828facbb4250117f83416d9f7" ON "timesheet" ("isBilled") `); - await queryRunner.query(`CREATE INDEX "IDX_3502c60f98a7cda58dea75bcb5" ON "timesheet" ("lockedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3f8fc4b5718fcaa913f9438e27" ON "timesheet" ("submittedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6a79eb7534066b11f59243ede1" ON "timesheet" ("approvedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f6558fbb3158ab90da1c41d943" ON "timesheet" ("stoppedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_930e2b28de9ecb1ea689d5a97a" ON "timesheet" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7" ON "timesheet" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_aca65a79fe0c1ec9e6a59022c5" ON "timesheet" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_8c8f821cb0fe0dd387491ea7d9" ON "timesheet" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_6c1f81934a3f597b3b1a17f562" ON "timesheet" ("approvedById") `); - await queryRunner.query(`CREATE INDEX "IDX_42205a9e6af108364e5cc62dd4" ON "timesheet" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff" ON "timesheet" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5"`); - await queryRunner.query(`DROP INDEX "IDX_ca24fc59aac015d9660955f5f6"`); - await queryRunner.query(`DROP INDEX "IDX_1f97ff07fb198bd0a7786b2abd"`); - await queryRunner.query(`DROP INDEX "IDX_7143f31467178a6164a42426c1"`); - await queryRunner.query(`DROP INDEX "IDX_611e1392c8cc9b101e3ea7ad80"`); - await queryRunner.query(`DROP INDEX "IDX_c764336019c69cc4927f317cb0"`); - await queryRunner.query( - `CREATE TABLE "temporary_user_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isDefault" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "userId" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_29c3c8cc3ea9db22e4a347f4b5a" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7143f31467178a6164a42426c15" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_611e1392c8cc9b101e3ea7ad80c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_user_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt" FROM "user_organization"` - ); - await queryRunner.query(`DROP TABLE "user_organization"`); - await queryRunner.query(`ALTER TABLE "temporary_user_organization" RENAME TO "user_organization"`); - await queryRunner.query(`CREATE INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5" ON "user_organization" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_ca24fc59aac015d9660955f5f6" ON "user_organization" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1f97ff07fb198bd0a7786b2abd" ON "user_organization" ("isDefault") `); - await queryRunner.query( - `CREATE INDEX "IDX_7143f31467178a6164a42426c1" ON "user_organization" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_611e1392c8cc9b101e3ea7ad80" ON "user_organization" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c764336019c69cc4927f317cb0" ON "user_organization" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_f725c3df76a1a94e3e9f0313a5"`); - await queryRunner.query(`DROP INDEX "IDX_0e9f745ad08103a1c21523326c"`); - await queryRunner.query(`DROP INDEX "IDX_5864814596f85fe59bd1a0dc76"`); - await queryRunner.query(`DROP INDEX "IDX_1a8ae1126aae1823d62ccf3f82"`); - await queryRunner.query(`DROP INDEX "IDX_685bf353c85f23b6f848e4dcde"`); - await queryRunner.query(`DROP INDEX "IDX_19de43e9f1842360ce646253d7"`); - await queryRunner.query(`DROP INDEX "IDX_58e4dbff0e1a32a9bdc861bb29"`); - await queryRunner.query(`DROP INDEX "IDX_f0e1b4ecdca13b177e2e3a0613"`); - await queryRunner.query(`DROP INDEX "IDX_e12875dfb3b1d92d7d7c5377e2"`); - await queryRunner.query(`DROP INDEX "IDX_78a916df40e02a9deb1c4b75ed"`); - await queryRunner.query(`DROP INDEX "IDX_c28e52f758e7bbc53828db9219"`); - await queryRunner.query(`DROP INDEX "IDX_f2578043e491921209f5dadd08"`); - await queryRunner.query(`DROP INDEX "IDX_5e028298e103e1694147ada69e"`); - await queryRunner.query(`DROP INDEX "IDX_fde2ce12ab12b02ae583dd76c7"`); - await queryRunner.query(`DROP INDEX "IDX_557cb712d32a9ad9ffbb4cd50d"`); - await queryRunner.query( - `CREATE TABLE "temporary_user" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "thirdPartyId" varchar, "firstName" varchar, "lastName" varchar, "email" varchar, "username" varchar, "hash" varchar, "imageUrl" varchar(500), "preferredLanguage" varchar DEFAULT ('en'), "preferredComponentLayout" varchar CHECK( "preferredComponentLayout" IN ('CARDS_GRID','TABLE') ) DEFAULT ('TABLE'), "roleId" varchar, "refreshToken" varchar, "isActive" boolean DEFAULT (1), "code" varchar, "codeExpireAt" datetime, "emailVerifiedAt" datetime, "emailToken" varchar, "phoneNumber" varchar, "timeZone" varchar, "imageId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "timeFormat" varchar CHECK( "timeFormat" IN ('12','24') ) NOT NULL DEFAULT (12), "lastLoginAt" datetime, "defaultTeamId" varchar, "lastTeamId" varchar, "defaultOrganizationId" varchar, "lastOrganizationId" varchar, "archivedAt" datetime, CONSTRAINT "FK_f725c3df76a1a94e3e9f0313a5f" FOREIGN KEY ("lastOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0e9f745ad08103a1c21523326c6" FOREIGN KEY ("defaultOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5864814596f85fe59bd1a0dc766" FOREIGN KEY ("lastTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1a8ae1126aae1823d62ccf3f821" FOREIGN KEY ("defaultTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c28e52f758e7bbc53828db92194" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_685bf353c85f23b6f848e4dcded" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e028298e103e1694147ada69e5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_user"("id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId") SELECT "id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId" FROM "user"` - ); - await queryRunner.query(`DROP TABLE "user"`); - await queryRunner.query(`ALTER TABLE "temporary_user" RENAME TO "user"`); - await queryRunner.query(`CREATE INDEX "IDX_f725c3df76a1a94e3e9f0313a5" ON "user" ("lastOrganizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_0e9f745ad08103a1c21523326c" ON "user" ("defaultOrganizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_5864814596f85fe59bd1a0dc76" ON "user" ("lastTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_1a8ae1126aae1823d62ccf3f82" ON "user" ("defaultTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_685bf353c85f23b6f848e4dcde" ON "user" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_19de43e9f1842360ce646253d7" ON "user" ("thirdPartyId") `); - await queryRunner.query(`CREATE INDEX "IDX_58e4dbff0e1a32a9bdc861bb29" ON "user" ("firstName") `); - await queryRunner.query(`CREATE INDEX "IDX_f0e1b4ecdca13b177e2e3a0613" ON "user" ("lastName") `); - await queryRunner.query(`CREATE INDEX "IDX_e12875dfb3b1d92d7d7c5377e2" ON "user" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_78a916df40e02a9deb1c4b75ed" ON "user" ("username") `); - await queryRunner.query(`CREATE INDEX "IDX_c28e52f758e7bbc53828db9219" ON "user" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_f2578043e491921209f5dadd08" ON "user" ("phoneNumber") `); - await queryRunner.query(`CREATE INDEX "IDX_5e028298e103e1694147ada69e" ON "user" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_fde2ce12ab12b02ae583dd76c7" ON "user" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_557cb712d32a9ad9ffbb4cd50d" ON "user" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_c899e17322d11e1977832e8c65"`); - await queryRunner.query(`DROP INDEX "IDX_62573a939f834f2de343f98288"`); - await queryRunner.query(`DROP INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb"`); - await queryRunner.query(`DROP INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7"`); - await queryRunner.query(`DROP INDEX "IDX_7a584a02d15a022e9c4f06ea72"`); - await queryRunner.query(`DROP INDEX "IDX_3370818c940a51996d80bb4d16"`); - await queryRunner.query( - `CREATE TABLE "temporary_warehouse_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "warehouseId" varchar NOT NULL, "productId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_3f934c4772e7c7f2c66d7ea4e72" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a8c9aee14d47ec7b3f2ac429ebc" FOREIGN KEY ("warehouseId") REFERENCES "warehouse" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c899e17322d11e1977832e8c656" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_62573a939f834f2de343f98288c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_warehouse_product"("id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "warehouse_product"` - ); - await queryRunner.query(`DROP TABLE "warehouse_product"`); - await queryRunner.query(`ALTER TABLE "temporary_warehouse_product" RENAME TO "warehouse_product"`); - await queryRunner.query( - `CREATE INDEX "IDX_c899e17322d11e1977832e8c65" ON "warehouse_product" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_62573a939f834f2de343f98288" ON "warehouse_product" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb" ON "warehouse_product" ("warehouseId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7" ON "warehouse_product" ("productId") `); - await queryRunner.query(`CREATE INDEX "IDX_7a584a02d15a022e9c4f06ea72" ON "warehouse_product" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_3370818c940a51996d80bb4d16" ON "warehouse_product" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed"`); - await queryRunner.query(`DROP INDEX "IDX_a1c4a97b928b547c3041d3ac1f"`); - await queryRunner.query(`DROP INDEX "IDX_a2f863689d1316810c41c1ea38"`); - await queryRunner.query(`DROP INDEX "IDX_617306cb3613dd8d59301ae16f"`); - await queryRunner.query(`DROP INDEX "IDX_5f32a52e9bd19bf323b02efcd1"`); - await queryRunner.query(`DROP INDEX "IDX_40aa52eaed1ce133f5fee76bca"`); - await queryRunner.query( - `CREATE TABLE "temporary_warehouse_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "variantId" varchar NOT NULL, "warehouseProductId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d5f4b64e6a80546fd6dd4ac3ed0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a1c4a97b928b547c3041d3ac1f6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2f863689d1316810c41c1ea38e" FOREIGN KEY ("variantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_617306cb3613dd8d59301ae16fd" FOREIGN KEY ("warehouseProductId") REFERENCES "warehouse_product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_warehouse_product_variant"("id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "warehouse_product_variant"` - ); - await queryRunner.query(`DROP TABLE "warehouse_product_variant"`); - await queryRunner.query( - `ALTER TABLE "temporary_warehouse_product_variant" RENAME TO "warehouse_product_variant"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed" ON "warehouse_product_variant" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a1c4a97b928b547c3041d3ac1f" ON "warehouse_product_variant" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a2f863689d1316810c41c1ea38" ON "warehouse_product_variant" ("variantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_617306cb3613dd8d59301ae16f" ON "warehouse_product_variant" ("warehouseProductId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5f32a52e9bd19bf323b02efcd1" ON "warehouse_product_variant" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_40aa52eaed1ce133f5fee76bca" ON "warehouse_product_variant" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_9b2f00761a6b1b77cb6289e3ff"`); - await queryRunner.query(`DROP INDEX "IDX_f5735eafddabdb4b20f621a976"`); - await queryRunner.query(`DROP INDEX "IDX_f502dc6d9802306f9d1584932b"`); - await queryRunner.query(`DROP INDEX "IDX_84594016a98da8b87e0f51cd93"`); - await queryRunner.query(`DROP INDEX "IDX_ee85901ae866ffe2061d5b35c8"`); - await queryRunner.query(`DROP INDEX "IDX_835691d3dd62d0b705302cbb2d"`); - await queryRunner.query( - `CREATE TABLE "temporary_warehouse" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "logoId" varchar, "contactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "REL_84594016a98da8b87e0f51cd93" UNIQUE ("contactId"), CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f502dc6d9802306f9d1584932b8" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f5735eafddabdb4b20f621a976a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9b2f00761a6b1b77cb6289e3fff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_warehouse"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt" FROM "warehouse"` - ); - await queryRunner.query(`DROP TABLE "warehouse"`); - await queryRunner.query(`ALTER TABLE "temporary_warehouse" RENAME TO "warehouse"`); - await queryRunner.query(`CREATE INDEX "IDX_9b2f00761a6b1b77cb6289e3ff" ON "warehouse" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f5735eafddabdb4b20f621a976" ON "warehouse" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f502dc6d9802306f9d1584932b" ON "warehouse" ("logoId") `); - await queryRunner.query(`CREATE INDEX "IDX_84594016a98da8b87e0f51cd93" ON "warehouse" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_ee85901ae866ffe2061d5b35c8" ON "warehouse" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_835691d3dd62d0b705302cbb2d" ON "warehouse" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); - await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); - await queryRunner.query(`DROP INDEX "IDX_cc89233c87fcf64b01df07e038"`); - await queryRunner.query(`DROP INDEX "IDX_cbc2b8338d45e774afd8682ffe"`); - await queryRunner.query( - `CREATE TABLE "temporary_changelog" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "title" varchar, "date" datetime NOT NULL, "content" varchar NOT NULL, "learnMoreUrl" varchar, "isFeature" boolean, "imageUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_744268ee0ec6073883267bc3b66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c2037b621d2e8023898aee4ac74" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_changelog"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt" FROM "changelog"` - ); - await queryRunner.query(`DROP TABLE "changelog"`); - await queryRunner.query(`ALTER TABLE "temporary_changelog" RENAME TO "changelog"`); - await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_cc89233c87fcf64b01df07e038" ON "changelog" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_cbc2b8338d45e774afd8682ffe" ON "changelog" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_add7dbec156589dd0b27e2e0c4"`); - await queryRunner.query(`DROP INDEX "IDX_9e8a77c1d330554fab9230100a"`); - await queryRunner.query(`DROP INDEX "IDX_a146e202c19f521bf5ec69bb26"`); - await queryRunner.query(`DROP INDEX "IDX_6eea42a69e130bbd14b7ea3659"`); - await queryRunner.query(`DROP INDEX "IDX_ca0fa80f50baed7287a499dc2c"`); - await queryRunner.query(`DROP INDEX "IDX_69d75a47af6bfcda545a865691"`); - await queryRunner.query(`DROP INDEX "IDX_480158f21938444e4f62fb3185"`); - await queryRunner.query(`DROP INDEX "IDX_ef65338e8597b9f56fd0fe3c94"`); - await queryRunner.query(`DROP INDEX "IDX_5e97728cfda96f49cc7f95bbaf"`); - await queryRunner.query(`DROP INDEX "IDX_04717f25bea7d9cef0d51cac50"`); - await queryRunner.query(`DROP INDEX "IDX_34c48d11eb82ef42e89370bdc7"`); - await queryRunner.query(`DROP INDEX "IDX_2eec784cadcb7847b64937fb58"`); - await queryRunner.query(`DROP INDEX "IDX_59407d03d189560ac1a0a4b0eb"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_github_repository" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "repositoryId" bigint NOT NULL, "name" varchar NOT NULL, "fullName" varchar NOT NULL, "owner" varchar NOT NULL, "integrationId" varchar, "issuesCount" integer, "hasSyncEnabled" boolean DEFAULT (1), "private" boolean DEFAULT (0), "status" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_add7dbec156589dd0b27e2e0c49" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_69d75a47af6bfcda545a865691b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_480158f21938444e4f62fb31857" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_github_repository"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt" FROM "organization_github_repository"` - ); - await queryRunner.query(`DROP TABLE "organization_github_repository"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_github_repository" RENAME TO "organization_github_repository"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_add7dbec156589dd0b27e2e0c4" ON "organization_github_repository" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9e8a77c1d330554fab9230100a" ON "organization_github_repository" ("owner") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a146e202c19f521bf5ec69bb26" ON "organization_github_repository" ("fullName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6eea42a69e130bbd14b7ea3659" ON "organization_github_repository" ("name") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ca0fa80f50baed7287a499dc2c" ON "organization_github_repository" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_69d75a47af6bfcda545a865691" ON "organization_github_repository" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_480158f21938444e4f62fb3185" ON "organization_github_repository" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ef65338e8597b9f56fd0fe3c94" ON "organization_github_repository" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5e97728cfda96f49cc7f95bbaf" ON "organization_github_repository" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_04717f25bea7d9cef0d51cac50" ON "organization_github_repository" ("issuesCount") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_34c48d11eb82ef42e89370bdc7" ON "organization_github_repository" ("hasSyncEnabled") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2eec784cadcb7847b64937fb58" ON "organization_github_repository" ("private") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_59407d03d189560ac1a0a4b0eb" ON "organization_github_repository" ("status") ` - ); - await queryRunner.query(`DROP INDEX "IDX_5065401113abb6e9608225e567"`); - await queryRunner.query(`DROP INDEX "IDX_a8709a9c5cc142c6fbe92df274"`); - await queryRunner.query(`DROP INDEX "IDX_055f310a04a928343494a5255a"`); - await queryRunner.query(`DROP INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b"`); - await queryRunner.query(`DROP INDEX "IDX_b3234be5b70c2362cdf67bb188"`); - await queryRunner.query(`DROP INDEX "IDX_c774c276d6b7ea05a7e12d3c81"`); - await queryRunner.query(`DROP INDEX "IDX_d706210d377ece2a1bc3386388"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_github_repository_issue" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "issueId" bigint NOT NULL, "issueNumber" integer NOT NULL, "repositoryId" varchar, "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_5065401113abb6e9608225e5678" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6c8e119fc6a2a7d3413aa76d3bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3234be5b70c2362cdf67bb1889" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_github_repository_issue"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt" FROM "organization_github_repository_issue"` - ); - await queryRunner.query(`DROP TABLE "organization_github_repository_issue"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_github_repository_issue" RENAME TO "organization_github_repository_issue"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5065401113abb6e9608225e567" ON "organization_github_repository_issue" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a8709a9c5cc142c6fbe92df274" ON "organization_github_repository_issue" ("issueNumber") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_055f310a04a928343494a5255a" ON "organization_github_repository_issue" ("issueId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b" ON "organization_github_repository_issue" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b3234be5b70c2362cdf67bb188" ON "organization_github_repository_issue" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c774c276d6b7ea05a7e12d3c81" ON "organization_github_repository_issue" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d706210d377ece2a1bc3386388" ON "organization_github_repository_issue" ("isActive") ` - ); - await queryRunner.query(`DROP INDEX "IDX_cc28a54171231fbd9a127051f0"`); - await queryRunner.query(`DROP INDEX "IDX_d59ec6899d435f430799795ad7"`); - await queryRunner.query(`DROP INDEX "IDX_4177329f5e6ddbfb6416592713"`); - await queryRunner.query(`DROP INDEX "IDX_61a30a7d83666bf265fd86a72d"`); - await queryRunner.query(`DROP INDEX "IDX_e2836e856f491dd4676e1ec8d3"`); - await queryRunner.query( - `CREATE TABLE "temporary_proposal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPostUrl" varchar, "valueDate" datetime, "jobPostContent" varchar NOT NULL, "proposalContent" varchar NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_61c45ab51852e4b0e539756d40f" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f399488a0f3ea10bb511e3f5aa3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d59ec6899d435f430799795ad7b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4177329f5e6ddbfb64165927134" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_proposal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "proposal"` - ); - await queryRunner.query(`DROP TABLE "proposal"`); - await queryRunner.query(`ALTER TABLE "temporary_proposal" RENAME TO "proposal"`); - await queryRunner.query(`CREATE INDEX "IDX_cc28a54171231fbd9a127051f0" ON "proposal" ("jobPostUrl") `); - await queryRunner.query(`CREATE INDEX "IDX_d59ec6899d435f430799795ad7" ON "proposal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4177329f5e6ddbfb6416592713" ON "proposal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_61a30a7d83666bf265fd86a72d" ON "proposal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e2836e856f491dd4676e1ec8d3" ON "proposal" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_2be728a7f8b118712a4200990d"`); - await queryRunner.query(`DROP INDEX "IDX_a13f3564eae9db44ddc4308afc"`); - await queryRunner.query(`DROP INDEX "IDX_0111963c9cb4dd14565c0d9c84"`); - await queryRunner.query(`DROP INDEX "IDX_dc2ff85f7de16dea6453a833dd"`); - await queryRunner.query(`DROP INDEX "IDX_ee780fbd8f91de31c004929eec"`); - await queryRunner.query(`DROP INDEX "IDX_f577c9bc6183c1d1eae1e154bb"`); - await queryRunner.query(`DROP INDEX "IDX_2bb17670e2bea3980ff960bbcf"`); - await queryRunner.query(`DROP INDEX "IDX_e396663e1a31114eac39087829"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_proposal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "content" text, "isDefault" boolean NOT NULL DEFAULT (0), "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2be728a7f8b118712a4200990d4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ee780fbd8f91de31c004929eecb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f577c9bc6183c1d1eae1e154bbc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_proposal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt" FROM "employee_proposal_template"` - ); - await queryRunner.query(`DROP TABLE "employee_proposal_template"`); - await queryRunner.query( - `ALTER TABLE "temporary_employee_proposal_template" RENAME TO "employee_proposal_template"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2be728a7f8b118712a4200990d" ON "employee_proposal_template" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a13f3564eae9db44ddc4308afc" ON "employee_proposal_template" ("isDefault") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0111963c9cb4dd14565c0d9c84" ON "employee_proposal_template" ("content") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_dc2ff85f7de16dea6453a833dd" ON "employee_proposal_template" ("name") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ee780fbd8f91de31c004929eec" ON "employee_proposal_template" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f577c9bc6183c1d1eae1e154bb" ON "employee_proposal_template" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2bb17670e2bea3980ff960bbcf" ON "employee_proposal_template" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e396663e1a31114eac39087829" ON "employee_proposal_template" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_44e22d88b47daf2095491b7cac"`); - await queryRunner.query(`DROP INDEX "IDX_1a62a99e1016e4a2b461e886ec"`); - await queryRunner.query(`DROP INDEX "IDX_9f1288205ae91f91cf356cac2f"`); - await queryRunner.query(`DROP INDEX "IDX_cb64573b18dd7b23f591f15502"`); - await queryRunner.query(`DROP INDEX "IDX_c8723c90a6f007f8d7e882a04f"`); - await queryRunner.query(`DROP INDEX "IDX_4b8450a24233df8b47ca472923"`); - await queryRunner.query(`DROP INDEX "IDX_e4bc75a1cbb07d117a0acfcdba"`); - await queryRunner.query( - `CREATE TABLE "temporary_job_search_occupation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceOccupationId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_44e22d88b47daf2095491b7cac3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1a62a99e1016e4a2b461e886ecd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_job_search_occupation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "job_search_occupation"` - ); - await queryRunner.query(`DROP TABLE "job_search_occupation"`); - await queryRunner.query(`ALTER TABLE "temporary_job_search_occupation" RENAME TO "job_search_occupation"`); - await queryRunner.query( - `CREATE INDEX "IDX_44e22d88b47daf2095491b7cac" ON "job_search_occupation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1a62a99e1016e4a2b461e886ec" ON "job_search_occupation" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9f1288205ae91f91cf356cac2f" ON "job_search_occupation" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_cb64573b18dd7b23f591f15502" ON "job_search_occupation" ("jobSourceOccupationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c8723c90a6f007f8d7e882a04f" ON "job_search_occupation" ("jobSource") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4b8450a24233df8b47ca472923" ON "job_search_occupation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e4bc75a1cbb07d117a0acfcdba" ON "job_search_occupation" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_35e120f2b6e5188391cf068d3b"`); - await queryRunner.query(`DROP INDEX "IDX_86381fb6d28978b101b3aec8ca"`); - await queryRunner.query(`DROP INDEX "IDX_3b335bbcbf7d5e00853acaa165"`); - await queryRunner.query(`DROP INDEX "IDX_d0a798419c775b9157bf0269f4"`); - await queryRunner.query(`DROP INDEX "IDX_6ee5218c869b57197e4a209bed"`); - await queryRunner.query(`DROP INDEX "IDX_36333846c37e5f8812a5c9f7ff"`); - await queryRunner.query(`DROP INDEX "IDX_015231c6e28cfb2b789ca4b76f"`); - await queryRunner.query( - `CREATE TABLE "temporary_job_search_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceCategoryId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_35e120f2b6e5188391cf068d3ba" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86381fb6d28978b101b3aec8ca4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "temporary_job_search_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "job_search_category"` - ); - await queryRunner.query(`DROP TABLE "job_search_category"`); - await queryRunner.query(`ALTER TABLE "temporary_job_search_category" RENAME TO "job_search_category"`); - await queryRunner.query(`CREATE INDEX "IDX_35e120f2b6e5188391cf068d3b" ON "job_search_category" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_86381fb6d28978b101b3aec8ca" ON "job_search_category" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3b335bbcbf7d5e00853acaa165" ON "job_search_category" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_d0a798419c775b9157bf0269f4" ON "job_search_category" ("jobSourceCategoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6ee5218c869b57197e4a209bed" ON "job_search_category" ("jobSource") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_36333846c37e5f8812a5c9f7ff" ON "job_search_category" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_015231c6e28cfb2b789ca4b76f" ON "job_search_category" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_630337302efe97cc93deeb2151"`); - await queryRunner.query(`DROP INDEX "IDX_afe6c40d3d9951388fa05f83f2"`); - await queryRunner.query(`DROP INDEX "IDX_6bae61744663a416e73903d9af"`); - await queryRunner.query(`DROP INDEX "IDX_0e130a25bb4abe1b27c8a0adf4"`); - await queryRunner.query( - `CREATE TABLE "temporary_employee_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar, "employeeId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_d2b148ddd67e520fb8061f4c133" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b6bcd5ceb60e4bb493344a6b4f2" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c872e6e3ab28e813c2324d1f4fb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_2dc73e07ac7040f273cea3c999d" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_630337302efe97cc93deeb21516" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_afe6c40d3d9951388fa05f83f28" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_employee_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "employee_upwork_job_search_criterion"` - ); - await queryRunner.query(`DROP TABLE "employee_upwork_job_search_criterion"`); - await queryRunner.query( - `ALTER TABLE "temporary_employee_upwork_job_search_criterion" RENAME TO "employee_upwork_job_search_criterion"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_630337302efe97cc93deeb2151" ON "employee_upwork_job_search_criterion" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_afe6c40d3d9951388fa05f83f2" ON "employee_upwork_job_search_criterion" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6bae61744663a416e73903d9af" ON "employee_upwork_job_search_criterion" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0e130a25bb4abe1b27c8a0adf4" ON "employee_upwork_job_search_criterion" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f2c1b6770dd2a3abfa35f49411"`); - await queryRunner.query(`DROP INDEX "IDX_a4b038417e3221c0791dd8c771"`); - await queryRunner.query(`DROP INDEX "IDX_7e53ea80aca15da11a8a5ec038"`); - await queryRunner.query(`DROP INDEX "IDX_46226c3185e3ca3d7033831d7a"`); - await queryRunner.query(`DROP INDEX "IDX_e210f70c3904cf84ab5113be8f"`); - await queryRunner.query( - `CREATE TABLE "temporary_job_preset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_a4b038417e3221c0791dd8c7714" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e53ea80aca15da11a8a5ec0380" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_job_preset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "job_preset"` - ); - await queryRunner.query(`DROP TABLE "job_preset"`); - await queryRunner.query(`ALTER TABLE "temporary_job_preset" RENAME TO "job_preset"`); - await queryRunner.query(`CREATE INDEX "IDX_f2c1b6770dd2a3abfa35f49411" ON "job_preset" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_a4b038417e3221c0791dd8c771" ON "job_preset" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_7e53ea80aca15da11a8a5ec038" ON "job_preset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_46226c3185e3ca3d7033831d7a" ON "job_preset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e210f70c3904cf84ab5113be8f" ON "job_preset" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_d5ca48cfacfb516543d6507ca4"`); - await queryRunner.query(`DROP INDEX "IDX_2323220b4decfd2f4d8307fd78"`); - await queryRunner.query(`DROP INDEX "IDX_af850e1fa48af82d66e9bf81c7"`); - await queryRunner.query(`DROP INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56"`); - await queryRunner.query( - `CREATE TABLE "temporary_job_preset_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_b909a3df761d7e489aca80f138a" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d45b36b85ffbd5189f7e70f29f5" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_9a687ce1a10a3abda460922cf84" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d5ca48cfacfb516543d6507ca4a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2323220b4decfd2f4d8307fd78f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_job_preset_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "job_preset_upwork_job_search_criterion"` - ); - await queryRunner.query(`DROP TABLE "job_preset_upwork_job_search_criterion"`); - await queryRunner.query( - `ALTER TABLE "temporary_job_preset_upwork_job_search_criterion" RENAME TO "job_preset_upwork_job_search_criterion"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5ca48cfacfb516543d6507ca4" ON "job_preset_upwork_job_search_criterion" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2323220b4decfd2f4d8307fd78" ON "job_preset_upwork_job_search_criterion" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_af850e1fa48af82d66e9bf81c7" ON "job_preset_upwork_job_search_criterion" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56" ON "job_preset_upwork_job_search_criterion" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_ff979040ce93cbc60863d322ec"`); - await queryRunner.query(`DROP INDEX "IDX_2ba72a9dec732a10e8c05bcdec"`); - await queryRunner.query(`DROP INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed"`); - await queryRunner.query(`DROP INDEX "IDX_9b22423b8cb20087c16613ecba"`); - await queryRunner.query(`DROP INDEX "IDX_0765098c5a6f93f51a55bda026"`); - await queryRunner.query( - `CREATE TABLE "temporary_knowledge_base" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "flag" varchar NOT NULL, "icon" varchar NOT NULL, "privacy" varchar NOT NULL, "language" varchar NOT NULL, "color" varchar NOT NULL, "description" varchar, "data" varchar, "index" integer, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_ff979040ce93cbc60863d322ecd" FOREIGN KEY ("parentId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba72a9dec732a10e8c05bcdec1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_bcb30c9893f4c8d0c4e556b4ed3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_knowledge_base"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base"` - ); - await queryRunner.query(`DROP TABLE "knowledge_base"`); - await queryRunner.query(`ALTER TABLE "temporary_knowledge_base" RENAME TO "knowledge_base"`); - await queryRunner.query(`CREATE INDEX "IDX_ff979040ce93cbc60863d322ec" ON "knowledge_base" ("parentId") `); - await queryRunner.query( - `CREATE INDEX "IDX_2ba72a9dec732a10e8c05bcdec" ON "knowledge_base" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed" ON "knowledge_base" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9b22423b8cb20087c16613ecba" ON "knowledge_base" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_0765098c5a6f93f51a55bda026" ON "knowledge_base" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_66af194845635058239e794e1b"`); - await queryRunner.query(`DROP INDEX "IDX_3547f82f867489542ceae58a49"`); - await queryRunner.query(`DROP INDEX "IDX_06a9902fedc1f9dcdbaf14afb0"`); - await queryRunner.query(`DROP INDEX "IDX_1544c43e36e1ccf7d578c70607"`); - await queryRunner.query(`DROP INDEX "IDX_e9720156c57ff1ad841e95ace7"`); - await queryRunner.query( - `CREATE TABLE "temporary_knowledge_base_article" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "data" varchar, "draft" boolean NOT NULL, "privacy" boolean NOT NULL, "index" integer NOT NULL, "categoryId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_66af194845635058239e794e1b9" FOREIGN KEY ("categoryId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3547f82f867489542ceae58a49e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_06a9902fedc1f9dcdbaf14afb01" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_knowledge_base_article"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base_article"` - ); - await queryRunner.query(`DROP TABLE "knowledge_base_article"`); - await queryRunner.query(`ALTER TABLE "temporary_knowledge_base_article" RENAME TO "knowledge_base_article"`); - await queryRunner.query( - `CREATE INDEX "IDX_66af194845635058239e794e1b" ON "knowledge_base_article" ("categoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3547f82f867489542ceae58a49" ON "knowledge_base_article" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_06a9902fedc1f9dcdbaf14afb0" ON "knowledge_base_article" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1544c43e36e1ccf7d578c70607" ON "knowledge_base_article" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e9720156c57ff1ad841e95ace7" ON "knowledge_base_article" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2d5ecab1f06b327bad54553614"`); - await queryRunner.query(`DROP INDEX "IDX_8eb7e413257d7a26104f4e326f"`); - await queryRunner.query(`DROP INDEX "IDX_81558bb2bef673628d92540b4e"`); - await queryRunner.query(`DROP INDEX "IDX_1551e821871d9230cc0dafbbe5"`); - await queryRunner.query(`DROP INDEX "IDX_b9623984c84eb7be4c0eb076c2"`); - await queryRunner.query(`DROP INDEX "IDX_a9130ad7824fb843f06103971e"`); - await queryRunner.query( - `CREATE TABLE "temporary_knowledge_base_author" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar NOT NULL, "articleId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "archivedAt" datetime, CONSTRAINT "FK_2d5ecab1f06b327bad545536143" FOREIGN KEY ("articleId") REFERENCES "knowledge_base_article" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8eb7e413257d7a26104f4e326fd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_81558bb2bef673628d92540b4e4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1551e821871d9230cc0dafbbe58" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_knowledge_base_author"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt" FROM "knowledge_base_author"` - ); - await queryRunner.query(`DROP TABLE "knowledge_base_author"`); - await queryRunner.query(`ALTER TABLE "temporary_knowledge_base_author" RENAME TO "knowledge_base_author"`); - await queryRunner.query( - `CREATE INDEX "IDX_2d5ecab1f06b327bad54553614" ON "knowledge_base_author" ("articleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8eb7e413257d7a26104f4e326f" ON "knowledge_base_author" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_81558bb2bef673628d92540b4e" ON "knowledge_base_author" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1551e821871d9230cc0dafbbe5" ON "knowledge_base_author" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b9623984c84eb7be4c0eb076c2" ON "knowledge_base_author" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9130ad7824fb843f06103971e" ON "knowledge_base_author" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_db21a1dc776b455ee83eb7ff88"`); - await queryRunner.query(`DROP INDEX "IDX_06e7335708b5e7870f1eaa608d"`); - await queryRunner.query(`DROP INDEX "IDX_913f7739f1262fc8c70cbbafa3"`); - await queryRunner.query(`DROP INDEX "IDX_f3591fd59cc32b585c3ba7d3ae"`); - await queryRunner.query(`DROP INDEX "IDX_28f06c5655d507668b8839b59a"`); - await queryRunner.query(`DROP INDEX "IDX_28ce717020729e36aa06cca5c5"`); - await queryRunner.query(`DROP INDEX "IDX_586e6b1273ba2732ec0ee41a80"`); - await queryRunner.query(`DROP INDEX "IDX_9cb4931c7348b6c171f13b6216"`); - await queryRunner.query(`DROP INDEX "IDX_6248458c7e237cef4adac4761d"`); - await queryRunner.query( - `CREATE TABLE "temporary_product_review" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" text, "rating" integer NOT NULL, "upvotes" integer NOT NULL DEFAULT (0), "downvotes" integer NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('pending'), "editedAt" datetime, "productId" varchar NOT NULL, "userId" varchar NOT NULL, "archivedAt" datetime, CONSTRAINT "FK_db21a1dc776b455ee83eb7ff88e" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_06e7335708b5e7870f1eaa608d2" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_28ce717020729e36aa06cca5c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_586e6b1273ba2732ec0ee41a80b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_product_review"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId" FROM "product_review"` - ); - await queryRunner.query(`DROP TABLE "product_review"`); - await queryRunner.query(`ALTER TABLE "temporary_product_review" RENAME TO "product_review"`); - await queryRunner.query(`CREATE INDEX "IDX_db21a1dc776b455ee83eb7ff88" ON "product_review" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_06e7335708b5e7870f1eaa608d" ON "product_review" ("productId") `); - await queryRunner.query(`CREATE INDEX "IDX_913f7739f1262fc8c70cbbafa3" ON "product_review" ("editedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f3591fd59cc32b585c3ba7d3ae" ON "product_review" ("downvotes") `); - await queryRunner.query(`CREATE INDEX "IDX_28f06c5655d507668b8839b59a" ON "product_review" ("upvotes") `); - await queryRunner.query( - `CREATE INDEX "IDX_28ce717020729e36aa06cca5c5" ON "product_review" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_586e6b1273ba2732ec0ee41a80" ON "product_review" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9cb4931c7348b6c171f13b6216" ON "product_review" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_6248458c7e237cef4adac4761d" ON "product_review" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_5d74a3f25e6acfb6caec05ec65" ON "accounting_template" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e0c6443e0d2d5630067bc10ccf" ON "appointment_employee" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_829e02292a572f25476c4e426c" ON "approval_policy" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2ada776a231239b8e99f78bf64" ON "availability_slot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c323aa830e10a871854d0a0408" ON "social_account" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_75bd5526e43c8801085225ffa9" ON "candidate_criterion_rating" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4985a92870282574f6fec8dd98" ON "candidate_document" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_745780f5553e56a3ca19bccf86" ON "candidate_education" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bb09aa3130d0e54007a98523c5" ON "candidate_experience" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_89ff7e0a8c37fdf7770b753776" ON "candidate_feedback" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_09f72a1a309aae91e0cd83949a" ON "candidate_interview" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_54b281d06e1a4e7e6ff640dab4" ON "candidate_interviewer" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fa411cb89c9c6848d192d7f2e6" ON "candidate_personal_quality" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f651e72ab42727f28c29441f1b" ON "candidate_skill" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436" ON "candidate_source" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_5cb080756923318f19f1d2eabe" ON "candidate_technology" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_ac765cfc390ec77d765dd48b61" ON "candidate" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_67a4423093e3c311cb76275659" ON "contact" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_711fd0159178a0102abc4db336" ON "country" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e99bb270f0fa89ea715a457d29" ON "currency" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_36106478339961c8a17674a031" ON "custom_smtp" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_284658fe519bca6048fd73ff72" ON "deal" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_753f4b022ec98a0c8f38b370c0" ON "email_sent" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_35ac91a92c521b68277e780e6e" ON "email_reset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ce96229ae8d1d1af61348730da" ON "email_template" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_e69d60f1adcded4445095c4787" ON "employee_appointment" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_cee87c9b8743f0e81db8152f68" ON "employee_award" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_9dff154a1be222c66c179ad14b" ON "employee_level" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_08e391262cb3d4fbe9db97ecf8" ON "employee_phone" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_185b880550575c61d4212896e2" ON "employee_recurring_expense" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_a8e048dfb4d618068376407c86" ON "employee_setting" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c17e703a7008f6b9c2770a5cba" ON "employee" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_0c5508f4c86446f84d609e3b76" ON "equipment_sharing_policy" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_21bb7aec28dbb12ebc58a41d02" ON "equipment_sharing" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8" ON "equipment" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c029854e57e273cb30445e6417" ON "estimate_email" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc" ON "event_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0edbfb90f0bc4c28eb57892900" ON "expense_category" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6620af16ccd56e7e52b6ad914d" ON "expense" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ca5fc2af0a26e454779d014a6a" ON "import-history" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b1669a96371cbdb8fd8d4724d6" ON "import-record" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_c795b7a18f1213b980bcc91ffe" ON "feature_organization" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9" ON "feature" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_03dbd727034c431934185d1d6f" ON "goal_general_setting" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_84a5a399408725b9c8612767e0" ON "goal_kpi_template" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_dae34450bed722e897370e2aec" ON "goal_kpi" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_25e0f8060ed921994873391253" ON "goal_template" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_cc3487eb32dd8baa86a8043540" ON "goal_time_frame" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_265b5cbc3e414bb3bb2facbb22" ON "goal" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2a8cd17a33093bb6afed97e9d3" ON "image_asset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_263e874cebea17ad3f2ba39e11" ON "income" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_2a9f9f6fa9064b328e277063a1" ON "integration_entity_setting_tied" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5053bf22f9e0a5e9e8df7850da" ON "integration_entity_setting" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3907c6f563fc45d824558d239d" ON "integration_map" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_02f667ad727ca0975d5022e695" ON "integration_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b6654519fbad729cdb490069be" ON "integration_tenant" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_842e81def8eef9f71a97496ff1" ON "integration_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_90aec772805c7fd508d71bedfe" ON "integration" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_00a3c849694b6f8be7b193c888" ON "invite" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_599de8ec6ea69550c6d49c4ae1" ON "invoice_estimate_history" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_457cbab434fc9a031f03eb6211" ON "invoice_item" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_40ee7b28c0ea835534a93b54bf" ON "invoice" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_04b8ef5663b40baa58e1b65160" ON "key_result_template" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c5df67196c2aca0a7fb6ffd274" ON "key_result_update" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_30bf8575f0744aa3b68b611985" ON "key_result" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_745828269219870069b3b46a7f" ON "language" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_ebff440aec581d4893ad743c7e" ON "merchant" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_20aebc4219b9f9196f5ca2344d" ON "organization_award" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cdf46b38fd75cd7baebce81cc6" ON "organization_contact" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8cf81262c7cddfcf3fedcbc106" ON "organization_department" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bf9a2edebcda9ac2c59e4439cb" ON "organization_document" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a11abe644b2cb5810bb65c8f9" ON "organization_employment_type" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_94330f9121dd1e72fe31fdb3c5" ON "organization_language" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122" ON "organization_position" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_21510dbb86b763f55a8bf4ec93" ON "organization_project_module" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_636a95bda1eaf9fab00849dec2" ON "organization_recurring_expense" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cbb3f1eb241abc47103df48f83" ON "organization_sprint" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_60683da6db3f64a0767d40b291" ON "organization_task_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d109b8470a4cf2662bec0a672b" ON "organization_team_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5deae148453dfaf555b24d151f" ON "organization_team_join_request" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_af48bbfa76f6261a5520e5e90f" ON "organization_team" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_6c41095093c47ac91434a1bdf9" ON "organization_vendor" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94" ON "organization" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_7f8ba01a73690cbabe6c6ab93c" ON "password_reset" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_523b77d9dcbace8377fbca05ae" ON "payment" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c5075efc6dab483721af36616f" ON "pipeline_stage" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_8b0d255d8f0ec4ca22e36249a8" ON "pipeline" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_2dce278beac80aebe7e179d7c9" ON "product_category_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_89d6d92ce60b7b6de00449b30d" ON "product_category" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_e69de0d6c91d71407822a95bc9" ON "product_option_group" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fdca637f69b879c6e95525a01f" ON "product_option_group_translation" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_eed2b389448b96ec1118ca38ef" ON "product_option_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_41bff03b05f43a4e22e54cb83e" ON "product_option" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_18a46a61494103f9db1c42285d" ON "product_variant_setting" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7c3776ae0d403baebc8a9387d8" ON "product_type_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_577cfbbd0e9dedad955108df36" ON "product_type" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_3041f4d50857a4bc37dd72f233" ON "product_variant_price" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0eb547a970dfecff424eb2098b" ON "product_variant" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_98c2019d4a108469e30b265972" ON "product" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_12de5ef2de583b2e92a1dfee3d" ON "product_translation" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0ad88d687468141532bef9cc5e" ON "report_category" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_3619176cb8845c5c03803caf9d" ON "report_organization" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_5a453f466165d928a495e158ac" ON "report" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_f6c789158e91e7a6242174aaae" ON "request_approval_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c02d6337074841598e6952fed" ON "request_approval_team" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_aac7b3092d5d02d80deb5808b3" ON "request_approval" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592" ON "role_permission" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6c388c8d50b4238ab077fdc800" ON "role" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_0d379f40301224bfa5043dc7cc" ON "skill" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_1ddd19850ad49f4e61ad727018" ON "tag" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_1255e02d6dddd4e09a5ddb10d4" ON "daily_plan" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_da2990e3e7d2047d950ab8edea" ON "task_estimation" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2ff61d100d00793724c099b86c" ON "issue_type" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_93bb4c9fb014dda0d984e9060a" ON "task" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_024d5a6727f6f4804d8cecfe32" ON "task_linked_issues" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f9fdc26bc564bf9f7963489f23" ON "task_priority" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_d1689daf93e2cb6029a9ff96d2" ON "task_related_issue_type" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c364d9cb885e274666950b1afc" ON "task_size" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_259cb3e6d0d59edad2798b0ac3" ON "task_status" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_526e175838190ccc3c350df01a" ON "task_version" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6e8dc5c9992499a05248237e58" ON "tenant_setting" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_10ede978ae7c1b67755932eac6" ON "tenant" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_21aa702abacf7dabe11da12818" ON "time_off_policy" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_a5c6d8b62974fb9e4161e09499" ON "time_off_request" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_83df5ca85dae51ff9341e47785" ON "activity" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_afad5ae421b31768c4232f7224" ON "screenshot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_2cbd790171893d994992116f19" ON "time_log" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_b520b83e91a6d3c8ef33675efe" ON "time_slot" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_bb9f95f639ced2a5b71395169e" ON "time_slot_minute" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_43f3709ff2b8dcc90c1809b023" ON "timesheet" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6f87e00eb9e37242f01e6e5566" ON "user_organization" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd" ON "user" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_fa9bdc44b90c4f32e658938a2d" ON "warehouse_product" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_21bba7ad2249260cc9d0022af9" ON "warehouse_product_variant" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_66abaca4fc9c367203403310aa" ON "warehouse" ("archivedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_888ffe5a395d1cf7afb001dc3a" ON "changelog" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_55dbb0b04712921d3c5dd7664e" ON "organization_github_repository" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_290ccd540d1e1f450c408539a1" ON "organization_github_repository_issue" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_811cc78a6e4df2ae75d237e40e" ON "proposal" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_6b73b978dcd27856a83df0d23c" ON "employee_proposal_template" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_551be2742a129d5d8ff461e9fe" ON "job_search_occupation" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4b69eac7a9f1b9e93eebe3a850" ON "job_search_category" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0d66c27013f4c34b339738f210" ON "employee_upwork_job_search_criterion" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c271c2698e24de252f1fd148f0" ON "job_preset" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_84a641af24ce125f296142216b" ON "job_preset_upwork_job_search_criterion" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_407463aef81b89c8bc5943ac8a" ON "knowledge_base" ("archivedAt") `); - await queryRunner.query( - `CREATE INDEX "IDX_bd8360d2c539ae6b351129c86d" ON "knowledge_base_article" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_eb418dd0f3234df01222bcf438" ON "knowledge_base_author" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c94775caea731394d690d67db1" ON "product_review" ("archivedAt") `); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId" FROM "organization_project"` - ); - await queryRunner.query(`DROP TABLE "organization_project"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query( - `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); - await queryRunner.query( - `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "archivedAt" datetime, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "managerId" varchar, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "archivedAt", "status", "icon", "archiveTasksIn", "closeTasksIn", "managerId", "defaultAssigneeId" FROM "temporary_organization_project"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30" ON "organization_project" ("archivedAt") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_c94775caea731394d690d67db1"`); - await queryRunner.query(`DROP INDEX "IDX_eb418dd0f3234df01222bcf438"`); - await queryRunner.query(`DROP INDEX "IDX_bd8360d2c539ae6b351129c86d"`); - await queryRunner.query(`DROP INDEX "IDX_407463aef81b89c8bc5943ac8a"`); - await queryRunner.query(`DROP INDEX "IDX_84a641af24ce125f296142216b"`); - await queryRunner.query(`DROP INDEX "IDX_c271c2698e24de252f1fd148f0"`); - await queryRunner.query(`DROP INDEX "IDX_0d66c27013f4c34b339738f210"`); - await queryRunner.query(`DROP INDEX "IDX_4b69eac7a9f1b9e93eebe3a850"`); - await queryRunner.query(`DROP INDEX "IDX_551be2742a129d5d8ff461e9fe"`); - await queryRunner.query(`DROP INDEX "IDX_6b73b978dcd27856a83df0d23c"`); - await queryRunner.query(`DROP INDEX "IDX_811cc78a6e4df2ae75d237e40e"`); - await queryRunner.query(`DROP INDEX "IDX_290ccd540d1e1f450c408539a1"`); - await queryRunner.query(`DROP INDEX "IDX_55dbb0b04712921d3c5dd7664e"`); - await queryRunner.query(`DROP INDEX "IDX_888ffe5a395d1cf7afb001dc3a"`); - await queryRunner.query(`DROP INDEX "IDX_66abaca4fc9c367203403310aa"`); - await queryRunner.query(`DROP INDEX "IDX_21bba7ad2249260cc9d0022af9"`); - await queryRunner.query(`DROP INDEX "IDX_fa9bdc44b90c4f32e658938a2d"`); - await queryRunner.query(`DROP INDEX "IDX_e49cb4b6b256bd4a5edab1e4dd"`); - await queryRunner.query(`DROP INDEX "IDX_6f87e00eb9e37242f01e6e5566"`); - await queryRunner.query(`DROP INDEX "IDX_43f3709ff2b8dcc90c1809b023"`); - await queryRunner.query(`DROP INDEX "IDX_bb9f95f639ced2a5b71395169e"`); - await queryRunner.query(`DROP INDEX "IDX_b520b83e91a6d3c8ef33675efe"`); - await queryRunner.query(`DROP INDEX "IDX_2cbd790171893d994992116f19"`); - await queryRunner.query(`DROP INDEX "IDX_afad5ae421b31768c4232f7224"`); - await queryRunner.query(`DROP INDEX "IDX_83df5ca85dae51ff9341e47785"`); - await queryRunner.query(`DROP INDEX "IDX_a5c6d8b62974fb9e4161e09499"`); - await queryRunner.query(`DROP INDEX "IDX_21aa702abacf7dabe11da12818"`); - await queryRunner.query(`DROP INDEX "IDX_10ede978ae7c1b67755932eac6"`); - await queryRunner.query(`DROP INDEX "IDX_6e8dc5c9992499a05248237e58"`); - await queryRunner.query(`DROP INDEX "IDX_526e175838190ccc3c350df01a"`); - await queryRunner.query(`DROP INDEX "IDX_259cb3e6d0d59edad2798b0ac3"`); - await queryRunner.query(`DROP INDEX "IDX_c364d9cb885e274666950b1afc"`); - await queryRunner.query(`DROP INDEX "IDX_d1689daf93e2cb6029a9ff96d2"`); - await queryRunner.query(`DROP INDEX "IDX_f9fdc26bc564bf9f7963489f23"`); - await queryRunner.query(`DROP INDEX "IDX_024d5a6727f6f4804d8cecfe32"`); - await queryRunner.query(`DROP INDEX "IDX_93bb4c9fb014dda0d984e9060a"`); - await queryRunner.query(`DROP INDEX "IDX_2ff61d100d00793724c099b86c"`); - await queryRunner.query(`DROP INDEX "IDX_da2990e3e7d2047d950ab8edea"`); - await queryRunner.query(`DROP INDEX "IDX_1255e02d6dddd4e09a5ddb10d4"`); - await queryRunner.query(`DROP INDEX "IDX_1ddd19850ad49f4e61ad727018"`); - await queryRunner.query(`DROP INDEX "IDX_0d379f40301224bfa5043dc7cc"`); - await queryRunner.query(`DROP INDEX "IDX_6c388c8d50b4238ab077fdc800"`); - await queryRunner.query(`DROP INDEX "IDX_8cdc64dbd7f2ed3f8850bd2592"`); - await queryRunner.query(`DROP INDEX "IDX_aac7b3092d5d02d80deb5808b3"`); - await queryRunner.query(`DROP INDEX "IDX_1c02d6337074841598e6952fed"`); - await queryRunner.query(`DROP INDEX "IDX_f6c789158e91e7a6242174aaae"`); - await queryRunner.query(`DROP INDEX "IDX_5a453f466165d928a495e158ac"`); - await queryRunner.query(`DROP INDEX "IDX_3619176cb8845c5c03803caf9d"`); - await queryRunner.query(`DROP INDEX "IDX_0ad88d687468141532bef9cc5e"`); - await queryRunner.query(`DROP INDEX "IDX_12de5ef2de583b2e92a1dfee3d"`); - await queryRunner.query(`DROP INDEX "IDX_98c2019d4a108469e30b265972"`); - await queryRunner.query(`DROP INDEX "IDX_0eb547a970dfecff424eb2098b"`); - await queryRunner.query(`DROP INDEX "IDX_3041f4d50857a4bc37dd72f233"`); - await queryRunner.query(`DROP INDEX "IDX_577cfbbd0e9dedad955108df36"`); - await queryRunner.query(`DROP INDEX "IDX_7c3776ae0d403baebc8a9387d8"`); - await queryRunner.query(`DROP INDEX "IDX_18a46a61494103f9db1c42285d"`); - await queryRunner.query(`DROP INDEX "IDX_41bff03b05f43a4e22e54cb83e"`); - await queryRunner.query(`DROP INDEX "IDX_eed2b389448b96ec1118ca38ef"`); - await queryRunner.query(`DROP INDEX "IDX_fdca637f69b879c6e95525a01f"`); - await queryRunner.query(`DROP INDEX "IDX_e69de0d6c91d71407822a95bc9"`); - await queryRunner.query(`DROP INDEX "IDX_89d6d92ce60b7b6de00449b30d"`); - await queryRunner.query(`DROP INDEX "IDX_2dce278beac80aebe7e179d7c9"`); - await queryRunner.query(`DROP INDEX "IDX_8b0d255d8f0ec4ca22e36249a8"`); - await queryRunner.query(`DROP INDEX "IDX_c5075efc6dab483721af36616f"`); - await queryRunner.query(`DROP INDEX "IDX_523b77d9dcbace8377fbca05ae"`); - await queryRunner.query(`DROP INDEX "IDX_7f8ba01a73690cbabe6c6ab93c"`); - await queryRunner.query(`DROP INDEX "IDX_3c5fdf6c34ed7a20fae6c9ae94"`); - await queryRunner.query(`DROP INDEX "IDX_6c41095093c47ac91434a1bdf9"`); - await queryRunner.query(`DROP INDEX "IDX_af48bbfa76f6261a5520e5e90f"`); - await queryRunner.query(`DROP INDEX "IDX_5deae148453dfaf555b24d151f"`); - await queryRunner.query(`DROP INDEX "IDX_d109b8470a4cf2662bec0a672b"`); - await queryRunner.query(`DROP INDEX "IDX_60683da6db3f64a0767d40b291"`); - await queryRunner.query(`DROP INDEX "IDX_cbb3f1eb241abc47103df48f83"`); - await queryRunner.query(`DROP INDEX "IDX_636a95bda1eaf9fab00849dec2"`); - await queryRunner.query(`DROP INDEX "IDX_21510dbb86b763f55a8bf4ec93"`); - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "IDX_05edb214d298384f9f918d6b5d"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_fdd58e4f13a3f4a92c70bcdb30"`); - await queryRunner.query(`DROP INDEX "IDX_1bff92d7a3b4b1f1a0e62a5122"`); - await queryRunner.query(`DROP INDEX "IDX_94330f9121dd1e72fe31fdb3c5"`); - await queryRunner.query(`DROP INDEX "IDX_8a11abe644b2cb5810bb65c8f9"`); - await queryRunner.query(`DROP INDEX "IDX_bf9a2edebcda9ac2c59e4439cb"`); - await queryRunner.query(`DROP INDEX "IDX_8cf81262c7cddfcf3fedcbc106"`); - await queryRunner.query(`DROP INDEX "IDX_cdf46b38fd75cd7baebce81cc6"`); - await queryRunner.query(`DROP INDEX "IDX_20aebc4219b9f9196f5ca2344d"`); - await queryRunner.query(`DROP INDEX "IDX_ebff440aec581d4893ad743c7e"`); - await queryRunner.query(`DROP INDEX "IDX_745828269219870069b3b46a7f"`); - await queryRunner.query(`DROP INDEX "IDX_30bf8575f0744aa3b68b611985"`); - await queryRunner.query(`DROP INDEX "IDX_c5df67196c2aca0a7fb6ffd274"`); - await queryRunner.query(`DROP INDEX "IDX_04b8ef5663b40baa58e1b65160"`); - await queryRunner.query(`DROP INDEX "IDX_40ee7b28c0ea835534a93b54bf"`); - await queryRunner.query(`DROP INDEX "IDX_457cbab434fc9a031f03eb6211"`); - await queryRunner.query(`DROP INDEX "IDX_599de8ec6ea69550c6d49c4ae1"`); - await queryRunner.query(`DROP INDEX "IDX_00a3c849694b6f8be7b193c888"`); - await queryRunner.query(`DROP INDEX "IDX_90aec772805c7fd508d71bedfe"`); - await queryRunner.query(`DROP INDEX "IDX_842e81def8eef9f71a97496ff1"`); - await queryRunner.query(`DROP INDEX "IDX_b6654519fbad729cdb490069be"`); - await queryRunner.query(`DROP INDEX "IDX_02f667ad727ca0975d5022e695"`); - await queryRunner.query(`DROP INDEX "IDX_3907c6f563fc45d824558d239d"`); - await queryRunner.query(`DROP INDEX "IDX_5053bf22f9e0a5e9e8df7850da"`); - await queryRunner.query(`DROP INDEX "IDX_2a9f9f6fa9064b328e277063a1"`); - await queryRunner.query(`DROP INDEX "IDX_263e874cebea17ad3f2ba39e11"`); - await queryRunner.query(`DROP INDEX "IDX_2a8cd17a33093bb6afed97e9d3"`); - await queryRunner.query(`DROP INDEX "IDX_265b5cbc3e414bb3bb2facbb22"`); - await queryRunner.query(`DROP INDEX "IDX_cc3487eb32dd8baa86a8043540"`); - await queryRunner.query(`DROP INDEX "IDX_25e0f8060ed921994873391253"`); - await queryRunner.query(`DROP INDEX "IDX_dae34450bed722e897370e2aec"`); - await queryRunner.query(`DROP INDEX "IDX_84a5a399408725b9c8612767e0"`); - await queryRunner.query(`DROP INDEX "IDX_03dbd727034c431934185d1d6f"`); - await queryRunner.query(`DROP INDEX "IDX_3c0aa9d1eabc26757fbddc2bb9"`); - await queryRunner.query(`DROP INDEX "IDX_c795b7a18f1213b980bcc91ffe"`); - await queryRunner.query(`DROP INDEX "IDX_b1669a96371cbdb8fd8d4724d6"`); - await queryRunner.query(`DROP INDEX "IDX_ca5fc2af0a26e454779d014a6a"`); - await queryRunner.query(`DROP INDEX "IDX_6620af16ccd56e7e52b6ad914d"`); - await queryRunner.query(`DROP INDEX "IDX_0edbfb90f0bc4c28eb57892900"`); - await queryRunner.query(`DROP INDEX "IDX_e261b3b6ed4c6e79901fb3e1bc"`); - await queryRunner.query(`DROP INDEX "IDX_c029854e57e273cb30445e6417"`); - await queryRunner.query(`DROP INDEX "IDX_7ed01d2a28f6cc9acb72c5fcf8"`); - await queryRunner.query(`DROP INDEX "IDX_21bb7aec28dbb12ebc58a41d02"`); - await queryRunner.query(`DROP INDEX "IDX_0c5508f4c86446f84d609e3b76"`); - await queryRunner.query(`DROP INDEX "IDX_c17e703a7008f6b9c2770a5cba"`); - await queryRunner.query(`DROP INDEX "IDX_a8e048dfb4d618068376407c86"`); - await queryRunner.query(`DROP INDEX "IDX_185b880550575c61d4212896e2"`); - await queryRunner.query(`DROP INDEX "IDX_08e391262cb3d4fbe9db97ecf8"`); - await queryRunner.query(`DROP INDEX "IDX_9dff154a1be222c66c179ad14b"`); - await queryRunner.query(`DROP INDEX "IDX_cee87c9b8743f0e81db8152f68"`); - await queryRunner.query(`DROP INDEX "IDX_e69d60f1adcded4445095c4787"`); - await queryRunner.query(`DROP INDEX "IDX_ce96229ae8d1d1af61348730da"`); - await queryRunner.query(`DROP INDEX "IDX_35ac91a92c521b68277e780e6e"`); - await queryRunner.query(`DROP INDEX "IDX_753f4b022ec98a0c8f38b370c0"`); - await queryRunner.query(`DROP INDEX "IDX_284658fe519bca6048fd73ff72"`); - await queryRunner.query(`DROP INDEX "IDX_36106478339961c8a17674a031"`); - await queryRunner.query(`DROP INDEX "IDX_e99bb270f0fa89ea715a457d29"`); - await queryRunner.query(`DROP INDEX "IDX_711fd0159178a0102abc4db336"`); - await queryRunner.query(`DROP INDEX "IDX_67a4423093e3c311cb76275659"`); - await queryRunner.query(`DROP INDEX "IDX_ac765cfc390ec77d765dd48b61"`); - await queryRunner.query(`DROP INDEX "IDX_5cb080756923318f19f1d2eabe"`); - await queryRunner.query(`DROP INDEX "IDX_df0a9a4b6ae0e3cab9c4f35436"`); - await queryRunner.query(`DROP INDEX "IDX_f651e72ab42727f28c29441f1b"`); - await queryRunner.query(`DROP INDEX "IDX_fa411cb89c9c6848d192d7f2e6"`); - await queryRunner.query(`DROP INDEX "IDX_54b281d06e1a4e7e6ff640dab4"`); - await queryRunner.query(`DROP INDEX "IDX_09f72a1a309aae91e0cd83949a"`); - await queryRunner.query(`DROP INDEX "IDX_89ff7e0a8c37fdf7770b753776"`); - await queryRunner.query(`DROP INDEX "IDX_bb09aa3130d0e54007a98523c5"`); - await queryRunner.query(`DROP INDEX "IDX_745780f5553e56a3ca19bccf86"`); - await queryRunner.query(`DROP INDEX "IDX_4985a92870282574f6fec8dd98"`); - await queryRunner.query(`DROP INDEX "IDX_75bd5526e43c8801085225ffa9"`); - await queryRunner.query(`DROP INDEX "IDX_c323aa830e10a871854d0a0408"`); - await queryRunner.query(`DROP INDEX "IDX_2ada776a231239b8e99f78bf64"`); - await queryRunner.query(`DROP INDEX "IDX_829e02292a572f25476c4e426c"`); - await queryRunner.query(`DROP INDEX "IDX_e0c6443e0d2d5630067bc10ccf"`); - await queryRunner.query(`DROP INDEX "IDX_5d74a3f25e6acfb6caec05ec65"`); - await queryRunner.query(`DROP INDEX "IDX_6248458c7e237cef4adac4761d"`); - await queryRunner.query(`DROP INDEX "IDX_9cb4931c7348b6c171f13b6216"`); - await queryRunner.query(`DROP INDEX "IDX_586e6b1273ba2732ec0ee41a80"`); - await queryRunner.query(`DROP INDEX "IDX_28ce717020729e36aa06cca5c5"`); - await queryRunner.query(`DROP INDEX "IDX_28f06c5655d507668b8839b59a"`); - await queryRunner.query(`DROP INDEX "IDX_f3591fd59cc32b585c3ba7d3ae"`); - await queryRunner.query(`DROP INDEX "IDX_913f7739f1262fc8c70cbbafa3"`); - await queryRunner.query(`DROP INDEX "IDX_06e7335708b5e7870f1eaa608d"`); - await queryRunner.query(`DROP INDEX "IDX_db21a1dc776b455ee83eb7ff88"`); - await queryRunner.query(`ALTER TABLE "product_review" RENAME TO "temporary_product_review"`); - await queryRunner.query( - `CREATE TABLE "product_review" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" text, "rating" integer NOT NULL, "upvotes" integer NOT NULL DEFAULT (0), "downvotes" integer NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('pending'), "editedAt" datetime, "productId" varchar NOT NULL, "userId" varchar NOT NULL, CONSTRAINT "FK_db21a1dc776b455ee83eb7ff88e" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_06e7335708b5e7870f1eaa608d2" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_28ce717020729e36aa06cca5c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_586e6b1273ba2732ec0ee41a80b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_review"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "title", "description", "rating", "upvotes", "downvotes", "status", "editedAt", "productId", "userId" FROM "temporary_product_review"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_review"`); - await queryRunner.query(`CREATE INDEX "IDX_6248458c7e237cef4adac4761d" ON "product_review" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_9cb4931c7348b6c171f13b6216" ON "product_review" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_586e6b1273ba2732ec0ee41a80" ON "product_review" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_28ce717020729e36aa06cca5c5" ON "product_review" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_28f06c5655d507668b8839b59a" ON "product_review" ("upvotes") `); - await queryRunner.query(`CREATE INDEX "IDX_f3591fd59cc32b585c3ba7d3ae" ON "product_review" ("downvotes") `); - await queryRunner.query(`CREATE INDEX "IDX_913f7739f1262fc8c70cbbafa3" ON "product_review" ("editedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_06e7335708b5e7870f1eaa608d" ON "product_review" ("productId") `); - await queryRunner.query(`CREATE INDEX "IDX_db21a1dc776b455ee83eb7ff88" ON "product_review" ("userId") `); - await queryRunner.query(`DROP INDEX "IDX_a9130ad7824fb843f06103971e"`); - await queryRunner.query(`DROP INDEX "IDX_b9623984c84eb7be4c0eb076c2"`); - await queryRunner.query(`DROP INDEX "IDX_1551e821871d9230cc0dafbbe5"`); - await queryRunner.query(`DROP INDEX "IDX_81558bb2bef673628d92540b4e"`); - await queryRunner.query(`DROP INDEX "IDX_8eb7e413257d7a26104f4e326f"`); - await queryRunner.query(`DROP INDEX "IDX_2d5ecab1f06b327bad54553614"`); - await queryRunner.query(`ALTER TABLE "knowledge_base_author" RENAME TO "temporary_knowledge_base_author"`); - await queryRunner.query( - `CREATE TABLE "knowledge_base_author" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar NOT NULL, "articleId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2d5ecab1f06b327bad545536143" FOREIGN KEY ("articleId") REFERENCES "knowledge_base_article" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8eb7e413257d7a26104f4e326fd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_81558bb2bef673628d92540b4e4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1551e821871d9230cc0dafbbe58" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "knowledge_base_author"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "articleId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base_author"` - ); - await queryRunner.query(`DROP TABLE "temporary_knowledge_base_author"`); - await queryRunner.query( - `CREATE INDEX "IDX_a9130ad7824fb843f06103971e" ON "knowledge_base_author" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b9623984c84eb7be4c0eb076c2" ON "knowledge_base_author" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1551e821871d9230cc0dafbbe5" ON "knowledge_base_author" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_81558bb2bef673628d92540b4e" ON "knowledge_base_author" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8eb7e413257d7a26104f4e326f" ON "knowledge_base_author" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2d5ecab1f06b327bad54553614" ON "knowledge_base_author" ("articleId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e9720156c57ff1ad841e95ace7"`); - await queryRunner.query(`DROP INDEX "IDX_1544c43e36e1ccf7d578c70607"`); - await queryRunner.query(`DROP INDEX "IDX_06a9902fedc1f9dcdbaf14afb0"`); - await queryRunner.query(`DROP INDEX "IDX_3547f82f867489542ceae58a49"`); - await queryRunner.query(`DROP INDEX "IDX_66af194845635058239e794e1b"`); - await queryRunner.query(`ALTER TABLE "knowledge_base_article" RENAME TO "temporary_knowledge_base_article"`); - await queryRunner.query( - `CREATE TABLE "knowledge_base_article" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "data" varchar, "draft" boolean NOT NULL, "privacy" boolean NOT NULL, "index" integer NOT NULL, "categoryId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_66af194845635058239e794e1b9" FOREIGN KEY ("categoryId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3547f82f867489542ceae58a49e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_06a9902fedc1f9dcdbaf14afb01" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "knowledge_base_article"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "data", "draft", "privacy", "index", "categoryId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base_article"` - ); - await queryRunner.query(`DROP TABLE "temporary_knowledge_base_article"`); - await queryRunner.query( - `CREATE INDEX "IDX_e9720156c57ff1ad841e95ace7" ON "knowledge_base_article" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1544c43e36e1ccf7d578c70607" ON "knowledge_base_article" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_06a9902fedc1f9dcdbaf14afb0" ON "knowledge_base_article" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3547f82f867489542ceae58a49" ON "knowledge_base_article" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_66af194845635058239e794e1b" ON "knowledge_base_article" ("categoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_0765098c5a6f93f51a55bda026"`); - await queryRunner.query(`DROP INDEX "IDX_9b22423b8cb20087c16613ecba"`); - await queryRunner.query(`DROP INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed"`); - await queryRunner.query(`DROP INDEX "IDX_2ba72a9dec732a10e8c05bcdec"`); - await queryRunner.query(`DROP INDEX "IDX_ff979040ce93cbc60863d322ec"`); - await queryRunner.query(`ALTER TABLE "knowledge_base" RENAME TO "temporary_knowledge_base"`); - await queryRunner.query( - `CREATE TABLE "knowledge_base" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "flag" varchar NOT NULL, "icon" varchar NOT NULL, "privacy" varchar NOT NULL, "language" varchar NOT NULL, "color" varchar NOT NULL, "description" varchar, "data" varchar, "index" integer, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_ff979040ce93cbc60863d322ecd" FOREIGN KEY ("parentId") REFERENCES "knowledge_base" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba72a9dec732a10e8c05bcdec1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_bcb30c9893f4c8d0c4e556b4ed3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "knowledge_base"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "flag", "icon", "privacy", "language", "color", "description", "data", "index", "parentId", "isActive", "isArchived", "deletedAt" FROM "temporary_knowledge_base"` - ); - await queryRunner.query(`DROP TABLE "temporary_knowledge_base"`); - await queryRunner.query(`CREATE INDEX "IDX_0765098c5a6f93f51a55bda026" ON "knowledge_base" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_9b22423b8cb20087c16613ecba" ON "knowledge_base" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_bcb30c9893f4c8d0c4e556b4ed" ON "knowledge_base" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_2ba72a9dec732a10e8c05bcdec" ON "knowledge_base" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_ff979040ce93cbc60863d322ec" ON "knowledge_base" ("parentId") `); - await queryRunner.query(`DROP INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56"`); - await queryRunner.query(`DROP INDEX "IDX_af850e1fa48af82d66e9bf81c7"`); - await queryRunner.query(`DROP INDEX "IDX_2323220b4decfd2f4d8307fd78"`); - await queryRunner.query(`DROP INDEX "IDX_d5ca48cfacfb516543d6507ca4"`); - await queryRunner.query( - `ALTER TABLE "job_preset_upwork_job_search_criterion" RENAME TO "temporary_job_preset_upwork_job_search_criterion"` - ); - await queryRunner.query( - `CREATE TABLE "job_preset_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_b909a3df761d7e489aca80f138a" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d45b36b85ffbd5189f7e70f29f5" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_9a687ce1a10a3abda460922cf84" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d5ca48cfacfb516543d6507ca4a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2323220b4decfd2f4d8307fd78f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "job_preset_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "temporary_job_preset_upwork_job_search_criterion"` - ); - await queryRunner.query(`DROP TABLE "temporary_job_preset_upwork_job_search_criterion"`); - await queryRunner.query( - `CREATE INDEX "IDX_4070b6f3480e9c4b2dcf3f7b56" ON "job_preset_upwork_job_search_criterion" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_af850e1fa48af82d66e9bf81c7" ON "job_preset_upwork_job_search_criterion" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2323220b4decfd2f4d8307fd78" ON "job_preset_upwork_job_search_criterion" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5ca48cfacfb516543d6507ca4" ON "job_preset_upwork_job_search_criterion" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e210f70c3904cf84ab5113be8f"`); - await queryRunner.query(`DROP INDEX "IDX_46226c3185e3ca3d7033831d7a"`); - await queryRunner.query(`DROP INDEX "IDX_7e53ea80aca15da11a8a5ec038"`); - await queryRunner.query(`DROP INDEX "IDX_a4b038417e3221c0791dd8c771"`); - await queryRunner.query(`DROP INDEX "IDX_f2c1b6770dd2a3abfa35f49411"`); - await queryRunner.query(`ALTER TABLE "job_preset" RENAME TO "temporary_job_preset"`); - await queryRunner.query( - `CREATE TABLE "job_preset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a4b038417e3221c0791dd8c7714" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e53ea80aca15da11a8a5ec0380" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "job_preset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_job_preset"` - ); - await queryRunner.query(`DROP TABLE "temporary_job_preset"`); - await queryRunner.query(`CREATE INDEX "IDX_e210f70c3904cf84ab5113be8f" ON "job_preset" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_46226c3185e3ca3d7033831d7a" ON "job_preset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_7e53ea80aca15da11a8a5ec038" ON "job_preset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_a4b038417e3221c0791dd8c771" ON "job_preset" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f2c1b6770dd2a3abfa35f49411" ON "job_preset" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_0e130a25bb4abe1b27c8a0adf4"`); - await queryRunner.query(`DROP INDEX "IDX_6bae61744663a416e73903d9af"`); - await queryRunner.query(`DROP INDEX "IDX_afe6c40d3d9951388fa05f83f2"`); - await queryRunner.query(`DROP INDEX "IDX_630337302efe97cc93deeb2151"`); - await queryRunner.query( - `ALTER TABLE "employee_upwork_job_search_criterion" RENAME TO "temporary_employee_upwork_job_search_criterion"` - ); - await queryRunner.query( - `CREATE TABLE "employee_upwork_job_search_criterion" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPresetId" varchar, "employeeId" varchar NOT NULL, "occupationId" varchar, "categoryId" varchar, "keyword" varchar, "jobType" text, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d2b148ddd67e520fb8061f4c133" FOREIGN KEY ("categoryId") REFERENCES "job_search_category" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b6bcd5ceb60e4bb493344a6b4f2" FOREIGN KEY ("occupationId") REFERENCES "job_search_occupation" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c872e6e3ab28e813c2324d1f4fb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_2dc73e07ac7040f273cea3c999d" FOREIGN KEY ("jobPresetId") REFERENCES "job_preset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_630337302efe97cc93deeb21516" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_afe6c40d3d9951388fa05f83f28" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_upwork_job_search_criterion"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPresetId", "employeeId", "occupationId", "categoryId", "keyword", "jobType", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_upwork_job_search_criterion"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_upwork_job_search_criterion"`); - await queryRunner.query( - `CREATE INDEX "IDX_0e130a25bb4abe1b27c8a0adf4" ON "employee_upwork_job_search_criterion" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6bae61744663a416e73903d9af" ON "employee_upwork_job_search_criterion" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_afe6c40d3d9951388fa05f83f2" ON "employee_upwork_job_search_criterion" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_630337302efe97cc93deeb2151" ON "employee_upwork_job_search_criterion" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_015231c6e28cfb2b789ca4b76f"`); - await queryRunner.query(`DROP INDEX "IDX_36333846c37e5f8812a5c9f7ff"`); - await queryRunner.query(`DROP INDEX "IDX_6ee5218c869b57197e4a209bed"`); - await queryRunner.query(`DROP INDEX "IDX_d0a798419c775b9157bf0269f4"`); - await queryRunner.query(`DROP INDEX "IDX_3b335bbcbf7d5e00853acaa165"`); - await queryRunner.query(`DROP INDEX "IDX_86381fb6d28978b101b3aec8ca"`); - await queryRunner.query(`DROP INDEX "IDX_35e120f2b6e5188391cf068d3b"`); - await queryRunner.query(`ALTER TABLE "job_search_category" RENAME TO "temporary_job_search_category"`); - await queryRunner.query( - `CREATE TABLE "job_search_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceCategoryId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_35e120f2b6e5188391cf068d3ba" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86381fb6d28978b101b3aec8ca4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "job_search_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceCategoryId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "temporary_job_search_category"` - ); - await queryRunner.query(`DROP TABLE "temporary_job_search_category"`); - await queryRunner.query( - `CREATE INDEX "IDX_015231c6e28cfb2b789ca4b76f" ON "job_search_category" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_36333846c37e5f8812a5c9f7ff" ON "job_search_category" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_6ee5218c869b57197e4a209bed" ON "job_search_category" ("jobSource") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d0a798419c775b9157bf0269f4" ON "job_search_category" ("jobSourceCategoryId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3b335bbcbf7d5e00853acaa165" ON "job_search_category" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_86381fb6d28978b101b3aec8ca" ON "job_search_category" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_35e120f2b6e5188391cf068d3b" ON "job_search_category" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_e4bc75a1cbb07d117a0acfcdba"`); - await queryRunner.query(`DROP INDEX "IDX_4b8450a24233df8b47ca472923"`); - await queryRunner.query(`DROP INDEX "IDX_c8723c90a6f007f8d7e882a04f"`); - await queryRunner.query(`DROP INDEX "IDX_cb64573b18dd7b23f591f15502"`); - await queryRunner.query(`DROP INDEX "IDX_9f1288205ae91f91cf356cac2f"`); - await queryRunner.query(`DROP INDEX "IDX_1a62a99e1016e4a2b461e886ec"`); - await queryRunner.query(`DROP INDEX "IDX_44e22d88b47daf2095491b7cac"`); - await queryRunner.query(`ALTER TABLE "job_search_occupation" RENAME TO "temporary_job_search_occupation"`); - await queryRunner.query( - `CREATE TABLE "job_search_occupation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "jobSourceOccupationId" varchar, "jobSource" text NOT NULL DEFAULT ('upwork'), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_44e22d88b47daf2095491b7cac3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1a62a99e1016e4a2b461e886ecd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "job_search_occupation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "jobSourceOccupationId", "jobSource", "isActive", "isArchived", "deletedAt" FROM "temporary_job_search_occupation"` - ); - await queryRunner.query(`DROP TABLE "temporary_job_search_occupation"`); - await queryRunner.query( - `CREATE INDEX "IDX_e4bc75a1cbb07d117a0acfcdba" ON "job_search_occupation" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4b8450a24233df8b47ca472923" ON "job_search_occupation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c8723c90a6f007f8d7e882a04f" ON "job_search_occupation" ("jobSource") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cb64573b18dd7b23f591f15502" ON "job_search_occupation" ("jobSourceOccupationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9f1288205ae91f91cf356cac2f" ON "job_search_occupation" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_1a62a99e1016e4a2b461e886ec" ON "job_search_occupation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_44e22d88b47daf2095491b7cac" ON "job_search_occupation" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e396663e1a31114eac39087829"`); - await queryRunner.query(`DROP INDEX "IDX_2bb17670e2bea3980ff960bbcf"`); - await queryRunner.query(`DROP INDEX "IDX_f577c9bc6183c1d1eae1e154bb"`); - await queryRunner.query(`DROP INDEX "IDX_ee780fbd8f91de31c004929eec"`); - await queryRunner.query(`DROP INDEX "IDX_dc2ff85f7de16dea6453a833dd"`); - await queryRunner.query(`DROP INDEX "IDX_0111963c9cb4dd14565c0d9c84"`); - await queryRunner.query(`DROP INDEX "IDX_a13f3564eae9db44ddc4308afc"`); - await queryRunner.query(`DROP INDEX "IDX_2be728a7f8b118712a4200990d"`); - await queryRunner.query( - `ALTER TABLE "employee_proposal_template" RENAME TO "temporary_employee_proposal_template"` - ); - await queryRunner.query( - `CREATE TABLE "employee_proposal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "content" text, "isDefault" boolean NOT NULL DEFAULT (0), "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2be728a7f8b118712a4200990d4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ee780fbd8f91de31c004929eecb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f577c9bc6183c1d1eae1e154bbc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_proposal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "isDefault", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_proposal_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_proposal_template"`); - await queryRunner.query( - `CREATE INDEX "IDX_e396663e1a31114eac39087829" ON "employee_proposal_template" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2bb17670e2bea3980ff960bbcf" ON "employee_proposal_template" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f577c9bc6183c1d1eae1e154bb" ON "employee_proposal_template" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ee780fbd8f91de31c004929eec" ON "employee_proposal_template" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_dc2ff85f7de16dea6453a833dd" ON "employee_proposal_template" ("name") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0111963c9cb4dd14565c0d9c84" ON "employee_proposal_template" ("content") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a13f3564eae9db44ddc4308afc" ON "employee_proposal_template" ("isDefault") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2be728a7f8b118712a4200990d" ON "employee_proposal_template" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e2836e856f491dd4676e1ec8d3"`); - await queryRunner.query(`DROP INDEX "IDX_61a30a7d83666bf265fd86a72d"`); - await queryRunner.query(`DROP INDEX "IDX_4177329f5e6ddbfb6416592713"`); - await queryRunner.query(`DROP INDEX "IDX_d59ec6899d435f430799795ad7"`); - await queryRunner.query(`DROP INDEX "IDX_cc28a54171231fbd9a127051f0"`); - await queryRunner.query(`ALTER TABLE "proposal" RENAME TO "temporary_proposal"`); - await queryRunner.query( - `CREATE TABLE "proposal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "jobPostUrl" varchar, "valueDate" datetime, "jobPostContent" varchar NOT NULL, "proposalContent" varchar NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_61c45ab51852e4b0e539756d40f" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f399488a0f3ea10bb511e3f5aa3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d59ec6899d435f430799795ad7b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4177329f5e6ddbfb64165927134" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "proposal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "jobPostUrl", "valueDate", "jobPostContent", "proposalContent", "status", "employeeId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_proposal"` - ); - await queryRunner.query(`DROP TABLE "temporary_proposal"`); - await queryRunner.query(`CREATE INDEX "IDX_e2836e856f491dd4676e1ec8d3" ON "proposal" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_61a30a7d83666bf265fd86a72d" ON "proposal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4177329f5e6ddbfb6416592713" ON "proposal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d59ec6899d435f430799795ad7" ON "proposal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_cc28a54171231fbd9a127051f0" ON "proposal" ("jobPostUrl") `); - await queryRunner.query(`DROP INDEX "IDX_d706210d377ece2a1bc3386388"`); - await queryRunner.query(`DROP INDEX "IDX_c774c276d6b7ea05a7e12d3c81"`); - await queryRunner.query(`DROP INDEX "IDX_b3234be5b70c2362cdf67bb188"`); - await queryRunner.query(`DROP INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b"`); - await queryRunner.query(`DROP INDEX "IDX_055f310a04a928343494a5255a"`); - await queryRunner.query(`DROP INDEX "IDX_a8709a9c5cc142c6fbe92df274"`); - await queryRunner.query(`DROP INDEX "IDX_5065401113abb6e9608225e567"`); - await queryRunner.query( - `ALTER TABLE "organization_github_repository_issue" RENAME TO "temporary_organization_github_repository_issue"` - ); - await queryRunner.query( - `CREATE TABLE "organization_github_repository_issue" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "issueId" bigint NOT NULL, "issueNumber" integer NOT NULL, "repositoryId" varchar, "deletedAt" datetime, CONSTRAINT "FK_5065401113abb6e9608225e5678" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6c8e119fc6a2a7d3413aa76d3bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3234be5b70c2362cdf67bb1889" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_github_repository_issue"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "issueId", "issueNumber", "repositoryId", "deletedAt" FROM "temporary_organization_github_repository_issue"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_github_repository_issue"`); - await queryRunner.query( - `CREATE INDEX "IDX_d706210d377ece2a1bc3386388" ON "organization_github_repository_issue" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c774c276d6b7ea05a7e12d3c81" ON "organization_github_repository_issue" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b3234be5b70c2362cdf67bb188" ON "organization_github_repository_issue" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6c8e119fc6a2a7d3413aa76d3b" ON "organization_github_repository_issue" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_055f310a04a928343494a5255a" ON "organization_github_repository_issue" ("issueId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a8709a9c5cc142c6fbe92df274" ON "organization_github_repository_issue" ("issueNumber") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5065401113abb6e9608225e567" ON "organization_github_repository_issue" ("repositoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_59407d03d189560ac1a0a4b0eb"`); - await queryRunner.query(`DROP INDEX "IDX_2eec784cadcb7847b64937fb58"`); - await queryRunner.query(`DROP INDEX "IDX_34c48d11eb82ef42e89370bdc7"`); - await queryRunner.query(`DROP INDEX "IDX_04717f25bea7d9cef0d51cac50"`); - await queryRunner.query(`DROP INDEX "IDX_5e97728cfda96f49cc7f95bbaf"`); - await queryRunner.query(`DROP INDEX "IDX_ef65338e8597b9f56fd0fe3c94"`); - await queryRunner.query(`DROP INDEX "IDX_480158f21938444e4f62fb3185"`); - await queryRunner.query(`DROP INDEX "IDX_69d75a47af6bfcda545a865691"`); - await queryRunner.query(`DROP INDEX "IDX_ca0fa80f50baed7287a499dc2c"`); - await queryRunner.query(`DROP INDEX "IDX_6eea42a69e130bbd14b7ea3659"`); - await queryRunner.query(`DROP INDEX "IDX_a146e202c19f521bf5ec69bb26"`); - await queryRunner.query(`DROP INDEX "IDX_9e8a77c1d330554fab9230100a"`); - await queryRunner.query(`DROP INDEX "IDX_add7dbec156589dd0b27e2e0c4"`); - await queryRunner.query( - `ALTER TABLE "organization_github_repository" RENAME TO "temporary_organization_github_repository"` - ); - await queryRunner.query( - `CREATE TABLE "organization_github_repository" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "repositoryId" bigint NOT NULL, "name" varchar NOT NULL, "fullName" varchar NOT NULL, "owner" varchar NOT NULL, "integrationId" varchar, "issuesCount" integer, "hasSyncEnabled" boolean DEFAULT (1), "private" boolean DEFAULT (0), "status" varchar, "deletedAt" datetime, CONSTRAINT "FK_add7dbec156589dd0b27e2e0c49" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_69d75a47af6bfcda545a865691b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_480158f21938444e4f62fb31857" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_github_repository"("id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "repositoryId", "name", "fullName", "owner", "integrationId", "issuesCount", "hasSyncEnabled", "private", "status", "deletedAt" FROM "temporary_organization_github_repository"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_github_repository"`); - await queryRunner.query( - `CREATE INDEX "IDX_59407d03d189560ac1a0a4b0eb" ON "organization_github_repository" ("status") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2eec784cadcb7847b64937fb58" ON "organization_github_repository" ("private") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_34c48d11eb82ef42e89370bdc7" ON "organization_github_repository" ("hasSyncEnabled") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_04717f25bea7d9cef0d51cac50" ON "organization_github_repository" ("issuesCount") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5e97728cfda96f49cc7f95bbaf" ON "organization_github_repository" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ef65338e8597b9f56fd0fe3c94" ON "organization_github_repository" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_480158f21938444e4f62fb3185" ON "organization_github_repository" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_69d75a47af6bfcda545a865691" ON "organization_github_repository" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ca0fa80f50baed7287a499dc2c" ON "organization_github_repository" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6eea42a69e130bbd14b7ea3659" ON "organization_github_repository" ("name") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a146e202c19f521bf5ec69bb26" ON "organization_github_repository" ("fullName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9e8a77c1d330554fab9230100a" ON "organization_github_repository" ("owner") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_add7dbec156589dd0b27e2e0c4" ON "organization_github_repository" ("integrationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_cbc2b8338d45e774afd8682ffe"`); - await queryRunner.query(`DROP INDEX "IDX_cc89233c87fcf64b01df07e038"`); - await queryRunner.query(`DROP INDEX "IDX_c2037b621d2e8023898aee4ac7"`); - await queryRunner.query(`DROP INDEX "IDX_744268ee0ec6073883267bc3b6"`); - await queryRunner.query(`ALTER TABLE "changelog" RENAME TO "temporary_changelog"`); - await queryRunner.query( - `CREATE TABLE "changelog" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "title" varchar, "date" datetime NOT NULL, "content" varchar NOT NULL, "learnMoreUrl" varchar, "isFeature" boolean, "imageUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_744268ee0ec6073883267bc3b66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c2037b621d2e8023898aee4ac74" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "changelog"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "title", "date", "content", "learnMoreUrl", "isFeature", "imageUrl", "isActive", "isArchived", "deletedAt" FROM "temporary_changelog"` - ); - await queryRunner.query(`DROP TABLE "temporary_changelog"`); - await queryRunner.query(`CREATE INDEX "IDX_cbc2b8338d45e774afd8682ffe" ON "changelog" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_cc89233c87fcf64b01df07e038" ON "changelog" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_c2037b621d2e8023898aee4ac7" ON "changelog" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_744268ee0ec6073883267bc3b6" ON "changelog" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_835691d3dd62d0b705302cbb2d"`); - await queryRunner.query(`DROP INDEX "IDX_ee85901ae866ffe2061d5b35c8"`); - await queryRunner.query(`DROP INDEX "IDX_84594016a98da8b87e0f51cd93"`); - await queryRunner.query(`DROP INDEX "IDX_f502dc6d9802306f9d1584932b"`); - await queryRunner.query(`DROP INDEX "IDX_f5735eafddabdb4b20f621a976"`); - await queryRunner.query(`DROP INDEX "IDX_9b2f00761a6b1b77cb6289e3ff"`); - await queryRunner.query(`ALTER TABLE "warehouse" RENAME TO "temporary_warehouse"`); - await queryRunner.query( - `CREATE TABLE "warehouse" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "logoId" varchar, "contactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_84594016a98da8b87e0f51cd93" UNIQUE ("contactId"), CONSTRAINT "FK_84594016a98da8b87e0f51cd931" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f502dc6d9802306f9d1584932b8" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f5735eafddabdb4b20f621a976a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9b2f00761a6b1b77cb6289e3fff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "warehouse"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "description", "active", "logoId", "contactId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse"` - ); - await queryRunner.query(`DROP TABLE "temporary_warehouse"`); - await queryRunner.query(`CREATE INDEX "IDX_835691d3dd62d0b705302cbb2d" ON "warehouse" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_ee85901ae866ffe2061d5b35c8" ON "warehouse" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_84594016a98da8b87e0f51cd93" ON "warehouse" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_f502dc6d9802306f9d1584932b" ON "warehouse" ("logoId") `); - await queryRunner.query(`CREATE INDEX "IDX_f5735eafddabdb4b20f621a976" ON "warehouse" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_9b2f00761a6b1b77cb6289e3ff" ON "warehouse" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_40aa52eaed1ce133f5fee76bca"`); - await queryRunner.query(`DROP INDEX "IDX_5f32a52e9bd19bf323b02efcd1"`); - await queryRunner.query(`DROP INDEX "IDX_617306cb3613dd8d59301ae16f"`); - await queryRunner.query(`DROP INDEX "IDX_a2f863689d1316810c41c1ea38"`); - await queryRunner.query(`DROP INDEX "IDX_a1c4a97b928b547c3041d3ac1f"`); - await queryRunner.query(`DROP INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed"`); - await queryRunner.query( - `ALTER TABLE "warehouse_product_variant" RENAME TO "temporary_warehouse_product_variant"` - ); - await queryRunner.query( - `CREATE TABLE "warehouse_product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "variantId" varchar NOT NULL, "warehouseProductId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d5f4b64e6a80546fd6dd4ac3ed0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a1c4a97b928b547c3041d3ac1f6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2f863689d1316810c41c1ea38e" FOREIGN KEY ("variantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_617306cb3613dd8d59301ae16fd" FOREIGN KEY ("warehouseProductId") REFERENCES "warehouse_product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "warehouse_product_variant"("id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "variantId", "warehouseProductId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse_product_variant"` - ); - await queryRunner.query(`DROP TABLE "temporary_warehouse_product_variant"`); - await queryRunner.query( - `CREATE INDEX "IDX_40aa52eaed1ce133f5fee76bca" ON "warehouse_product_variant" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5f32a52e9bd19bf323b02efcd1" ON "warehouse_product_variant" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_617306cb3613dd8d59301ae16f" ON "warehouse_product_variant" ("warehouseProductId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a2f863689d1316810c41c1ea38" ON "warehouse_product_variant" ("variantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a1c4a97b928b547c3041d3ac1f" ON "warehouse_product_variant" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5f4b64e6a80546fd6dd4ac3ed" ON "warehouse_product_variant" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3370818c940a51996d80bb4d16"`); - await queryRunner.query(`DROP INDEX "IDX_7a584a02d15a022e9c4f06ea72"`); - await queryRunner.query(`DROP INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7"`); - await queryRunner.query(`DROP INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb"`); - await queryRunner.query(`DROP INDEX "IDX_62573a939f834f2de343f98288"`); - await queryRunner.query(`DROP INDEX "IDX_c899e17322d11e1977832e8c65"`); - await queryRunner.query(`ALTER TABLE "warehouse_product" RENAME TO "temporary_warehouse_product"`); - await queryRunner.query( - `CREATE TABLE "warehouse_product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "quantity" numeric DEFAULT (0), "warehouseId" varchar NOT NULL, "productId" varchar NOT NULL, "organizationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3f934c4772e7c7f2c66d7ea4e72" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a8c9aee14d47ec7b3f2ac429ebc" FOREIGN KEY ("warehouseId") REFERENCES "warehouse" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c899e17322d11e1977832e8c656" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_62573a939f834f2de343f98288c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "warehouse_product"("id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "quantity", "warehouseId", "productId", "organizationId", "isActive", "isArchived", "deletedAt" FROM "temporary_warehouse_product"` - ); - await queryRunner.query(`DROP TABLE "temporary_warehouse_product"`); - await queryRunner.query(`CREATE INDEX "IDX_3370818c940a51996d80bb4d16" ON "warehouse_product" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_7a584a02d15a022e9c4f06ea72" ON "warehouse_product" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_3f934c4772e7c7f2c66d7ea4e7" ON "warehouse_product" ("productId") `); - await queryRunner.query( - `CREATE INDEX "IDX_a8c9aee14d47ec7b3f2ac429eb" ON "warehouse_product" ("warehouseId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_62573a939f834f2de343f98288" ON "warehouse_product" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_c899e17322d11e1977832e8c65" ON "warehouse_product" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_557cb712d32a9ad9ffbb4cd50d"`); - await queryRunner.query(`DROP INDEX "IDX_fde2ce12ab12b02ae583dd76c7"`); - await queryRunner.query(`DROP INDEX "IDX_5e028298e103e1694147ada69e"`); - await queryRunner.query(`DROP INDEX "IDX_f2578043e491921209f5dadd08"`); - await queryRunner.query(`DROP INDEX "IDX_c28e52f758e7bbc53828db9219"`); - await queryRunner.query(`DROP INDEX "IDX_78a916df40e02a9deb1c4b75ed"`); - await queryRunner.query(`DROP INDEX "IDX_e12875dfb3b1d92d7d7c5377e2"`); - await queryRunner.query(`DROP INDEX "IDX_f0e1b4ecdca13b177e2e3a0613"`); - await queryRunner.query(`DROP INDEX "IDX_58e4dbff0e1a32a9bdc861bb29"`); - await queryRunner.query(`DROP INDEX "IDX_19de43e9f1842360ce646253d7"`); - await queryRunner.query(`DROP INDEX "IDX_685bf353c85f23b6f848e4dcde"`); - await queryRunner.query(`DROP INDEX "IDX_1a8ae1126aae1823d62ccf3f82"`); - await queryRunner.query(`DROP INDEX "IDX_5864814596f85fe59bd1a0dc76"`); - await queryRunner.query(`DROP INDEX "IDX_0e9f745ad08103a1c21523326c"`); - await queryRunner.query(`DROP INDEX "IDX_f725c3df76a1a94e3e9f0313a5"`); - await queryRunner.query(`ALTER TABLE "user" RENAME TO "temporary_user"`); - await queryRunner.query( - `CREATE TABLE "user" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "thirdPartyId" varchar, "firstName" varchar, "lastName" varchar, "email" varchar, "username" varchar, "hash" varchar, "imageUrl" varchar(500), "preferredLanguage" varchar DEFAULT ('en'), "preferredComponentLayout" varchar CHECK( "preferredComponentLayout" IN ('CARDS_GRID','TABLE') ) DEFAULT ('TABLE'), "roleId" varchar, "refreshToken" varchar, "isActive" boolean DEFAULT (1), "code" varchar, "codeExpireAt" datetime, "emailVerifiedAt" datetime, "emailToken" varchar, "phoneNumber" varchar, "timeZone" varchar, "imageId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "timeFormat" varchar CHECK( "timeFormat" IN ('12','24') ) NOT NULL DEFAULT (12), "lastLoginAt" datetime, "defaultTeamId" varchar, "lastTeamId" varchar, "defaultOrganizationId" varchar, "lastOrganizationId" varchar, CONSTRAINT "FK_f725c3df76a1a94e3e9f0313a5f" FOREIGN KEY ("lastOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0e9f745ad08103a1c21523326c6" FOREIGN KEY ("defaultOrganizationId") REFERENCES "organization" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5864814596f85fe59bd1a0dc766" FOREIGN KEY ("lastTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1a8ae1126aae1823d62ccf3f821" FOREIGN KEY ("defaultTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c28e52f758e7bbc53828db92194" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_685bf353c85f23b6f848e4dcded" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e028298e103e1694147ada69e5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "user"("id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId") SELECT "id", "createdAt", "updatedAt", "tenantId", "thirdPartyId", "firstName", "lastName", "email", "username", "hash", "imageUrl", "preferredLanguage", "preferredComponentLayout", "roleId", "refreshToken", "isActive", "code", "codeExpireAt", "emailVerifiedAt", "emailToken", "phoneNumber", "timeZone", "imageId", "isArchived", "deletedAt", "timeFormat", "lastLoginAt", "defaultTeamId", "lastTeamId", "defaultOrganizationId", "lastOrganizationId" FROM "temporary_user"` - ); - await queryRunner.query(`DROP TABLE "temporary_user"`); - await queryRunner.query(`CREATE INDEX "IDX_557cb712d32a9ad9ffbb4cd50d" ON "user" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_fde2ce12ab12b02ae583dd76c7" ON "user" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_5e028298e103e1694147ada69e" ON "user" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_f2578043e491921209f5dadd08" ON "user" ("phoneNumber") `); - await queryRunner.query(`CREATE INDEX "IDX_c28e52f758e7bbc53828db9219" ON "user" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_78a916df40e02a9deb1c4b75ed" ON "user" ("username") `); - await queryRunner.query(`CREATE INDEX "IDX_e12875dfb3b1d92d7d7c5377e2" ON "user" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_f0e1b4ecdca13b177e2e3a0613" ON "user" ("lastName") `); - await queryRunner.query(`CREATE INDEX "IDX_58e4dbff0e1a32a9bdc861bb29" ON "user" ("firstName") `); - await queryRunner.query(`CREATE INDEX "IDX_19de43e9f1842360ce646253d7" ON "user" ("thirdPartyId") `); - await queryRunner.query(`CREATE INDEX "IDX_685bf353c85f23b6f848e4dcde" ON "user" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_1a8ae1126aae1823d62ccf3f82" ON "user" ("defaultTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_5864814596f85fe59bd1a0dc76" ON "user" ("lastTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_0e9f745ad08103a1c21523326c" ON "user" ("defaultOrganizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_f725c3df76a1a94e3e9f0313a5" ON "user" ("lastOrganizationId") `); - await queryRunner.query(`DROP INDEX "IDX_c764336019c69cc4927f317cb0"`); - await queryRunner.query(`DROP INDEX "IDX_611e1392c8cc9b101e3ea7ad80"`); - await queryRunner.query(`DROP INDEX "IDX_7143f31467178a6164a42426c1"`); - await queryRunner.query(`DROP INDEX "IDX_1f97ff07fb198bd0a7786b2abd"`); - await queryRunner.query(`DROP INDEX "IDX_ca24fc59aac015d9660955f5f6"`); - await queryRunner.query(`DROP INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5"`); - await queryRunner.query(`ALTER TABLE "user_organization" RENAME TO "temporary_user_organization"`); - await queryRunner.query( - `CREATE TABLE "user_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isDefault" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "userId" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_29c3c8cc3ea9db22e4a347f4b5a" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7143f31467178a6164a42426c15" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_611e1392c8cc9b101e3ea7ad80c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "user_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isDefault", "isActive", "userId", "isArchived", "deletedAt" FROM "temporary_user_organization"` - ); - await queryRunner.query(`DROP TABLE "temporary_user_organization"`); - await queryRunner.query(`CREATE INDEX "IDX_c764336019c69cc4927f317cb0" ON "user_organization" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_611e1392c8cc9b101e3ea7ad80" ON "user_organization" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7143f31467178a6164a42426c1" ON "user_organization" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1f97ff07fb198bd0a7786b2abd" ON "user_organization" ("isDefault") `); - await queryRunner.query(`CREATE INDEX "IDX_ca24fc59aac015d9660955f5f6" ON "user_organization" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_29c3c8cc3ea9db22e4a347f4b5" ON "user_organization" ("userId") `); - await queryRunner.query(`DROP INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff"`); - await queryRunner.query(`DROP INDEX "IDX_42205a9e6af108364e5cc62dd4"`); - await queryRunner.query(`DROP INDEX "IDX_6c1f81934a3f597b3b1a17f562"`); - await queryRunner.query(`DROP INDEX "IDX_8c8f821cb0fe0dd387491ea7d9"`); - await queryRunner.query(`DROP INDEX "IDX_aca65a79fe0c1ec9e6a59022c5"`); - await queryRunner.query(`DROP INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7"`); - await queryRunner.query(`DROP INDEX "IDX_930e2b28de9ecb1ea689d5a97a"`); - await queryRunner.query(`DROP INDEX "IDX_f6558fbb3158ab90da1c41d943"`); - await queryRunner.query(`DROP INDEX "IDX_6a79eb7534066b11f59243ede1"`); - await queryRunner.query(`DROP INDEX "IDX_3f8fc4b5718fcaa913f9438e27"`); - await queryRunner.query(`DROP INDEX "IDX_3502c60f98a7cda58dea75bcb5"`); - await queryRunner.query(`DROP INDEX "IDX_c828facbb4250117f83416d9f7"`); - await queryRunner.query(`DROP INDEX "IDX_23fdffa8369387d87101090684"`); - await queryRunner.query(`DROP INDEX "IDX_ea81b5247ecdf5d82cf71fa096"`); - await queryRunner.query(`ALTER TABLE "timesheet" RENAME TO "temporary_timesheet"`); - await queryRunner.query( - `CREATE TABLE "timesheet" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime, "stoppedAt" datetime, "approvedAt" datetime, "submittedAt" datetime, "lockedAt" datetime, "isBilled" boolean NOT NULL DEFAULT (0), "status" varchar NOT NULL DEFAULT ('PENDING'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "approvedById" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, CONSTRAINT "FK_6c1f81934a3f597b3b1a17f5623" FOREIGN KEY ("approvedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_25b8df69c9b7f5752c6a6a6ef7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aca65a79fe0c1ec9e6a59022c54" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8c8f821cb0fe0dd387491ea7d9e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "timesheet"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "stoppedAt", "approvedAt", "submittedAt", "lockedAt", "isBilled", "status", "deletedAt", "employeeId", "approvedById", "isActive", "isArchived", "editedAt" FROM "temporary_timesheet"` - ); - await queryRunner.query(`DROP TABLE "temporary_timesheet"`); - await queryRunner.query(`CREATE INDEX "IDX_f2d4cd3a7e839bfc7cb6b993ff" ON "timesheet" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_42205a9e6af108364e5cc62dd4" ON "timesheet" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6c1f81934a3f597b3b1a17f562" ON "timesheet" ("approvedById") `); - await queryRunner.query(`CREATE INDEX "IDX_8c8f821cb0fe0dd387491ea7d9" ON "timesheet" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_aca65a79fe0c1ec9e6a59022c5" ON "timesheet" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_25b8df69c9b7f5752c6a6a6ef7" ON "timesheet" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_930e2b28de9ecb1ea689d5a97a" ON "timesheet" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_f6558fbb3158ab90da1c41d943" ON "timesheet" ("stoppedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_6a79eb7534066b11f59243ede1" ON "timesheet" ("approvedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3f8fc4b5718fcaa913f9438e27" ON "timesheet" ("submittedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_3502c60f98a7cda58dea75bcb5" ON "timesheet" ("lockedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_c828facbb4250117f83416d9f7" ON "timesheet" ("isBilled") `); - await queryRunner.query(`CREATE INDEX "IDX_23fdffa8369387d87101090684" ON "timesheet" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_ea81b5247ecdf5d82cf71fa096" ON "timesheet" ("editedAt") `); - await queryRunner.query(`DROP INDEX "IDX_a3eeb9629f550c367bb752855e"`); - await queryRunner.query(`DROP INDEX "IDX_8260fdc7862ca27d8cf10e6290"`); - await queryRunner.query(`DROP INDEX "IDX_c7f72cb68b22b8ab988158e4d2"`); - await queryRunner.query(`DROP INDEX "IDX_82c5edbd179359212f16f0d386"`); - await queryRunner.query(`DROP INDEX "IDX_9272701d3da8bd8507f316c915"`); - await queryRunner.query(`ALTER TABLE "time_slot_minute" RENAME TO "temporary_time_slot_minute"`); - await queryRunner.query( - `CREATE TABLE "time_slot_minute" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "datetime" datetime NOT NULL, "timeSlotId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_0ac1d2777eefcee82db52ca3660" UNIQUE ("timeSlotId", "datetime"), CONSTRAINT "FK_9272701d3da8bd8507f316c9154" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_82c5edbd179359212f16f0d386a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_c7f72cb68b22b8ab988158e4d26" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "time_slot_minute"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "keyboard", "mouse", "datetime", "timeSlotId", "isActive", "isArchived", "deletedAt" FROM "temporary_time_slot_minute"` - ); - await queryRunner.query(`DROP TABLE "temporary_time_slot_minute"`); - await queryRunner.query(`CREATE INDEX "IDX_a3eeb9629f550c367bb752855e" ON "time_slot_minute" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_8260fdc7862ca27d8cf10e6290" ON "time_slot_minute" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_c7f72cb68b22b8ab988158e4d2" ON "time_slot_minute" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_82c5edbd179359212f16f0d386" ON "time_slot_minute" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9272701d3da8bd8507f316c915" ON "time_slot_minute" ("timeSlotId") `); - await queryRunner.query(`DROP INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5"`); - await queryRunner.query(`DROP INDEX "IDX_645a6bc3f1141d4a111a3166d8"`); - await queryRunner.query(`DROP INDEX "IDX_b407841271245501dd1a8c7551"`); - await queryRunner.query(`DROP INDEX "IDX_b8284109257b5137256b5b3e84"`); - await queryRunner.query(`DROP INDEX "IDX_0c707825a7c2ecc4e186b07ebf"`); - await queryRunner.query(`DROP INDEX "IDX_f44e721669d5c6bed32cd6a3bf"`); - await queryRunner.query(`DROP INDEX "IDX_c6e7d1075bfd97eea6643b1479"`); - await queryRunner.query(`DROP INDEX "IDX_7913305b850c7afc89b6ed96a3"`); - await queryRunner.query(`ALTER TABLE "time_slot" RENAME TO "temporary_time_slot"`); - await queryRunner.query( - `CREATE TABLE "time_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" integer NOT NULL DEFAULT (0), "keyboard" integer NOT NULL DEFAULT (0), "mouse" integer NOT NULL DEFAULT (0), "overall" integer NOT NULL DEFAULT (0), "startedAt" datetime NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7913305b850c7afc89b6ed96a30" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b8284109257b5137256b5b3e848" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b407841271245501dd1a8c75513" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "time_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "keyboard", "mouse", "overall", "startedAt", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_time_slot"` - ); - await queryRunner.query(`DROP TABLE "temporary_time_slot"`); - await queryRunner.query(`CREATE INDEX "IDX_81060c5dbe69efa1f3b6e1a2e5" ON "time_slot" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_645a6bc3f1141d4a111a3166d8" ON "time_slot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_b407841271245501dd1a8c7551" ON "time_slot" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_b8284109257b5137256b5b3e84" ON "time_slot" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_0c707825a7c2ecc4e186b07ebf" ON "time_slot" ("duration") `); - await queryRunner.query(`CREATE INDEX "IDX_f44e721669d5c6bed32cd6a3bf" ON "time_slot" ("overall") `); - await queryRunner.query(`CREATE INDEX "IDX_c6e7d1075bfd97eea6643b1479" ON "time_slot" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_7913305b850c7afc89b6ed96a3" ON "time_slot" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_91a64228fbbe1516730a0cab5d"`); - await queryRunner.query(`DROP INDEX "IDX_a1910a76044b971609b75ea165"`); - await queryRunner.query(`DROP INDEX "IDX_79001d281ecb766005b3d331c1"`); - await queryRunner.query(`DROP INDEX "IDX_f447474d185cd70b3015853874"`); - await queryRunner.query(`DROP INDEX "IDX_722b9cb3a991c964d86396b6bc"`); - await queryRunner.query(`DROP INDEX "IDX_402290e7045e0c10ef97d9f982"`); - await queryRunner.query(`DROP INDEX "IDX_e80fb588b1086ce2a4f2244814"`); - await queryRunner.query(`DROP INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec"`); - await queryRunner.query(`DROP INDEX "IDX_189b79acd611870aba62b3594e"`); - await queryRunner.query(`DROP INDEX "IDX_fa9018cb248ea0f3b2b30ef143"`); - await queryRunner.query(`DROP INDEX "IDX_aed2d5cc5680fba9d387c7f931"`); - await queryRunner.query(`DROP INDEX "IDX_a89a849957e005bafb8e4220bc"`); - await queryRunner.query(`DROP INDEX "IDX_e65393bb52aa8275b1392c73f7"`); - await queryRunner.query(`DROP INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5"`); - await queryRunner.query(`DROP INDEX "IDX_1ddf2da35e34378fd845d80a18"`); - await queryRunner.query(`DROP INDEX "IDX_d1e8f22c02c5e949453dde7f2d"`); - await queryRunner.query(`DROP INDEX "IDX_18dcdf754396f0cb0308dc91f4"`); - await queryRunner.query(`DROP INDEX "IDX_154e9120e2acb632d8bd9b91ff"`); - await queryRunner.query(`ALTER TABLE "time_log" RENAME TO "temporary_time_log"`); - await queryRunner.query( - `CREATE TABLE "time_log" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startedAt" datetime, "stoppedAt" datetime, "logType" varchar NOT NULL DEFAULT ('TRACKED'), "source" varchar NOT NULL DEFAULT ('BROWSER'), "description" varchar, "reason" varchar, "isBillable" boolean NOT NULL DEFAULT (0), "deletedAt" datetime, "employeeId" varchar NOT NULL, "timesheetId" varchar, "projectId" varchar, "taskId" varchar, "organizationContactId" varchar, "isRunning" boolean, "version" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "editedAt" datetime, CONSTRAINT "FK_18dcdf754396f0cb0308dc91f4c" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d1e8f22c02c5e949453dde7f2d1" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1ddf2da35e34378fd845d80a18b" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_54776f6f5fd3c13c3bc1fbfac5b" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e65393bb52aa8275b1392c73f72" FOREIGN KEY ("timesheetId") REFERENCES "timesheet" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_aed2d5cc5680fba9d387c7f931d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa9018cb248ea0f3b2b30ef143b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a89a849957e005bafb8e4220bc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "time_log"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startedAt", "stoppedAt", "logType", "source", "description", "reason", "isBillable", "deletedAt", "employeeId", "timesheetId", "projectId", "taskId", "organizationContactId", "isRunning", "version", "organizationTeamId", "isActive", "isArchived", "editedAt" FROM "temporary_time_log"` - ); - await queryRunner.query(`DROP TABLE "temporary_time_log"`); - await queryRunner.query(`CREATE INDEX "IDX_91a64228fbbe1516730a0cab5d" ON "time_log" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_a1910a76044b971609b75ea165" ON "time_log" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_79001d281ecb766005b3d331c1" ON "time_log" ("version") `); - await queryRunner.query(`CREATE INDEX "IDX_f447474d185cd70b3015853874" ON "time_log" ("isRunning") `); - await queryRunner.query(`CREATE INDEX "IDX_722b9cb3a991c964d86396b6bc" ON "time_log" ("isBillable") `); - await queryRunner.query(`CREATE INDEX "IDX_402290e7045e0c10ef97d9f982" ON "time_log" ("source") `); - await queryRunner.query(`CREATE INDEX "IDX_e80fb588b1086ce2a4f2244814" ON "time_log" ("logType") `); - await queryRunner.query(`CREATE INDEX "IDX_a1f8fcd70164d915fe7dd4a1ec" ON "time_log" ("stoppedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_189b79acd611870aba62b3594e" ON "time_log" ("startedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_fa9018cb248ea0f3b2b30ef143" ON "time_log" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_aed2d5cc5680fba9d387c7f931" ON "time_log" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_a89a849957e005bafb8e4220bc" ON "time_log" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_e65393bb52aa8275b1392c73f7" ON "time_log" ("timesheetId") `); - await queryRunner.query(`CREATE INDEX "IDX_54776f6f5fd3c13c3bc1fbfac5" ON "time_log" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_1ddf2da35e34378fd845d80a18" ON "time_log" ("taskId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d1e8f22c02c5e949453dde7f2d" ON "time_log" ("organizationContactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_18dcdf754396f0cb0308dc91f4" ON "time_log" ("organizationTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_154e9120e2acb632d8bd9b91ff" ON "time_log" ("editedAt") `); - await queryRunner.query(`DROP INDEX "IDX_892e285e1da2b3e61e51e50628"`); - await queryRunner.query(`DROP INDEX "IDX_742688858e0484d66f04e4d4c4"`); - await queryRunner.query(`DROP INDEX "IDX_2b374e5cdee1145ebb2a832f20"`); - await queryRunner.query(`DROP INDEX "IDX_3d7feb5fe793e4811cdb79f983"`); - await queryRunner.query(`DROP INDEX "IDX_235004f3dafac90692cd64d915"`); - await queryRunner.query(`DROP INDEX "IDX_0951aacffe3f8d0cff54cf2f34"`); - await queryRunner.query(`DROP INDEX "IDX_5b594d02d98d5defcde323abe5"`); - await queryRunner.query(`DROP INDEX "IDX_fa1896dc735403799311968f7e"`); - await queryRunner.query(`DROP INDEX "IDX_1b0867d86ead2332f3d4edba7d"`); - await queryRunner.query(`DROP INDEX "IDX_eea7986acfb827bf5d0622c41f"`); - await queryRunner.query(`ALTER TABLE "screenshot" RENAME TO "temporary_screenshot"`); - await queryRunner.query( - `CREATE TABLE "screenshot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "file" varchar NOT NULL, "thumb" varchar, "recordedAt" datetime, "deletedAt" datetime, "timeSlotId" varchar, "storageProvider" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "isWorkRelated" boolean, "description" varchar, "apps" text, CONSTRAINT "FK_fa1896dc735403799311968f7ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b594d02d98d5defcde323abe5b" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0951aacffe3f8d0cff54cf2f341" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_235004f3dafac90692cd64d9158" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "screenshot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "file", "thumb", "recordedAt", "deletedAt", "timeSlotId", "storageProvider", "userId", "isActive", "isArchived", "isWorkRelated", "description", "apps" FROM "temporary_screenshot"` - ); - await queryRunner.query(`DROP TABLE "temporary_screenshot"`); - await queryRunner.query(`CREATE INDEX "IDX_892e285e1da2b3e61e51e50628" ON "screenshot" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_742688858e0484d66f04e4d4c4" ON "screenshot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_2b374e5cdee1145ebb2a832f20" ON "screenshot" ("storageProvider") `); - await queryRunner.query(`CREATE INDEX "IDX_3d7feb5fe793e4811cdb79f983" ON "screenshot" ("recordedAt") `); - await queryRunner.query(`CREATE INDEX "IDX_235004f3dafac90692cd64d915" ON "screenshot" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_0951aacffe3f8d0cff54cf2f34" ON "screenshot" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_5b594d02d98d5defcde323abe5" ON "screenshot" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_fa1896dc735403799311968f7e" ON "screenshot" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_1b0867d86ead2332f3d4edba7d" ON "screenshot" ("isWorkRelated") `); - await queryRunner.query(`CREATE INDEX "IDX_eea7986acfb827bf5d0622c41f" ON "screenshot" ("description") `); - await queryRunner.query(`DROP INDEX "IDX_d2d6db7f03da5632687e5d140e"`); - await queryRunner.query(`DROP INDEX "IDX_ae6ac57aafef59f561d4db3dd7"`); - await queryRunner.query(`DROP INDEX "IDX_f2401d8fdff5d8970dfe30d3ae"`); - await queryRunner.query(`DROP INDEX "IDX_fdb3f018c2bba4885bfa5757d1"`); - await queryRunner.query(`DROP INDEX "IDX_a6f74ae99d549932391f0f4460"`); - await queryRunner.query(`DROP INDEX "IDX_5a898f44fa31ef7916f0c38b01"`); - await queryRunner.query(`DROP INDEX "IDX_4e382caaf07ab0923b2e06bf91"`); - await queryRunner.query(`DROP INDEX "IDX_2743f8990fde12f9586287eb09"`); - await queryRunner.query(`DROP INDEX "IDX_a28a1682ea80f10d1ecc7babaa"`); - await queryRunner.query(`DROP INDEX "IDX_302b60a4970ffe94d5223f1c23"`); - await queryRunner.query(`DROP INDEX "IDX_b5525385e85f7429e233d4a0fa"`); - await queryRunner.query(`DROP INDEX "IDX_f27285af15ef48363745ab2d79"`); - await queryRunner.query(`DROP INDEX "IDX_0e36a2c95e2f1df7f1b3059d24"`); - await queryRunner.query(`DROP INDEX "IDX_ffd736f18ba71b3221e4f835a9"`); - await queryRunner.query(`ALTER TABLE "activity" RENAME TO "temporary_activity"`); - await queryRunner.query( - `CREATE TABLE "activity" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar, "description" varchar, "metaData" text, "date" date, "time" time, "duration" integer NOT NULL DEFAULT (0), "type" varchar, "source" varchar NOT NULL DEFAULT ('BROWSER'), "deletedAt" datetime, "employeeId" varchar NOT NULL, "projectId" varchar, "timeSlotId" varchar, "taskId" varchar, "recordedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), CONSTRAINT "FK_2743f8990fde12f9586287eb09f" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4e382caaf07ab0923b2e06bf918" FOREIGN KEY ("timeSlotId") REFERENCES "time_slot" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5a898f44fa31ef7916f0c38b016" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a6f74ae99d549932391f0f44609" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fdb3f018c2bba4885bfa5757d16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2401d8fdff5d8970dfe30d3aed" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "activity"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "metaData", "date", "time", "duration", "type", "source", "deletedAt", "employeeId", "projectId", "timeSlotId", "taskId", "recordedAt", "isActive", "isArchived" FROM "temporary_activity"` - ); - await queryRunner.query(`DROP TABLE "temporary_activity"`); - await queryRunner.query(`CREATE INDEX "IDX_d2d6db7f03da5632687e5d140e" ON "activity" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_ae6ac57aafef59f561d4db3dd7" ON "activity" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f2401d8fdff5d8970dfe30d3ae" ON "activity" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_fdb3f018c2bba4885bfa5757d1" ON "activity" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_a6f74ae99d549932391f0f4460" ON "activity" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_5a898f44fa31ef7916f0c38b01" ON "activity" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_4e382caaf07ab0923b2e06bf91" ON "activity" ("timeSlotId") `); - await queryRunner.query(`CREATE INDEX "IDX_2743f8990fde12f9586287eb09" ON "activity" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_a28a1682ea80f10d1ecc7babaa" ON "activity" ("title") `); - await queryRunner.query(`CREATE INDEX "IDX_302b60a4970ffe94d5223f1c23" ON "activity" ("date") `); - await queryRunner.query(`CREATE INDEX "IDX_b5525385e85f7429e233d4a0fa" ON "activity" ("time") `); - await queryRunner.query(`CREATE INDEX "IDX_f27285af15ef48363745ab2d79" ON "activity" ("type") `); - await queryRunner.query(`CREATE INDEX "IDX_0e36a2c95e2f1df7f1b3059d24" ON "activity" ("source") `); - await queryRunner.query(`CREATE INDEX "IDX_ffd736f18ba71b3221e4f835a9" ON "activity" ("recordedAt") `); - await queryRunner.query(`DROP INDEX "IDX_5ddef92c4694e6d650d9e557b3"`); - await queryRunner.query(`DROP INDEX "IDX_45e4bc4476681f4db2097cc2d5"`); - await queryRunner.query(`DROP INDEX "IDX_4989834dd1c9c8ea3576ed99ce"`); - await queryRunner.query(`DROP INDEX "IDX_981333982a6df8b815957dcbf2"`); - await queryRunner.query(`DROP INDEX "IDX_c1f8ae47dc2f1882afc5045c73"`); - await queryRunner.query(`DROP INDEX "IDX_c009cdd795be674c2047062374"`); - await queryRunner.query(`ALTER TABLE "time_off_request" RENAME TO "temporary_time_off_request"`); - await queryRunner.query( - `CREATE TABLE "time_off_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "documentUrl" varchar, "description" varchar, "start" datetime NOT NULL, "end" datetime NOT NULL, "requestDate" datetime NOT NULL, "status" varchar NOT NULL, "isHoliday" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "policyId" varchar NOT NULL, "documentId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "FK_c009cdd795be674c20470623742" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_c1f8ae47dc2f1882afc5045c739" FOREIGN KEY ("policyId") REFERENCES "time_off_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_981333982a6df8b815957dcbf27" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4989834dd1c9c8ea3576ed99ce5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "time_off_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "documentUrl", "description", "start", "end", "requestDate", "status", "isHoliday", "isArchived", "policyId", "documentId", "isActive", "deletedAt" FROM "temporary_time_off_request"` - ); - await queryRunner.query(`DROP TABLE "temporary_time_off_request"`); - await queryRunner.query(`CREATE INDEX "IDX_5ddef92c4694e6d650d9e557b3" ON "time_off_request" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_45e4bc4476681f4db2097cc2d5" ON "time_off_request" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4989834dd1c9c8ea3576ed99ce" ON "time_off_request" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_981333982a6df8b815957dcbf2" ON "time_off_request" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c1f8ae47dc2f1882afc5045c73" ON "time_off_request" ("policyId") `); - await queryRunner.query(`CREATE INDEX "IDX_c009cdd795be674c2047062374" ON "time_off_request" ("documentId") `); - await queryRunner.query(`DROP INDEX "IDX_22d919e53cf5f6d836b18d407a"`); - await queryRunner.query(`DROP INDEX "IDX_cf9377d3bcb7cb996f72268941"`); - await queryRunner.query(`DROP INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1"`); - await queryRunner.query(`DROP INDEX "IDX_c2744cffeca55c3c9c52bb9789"`); - await queryRunner.query(`DROP INDEX "IDX_7d7f69c79df4a6f152b0e362b1"`); - await queryRunner.query(`ALTER TABLE "time_off_policy" RENAME TO "temporary_time_off_policy"`); - await queryRunner.query( - `CREATE TABLE "time_off_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "requiresApproval" boolean NOT NULL, "paid" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c2744cffeca55c3c9c52bb9789c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1c0ed84d54f8fbe4af10dfcda1c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "time_off_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "requiresApproval", "paid", "isActive", "isArchived", "deletedAt" FROM "temporary_time_off_policy"` - ); - await queryRunner.query(`DROP TABLE "temporary_time_off_policy"`); - await queryRunner.query(`CREATE INDEX "IDX_22d919e53cf5f6d836b18d407a" ON "time_off_policy" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_cf9377d3bcb7cb996f72268941" ON "time_off_policy" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1c0ed84d54f8fbe4af10dfcda1" ON "time_off_policy" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_c2744cffeca55c3c9c52bb9789" ON "time_off_policy" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_7d7f69c79df4a6f152b0e362b1" ON "time_off_policy" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_eeedffab85b3534a1068d9270f"`); - await queryRunner.query(`DROP INDEX "IDX_b8eb9f3e420aa846f30e291960"`); - await queryRunner.query(`DROP INDEX "IDX_56211336b5ff35fd944f225917"`); - await queryRunner.query(`DROP INDEX "IDX_d154d06dac0d0e0a5d9a083e25"`); - await queryRunner.query(`ALTER TABLE "tenant" RENAME TO "temporary_tenant"`); - await queryRunner.query( - `CREATE TABLE "tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "logo" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d154d06dac0d0e0a5d9a083e253" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "tenant"("id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "logo", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_tenant"` - ); - await queryRunner.query(`DROP TABLE "temporary_tenant"`); - await queryRunner.query(`CREATE INDEX "IDX_eeedffab85b3534a1068d9270f" ON "tenant" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_b8eb9f3e420aa846f30e291960" ON "tenant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_56211336b5ff35fd944f225917" ON "tenant" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_d154d06dac0d0e0a5d9a083e25" ON "tenant" ("imageId") `); - await queryRunner.query(`DROP INDEX "IDX_a7500f9b1b7917bf10882c820e"`); - await queryRunner.query(`DROP INDEX "IDX_1d9975b98d82f385ae14b4d7c6"`); - await queryRunner.query(`DROP INDEX "IDX_affdab301e348b892175f30fa3"`); - await queryRunner.query(`ALTER TABLE "tenant_setting" RENAME TO "temporary_tenant_setting"`); - await queryRunner.query( - `CREATE TABLE "tenant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "value" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_affdab301e348b892175f30fa39" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "tenant_setting"("id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "value", "isActive", "isArchived", "deletedAt" FROM "temporary_tenant_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_tenant_setting"`); - await queryRunner.query(`CREATE INDEX "IDX_a7500f9b1b7917bf10882c820e" ON "tenant_setting" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1d9975b98d82f385ae14b4d7c6" ON "tenant_setting" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_affdab301e348b892175f30fa3" ON "tenant_setting" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_313b0e55871c1c9b6c22341536"`); - await queryRunner.query(`DROP INDEX "IDX_7e509a66367ecaf8e3bc96f263"`); - await queryRunner.query(`DROP INDEX "IDX_379c8bd0ce203341148c1f99ee"`); - await queryRunner.query(`DROP INDEX "IDX_9c845f353378371ee3aa60f686"`); - await queryRunner.query(`DROP INDEX "IDX_3396dda57286ca17ab61fd3704"`); - await queryRunner.query(`DROP INDEX "IDX_e9fd8df772ad2d955a65f4c68a"`); - await queryRunner.query(`DROP INDEX "IDX_91988120385964f213aec8aa84"`); - await queryRunner.query(`DROP INDEX "IDX_959e77718a2e76ee56498c1106"`); - await queryRunner.query(`ALTER TABLE "task_version" RENAME TO "temporary_task_version"`); - await queryRunner.query( - `CREATE TABLE "task_version" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_959e77718a2e76ee56498c1106a" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91988120385964f213aec8aa84c" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9c845f353378371ee3aa60f6865" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_379c8bd0ce203341148c1f99ee7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task_version"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_version"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_version"`); - await queryRunner.query(`CREATE INDEX "IDX_313b0e55871c1c9b6c22341536" ON "task_version" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_7e509a66367ecaf8e3bc96f263" ON "task_version" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_379c8bd0ce203341148c1f99ee" ON "task_version" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_9c845f353378371ee3aa60f686" ON "task_version" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_3396dda57286ca17ab61fd3704" ON "task_version" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_e9fd8df772ad2d955a65f4c68a" ON "task_version" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_91988120385964f213aec8aa84" ON "task_version" ("projectId") `); - await queryRunner.query( - `CREATE INDEX "IDX_959e77718a2e76ee56498c1106" ON "task_version" ("organizationTeamId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a19e8975e5c296640d457dfc11"`); - await queryRunner.query(`DROP INDEX "IDX_68eaba689ed6d3e27ec93d3e88"`); - await queryRunner.query(`DROP INDEX "IDX_b0c955f276679dd2b2735c3936"`); - await queryRunner.query(`DROP INDEX "IDX_9b9a828a49f4bd6383a4073fe2"`); - await queryRunner.query(`DROP INDEX "IDX_efbaf00a743316b394cc31e4a2"`); - await queryRunner.query(`DROP INDEX "IDX_0330b4a942b536d8d1f264abe3"`); - await queryRunner.query(`DROP INDEX "IDX_25d9737ee153411871b4d20c67"`); - await queryRunner.query(`DROP INDEX "IDX_79c525a8c2209e90186bfcbea9"`); - await queryRunner.query(`ALTER TABLE "task_status" RENAME TO "temporary_task_status"`); - await queryRunner.query( - `CREATE TABLE "task_status" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isCollapsed" boolean NOT NULL DEFAULT (0), "order" integer, "isTodo" boolean NOT NULL DEFAULT (0), "isInProgress" boolean NOT NULL DEFAULT (0), "isDone" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_9b9a828a49f4bd6383a4073fe23" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_efbaf00a743316b394cc31e4a20" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a19e8975e5c296640d457dfc11f" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0330b4a942b536d8d1f264abe32" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task_status"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isCollapsed", "order", "isTodo", "isInProgress", "isDone" FROM "temporary_task_status"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_status"`); - await queryRunner.query(`CREATE INDEX "IDX_a19e8975e5c296640d457dfc11" ON "task_status" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_68eaba689ed6d3e27ec93d3e88" ON "task_status" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_b0c955f276679dd2b2735c3936" ON "task_status" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_9b9a828a49f4bd6383a4073fe2" ON "task_status" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_efbaf00a743316b394cc31e4a2" ON "task_status" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_0330b4a942b536d8d1f264abe3" ON "task_status" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_25d9737ee153411871b4d20c67" ON "task_status" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_79c525a8c2209e90186bfcbea9" ON "task_status" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_8f26ffc61abaef417b0f807695"`); - await queryRunner.query(`DROP INDEX "IDX_d65afcfe2d64e49d43931579a3"`); - await queryRunner.query(`DROP INDEX "IDX_f4438327b3c2afb0832569b2a1"`); - await queryRunner.query(`DROP INDEX "IDX_f6ec2207e50680a475d71c8979"`); - await queryRunner.query(`DROP INDEX "IDX_596512cc6508a482cc23ae6ab7"`); - await queryRunner.query(`DROP INDEX "IDX_90c54f57b29cc8b67edc2738ae"`); - await queryRunner.query(`DROP INDEX "IDX_1a7b137d009616a2ff1aa6834f"`); - await queryRunner.query(`DROP INDEX "IDX_ad6792b26526bd96ab18d63454"`); - await queryRunner.query(`ALTER TABLE "task_size" RENAME TO "temporary_task_size"`); - await queryRunner.query( - `CREATE TABLE "task_size" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f4438327b3c2afb0832569b2a1e" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ad6792b26526bd96ab18d634544" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f6ec2207e50680a475d71c89793" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_596512cc6508a482cc23ae6ab78" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "task_size"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_size"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_size"`); - await queryRunner.query(`CREATE INDEX "IDX_8f26ffc61abaef417b0f807695" ON "task_size" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_d65afcfe2d64e49d43931579a3" ON "task_size" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f4438327b3c2afb0832569b2a1" ON "task_size" ("organizationTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_f6ec2207e50680a475d71c8979" ON "task_size" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_596512cc6508a482cc23ae6ab7" ON "task_size" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_90c54f57b29cc8b67edc2738ae" ON "task_size" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_1a7b137d009616a2ff1aa6834f" ON "task_size" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_ad6792b26526bd96ab18d63454" ON "task_size" ("projectId") `); - await queryRunner.query(`DROP INDEX "IDX_8177dd93be8044b37d3bb9285d"`); - await queryRunner.query(`DROP INDEX "IDX_5a341f51d8f5ec12db24ab033f"`); - await queryRunner.query(`DROP INDEX "IDX_b7b0ea8ac2825fb981c1181d11"`); - await queryRunner.query(`DROP INDEX "IDX_bed691e21fe01cf5aceee72295"`); - await queryRunner.query(`DROP INDEX "IDX_9423f99da972c150f85dbc11c1"`); - await queryRunner.query(`DROP INDEX "IDX_61a7cb4452d9e23f91231b7fd6"`); - await queryRunner.query(`DROP INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9"`); - await queryRunner.query(`DROP INDEX "IDX_4967ebdca0aefb9d43e56695e4"`); - await queryRunner.query(`ALTER TABLE "task_related_issue_type" RENAME TO "temporary_task_related_issue_type"`); - await queryRunner.query( - `CREATE TABLE "task_related_issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_4967ebdca0aefb9d43e56695e42" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d99fe5b50dbe5078e0d9a9b6a9d" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed691e21fe01cf5aceee722952" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b7b0ea8ac2825fb981c1181d115" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task_related_issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_related_issue_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_related_issue_type"`); - await queryRunner.query( - `CREATE INDEX "IDX_8177dd93be8044b37d3bb9285d" ON "task_related_issue_type" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5a341f51d8f5ec12db24ab033f" ON "task_related_issue_type" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b7b0ea8ac2825fb981c1181d11" ON "task_related_issue_type" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bed691e21fe01cf5aceee72295" ON "task_related_issue_type" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9423f99da972c150f85dbc11c1" ON "task_related_issue_type" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_61a7cb4452d9e23f91231b7fd6" ON "task_related_issue_type" ("value") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d99fe5b50dbe5078e0d9a9b6a9" ON "task_related_issue_type" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4967ebdca0aefb9d43e56695e4" ON "task_related_issue_type" ("organizationTeamId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e6adb82db368af15f2b8cdd4e8"`); - await queryRunner.query(`DROP INDEX "IDX_8ddcc5eeaf96314f53ca486821"`); - await queryRunner.query(`DROP INDEX "IDX_52b039cff6a1adf6b7f9e49ee4"`); - await queryRunner.query(`DROP INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d"`); - await queryRunner.query(`DROP INDEX "IDX_7fd1b30d159b608cbf59009f68"`); - await queryRunner.query(`DROP INDEX "IDX_7d656b4cba8f11e639dbc5aab3"`); - await queryRunner.query(`DROP INDEX "IDX_46daede7b19176b6ad959d70da"`); - await queryRunner.query(`DROP INDEX "IDX_db4237960ca989eb7a48cd433b"`); - await queryRunner.query(`ALTER TABLE "task_priority" RENAME TO "temporary_task_priority"`); - await queryRunner.query( - `CREATE TABLE "task_priority" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_52b039cff6a1adf6b7f9e49ee44" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_db4237960ca989eb7a48cd433b1" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1818655f27b8cf4f0d1dbfeb8db" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd1b30d159b608cbf59009f681" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "task_priority"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_priority"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_priority"`); - await queryRunner.query(`CREATE INDEX "IDX_e6adb82db368af15f2b8cdd4e8" ON "task_priority" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_8ddcc5eeaf96314f53ca486821" ON "task_priority" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_52b039cff6a1adf6b7f9e49ee4" ON "task_priority" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1818655f27b8cf4f0d1dbfeb8d" ON "task_priority" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_7fd1b30d159b608cbf59009f68" ON "task_priority" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_7d656b4cba8f11e639dbc5aab3" ON "task_priority" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_46daede7b19176b6ad959d70da" ON "task_priority" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_db4237960ca989eb7a48cd433b" ON "task_priority" ("projectId") `); - await queryRunner.query(`DROP INDEX "IDX_88021c0cd9508757d3d90333f8"`); - await queryRunner.query(`DROP INDEX "IDX_d49853e18e5bc772f5435b01a5"`); - await queryRunner.query(`DROP INDEX "IDX_20b50abc5c97610a75d49ad381"`); - await queryRunner.query(`DROP INDEX "IDX_24114c4059e6b6991daba541b1"`); - await queryRunner.query(`DROP INDEX "IDX_6deea7b3671e45973e191a1502"`); - await queryRunner.query(`DROP INDEX "IDX_0848fd2b8c23c0ab55146297cf"`); - await queryRunner.query(`ALTER TABLE "task_linked_issues" RENAME TO "temporary_task_linked_issues"`); - await queryRunner.query( - `CREATE TABLE "task_linked_issues" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" integer NOT NULL, "taskFromId" varchar NOT NULL, "taskToId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0848fd2b8c23c0ab55146297cff" FOREIGN KEY ("taskToId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6deea7b3671e45973e191a1502c" FOREIGN KEY ("taskFromId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_24114c4059e6b6991daba541b1d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_20b50abc5c97610a75d49ad3817" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task_linked_issues"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "taskFromId", "taskToId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_linked_issues"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_linked_issues"`); - await queryRunner.query( - `CREATE INDEX "IDX_88021c0cd9508757d3d90333f8" ON "task_linked_issues" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_d49853e18e5bc772f5435b01a5" ON "task_linked_issues" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_20b50abc5c97610a75d49ad381" ON "task_linked_issues" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_24114c4059e6b6991daba541b1" ON "task_linked_issues" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6deea7b3671e45973e191a1502" ON "task_linked_issues" ("taskFromId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0848fd2b8c23c0ab55146297cf" ON "task_linked_issues" ("taskToId") `); - await queryRunner.query(`DROP INDEX "IDX_b8616deefe44d0622233e73fbf"`); - await queryRunner.query(`DROP INDEX "IDX_2f4bdd2593fd6038aaa91fd107"`); - await queryRunner.query(`DROP INDEX "IDX_0cbe714983eb0aae5feeee8212"`); - await queryRunner.query(`DROP INDEX "IDX_ed5441fb13e82854a994da5a78"`); - await queryRunner.query(`DROP INDEX "IDX_7127880d6fae956ecc1c84ac31"`); - await queryRunner.query(`DROP INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1"`); - await queryRunner.query(`DROP INDEX "IDX_2fe7a278e6f08d2be55740a939"`); - await queryRunner.query(`DROP INDEX "IDX_e91cbff3d206f150ccc14d0c3a"`); - await queryRunner.query(`DROP INDEX "IDX_5b0272d923a31c972bed1a1ac4"`); - await queryRunner.query(`DROP INDEX "IDX_3797a20ef5553ae87af126bc2f"`); - await queryRunner.query(`DROP INDEX "IDX_94fe6b3a5aec5f85427df4f8cd"`); - await queryRunner.query(`DROP INDEX "IDX_1e1f64696aa3a26d3e12c840e5"`); - await queryRunner.query(`DROP INDEX "taskNumber"`); - await queryRunner.query(`DROP INDEX "IDX_3e16c81005c389a4db83c0e5e3"`); - await queryRunner.query(`DROP INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54"`); - await queryRunner.query(`DROP INDEX "IDX_579534d8e12f22d308d6bd5f42"`); - await queryRunner.query(`ALTER TABLE "task" RENAME TO "temporary_task"`); - await queryRunner.query( - `CREATE TABLE "task" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "description" varchar, "status" varchar, "estimate" integer, "dueDate" datetime, "projectId" varchar, "creatorId" varchar, "organizationSprintId" varchar, "number" integer, "prefix" varchar, "priority" varchar, "size" varchar, "public" boolean DEFAULT (1), "startDate" datetime, "resolvedAt" datetime, "version" varchar, "issueType" varchar, "parentId" varchar, "taskStatusId" varchar, "taskSizeId" varchar, "taskPriorityId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "projectModuleId" varchar, CONSTRAINT "FK_579534d8e12f22d308d6bd5f428" FOREIGN KEY ("projectModuleId") REFERENCES "organization_project_module" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8c9920b5fb32c3d8453f64b705c" FOREIGN KEY ("parentId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_1e1f64696aa3a26d3e12c840e55" FOREIGN KEY ("organizationSprintId") REFERENCES "organization_sprint" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_94fe6b3a5aec5f85427df4f8cd7" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3797a20ef5553ae87af126bc2fe" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5b0272d923a31c972bed1a1ac4d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e91cbff3d206f150ccc14d0c3a1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cbe714983eb0aae5feeee8212b" FOREIGN KEY ("taskStatusId") REFERENCES "task_status" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_2f4bdd2593fd6038aaa91fd1076" FOREIGN KEY ("taskSizeId") REFERENCES "task_size" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b8616deefe44d0622233e73fbf9" FOREIGN KEY ("taskPriorityId") REFERENCES "task_priority" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "description", "status", "estimate", "dueDate", "projectId", "creatorId", "organizationSprintId", "number", "prefix", "priority", "size", "public", "startDate", "resolvedAt", "version", "issueType", "parentId", "taskStatusId", "taskSizeId", "taskPriorityId", "isActive", "isArchived", "deletedAt", "projectModuleId" FROM "temporary_task"` - ); - await queryRunner.query(`DROP TABLE "temporary_task"`); - await queryRunner.query(`CREATE INDEX "IDX_b8616deefe44d0622233e73fbf" ON "task" ("taskPriorityId") `); - await queryRunner.query(`CREATE INDEX "IDX_2f4bdd2593fd6038aaa91fd107" ON "task" ("taskSizeId") `); - await queryRunner.query(`CREATE INDEX "IDX_0cbe714983eb0aae5feeee8212" ON "task" ("taskStatusId") `); - await queryRunner.query(`CREATE INDEX "IDX_ed5441fb13e82854a994da5a78" ON "task" ("issueType") `); - await queryRunner.query(`CREATE INDEX "IDX_7127880d6fae956ecc1c84ac31" ON "task" ("size") `); - await queryRunner.query(`CREATE INDEX "IDX_f092f3386f10f2e2ef5b0b6ad1" ON "task" ("priority") `); - await queryRunner.query(`CREATE INDEX "IDX_2fe7a278e6f08d2be55740a939" ON "task" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_e91cbff3d206f150ccc14d0c3a" ON "task" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_5b0272d923a31c972bed1a1ac4" ON "task" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_3797a20ef5553ae87af126bc2f" ON "task" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_94fe6b3a5aec5f85427df4f8cd" ON "task" ("creatorId") `); - await queryRunner.query(`CREATE INDEX "IDX_1e1f64696aa3a26d3e12c840e5" ON "task" ("organizationSprintId") `); - await queryRunner.query(`CREATE UNIQUE INDEX "taskNumber" ON "task" ("projectId", "number") `); - await queryRunner.query(`CREATE INDEX "IDX_3e16c81005c389a4db83c0e5e3" ON "task" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_ca2f7edd5a5ce8f14b257c9d54" ON "task" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_579534d8e12f22d308d6bd5f42" ON "task" ("projectModuleId") `); - await queryRunner.query(`DROP INDEX "IDX_586513cceb16777fd14a17bfe1"`); - await queryRunner.query(`DROP INDEX "IDX_131331557078611a68b4a5b2e7"`); - await queryRunner.query(`DROP INDEX "IDX_33779b0395f72af0b50dc526d1"`); - await queryRunner.query(`DROP INDEX "IDX_af2d743ed61571bcdc5d9a27a0"`); - await queryRunner.query(`DROP INDEX "IDX_4af451ab46a94e94394c72d911"`); - await queryRunner.query(`DROP INDEX "IDX_16dbef9d1b2b422abdce8ee3ae"`); - await queryRunner.query(`DROP INDEX "IDX_8b12c913c39c72fe5980427c96"`); - await queryRunner.query(`DROP INDEX "IDX_722ce5d7535524b96c6d03f7c4"`); - await queryRunner.query(`DROP INDEX "IDX_1909e9bae7d8b2c920b3e4d859"`); - await queryRunner.query(`ALTER TABLE "issue_type" RENAME TO "temporary_issue_type"`); - await queryRunner.query( - `CREATE TABLE "issue_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "value" varchar NOT NULL, "description" varchar, "icon" varchar, "color" varchar, "isSystem" boolean NOT NULL DEFAULT (0), "imageId" varchar, "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "isDefault" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_8b12c913c39c72fe5980427c963" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16dbef9d1b2b422abdce8ee3ae2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_33779b0395f72af0b50dc526d1d" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_131331557078611a68b4a5b2e7e" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_586513cceb16777fd14a17bfe10" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "issue_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "value", "description", "icon", "color", "isSystem", "imageId", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt", "isDefault" FROM "temporary_issue_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_issue_type"`); - await queryRunner.query( - `CREATE INDEX "IDX_586513cceb16777fd14a17bfe1" ON "issue_type" ("organizationTeamId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_131331557078611a68b4a5b2e7" ON "issue_type" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_33779b0395f72af0b50dc526d1" ON "issue_type" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_af2d743ed61571bcdc5d9a27a0" ON "issue_type" ("value") `); - await queryRunner.query(`CREATE INDEX "IDX_4af451ab46a94e94394c72d911" ON "issue_type" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_16dbef9d1b2b422abdce8ee3ae" ON "issue_type" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_8b12c913c39c72fe5980427c96" ON "issue_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_722ce5d7535524b96c6d03f7c4" ON "issue_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1909e9bae7d8b2c920b3e4d859" ON "issue_type" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_1f3ffda4fce02682e76308b476"`); - await queryRunner.query(`DROP INDEX "IDX_b1a7086c279309b20e8384d0d9"`); - await queryRunner.query(`DROP INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6"`); - await queryRunner.query(`DROP INDEX "IDX_16507eb222e3c50be077fb4ace"`); - await queryRunner.query(`DROP INDEX "IDX_8f274646f2bdf4e12990feeb04"`); - await queryRunner.query(`DROP INDEX "IDX_a3ee022203211f678376cd919b"`); - await queryRunner.query(`ALTER TABLE "task_estimation" RENAME TO "temporary_task_estimation"`); - await queryRunner.query( - `CREATE TABLE "task_estimation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "estimate" integer NOT NULL, "employeeId" varchar NOT NULL, "taskId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a3ee022203211f678376cd919bb" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f274646f2bdf4e12990feeb040" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_16507eb222e3c50be077fb4ace2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_87bfea6d0b9a1ec602ee88e5f68" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "task_estimation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "estimate", "employeeId", "taskId", "isActive", "isArchived", "deletedAt" FROM "temporary_task_estimation"` - ); - await queryRunner.query(`DROP TABLE "temporary_task_estimation"`); - await queryRunner.query(`CREATE INDEX "IDX_1f3ffda4fce02682e76308b476" ON "task_estimation" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_b1a7086c279309b20e8384d0d9" ON "task_estimation" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_87bfea6d0b9a1ec602ee88e5f6" ON "task_estimation" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_16507eb222e3c50be077fb4ace" ON "task_estimation" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_8f274646f2bdf4e12990feeb04" ON "task_estimation" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_a3ee022203211f678376cd919b" ON "task_estimation" ("taskId") `); - await queryRunner.query(`DROP INDEX "IDX_f2cf366f3f08e31784b056df88"`); - await queryRunner.query(`DROP INDEX "IDX_9779a35ef1338bafb7b90714f1"`); - await queryRunner.query(`DROP INDEX "IDX_ecb357a3764a7344c633a257d7"`); - await queryRunner.query(`DROP INDEX "IDX_ce5e588780497b05cd6267e20e"`); - await queryRunner.query(`DROP INDEX "IDX_903b08cd4c8025e73316342452"`); - await queryRunner.query(`DROP INDEX "IDX_b022c2b684c35dcc63c22850f1"`); - await queryRunner.query(`ALTER TABLE "daily_plan" RENAME TO "temporary_daily_plan"`); - await queryRunner.query( - `CREATE TABLE "daily_plan" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "date" datetime NOT NULL, "workTimePlanned" decimal NOT NULL, "status" varchar NOT NULL, "employeeId" varchar, "organizationTeamId" varchar, CONSTRAINT "FK_b022c2b684c35dcc63c22850f13" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb357a3764a7344c633a257d76" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9779a35ef1338bafb7b90714f16" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f2cf366f3f08e31784b056df880" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "daily_plan"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "date", "workTimePlanned", "status", "employeeId", "organizationTeamId" FROM "temporary_daily_plan"` - ); - await queryRunner.query(`DROP TABLE "temporary_daily_plan"`); - await queryRunner.query(`CREATE INDEX "IDX_f2cf366f3f08e31784b056df88" ON "daily_plan" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_9779a35ef1338bafb7b90714f1" ON "daily_plan" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_ecb357a3764a7344c633a257d7" ON "daily_plan" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_ce5e588780497b05cd6267e20e" ON "daily_plan" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_903b08cd4c8025e73316342452" ON "daily_plan" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_b022c2b684c35dcc63c22850f1" ON "daily_plan" ("organizationTeamId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_49746602acc4e5e8721062b69e"`); - await queryRunner.query(`DROP INDEX "IDX_b08dd29fb6a8acdf83c83d8988"`); - await queryRunner.query(`DROP INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9"`); - await queryRunner.query(`DROP INDEX "IDX_1f22c73374bcca1ea84a4dca59"`); - await queryRunner.query(`DROP INDEX "IDX_58876ee26a90170551027459bf"`); - await queryRunner.query(`ALTER TABLE "tag" RENAME TO "temporary_tag"`); - await queryRunner.query( - `CREATE TABLE "tag" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "icon" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "textColor" varchar, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_c2f6bec0b39eaa3a6d90903ae99" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b08dd29fb6a8acdf83c83d8988f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_49746602acc4e5e8721062b69ec" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "tag"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isSystem", "icon", "organizationTeamId", "isActive", "isArchived", "deletedAt", "textColor", "fix_relational_custom_fields" FROM "temporary_tag"` - ); - await queryRunner.query(`DROP TABLE "temporary_tag"`); - await queryRunner.query(`CREATE INDEX "IDX_49746602acc4e5e8721062b69e" ON "tag" ("organizationTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_b08dd29fb6a8acdf83c83d8988" ON "tag" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c2f6bec0b39eaa3a6d90903ae9" ON "tag" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_1f22c73374bcca1ea84a4dca59" ON "tag" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_58876ee26a90170551027459bf" ON "tag" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_ca52119f9e4857399706d723e9"`); - await queryRunner.query(`DROP INDEX "IDX_f4cdbe61d68413f4d6a671f8c2"`); - await queryRunner.query(`DROP INDEX "IDX_8e502eac7ed1347c71c26beae8"`); - await queryRunner.query(`DROP INDEX "IDX_b2923d394f3636671ff9b3c3e8"`); - await queryRunner.query(`ALTER TABLE "skill" RENAME TO "temporary_skill"`); - await queryRunner.query( - `CREATE TABLE "skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_b2923d394f3636671ff9b3c3e81" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8e502eac7ed1347c71c26beae81" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "color", "isActive", "isArchived", "deletedAt" FROM "temporary_skill"` - ); - await queryRunner.query(`DROP TABLE "temporary_skill"`); - await queryRunner.query(`CREATE INDEX "IDX_ca52119f9e4857399706d723e9" ON "skill" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_f4cdbe61d68413f4d6a671f8c2" ON "skill" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8e502eac7ed1347c71c26beae8" ON "skill" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_b2923d394f3636671ff9b3c3e8" ON "skill" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_09868c0733ba37a4753ff8931f"`); - await queryRunner.query(`DROP INDEX "IDX_c5f75cd3367769b6f22b298d29"`); - await queryRunner.query(`DROP INDEX "IDX_ae4578dcaed5adff96595e6166"`); - await queryRunner.query(`DROP INDEX "IDX_1751a572e91385a09d41c62471"`); - await queryRunner.query(`ALTER TABLE "role" RENAME TO "temporary_role"`); - await queryRunner.query( - `CREATE TABLE "role" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isSystem" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_1751a572e91385a09d41c624714" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "role"("id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isSystem", "isActive", "isArchived", "deletedAt" FROM "temporary_role"` - ); - await queryRunner.query(`DROP TABLE "temporary_role"`); - await queryRunner.query(`CREATE INDEX "IDX_09868c0733ba37a4753ff8931f" ON "role" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_c5f75cd3367769b6f22b298d29" ON "role" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_ae4578dcaed5adff96595e6166" ON "role" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_1751a572e91385a09d41c62471" ON "role" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_5c36df1a5c85016952e90d760f"`); - await queryRunner.query(`DROP INDEX "IDX_78f93dbb42a97f6785bcf53efd"`); - await queryRunner.query(`DROP INDEX "IDX_e3130a39c1e4a740d044e68573"`); - await queryRunner.query(`DROP INDEX "IDX_8307c5c44a4ad6210b767b17a9"`); - await queryRunner.query(`DROP INDEX "IDX_cbd053921056e77c0a8e03122a"`); - await queryRunner.query(`ALTER TABLE "role_permission" RENAME TO "temporary_role_permission"`); - await queryRunner.query( - `CREATE TABLE "role_permission" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "permission" varchar NOT NULL, "enabled" boolean DEFAULT (0), "roleId" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_cbd053921056e77c0a8e03122af" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e3130a39c1e4a740d044e685730" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "role_permission"("id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "permission", "enabled", "roleId", "description", "isActive", "isArchived", "deletedAt" FROM "temporary_role_permission"` - ); - await queryRunner.query(`DROP TABLE "temporary_role_permission"`); - await queryRunner.query(`CREATE INDEX "IDX_5c36df1a5c85016952e90d760f" ON "role_permission" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_78f93dbb42a97f6785bcf53efd" ON "role_permission" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e3130a39c1e4a740d044e68573" ON "role_permission" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_8307c5c44a4ad6210b767b17a9" ON "role_permission" ("permission") `); - await queryRunner.query(`CREATE INDEX "IDX_cbd053921056e77c0a8e03122a" ON "role_permission" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`); - await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`); - await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`); - await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`); - await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`); - await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`); - await queryRunner.query(`ALTER TABLE "request_approval" RENAME TO "temporary_request_approval"`); - await queryRunner.query( - `CREATE TABLE "request_approval" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" integer, "createdBy" varchar, "createdByName" varchar, "min_count" integer, "requestId" varchar, "requestType" varchar, "approvalPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "request_approval"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "createdBy", "createdByName", "min_count", "requestId", "requestType", "approvalPolicyId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval"` - ); - await queryRunner.query(`DROP TABLE "temporary_request_approval"`); - await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_bdcb4ea389bdb794bae75b0170"`); - await queryRunner.query(`DROP INDEX "IDX_34b2e8f794e0336b9ac410d8bd"`); - await queryRunner.query(`DROP INDEX "IDX_94b2a3d0f17c9549dea1493dc9"`); - await queryRunner.query(`DROP INDEX "IDX_77e1050669b32cfff482f96016"`); - await queryRunner.query(`DROP INDEX "IDX_6c75d8a8c609e88896b2653cc4"`); - await queryRunner.query(`DROP INDEX "IDX_9ccdaee6c5c62cda8f7375e841"`); - await queryRunner.query(`ALTER TABLE "request_approval_team" RENAME TO "temporary_request_approval_team"`); - await queryRunner.query( - `CREATE TABLE "request_approval_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "teamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9ccdaee6c5c62cda8f7375e8417" FOREIGN KEY ("teamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6c75d8a8c609e88896b2653cc41" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_77e1050669b32cfff482f960169" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_94b2a3d0f17c9549dea1493dc96" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "request_approval_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "teamId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval_team"` - ); - await queryRunner.query(`DROP TABLE "temporary_request_approval_team"`); - await queryRunner.query( - `CREATE INDEX "IDX_bdcb4ea389bdb794bae75b0170" ON "request_approval_team" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_34b2e8f794e0336b9ac410d8bd" ON "request_approval_team" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_94b2a3d0f17c9549dea1493dc9" ON "request_approval_team" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_77e1050669b32cfff482f96016" ON "request_approval_team" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6c75d8a8c609e88896b2653cc4" ON "request_approval_team" ("requestApprovalId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9ccdaee6c5c62cda8f7375e841" ON "request_approval_team" ("teamId") `); - await queryRunner.query(`DROP INDEX "IDX_3d66190c19b9fe69a8bbb300df"`); - await queryRunner.query(`DROP INDEX "IDX_2634ff04775e659c4792325f38"`); - await queryRunner.query(`DROP INDEX "IDX_a5445b38b780b29b09369e36a9"`); - await queryRunner.query(`DROP INDEX "IDX_4071f027554eefff65ac8123e6"`); - await queryRunner.query(`DROP INDEX "IDX_563fec5539b89a57f40731f985"`); - await queryRunner.query(`DROP INDEX "IDX_ce2113039f070b3f003aa0db61"`); - await queryRunner.query( - `ALTER TABLE "request_approval_employee" RENAME TO "temporary_request_approval_employee"` - ); - await queryRunner.query( - `CREATE TABLE "request_approval_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "status" integer, "requestApprovalId" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_ce2113039f070b3f003aa0db611" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_563fec5539b89a57f40731f9858" FOREIGN KEY ("requestApprovalId") REFERENCES "request_approval" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4071f027554eefff65ac8123e6e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a5445b38b780b29b09369e36a9b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "request_approval_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "status", "requestApprovalId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_request_approval_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_request_approval_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_3d66190c19b9fe69a8bbb300df" ON "request_approval_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2634ff04775e659c4792325f38" ON "request_approval_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a5445b38b780b29b09369e36a9" ON "request_approval_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4071f027554eefff65ac8123e6" ON "request_approval_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_563fec5539b89a57f40731f985" ON "request_approval_employee" ("requestApprovalId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ce2113039f070b3f003aa0db61" ON "request_approval_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1316fdd7b9a2926437a13271bf"`); - await queryRunner.query(`DROP INDEX "IDX_143ead1a6ac5f73125d8c4c3aa"`); - await queryRunner.query(`DROP INDEX "IDX_6f9ee54eb839117e83b937648d"`); - await queryRunner.query(`DROP INDEX "IDX_ef16fed5f7e6951027502e6458"`); - await queryRunner.query(`DROP INDEX "IDX_230652e48daa99c50c000fc5d1"`); - await queryRunner.query(`ALTER TABLE "report" RENAME TO "temporary_report"`); - await queryRunner.query( - `CREATE TABLE "report" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "categoryId" varchar NOT NULL, "name" varchar NOT NULL, "slug" varchar, "description" varchar, "image" varchar, "iconClass" varchar, "showInMenu" boolean NOT NULL DEFAULT (0), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_230652e48daa99c50c000fc5d10" FOREIGN KEY ("categoryId") REFERENCES "report_category" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "report"("id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "categoryId", "name", "slug", "description", "image", "iconClass", "showInMenu", "isActive", "isArchived", "deletedAt" FROM "temporary_report"` - ); - await queryRunner.query(`DROP TABLE "temporary_report"`); - await queryRunner.query(`CREATE INDEX "IDX_1316fdd7b9a2926437a13271bf" ON "report" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_143ead1a6ac5f73125d8c4c3aa" ON "report" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6f9ee54eb839117e83b937648d" ON "report" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_ef16fed5f7e6951027502e6458" ON "report" ("slug") `); - await queryRunner.query(`CREATE INDEX "IDX_230652e48daa99c50c000fc5d1" ON "report" ("categoryId") `); - await queryRunner.query(`DROP INDEX "IDX_40459267d68604655aa6df4251"`); - await queryRunner.query(`DROP INDEX "IDX_a6bde8f44e18f17b1ca603e150"`); - await queryRunner.query(`DROP INDEX "IDX_edf9bd011d7f08e3e18a5becb8"`); - await queryRunner.query(`DROP INDEX "IDX_5193788a3ebc1143bedb74cf72"`); - await queryRunner.query(`ALTER TABLE "report_organization" RENAME TO "temporary_report_organization"`); - await queryRunner.query( - `CREATE TABLE "report_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "reportId" varchar NOT NULL, "isEnabled" boolean NOT NULL DEFAULT (1), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a085d6f9bcfd19f8bae1dbfe135" FOREIGN KEY ("reportId") REFERENCES "report" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5193788a3ebc1143bedb74cf725" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_edf9bd011d7f08e3e18a5becb8b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "report_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "reportId", "isEnabled", "isActive", "isArchived", "deletedAt" FROM "temporary_report_organization"` - ); - await queryRunner.query(`DROP TABLE "temporary_report_organization"`); - await queryRunner.query( - `CREATE INDEX "IDX_40459267d68604655aa6df4251" ON "report_organization" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_a6bde8f44e18f17b1ca603e150" ON "report_organization" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_edf9bd011d7f08e3e18a5becb8" ON "report_organization" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_5193788a3ebc1143bedb74cf72" ON "report_organization" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_656f05f951faa13d7195853424"`); - await queryRunner.query(`DROP INDEX "IDX_dd9fcd7916d0a22189ecea6a36"`); - await queryRunner.query(`DROP INDEX "IDX_fa278d337ba5e200d44ade6697"`); - await queryRunner.query(`ALTER TABLE "report_category" RENAME TO "temporary_report_category"`); - await queryRunner.query( - `CREATE TABLE "report_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "iconClass" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "report_category"("id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "iconClass", "isActive", "isArchived", "deletedAt" FROM "temporary_report_category"` - ); - await queryRunner.query(`DROP TABLE "temporary_report_category"`); - await queryRunner.query(`CREATE INDEX "IDX_656f05f951faa13d7195853424" ON "report_category" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_dd9fcd7916d0a22189ecea6a36" ON "report_category" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_fa278d337ba5e200d44ade6697" ON "report_category" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_96413a8061ff4ccdc418d4e16a"`); - await queryRunner.query(`DROP INDEX "IDX_1d9ca23c7e1c606061fec8bb74"`); - await queryRunner.query(`DROP INDEX "IDX_7533fd275bfb3219ce9eb4004c"`); - await queryRunner.query(`DROP INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2"`); - await queryRunner.query(`DROP INDEX "IDX_d24bc28e54f1dc296452a25591"`); - await queryRunner.query(`ALTER TABLE "product_translation" RENAME TO "temporary_product_translation"`); - await queryRunner.query( - `CREATE TABLE "product_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d24bc28e54f1dc296452a255917" FOREIGN KEY ("referenceId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e6abcacc3d3a4f9cf5ca97f2b28" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7533fd275bfb3219ce9eb4004c7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_translation"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_96413a8061ff4ccdc418d4e16a" ON "product_translation" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1d9ca23c7e1c606061fec8bb74" ON "product_translation" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_7533fd275bfb3219ce9eb4004c" ON "product_translation" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_e6abcacc3d3a4f9cf5ca97f2b2" ON "product_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d24bc28e54f1dc296452a25591" ON "product_translation" ("referenceId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6f58935aa2175d930e47e97c9f"`); - await queryRunner.query(`DROP INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4"`); - await queryRunner.query(`DROP INDEX "IDX_08293ca31a601d3cd0228120bc"`); - await queryRunner.query(`DROP INDEX "IDX_32a4bdd261ec81f4ca6b3abe26"`); - await queryRunner.query(`DROP INDEX "IDX_4627873dbc1af07d732e6eec7b"`); - await queryRunner.query(`DROP INDEX "IDX_374bfd0d1b0e1398d7206456d9"`); - await queryRunner.query(`DROP INDEX "IDX_618194d24a7ea86a165d7ec628"`); - await queryRunner.query(`ALTER TABLE "product" RENAME TO "temporary_product"`); - await queryRunner.query( - `CREATE TABLE "product" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "enabled" boolean NOT NULL DEFAULT (1), "code" varchar NOT NULL, "imageUrl" varchar, "featuredImageId" varchar, "productTypeId" varchar, "productCategoryId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_618194d24a7ea86a165d7ec628e" FOREIGN KEY ("productCategoryId") REFERENCES "product_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_374bfd0d1b0e1398d7206456d98" FOREIGN KEY ("productTypeId") REFERENCES "product_type" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4627873dbc1af07d732e6eec7be" FOREIGN KEY ("featuredImageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_32a4bdd261ec81f4ca6b3abe262" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_08293ca31a601d3cd0228120bc9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "enabled", "code", "imageUrl", "featuredImageId", "productTypeId", "productCategoryId", "isActive", "isArchived", "deletedAt" FROM "temporary_product"` - ); - await queryRunner.query(`DROP TABLE "temporary_product"`); - await queryRunner.query(`CREATE INDEX "IDX_6f58935aa2175d930e47e97c9f" ON "product" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_7bb2b2f7a4c8a4916d4339d7f4" ON "product" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_08293ca31a601d3cd0228120bc" ON "product" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_32a4bdd261ec81f4ca6b3abe26" ON "product" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4627873dbc1af07d732e6eec7b" ON "product" ("featuredImageId") `); - await queryRunner.query(`CREATE INDEX "IDX_374bfd0d1b0e1398d7206456d9" ON "product" ("productTypeId") `); - await queryRunner.query(`CREATE INDEX "IDX_618194d24a7ea86a165d7ec628" ON "product" ("productCategoryId") `); - await queryRunner.query(`DROP INDEX "IDX_e0005cbdabb760488f66f3fbba"`); - await queryRunner.query(`DROP INDEX "IDX_e0d896cadbc695a490f64bb7e7"`); - await queryRunner.query(`DROP INDEX "IDX_9121e00c4dc3500dc610cf8722"`); - await queryRunner.query(`DROP INDEX "IDX_6a289b10030ae86903406e3c9b"`); - await queryRunner.query(`DROP INDEX "IDX_6e420052844edf3a5506d863ce"`); - await queryRunner.query(`DROP INDEX "IDX_b83f23626741630a8629960715"`); - await queryRunner.query(`ALTER TABLE "product_variant" RENAME TO "temporary_product_variant"`); - await queryRunner.query( - `CREATE TABLE "product_variant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "taxes" integer NOT NULL DEFAULT (0), "notes" varchar, "quantity" integer NOT NULL DEFAULT (0), "billingInvoicingPolicy" varchar NOT NULL DEFAULT ('Quantity ordered'), "internalReference" varchar, "enabled" boolean NOT NULL DEFAULT (1), "productId" varchar, "imageId" varchar, "priceId" varchar, "settingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_9f0fd369dfeb275415c649d110" UNIQUE ("settingId"), CONSTRAINT "REL_41b31a71dda350cfe5da07e0e4" UNIQUE ("priceId"), CONSTRAINT "FK_b83f23626741630a86299607156" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_6e420052844edf3a5506d863ce6" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9f0fd369dfeb275415c649d110b" FOREIGN KEY ("settingId") REFERENCES "product_variant_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_41b31a71dda350cfe5da07e0e4f" FOREIGN KEY ("priceId") REFERENCES "product_variant_price" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a289b10030ae86903406e3c9bd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9121e00c4dc3500dc610cf8722e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_variant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "taxes", "notes", "quantity", "billingInvoicingPolicy", "internalReference", "enabled", "productId", "imageId", "priceId", "settingId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_variant"`); - await queryRunner.query(`CREATE INDEX "IDX_e0005cbdabb760488f66f3fbba" ON "product_variant" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e0d896cadbc695a490f64bb7e7" ON "product_variant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_9121e00c4dc3500dc610cf8722" ON "product_variant" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_6a289b10030ae86903406e3c9b" ON "product_variant" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_6e420052844edf3a5506d863ce" ON "product_variant" ("productId") `); - await queryRunner.query(`CREATE INDEX "IDX_b83f23626741630a8629960715" ON "product_variant" ("imageId") `); - await queryRunner.query(`DROP INDEX "IDX_24ac11e35221577e4ba4fdd229"`); - await queryRunner.query(`DROP INDEX "IDX_562ef5984b6d4bed640bfcc6a2"`); - await queryRunner.query(`DROP INDEX "IDX_7052eaf00a5795afa5ebf35995"`); - await queryRunner.query(`DROP INDEX "IDX_0cfba32db58a952f58b1e35cf1"`); - await queryRunner.query(`ALTER TABLE "product_variant_price" RENAME TO "temporary_product_variant_price"`); - await queryRunner.query( - `CREATE TABLE "product_variant_price" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "unitCost" integer NOT NULL DEFAULT (0), "unitCostCurrency" varchar NOT NULL DEFAULT ('USD'), "retailPrice" integer NOT NULL DEFAULT (0), "retailPriceCurrency" varchar NOT NULL DEFAULT ('USD'), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_5842f603bd85d924127d63d73c" UNIQUE ("productVariantId"), CONSTRAINT "FK_5842f603bd85d924127d63d73cd" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0cfba32db58a952f58b1e35cf1c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7052eaf00a5795afa5ebf359950" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_variant_price"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "unitCost", "unitCostCurrency", "retailPrice", "retailPriceCurrency", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant_price"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_variant_price"`); - await queryRunner.query( - `CREATE INDEX "IDX_24ac11e35221577e4ba4fdd229" ON "product_variant_price" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_562ef5984b6d4bed640bfcc6a2" ON "product_variant_price" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7052eaf00a5795afa5ebf35995" ON "product_variant_price" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0cfba32db58a952f58b1e35cf1" ON "product_variant_price" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_49064ee0f3acd5882f4d893f3d"`); - await queryRunner.query(`DROP INDEX "IDX_90cc635a1065702ed3b79da6ec"`); - await queryRunner.query(`DROP INDEX "IDX_f206c807fc7e41fc8a8b6679ae"`); - await queryRunner.query(`DROP INDEX "IDX_e4e4120b0c19d3a207ce38d758"`); - await queryRunner.query(`ALTER TABLE "product_type" RENAME TO "temporary_product_type"`); - await queryRunner.query( - `CREATE TABLE "product_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e4e4120b0c19d3a207ce38d7581" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f206c807fc7e41fc8a8b6679ae0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "icon", "isActive", "isArchived", "deletedAt" FROM "temporary_product_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_type"`); - await queryRunner.query(`CREATE INDEX "IDX_49064ee0f3acd5882f4d893f3d" ON "product_type" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_90cc635a1065702ed3b79da6ec" ON "product_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f206c807fc7e41fc8a8b6679ae" ON "product_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e4e4120b0c19d3a207ce38d758" ON "product_type" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_65874d6bab7fefcaeccd2252c1"`); - await queryRunner.query(`DROP INDEX "IDX_e9dca49bad996f1761db3b2f56"`); - await queryRunner.query(`DROP INDEX "IDX_30aafca59cdb456bf5231f9e46"`); - await queryRunner.query(`DROP INDEX "IDX_2dd271bdeb602b8c3956287e33"`); - await queryRunner.query(`DROP INDEX "IDX_f4b767c43b4e9130c63382c9b2"`); - await queryRunner.query( - `ALTER TABLE "product_type_translation" RENAME TO "temporary_product_type_translation"` - ); - await queryRunner.query( - `CREATE TABLE "product_type_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f4b767c43b4e9130c63382c9b28" FOREIGN KEY ("referenceId") REFERENCES "product_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2dd271bdeb602b8c3956287e33c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_30aafca59cdb456bf5231f9e463" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_type_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_type_translation"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_type_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_65874d6bab7fefcaeccd2252c1" ON "product_type_translation" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e9dca49bad996f1761db3b2f56" ON "product_type_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_30aafca59cdb456bf5231f9e46" ON "product_type_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2dd271bdeb602b8c3956287e33" ON "product_type_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f4b767c43b4e9130c63382c9b2" ON "product_type_translation" ("referenceId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_ae78776111e1906accfd61511d"`); - await queryRunner.query(`DROP INDEX "IDX_ad107ba78e487cd8b13313593b"`); - await queryRunner.query(`DROP INDEX "IDX_2efe48435d4ba480a4bb8b96fa"`); - await queryRunner.query(`DROP INDEX "IDX_bed9d45e15866d9b8e87e7a7bf"`); - await queryRunner.query(`ALTER TABLE "product_variant_setting" RENAME TO "temporary_product_variant_setting"`); - await queryRunner.query( - `CREATE TABLE "product_variant_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isSubscription" boolean NOT NULL DEFAULT (0), "isPurchaseAutomatically" boolean NOT NULL DEFAULT (0), "canBeSold" boolean NOT NULL DEFAULT (1), "canBePurchased" boolean NOT NULL DEFAULT (1), "canBeCharged" boolean NOT NULL DEFAULT (0), "canBeRented" boolean NOT NULL DEFAULT (0), "isEquipment" boolean NOT NULL DEFAULT (0), "trackInventory" boolean NOT NULL DEFAULT (0), "productVariantId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_b0d86990fe7160a5f3e4011fb2" UNIQUE ("productVariantId"), CONSTRAINT "FK_b0d86990fe7160a5f3e4011fb23" FOREIGN KEY ("productVariantId") REFERENCES "product_variant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_bed9d45e15866d9b8e87e7a7bfe" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2efe48435d4ba480a4bb8b96fa6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_variant_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isSubscription", "isPurchaseAutomatically", "canBeSold", "canBePurchased", "canBeCharged", "canBeRented", "isEquipment", "trackInventory", "productVariantId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_variant_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_variant_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_ae78776111e1906accfd61511d" ON "product_variant_setting" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ad107ba78e487cd8b13313593b" ON "product_variant_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2efe48435d4ba480a4bb8b96fa" ON "product_variant_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bed9d45e15866d9b8e87e7a7bf" ON "product_variant_setting" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_35d083f4ecfe72cce72ee88f58"`); - await queryRunner.query(`DROP INDEX "IDX_d81028785f188c253e0bd49a03"`); - await queryRunner.query(`DROP INDEX "IDX_985d235aa5394937c4493262c7"`); - await queryRunner.query(`DROP INDEX "IDX_47ffb82a65c43f102b7e0efa41"`); - await queryRunner.query(`DROP INDEX "IDX_a6debf9198e2fbfa006aa10d71"`); - await queryRunner.query(`ALTER TABLE "product_option" RENAME TO "temporary_product_option"`); - await queryRunner.query( - `CREATE TABLE "product_option" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar, "groupId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a6debf9198e2fbfa006aa10d710" FOREIGN KEY ("groupId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_47ffb82a65c43f102b7e0efa41a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_985d235aa5394937c4493262c7f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_option"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "groupId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_option"`); - await queryRunner.query(`CREATE INDEX "IDX_35d083f4ecfe72cce72ee88f58" ON "product_option" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_d81028785f188c253e0bd49a03" ON "product_option" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_985d235aa5394937c4493262c7" ON "product_option" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_47ffb82a65c43f102b7e0efa41" ON "product_option" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_a6debf9198e2fbfa006aa10d71" ON "product_option" ("groupId") `); - await queryRunner.query(`DROP INDEX "IDX_2f581c3477a5c7a66de5d7f264"`); - await queryRunner.query(`DROP INDEX "IDX_f284f666950392c55afa0806c8"`); - await queryRunner.query(`DROP INDEX "IDX_9869d7680f48487e584f5d2fca"`); - await queryRunner.query(`DROP INDEX "IDX_4dc2f466cfa3d0b7fef19d1273"`); - await queryRunner.query(`DROP INDEX "IDX_f43c46e12db0580af320db7738"`); - await queryRunner.query( - `ALTER TABLE "product_option_translation" RENAME TO "temporary_product_option_translation"` - ); - await queryRunner.query( - `CREATE TABLE "product_option_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f43c46e12db0580af320db77381" FOREIGN KEY ("referenceId") REFERENCES "product_option" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4dc2f466cfa3d0b7fef19d12731" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9869d7680f48487e584f5d2fca7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_option_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_translation"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_option_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_2f581c3477a5c7a66de5d7f264" ON "product_option_translation" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f284f666950392c55afa0806c8" ON "product_option_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9869d7680f48487e584f5d2fca" ON "product_option_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4dc2f466cfa3d0b7fef19d1273" ON "product_option_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f43c46e12db0580af320db7738" ON "product_option_translation" ("referenceId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e9e50109d3054fb81205c0a74e"`); - await queryRunner.query(`DROP INDEX "IDX_75b7065234a6d32fbd03d8703f"`); - await queryRunner.query(`DROP INDEX "IDX_fd6b39f1fd1db026b5dcc3c795"`); - await queryRunner.query(`DROP INDEX "IDX_0e2fcc31743e20a45fc3cf0211"`); - await queryRunner.query(`DROP INDEX "IDX_c9ce1da98b6d93293daafee63a"`); - await queryRunner.query( - `ALTER TABLE "product_option_group_translation" RENAME TO "temporary_product_option_group_translation"` - ); - await queryRunner.query( - `CREATE TABLE "product_option_group_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c9ce1da98b6d93293daafee63aa" FOREIGN KEY ("referenceId") REFERENCES "product_option_group" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0e2fcc31743e20a45fc3cf0211d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fd6b39f1fd1db026b5dcc3c7953" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_option_group_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_group_translation"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_option_group_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_e9e50109d3054fb81205c0a74e" ON "product_option_group_translation" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75b7065234a6d32fbd03d8703f" ON "product_option_group_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fd6b39f1fd1db026b5dcc3c795" ON "product_option_group_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0e2fcc31743e20a45fc3cf0211" ON "product_option_group_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c9ce1da98b6d93293daafee63a" ON "product_option_group_translation" ("referenceId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_76bda4c33c83614617278617ae"`); - await queryRunner.query(`DROP INDEX "IDX_0fc743f2bc16502dbc5e85420c"`); - await queryRunner.query(`DROP INDEX "IDX_462a7fd3ce68935cf973c6709f"`); - await queryRunner.query(`DROP INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5"`); - await queryRunner.query(`DROP INDEX "IDX_a6e91739227bf4d442f23c52c7"`); - await queryRunner.query(`ALTER TABLE "product_option_group" RENAME TO "temporary_product_option_group"`); - await queryRunner.query( - `CREATE TABLE "product_option_group" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "productId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a6e91739227bf4d442f23c52c75" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_4a1430a01b71ecdfcd54b2b6c5c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_462a7fd3ce68935cf973c6709f9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_option_group"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "productId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_option_group"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_option_group"`); - await queryRunner.query( - `CREATE INDEX "IDX_76bda4c33c83614617278617ae" ON "product_option_group" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0fc743f2bc16502dbc5e85420c" ON "product_option_group" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_462a7fd3ce68935cf973c6709f" ON "product_option_group" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4a1430a01b71ecdfcd54b2b6c5" ON "product_option_group" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a6e91739227bf4d442f23c52c7" ON "product_option_group" ("productId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_06cd3959f09e0b12793a763515"`); - await queryRunner.query(`DROP INDEX "IDX_198fba43f049ea621407e7d188"`); - await queryRunner.query(`DROP INDEX "IDX_853302351eaa4daa39920c270a"`); - await queryRunner.query(`DROP INDEX "IDX_0a0cf25cd8232a154d1cce2641"`); - await queryRunner.query(`DROP INDEX "IDX_f38e86bd280ff9c9c7d9cb7839"`); - await queryRunner.query(`ALTER TABLE "product_category" RENAME TO "temporary_product_category"`); - await queryRunner.query( - `CREATE TABLE "product_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "imageUrl" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f38e86bd280ff9c9c7d9cb78393" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0a0cf25cd8232a154d1cce2641c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_853302351eaa4daa39920c270a9" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "product_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "imageUrl", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_category"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_category"`); - await queryRunner.query(`CREATE INDEX "IDX_06cd3959f09e0b12793a763515" ON "product_category" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_198fba43f049ea621407e7d188" ON "product_category" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_853302351eaa4daa39920c270a" ON "product_category" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_0a0cf25cd8232a154d1cce2641" ON "product_category" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f38e86bd280ff9c9c7d9cb7839" ON "product_category" ("imageId") `); - await queryRunner.query(`DROP INDEX "IDX_d32c5d5e4451acf44fd5b212ce"`); - await queryRunner.query(`DROP INDEX "IDX_e690dd59b69e74a6bb5d94f32b"`); - await queryRunner.query(`DROP INDEX "IDX_27d71aa2e843f07fbf36329be3"`); - await queryRunner.query(`DROP INDEX "IDX_e46203bf1dbf3291d174f02cb3"`); - await queryRunner.query(`DROP INDEX "IDX_586294149d24cd835678878ef1"`); - await queryRunner.query( - `ALTER TABLE "product_category_translation" RENAME TO "temporary_product_category_translation"` - ); - await queryRunner.query( - `CREATE TABLE "product_category_translation" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "languageCode" varchar NOT NULL, "referenceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_586294149d24cd835678878ef12" FOREIGN KEY ("referenceId") REFERENCES "product_category" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e46203bf1dbf3291d174f02cb34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_27d71aa2e843f07fbf36329be3f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "product_category_translation"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "languageCode", "referenceId", "isActive", "isArchived", "deletedAt" FROM "temporary_product_category_translation"` - ); - await queryRunner.query(`DROP TABLE "temporary_product_category_translation"`); - await queryRunner.query( - `CREATE INDEX "IDX_d32c5d5e4451acf44fd5b212ce" ON "product_category_translation" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e690dd59b69e74a6bb5d94f32b" ON "product_category_translation" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_27d71aa2e843f07fbf36329be3" ON "product_category_translation" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e46203bf1dbf3291d174f02cb3" ON "product_category_translation" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_586294149d24cd835678878ef1" ON "product_category_translation" ("referenceId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1adf9f97094bc93e176ede2482"`); - await queryRunner.query(`DROP INDEX "IDX_f3027eabd451ec18b93fab7ed5"`); - await queryRunner.query(`DROP INDEX "IDX_683274c59fb08b21249096e305"`); - await queryRunner.query(`DROP INDEX "IDX_873ade98fbd6ca71c8b4d1bbca"`); - await queryRunner.query(`ALTER TABLE "pipeline" RENAME TO "temporary_pipeline"`); - await queryRunner.query( - `CREATE TABLE "pipeline" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_873ade98fbd6ca71c8b4d1bbcac" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_683274c59fb08b21249096e305c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "pipeline"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_pipeline"` - ); - await queryRunner.query(`DROP TABLE "temporary_pipeline"`); - await queryRunner.query(`CREATE INDEX "IDX_1adf9f97094bc93e176ede2482" ON "pipeline" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_f3027eabd451ec18b93fab7ed5" ON "pipeline" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_683274c59fb08b21249096e305" ON "pipeline" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_873ade98fbd6ca71c8b4d1bbca" ON "pipeline" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_074caa106ee22d5d675a696a98"`); - await queryRunner.query(`DROP INDEX "IDX_a6acee4ad726734b73f3886c14"`); - await queryRunner.query(`DROP INDEX "IDX_28965bf63ad4c0976892d0fd5e"`); - await queryRunner.query(`DROP INDEX "IDX_04d16bdd72668de12c3e41a85a"`); - await queryRunner.query(`ALTER TABLE "pipeline_stage" RENAME TO "temporary_pipeline_stage"`); - await queryRunner.query( - `CREATE TABLE "pipeline_stage" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" text, "index" integer NOT NULL, "name" varchar NOT NULL, "pipelineId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_73ec3158bf224b485fd715cb3a6" FOREIGN KEY ("pipelineId") REFERENCES "pipeline" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_04d16bdd72668de12c3e41a85a6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_28965bf63ad4c0976892d0fd5e8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "pipeline_stage"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "index", "name", "pipelineId", "isActive", "isArchived", "deletedAt" FROM "temporary_pipeline_stage"` - ); - await queryRunner.query(`DROP TABLE "temporary_pipeline_stage"`); - await queryRunner.query(`CREATE INDEX "IDX_074caa106ee22d5d675a696a98" ON "pipeline_stage" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_a6acee4ad726734b73f3886c14" ON "pipeline_stage" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_28965bf63ad4c0976892d0fd5e" ON "pipeline_stage" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_04d16bdd72668de12c3e41a85a" ON "pipeline_stage" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_8c4018eab11e92c3b09583495f"`); - await queryRunner.query(`DROP INDEX "IDX_16a49d62227bf23686b77b5a21"`); - await queryRunner.query(`DROP INDEX "IDX_6959c37c3acf0832103a253570"`); - await queryRunner.query(`DROP INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9"`); - await queryRunner.query(`DROP INDEX "IDX_62ef561a3bb084a7d12dad8a2d"`); - await queryRunner.query(`DROP INDEX "IDX_87223c7f1d4c2ca51cf6992784"`); - await queryRunner.query(`DROP INDEX "IDX_3f13c738eff604a85700746ec7"`); - await queryRunner.query(`DROP INDEX "IDX_8846e403ec45e1ad8c309f91a3"`); - await queryRunner.query(`DROP INDEX "IDX_82753b9e315af84b20eaf84d77"`); - await queryRunner.query(`ALTER TABLE "payment" RENAME TO "temporary_payment"`); - await queryRunner.query( - `CREATE TABLE "payment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "paymentDate" datetime, "amount" numeric, "note" varchar, "currency" varchar NOT NULL, "paymentMethod" varchar, "overdue" boolean, "employeeId" varchar, "invoiceId" varchar, "recordedById" varchar NOT NULL, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_82753b9e315af84b20eaf84d778" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_8846e403ec45e1ad8c309f91a37" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3f13c738eff604a85700746ec7d" FOREIGN KEY ("recordedById") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_87223c7f1d4c2ca51cf69927844" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62ef561a3bb084a7d12dad8a2d9" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_be7fcc9fb8cd5a74cb602ec6c9b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6959c37c3acf0832103a2535703" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "payment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "paymentDate", "amount", "note", "currency", "paymentMethod", "overdue", "employeeId", "invoiceId", "recordedById", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_payment"` - ); - await queryRunner.query(`DROP TABLE "temporary_payment"`); - await queryRunner.query(`CREATE INDEX "IDX_8c4018eab11e92c3b09583495f" ON "payment" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_16a49d62227bf23686b77b5a21" ON "payment" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6959c37c3acf0832103a253570" ON "payment" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_be7fcc9fb8cd5a74cb602ec6c9" ON "payment" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_62ef561a3bb084a7d12dad8a2d" ON "payment" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_87223c7f1d4c2ca51cf6992784" ON "payment" ("invoiceId") `); - await queryRunner.query(`CREATE INDEX "IDX_3f13c738eff604a85700746ec7" ON "payment" ("recordedById") `); - await queryRunner.query(`CREATE INDEX "IDX_8846e403ec45e1ad8c309f91a3" ON "payment" ("projectId") `); - await queryRunner.query( - `CREATE INDEX "IDX_82753b9e315af84b20eaf84d77" ON "payment" ("organizationContactId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_36e929b98372d961bb63bd4b4e"`); - await queryRunner.query(`DROP INDEX "IDX_1c88db6e50f0704688d1f1978c"`); - await queryRunner.query(`DROP INDEX "IDX_380c03025a41ad032191f1ef2d"`); - await queryRunner.query(`DROP INDEX "IDX_e71a736d52820b568f6b0ca203"`); - await queryRunner.query(`DROP INDEX "IDX_1fa632f2d12a06ef8dcc00858f"`); - await queryRunner.query(`ALTER TABLE "password_reset" RENAME TO "temporary_password_reset"`); - await queryRunner.query( - `CREATE TABLE "password_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "email" varchar NOT NULL, "token" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "tenantId" varchar, CONSTRAINT "FK_1fa632f2d12a06ef8dcc00858ff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "password_reset"("id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId") SELECT "id", "createdAt", "updatedAt", "email", "token", "isActive", "isArchived", "deletedAt", "tenantId" FROM "temporary_password_reset"` - ); - await queryRunner.query(`DROP TABLE "temporary_password_reset"`); - await queryRunner.query(`CREATE INDEX "IDX_36e929b98372d961bb63bd4b4e" ON "password_reset" ("token") `); - await queryRunner.query(`CREATE INDEX "IDX_1c88db6e50f0704688d1f1978c" ON "password_reset" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_380c03025a41ad032191f1ef2d" ON "password_reset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_e71a736d52820b568f6b0ca203" ON "password_reset" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1fa632f2d12a06ef8dcc00858f" ON "password_reset" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_47b6a97e09895a06606a4a8042"`); - await queryRunner.query(`DROP INDEX "IDX_7965db2b12872551b586f76dd7"`); - await queryRunner.query(`DROP INDEX "IDX_2360aa7a4b5ab99e026584f305"`); - await queryRunner.query(`DROP INDEX "IDX_15458cef74076623c270500053"`); - await queryRunner.query(`DROP INDEX "IDX_9ea70bf5c390b00e7bb96b86ed"`); - await queryRunner.query(`DROP INDEX "IDX_c75285bf286b17c7ca5537857b"`); - await queryRunner.query(`DROP INDEX "IDX_f37d866c3326eca5f579cef35c"`); - await queryRunner.query(`DROP INDEX "IDX_b03a8a28f6ebdb6df8f630216b"`); - await queryRunner.query(`DROP INDEX "IDX_6cc2b2052744e352834a4c9e78"`); - await queryRunner.query(`DROP INDEX "IDX_40460ab803bf6e5a62b75a35c5"`); - await queryRunner.query(`DROP INDEX "IDX_03e5eecc2328eb545ff748cbdd"`); - await queryRunner.query(`DROP INDEX "IDX_c21e615583a3ebbb0977452afb"`); - await queryRunner.query(`DROP INDEX "IDX_745a293c8b2c750bc421fa0633"`); - await queryRunner.query(`DROP INDEX "IDX_6de52b8f3de32abee3df2628a3"`); - await queryRunner.query(`DROP INDEX "IDX_b2091c1795f1d0d919b278ab23"`); - await queryRunner.query(`ALTER TABLE "organization" RENAME TO "temporary_organization"`); - await queryRunner.query( - `CREATE TABLE "organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "name" varchar NOT NULL, "isDefault" boolean NOT NULL DEFAULT (0), "profile_link" varchar, "banner" varchar, "totalEmployees" integer, "short_description" varchar, "client_focus" varchar, "overview" varchar, "imageUrl" varchar(500), "currency" varchar NOT NULL, "valueDate" datetime, "defaultValueDateType" varchar CHECK( "defaultValueDateType" IN ('TODAY','END_OF_MONTH','START_OF_MONTH') ) DEFAULT ('TODAY'), "isActive" boolean DEFAULT (1), "defaultAlignmentType" varchar, "timeZone" varchar, "regionCode" varchar, "brandColor" varchar, "dateFormat" varchar, "officialName" varchar, "startWeekOn" varchar, "taxId" varchar, "numberFormat" varchar, "minimumProjectSize" varchar, "bonusType" varchar, "bonusPercentage" integer, "invitesAllowed" boolean DEFAULT (1), "show_income" boolean, "show_profits" boolean, "show_bonuses_paid" boolean, "show_total_hours" boolean, "show_minimum_project_size" boolean, "show_projects_count" boolean, "show_clients_count" boolean, "show_clients" boolean, "show_employees_count" boolean, "inviteExpiryPeriod" integer, "fiscalStartDate" datetime, "fiscalEndDate" datetime, "registrationDate" datetime, "futureDateAllowed" boolean, "allowManualTime" boolean NOT NULL DEFAULT (1), "allowModifyTime" boolean NOT NULL DEFAULT (1), "allowDeleteTime" boolean NOT NULL DEFAULT (1), "requireReason" boolean NOT NULL DEFAULT (0), "requireDescription" boolean NOT NULL DEFAULT (0), "requireProject" boolean NOT NULL DEFAULT (0), "requireTask" boolean NOT NULL DEFAULT (0), "requireClient" boolean NOT NULL DEFAULT (0), "timeFormat" integer NOT NULL DEFAULT (12), "separateInvoiceItemTaxAndDiscount" boolean, "website" varchar, "fiscalInformation" varchar, "currencyPosition" varchar NOT NULL DEFAULT ('LEFT'), "discountAfterTax" boolean, "defaultStartTime" varchar, "defaultEndTime" varchar, "defaultInvoiceEstimateTerms" varchar, "convertAcceptedEstimates" boolean, "daysUntilDue" integer, "contactId" varchar, "allowTrackInactivity" boolean NOT NULL DEFAULT (1), "inactivityTimeLimit" integer NOT NULL DEFAULT (10), "activityProofDuration" integer NOT NULL DEFAULT (1), "isRemoveIdleTime" boolean NOT NULL DEFAULT (0), "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "imageId" varchar, "upworkOrganizationId" varchar, "upworkOrganizationName" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "randomScreenshot" boolean DEFAULT (0), "trackOnSleep" boolean DEFAULT (0), "screenshotFrequency" numeric NOT NULL DEFAULT (10), "enforced" boolean DEFAULT (0), CONSTRAINT "FK_745a293c8b2c750bc421fa06332" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7965db2b12872551b586f76dd79" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_47b6a97e09895a06606a4a80421" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization"("id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced") SELECT "id", "createdAt", "updatedAt", "tenantId", "name", "isDefault", "profile_link", "banner", "totalEmployees", "short_description", "client_focus", "overview", "imageUrl", "currency", "valueDate", "defaultValueDateType", "isActive", "defaultAlignmentType", "timeZone", "regionCode", "brandColor", "dateFormat", "officialName", "startWeekOn", "taxId", "numberFormat", "minimumProjectSize", "bonusType", "bonusPercentage", "invitesAllowed", "show_income", "show_profits", "show_bonuses_paid", "show_total_hours", "show_minimum_project_size", "show_projects_count", "show_clients_count", "show_clients", "show_employees_count", "inviteExpiryPeriod", "fiscalStartDate", "fiscalEndDate", "registrationDate", "futureDateAllowed", "allowManualTime", "allowModifyTime", "allowDeleteTime", "requireReason", "requireDescription", "requireProject", "requireTask", "requireClient", "timeFormat", "separateInvoiceItemTaxAndDiscount", "website", "fiscalInformation", "currencyPosition", "discountAfterTax", "defaultStartTime", "defaultEndTime", "defaultInvoiceEstimateTerms", "convertAcceptedEstimates", "daysUntilDue", "contactId", "allowTrackInactivity", "inactivityTimeLimit", "activityProofDuration", "isRemoveIdleTime", "allowScreenshotCapture", "imageId", "upworkOrganizationId", "upworkOrganizationName", "isArchived", "deletedAt", "randomScreenshot", "trackOnSleep", "screenshotFrequency", "enforced" FROM "temporary_organization"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization"`); - await queryRunner.query(`CREATE INDEX "IDX_47b6a97e09895a06606a4a8042" ON "organization" ("imageId") `); - await queryRunner.query(`CREATE INDEX "IDX_7965db2b12872551b586f76dd7" ON "organization" ("contactId") `); - await queryRunner.query( - `CREATE INDEX "IDX_2360aa7a4b5ab99e026584f305" ON "organization" ("defaultValueDateType") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_15458cef74076623c270500053" ON "organization" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_9ea70bf5c390b00e7bb96b86ed" ON "organization" ("overview") `); - await queryRunner.query(`CREATE INDEX "IDX_c75285bf286b17c7ca5537857b" ON "organization" ("client_focus") `); - await queryRunner.query( - `CREATE INDEX "IDX_f37d866c3326eca5f579cef35c" ON "organization" ("short_description") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b03a8a28f6ebdb6df8f630216b" ON "organization" ("totalEmployees") `); - await queryRunner.query(`CREATE INDEX "IDX_6cc2b2052744e352834a4c9e78" ON "organization" ("banner") `); - await queryRunner.query(`CREATE INDEX "IDX_40460ab803bf6e5a62b75a35c5" ON "organization" ("profile_link") `); - await queryRunner.query(`CREATE INDEX "IDX_03e5eecc2328eb545ff748cbdd" ON "organization" ("isDefault") `); - await queryRunner.query(`CREATE INDEX "IDX_c21e615583a3ebbb0977452afb" ON "organization" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_745a293c8b2c750bc421fa0633" ON "organization" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_6de52b8f3de32abee3df2628a3" ON "organization" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_b2091c1795f1d0d919b278ab23" ON "organization" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_266972cd6ff9656eec8818e12d"`); - await queryRunner.query(`DROP INDEX "IDX_04c6320f910056ecb11b147ac8"`); - await queryRunner.query(`DROP INDEX "IDX_7e0bf6063e1728c9813d5da7ca"`); - await queryRunner.query(`DROP INDEX "IDX_56dd132aa3743cfa9b034d020e"`); - await queryRunner.query(`DROP INDEX "IDX_e56e80136b07ecd52545368611"`); - await queryRunner.query(`ALTER TABLE "organization_vendor" RENAME TO "temporary_organization_vendor"`); - await queryRunner.query( - `CREATE TABLE "organization_vendor" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "email" varchar, "phone" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_56dd132aa3743cfa9b034d020eb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7e0bf6063e1728c9813d5da7caa" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_vendor"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "email", "phone", "website", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_vendor"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_vendor"`); - await queryRunner.query( - `CREATE INDEX "IDX_266972cd6ff9656eec8818e12d" ON "organization_vendor" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_04c6320f910056ecb11b147ac8" ON "organization_vendor" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_7e0bf6063e1728c9813d5da7ca" ON "organization_vendor" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_56dd132aa3743cfa9b034d020e" ON "organization_vendor" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_e56e80136b07ecd52545368611" ON "organization_vendor" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_38f1d96e8c2d59e4f0f84209ab"`); - await queryRunner.query(`DROP INDEX "IDX_722d648e0b83267d4a66332ccb"`); - await queryRunner.query(`DROP INDEX "IDX_51e91be110fa0b8e70066f5727"`); - await queryRunner.query(`DROP INDEX "IDX_da625f694eb1e23e585f301008"`); - await queryRunner.query(`DROP INDEX "IDX_103ae3eb65f4b091efc55cb532"`); - await queryRunner.query(`DROP INDEX "IDX_eef1c19a0cb5321223cfe3286c"`); - await queryRunner.query(`DROP INDEX "IDX_176f5ed3c4534f3110d423d569"`); - await queryRunner.query(`DROP INDEX "IDX_e22ab0f1236b1a07785b641727"`); - await queryRunner.query(`ALTER TABLE "organization_team" RENAME TO "temporary_organization_team"`); - await queryRunner.query( - `CREATE TABLE "organization_team" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "prefix" varchar, "createdById" varchar, "public" boolean DEFAULT (0), "profile_link" varchar, "logo" varchar, "imageId" varchar, "color" varchar, "emoji" varchar, "teamSize" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, "shareProfileView" boolean DEFAULT (1), "requirePlanToTrack" boolean NOT NULL DEFAULT (0), CONSTRAINT "FK_176f5ed3c4534f3110d423d5690" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eef1c19a0cb5321223cfe3286c4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da625f694eb1e23e585f3010082" FOREIGN KEY ("createdById") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_51e91be110fa0b8e70066f5727f" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_team"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "prefix", "createdById", "public", "profile_link", "logo", "imageId", "color", "emoji", "teamSize", "isActive", "isArchived", "deletedAt", "shareProfileView", "requirePlanToTrack" FROM "temporary_organization_team"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_team"`); - await queryRunner.query(`CREATE INDEX "IDX_38f1d96e8c2d59e4f0f84209ab" ON "organization_team" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_722d648e0b83267d4a66332ccb" ON "organization_team" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_51e91be110fa0b8e70066f5727" ON "organization_team" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_da625f694eb1e23e585f301008" ON "organization_team" ("createdById") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_103ae3eb65f4b091efc55cb532" ON "organization_team" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_eef1c19a0cb5321223cfe3286c" ON "organization_team" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_176f5ed3c4534f3110d423d569" ON "organization_team" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_e22ab0f1236b1a07785b641727" ON "organization_team" ("profile_link") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b027ee2cb18245356b8d963d2f"`); - await queryRunner.query(`DROP INDEX "IDX_29ece7e3bb764028387cdbc888"`); - await queryRunner.query(`DROP INDEX "IDX_171b852be7c1f387eca93775aa"`); - await queryRunner.query(`DROP INDEX "IDX_5e73656ce0355347477c42ae19"`); - await queryRunner.query(`DROP INDEX "IDX_c15823bf3f63b1fe331d9de662"`); - await queryRunner.query(`DROP INDEX "IDX_d9529008c733cb90044b8c2ad6"`); - await queryRunner.query( - `ALTER TABLE "organization_team_join_request" RENAME TO "temporary_organization_team_join_request"` - ); - await queryRunner.query( - `CREATE TABLE "organization_team_join_request" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "email" varchar NOT NULL, "fullName" varchar, "linkAddress" varchar, "position" varchar, "status" varchar, "code" varchar, "token" varchar, "expiredAt" datetime, "userId" varchar, "organizationTeamId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_171b852be7c1f387eca93775aad" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5e73656ce0355347477c42ae19b" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c15823bf3f63b1fe331d9de6625" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d9529008c733cb90044b8c2ad6b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_team_join_request"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "email", "fullName", "linkAddress", "position", "status", "code", "token", "expiredAt", "userId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_team_join_request"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_team_join_request"`); - await queryRunner.query( - `CREATE INDEX "IDX_b027ee2cb18245356b8d963d2f" ON "organization_team_join_request" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_29ece7e3bb764028387cdbc888" ON "organization_team_join_request" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_171b852be7c1f387eca93775aa" ON "organization_team_join_request" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5e73656ce0355347477c42ae19" ON "organization_team_join_request" ("userId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c15823bf3f63b1fe331d9de662" ON "organization_team_join_request" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d9529008c733cb90044b8c2ad6" ON "organization_team_join_request" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_719aeb37fa7a1dd80d25336a0c"`); - await queryRunner.query(`DROP INDEX "IDX_ce83034f38496f5fe3f1979697"`); - await queryRunner.query(`DROP INDEX "IDX_a2a5601d799fbfc29c17b99243"`); - await queryRunner.query(`DROP INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0"`); - await queryRunner.query(`DROP INDEX "IDX_d8eba1c0e500c60be1b69c1e77"`); - await queryRunner.query(`DROP INDEX "IDX_fe12e1b76bbb76209134d9bdc2"`); - await queryRunner.query(`DROP INDEX "IDX_70fcc451944fbde73d223c2af3"`); - await queryRunner.query(`DROP INDEX "IDX_752d7a0fe6597ee6bbc6502a12"`); - await queryRunner.query( - `ALTER TABLE "organization_team_employee" RENAME TO "temporary_organization_team_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_team_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "organizationTeamId" varchar NOT NULL, "employeeId" varchar NOT NULL, "roleId" varchar, "isTrackingEnabled" boolean DEFAULT (1), "activeTaskId" varchar, "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "order" integer, CONSTRAINT "FK_fe12e1b76bbb76209134d9bdc2e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d8eba1c0e500c60be1b69c1e777" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dc83cdd7c519d73afc0d8bdf09" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a2a5601d799fbfc29c17b99243f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ce83034f38496f5fe3f19796977" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_719aeb37fa7a1dd80d25336a0cf" FOREIGN KEY ("activeTaskId") REFERENCES "task" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_team_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "organizationTeamId", "employeeId", "roleId", "isTrackingEnabled", "activeTaskId", "deletedAt", "isActive", "isArchived", "order" FROM "temporary_organization_team_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_team_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_719aeb37fa7a1dd80d25336a0c" ON "organization_team_employee" ("activeTaskId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ce83034f38496f5fe3f1979697" ON "organization_team_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a2a5601d799fbfc29c17b99243" ON "organization_team_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8dc83cdd7c519d73afc0d8bdf0" ON "organization_team_employee" ("organizationTeamId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d8eba1c0e500c60be1b69c1e77" ON "organization_team_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_fe12e1b76bbb76209134d9bdc2" ON "organization_team_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_70fcc451944fbde73d223c2af3" ON "organization_team_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_752d7a0fe6597ee6bbc6502a12" ON "organization_team_employee" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b7be7e61daf2b5af3232c9c4d6"`); - await queryRunner.query(`DROP INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3"`); - await queryRunner.query(`DROP INDEX "IDX_582768159ef0c749e8552ea9bc"`); - await queryRunner.query(`DROP INDEX "IDX_5830901876e426adfc15fb7341"`); - await queryRunner.query(`DROP INDEX "IDX_19ab7adf33199bc6f913db277d"`); - await queryRunner.query(`DROP INDEX "IDX_20a290f166c0810eafbf271717"`); - await queryRunner.query( - `ALTER TABLE "organization_task_setting" RENAME TO "temporary_organization_task_setting"` - ); - await queryRunner.query( - `CREATE TABLE "organization_task_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isTasksPrivacyEnabled" boolean NOT NULL DEFAULT (1), "isTasksMultipleAssigneesEnabled" boolean NOT NULL DEFAULT (1), "isTasksManualTimeEnabled" boolean NOT NULL DEFAULT (1), "isTasksGroupEstimationEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInHoursEnabled" boolean NOT NULL DEFAULT (1), "isTasksEstimationInStoryPointsEnabled" boolean NOT NULL DEFAULT (1), "isTasksProofOfCompletionEnabled" boolean NOT NULL DEFAULT (1), "tasksProofOfCompletionType" varchar NOT NULL DEFAULT ('PRIVATE'), "isTasksLinkedEnabled" boolean NOT NULL DEFAULT (1), "isTasksCommentsEnabled" boolean NOT NULL DEFAULT (1), "isTasksHistoryEnabled" boolean NOT NULL DEFAULT (1), "isTasksAcceptanceCriteriaEnabled" boolean NOT NULL DEFAULT (1), "isTasksDraftsEnabled" boolean NOT NULL DEFAULT (1), "isTasksNotifyLeftEnabled" boolean NOT NULL DEFAULT (1), "tasksNotifyLeftPeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoCloseEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoClosePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoArchiveEnabled" boolean NOT NULL DEFAULT (1), "tasksAutoArchivePeriodDays" integer NOT NULL DEFAULT (7), "isTasksAutoStatusEnabled" boolean NOT NULL DEFAULT (1), "projectId" varchar, "organizationTeamId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_20a290f166c0810eafbf2717171" FOREIGN KEY ("organizationTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_19ab7adf33199bc6f913db277d7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5830901876e426adfc15fb7341b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_582768159ef0c749e8552ea9bcd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_task_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isTasksPrivacyEnabled", "isTasksMultipleAssigneesEnabled", "isTasksManualTimeEnabled", "isTasksGroupEstimationEnabled", "isTasksEstimationInHoursEnabled", "isTasksEstimationInStoryPointsEnabled", "isTasksProofOfCompletionEnabled", "tasksProofOfCompletionType", "isTasksLinkedEnabled", "isTasksCommentsEnabled", "isTasksHistoryEnabled", "isTasksAcceptanceCriteriaEnabled", "isTasksDraftsEnabled", "isTasksNotifyLeftEnabled", "tasksNotifyLeftPeriodDays", "isTasksAutoCloseEnabled", "tasksAutoClosePeriodDays", "isTasksAutoArchiveEnabled", "tasksAutoArchivePeriodDays", "isTasksAutoStatusEnabled", "projectId", "organizationTeamId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_task_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_task_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_b7be7e61daf2b5af3232c9c4d6" ON "organization_task_setting" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f0e2385b2d5f176f9ed3b6a9e3" ON "organization_task_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_582768159ef0c749e8552ea9bc" ON "organization_task_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5830901876e426adfc15fb7341" ON "organization_task_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_19ab7adf33199bc6f913db277d" ON "organization_task_setting" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_20a290f166c0810eafbf271717" ON "organization_task_setting" ("organizationTeamId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_76e53f9609ca05477d50980743"`); - await queryRunner.query(`DROP INDEX "IDX_5596b4fa7fb2ceb0955580becd"`); - await queryRunner.query(`DROP INDEX "IDX_f57ad03c4e471bd8530494ea63"`); - await queryRunner.query(`DROP INDEX "IDX_8a1fe8afb3aa672bae5993fbe7"`); - await queryRunner.query(`ALTER TABLE "organization_sprint" RENAME TO "temporary_organization_sprint"`); - await queryRunner.query( - `CREATE TABLE "organization_sprint" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "projectId" varchar NOT NULL, "goal" varchar, "length" integer NOT NULL DEFAULT (7), "startDate" datetime, "endDate" datetime, "dayStart" integer, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a140b7e30ff3455551a0fd599fb" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8a1fe8afb3aa672bae5993fbe7d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f57ad03c4e471bd8530494ea63d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_sprint"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "projectId", "goal", "length", "startDate", "endDate", "dayStart", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_sprint"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_sprint"`); - await queryRunner.query( - `CREATE INDEX "IDX_76e53f9609ca05477d50980743" ON "organization_sprint" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_5596b4fa7fb2ceb0955580becd" ON "organization_sprint" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f57ad03c4e471bd8530494ea63" ON "organization_sprint" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_8a1fe8afb3aa672bae5993fbe7" ON "organization_sprint" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f3ef2000abb9762b138cc5a1b3"`); - await queryRunner.query(`DROP INDEX "IDX_9ad08dbc039d08279dae2dd94e"`); - await queryRunner.query(`DROP INDEX "IDX_0b19a287858af40661bd3eb741"`); - await queryRunner.query(`DROP INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e"`); - await queryRunner.query(`DROP INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b"`); - await queryRunner.query(`DROP INDEX "IDX_61387780d015923453f4b015b4"`); - await queryRunner.query(`DROP INDEX "IDX_637ac2c467df4bc3b71795a866"`); - await queryRunner.query( - `ALTER TABLE "organization_recurring_expense" RENAME TO "temporary_organization_recurring_expense"` - ); - await queryRunner.query( - `CREATE TABLE "organization_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "splitExpense" boolean, "parentRecurringExpenseId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_8a12e7a0d47d3c6a6b35f7984e3" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0b19a287858af40661bd3eb7411" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "splitExpense", "parentRecurringExpenseId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_recurring_expense"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_recurring_expense"`); - await queryRunner.query( - `CREATE INDEX "IDX_f3ef2000abb9762b138cc5a1b3" ON "organization_recurring_expense" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9ad08dbc039d08279dae2dd94e" ON "organization_recurring_expense" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0b19a287858af40661bd3eb741" ON "organization_recurring_expense" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a12e7a0d47d3c6a6b35f7984e" ON "organization_recurring_expense" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f1e5497ee6be7ba3f2ee90bf4b" ON "organization_recurring_expense" ("categoryName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_61387780d015923453f4b015b4" ON "organization_recurring_expense" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_637ac2c467df4bc3b71795a866" ON "organization_recurring_expense" ("parentRecurringExpenseId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f33638d289aff2306328c32a8c"`); - await queryRunner.query(`DROP INDEX "IDX_a56086e95fb2627ba2a3dd2eaa"`); - await queryRunner.query(`DROP INDEX "IDX_8a7a4d4206c003c3827c5afe5d"`); - await queryRunner.query(`DROP INDEX "IDX_cd928adcb5ebb00c9f2c57e390"`); - await queryRunner.query(`DROP INDEX "IDX_86438fbaa1d857f32f66b24885"`); - await queryRunner.query(`DROP INDEX "IDX_7fd3c8f54c01943b283080aefa"`); - await queryRunner.query(`DROP INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0"`); - await queryRunner.query(`DROP INDEX "IDX_e6b6555e5fc6c5120110a0195c"`); - await queryRunner.query( - `ALTER TABLE "organization_project_module" RENAME TO "temporary_organization_project_module"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_module" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" text, "status" varchar, "startDate" datetime, "endDate" datetime, "public" boolean DEFAULT (0), "isFavorite" boolean DEFAULT (0), "parentId" varchar, "projectId" varchar, "creatorId" varchar, "managerId" varchar, CONSTRAINT "FK_e6b6555e5fc6c5120110a0195cd" FOREIGN KEY ("managerId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8f2054a6a2d4b9c17624b9c8a01" FOREIGN KEY ("creatorId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7fd3c8f54c01943b283080aefa3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bb6fbfa64cf5d5977c2e5346a9" FOREIGN KEY ("parentId") REFERENCES "organization_project_module" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_cd928adcb5ebb00c9f2c57e3908" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a7a4d4206c003c3827c5afe5dc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_module"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "name", "description", "status", "startDate", "endDate", "public", "isFavorite", "parentId", "projectId", "creatorId", "managerId" FROM "temporary_organization_project_module"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_module"`); - await queryRunner.query( - `CREATE INDEX "IDX_f33638d289aff2306328c32a8c" ON "organization_project_module" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a56086e95fb2627ba2a3dd2eaa" ON "organization_project_module" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8a7a4d4206c003c3827c5afe5d" ON "organization_project_module" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_cd928adcb5ebb00c9f2c57e390" ON "organization_project_module" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_86438fbaa1d857f32f66b24885" ON "organization_project_module" ("status") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7fd3c8f54c01943b283080aefa" ON "organization_project_module" ("projectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8f2054a6a2d4b9c17624b9c8a0" ON "organization_project_module" ("creatorId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e6b6555e5fc6c5120110a0195c" ON "organization_project_module" ("managerId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); - await queryRunner.query( - `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "temporary_organization_project"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project"`); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f"`); - await queryRunner.query(`DROP INDEX "IDX_7317abf7a05a169783b6aa7932"`); - await queryRunner.query(`DROP INDEX "IDX_a8f497b1006ec967964abb0d49"`); - await queryRunner.query(`DROP INDEX "IDX_a0409e39f23ff6d418f2c03df5"`); - await queryRunner.query(`DROP INDEX "IDX_3f02c20145af9997253531349c"`); - await queryRunner.query(`ALTER TABLE "organization_position" RENAME TO "temporary_organization_position"`); - await queryRunner.query( - `CREATE TABLE "organization_position" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a0409e39f23ff6d418f2c03df58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a8f497b1006ec967964abb0d497" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_position"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_position"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_position"`); - await queryRunner.query( - `CREATE INDEX "IDX_ce8721ddf715f0efa4bd3d2c5f" ON "organization_position" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7317abf7a05a169783b6aa7932" ON "organization_position" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a8f497b1006ec967964abb0d49" ON "organization_position" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a0409e39f23ff6d418f2c03df5" ON "organization_position" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3f02c20145af9997253531349c" ON "organization_position" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_6577ec9ca4cef331a507264d44"`); - await queryRunner.query(`DROP INDEX "IDX_b79e8d45a3ef5503579643f5de"`); - await queryRunner.query(`DROP INDEX "IDX_225e476592214e32e117a85213"`); - await queryRunner.query(`DROP INDEX "IDX_4513931e2d530f78d7144c8c7c"`); - await queryRunner.query(`DROP INDEX "IDX_020516e74a57cb85d75381e841"`); - await queryRunner.query(`ALTER TABLE "organization_language" RENAME TO "temporary_organization_language"`); - await queryRunner.query( - `CREATE TABLE "organization_language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "languageCode" varchar NOT NULL, "name" varchar NOT NULL, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_020516e74a57cb85d75381e841a" FOREIGN KEY ("languageCode") REFERENCES "language" ("code") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4513931e2d530f78d7144c8c7cd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_225e476592214e32e117a85213c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_language"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "languageCode", "name", "level", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_language"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_language"`); - await queryRunner.query( - `CREATE INDEX "IDX_6577ec9ca4cef331a507264d44" ON "organization_language" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b79e8d45a3ef5503579643f5de" ON "organization_language" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_225e476592214e32e117a85213" ON "organization_language" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4513931e2d530f78d7144c8c7c" ON "organization_language" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_020516e74a57cb85d75381e841" ON "organization_language" ("languageCode") ` - ); - await queryRunner.query(`DROP INDEX "IDX_cc096d49e2399e89cdf32297da"`); - await queryRunner.query(`DROP INDEX "IDX_880f3cce5e03f42bec3da6e6dc"`); - await queryRunner.query(`DROP INDEX "IDX_227b5bd9867287cbbeece8f6ba"`); - await queryRunner.query(`DROP INDEX "IDX_a583cfe32f492f5ba99b7bb205"`); - await queryRunner.query( - `ALTER TABLE "organization_employment_type" RENAME TO "temporary_organization_employment_type"` - ); - await queryRunner.query( - `CREATE TABLE "organization_employment_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a583cfe32f492f5ba99b7bb2050" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_227b5bd9867287cbbeece8f6ba9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_employment_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_employment_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_employment_type"`); - await queryRunner.query( - `CREATE INDEX "IDX_cc096d49e2399e89cdf32297da" ON "organization_employment_type" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_880f3cce5e03f42bec3da6e6dc" ON "organization_employment_type" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_227b5bd9867287cbbeece8f6ba" ON "organization_employment_type" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a583cfe32f492f5ba99b7bb205" ON "organization_employment_type" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_72c6a8ad9de5c04b2b689fd229"`); - await queryRunner.query(`DROP INDEX "IDX_e5edb48261db95f46c3b4d34a5"`); - await queryRunner.query(`DROP INDEX "IDX_1057ec001a4c6b258658143047"`); - await queryRunner.query(`DROP INDEX "IDX_4bc83945c022a862a33629ff1e"`); - await queryRunner.query(`DROP INDEX "IDX_c129dee7d1cb84e01e69b5e2c6"`); - await queryRunner.query(`ALTER TABLE "organization_document" RENAME TO "temporary_organization_document"`); - await queryRunner.query( - `CREATE TABLE "organization_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "documentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c129dee7d1cb84e01e69b5e2c66" FOREIGN KEY ("documentId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_4bc83945c022a862a33629ff1e1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1057ec001a4c6b258658143047a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "organization_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "documentId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_document"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_document"`); - await queryRunner.query( - `CREATE INDEX "IDX_72c6a8ad9de5c04b2b689fd229" ON "organization_document" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e5edb48261db95f46c3b4d34a5" ON "organization_document" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1057ec001a4c6b258658143047" ON "organization_document" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4bc83945c022a862a33629ff1e" ON "organization_document" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c129dee7d1cb84e01e69b5e2c6" ON "organization_document" ("documentId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b65059949804b20048b1c86c3d"`); - await queryRunner.query(`DROP INDEX "IDX_6139cd4c620e81aefd4895d370"`); - await queryRunner.query(`DROP INDEX "IDX_b3644ff7cd65239e29d292a41d"`); - await queryRunner.query(`DROP INDEX "IDX_c61a562a2379d1c0077fe7de33"`); - await queryRunner.query(`DROP INDEX "IDX_91b652409dc1fb2f712590dd21"`); - await queryRunner.query(`ALTER TABLE "organization_department" RENAME TO "temporary_organization_department"`); - await queryRunner.query( - `CREATE TABLE "organization_department" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c61a562a2379d1c0077fe7de332" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b3644ff7cd65239e29d292a41d1" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_department"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_department"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_department"`); - await queryRunner.query( - `CREATE INDEX "IDX_b65059949804b20048b1c86c3d" ON "organization_department" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6139cd4c620e81aefd4895d370" ON "organization_department" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b3644ff7cd65239e29d292a41d" ON "organization_department" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c61a562a2379d1c0077fe7de33" ON "organization_department" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_91b652409dc1fb2f712590dd21" ON "organization_department" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_f91783c7a8565c648b65635efc"`); - await queryRunner.query(`DROP INDEX "IDX_53627a383c9817dbf1164d7dc6"`); - await queryRunner.query(`DROP INDEX "IDX_e68c43e315ad3aaea4e99cf461"`); - await queryRunner.query(`DROP INDEX "IDX_6200736cb4d3617b004e5b647f"`); - await queryRunner.query(`DROP INDEX "IDX_de33f92e042365d196d959e774"`); - await queryRunner.query(`DROP INDEX "IDX_a86d2e378b953cb39261f457d2"`); - await queryRunner.query(`DROP INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd"`); - await queryRunner.query(`ALTER TABLE "organization_contact" RENAME TO "temporary_organization_contact"`); - await queryRunner.query( - `CREATE TABLE "organization_contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "primaryEmail" varchar, "primaryPhone" varchar, "inviteStatus" varchar, "notes" varchar, "contactType" varchar CHECK( "contactType" IN ('CLIENT','CUSTOMER','LEAD') ) NOT NULL DEFAULT ('CLIENT'), "imageUrl" varchar(500), "budget" integer, "budgetType" varchar CHECK( "budgetType" IN ('hours','cost') ) DEFAULT ('cost'), "createdBy" varchar, "contactId" varchar, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_a86d2e378b953cb39261f457d2" UNIQUE ("contactId"), CONSTRAINT "FK_8cfcdc6bc8fb55e273d9ace5fd5" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a86d2e378b953cb39261f457d26" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6200736cb4d3617b004e5b647ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_e68c43e315ad3aaea4e99cf461d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "primaryEmail", "primaryPhone", "inviteStatus", "notes", "contactType", "imageUrl", "budget", "budgetType", "createdBy", "contactId", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_contact"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_contact"`); - await queryRunner.query( - `CREATE INDEX "IDX_f91783c7a8565c648b65635efc" ON "organization_contact" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_53627a383c9817dbf1164d7dc6" ON "organization_contact" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e68c43e315ad3aaea4e99cf461" ON "organization_contact" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6200736cb4d3617b004e5b647f" ON "organization_contact" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_de33f92e042365d196d959e774" ON "organization_contact" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_a86d2e378b953cb39261f457d2" ON "organization_contact" ("contactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_8cfcdc6bc8fb55e273d9ace5fd" ON "organization_contact" ("imageId") `); - await queryRunner.query(`DROP INDEX "IDX_34c6749e2bc94b2e52e9572f32"`); - await queryRunner.query(`DROP INDEX "IDX_4062b5d54aa740aaff9a6c5fbb"`); - await queryRunner.query(`DROP INDEX "IDX_af6423760433da72002a7f369e"`); - await queryRunner.query(`DROP INDEX "IDX_2e0d21aab892b5993abaac09bc"`); - await queryRunner.query(`DROP INDEX "IDX_31626e7d39eb95b710d5a2d80f"`); - await queryRunner.query(`ALTER TABLE "organization_award" RENAME TO "temporary_organization_award"`); - await queryRunner.query( - `CREATE TABLE "organization_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2e0d21aab892b5993abaac09bcd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_af6423760433da72002a7f369eb" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "isActive", "isArchived", "deletedAt" FROM "temporary_organization_award"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_award"`); - await queryRunner.query( - `CREATE INDEX "IDX_34c6749e2bc94b2e52e9572f32" ON "organization_award" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_4062b5d54aa740aaff9a6c5fbb" ON "organization_award" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_af6423760433da72002a7f369e" ON "organization_award" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_2e0d21aab892b5993abaac09bc" ON "organization_award" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_31626e7d39eb95b710d5a2d80f" ON "organization_award" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_0a0f972564e74c9c4905e3abcb"`); - await queryRunner.query(`DROP INDEX "IDX_a03be8a86e528e2720504a041f"`); - await queryRunner.query(`DROP INDEX "IDX_533144d7ae94180235ea456625"`); - await queryRunner.query(`DROP INDEX "IDX_d306a524b507f72fa8550aeffe"`); - await queryRunner.query(`DROP INDEX "IDX_e03ddff05652be527e04abdc56"`); - await queryRunner.query(`DROP INDEX "IDX_20acc3c3a6c900c6ef9fc68199"`); - await queryRunner.query(`ALTER TABLE "merchant" RENAME TO "temporary_merchant"`); - await queryRunner.query( - `CREATE TABLE "merchant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "code" varchar NOT NULL, "email" varchar NOT NULL, "phone" varchar, "description" varchar, "active" boolean NOT NULL DEFAULT (1), "currency" varchar NOT NULL DEFAULT ('USD'), "contactId" varchar, "logoId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_e03ddff05652be527e04abdc56" UNIQUE ("contactId"), CONSTRAINT "FK_20acc3c3a6c900c6ef9fc681996" FOREIGN KEY ("logoId") REFERENCES "image_asset" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e03ddff05652be527e04abdc56f" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d306a524b507f72fa8550aeffe4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_533144d7ae94180235ea456625b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "merchant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "code", "email", "phone", "description", "active", "currency", "contactId", "logoId", "isActive", "isArchived", "deletedAt" FROM "temporary_merchant"` - ); - await queryRunner.query(`DROP TABLE "temporary_merchant"`); - await queryRunner.query(`CREATE INDEX "IDX_0a0f972564e74c9c4905e3abcb" ON "merchant" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_a03be8a86e528e2720504a041f" ON "merchant" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_533144d7ae94180235ea456625" ON "merchant" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d306a524b507f72fa8550aeffe" ON "merchant" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_e03ddff05652be527e04abdc56" ON "merchant" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_20acc3c3a6c900c6ef9fc68199" ON "merchant" ("logoId") `); - await queryRunner.query(`DROP INDEX "IDX_15fcb8179bc7b0642ca78da69e"`); - await queryRunner.query(`DROP INDEX "IDX_3a7abee35dfa3c90ed491583eb"`); - await queryRunner.query(`ALTER TABLE "language" RENAME TO "temporary_language"`); - await queryRunner.query( - `CREATE TABLE "language" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar, "is_system" boolean DEFAULT (1), "description" varchar, "color" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))` - ); - await queryRunner.query( - `INSERT INTO "language"("id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "is_system", "description", "color", "isActive", "isArchived", "deletedAt" FROM "temporary_language"` - ); - await queryRunner.query(`DROP TABLE "temporary_language"`); - await queryRunner.query(`CREATE INDEX "IDX_15fcb8179bc7b0642ca78da69e" ON "language" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_3a7abee35dfa3c90ed491583eb" ON "language" ("isActive") `); - await queryRunner.query(`DROP INDEX "IDX_8889e2618366faefa575a8049b"`); - await queryRunner.query(`DROP INDEX "IDX_9b62dd2dddcde032f46a981733"`); - await queryRunner.query(`DROP INDEX "IDX_8ac2c6b487d03157adda874789"`); - await queryRunner.query(`DROP INDEX "IDX_d1f45ca98f17bd84a5e430feaf"`); - await queryRunner.query(`DROP INDEX "IDX_5880347716f9ec5056ec15112c"`); - await queryRunner.query(`DROP INDEX "IDX_c89adeff0de3aedb2e772a5bf4"`); - await queryRunner.query(`DROP INDEX "IDX_38dc003f3484eff4b59918e9ae"`); - await queryRunner.query(`DROP INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a"`); - await queryRunner.query(`DROP INDEX "IDX_4e1e975124c1d717814a4bb2ec"`); - await queryRunner.query(`DROP INDEX "IDX_3e1d08761a717c1dd71fe67249"`); - await queryRunner.query(`ALTER TABLE "key_result" RENAME TO "temporary_key_result"`); - await queryRunner.query( - `CREATE TABLE "key_result" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "type" varchar NOT NULL, "targetValue" integer, "initialValue" integer, "unit" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "deadline" varchar NOT NULL, "hardDeadline" datetime, "softDeadline" datetime, "status" varchar NOT NULL, "weight" varchar, "ownerId" varchar NOT NULL, "leadId" varchar, "projectId" varchar, "taskId" varchar, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3e1d08761a717c1dd71fe67249b" FOREIGN KEY ("goalId") REFERENCES "goal" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4e1e975124c1d717814a4bb2ec8" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d8547e21ccb8e37ac9f0d69c1af" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38dc003f3484eff4b59918e9ae3" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_c89adeff0de3aedb2e772a5bf4c" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_5880347716f9ec5056ec15112cc" FOREIGN KEY ("ownerId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_d1f45ca98f17bd84a5e430feaf4" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8ac2c6b487d03157adda874789f" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "key_result"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "targetValue", "initialValue", "unit", "update", "progress", "deadline", "hardDeadline", "softDeadline", "status", "weight", "ownerId", "leadId", "projectId", "taskId", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result"` - ); - await queryRunner.query(`DROP TABLE "temporary_key_result"`); - await queryRunner.query(`CREATE INDEX "IDX_8889e2618366faefa575a8049b" ON "key_result" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_9b62dd2dddcde032f46a981733" ON "key_result" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8ac2c6b487d03157adda874789" ON "key_result" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_d1f45ca98f17bd84a5e430feaf" ON "key_result" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_5880347716f9ec5056ec15112c" ON "key_result" ("ownerId") `); - await queryRunner.query(`CREATE INDEX "IDX_c89adeff0de3aedb2e772a5bf4" ON "key_result" ("leadId") `); - await queryRunner.query(`CREATE INDEX "IDX_38dc003f3484eff4b59918e9ae" ON "key_result" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_d8547e21ccb8e37ac9f0d69c1a" ON "key_result" ("taskId") `); - await queryRunner.query(`CREATE INDEX "IDX_4e1e975124c1d717814a4bb2ec" ON "key_result" ("kpiId") `); - await queryRunner.query(`CREATE INDEX "IDX_3e1d08761a717c1dd71fe67249" ON "key_result" ("goalId") `); - await queryRunner.query(`DROP INDEX "IDX_94aad97b26aede6545a3226fb3"`); - await queryRunner.query(`DROP INDEX "IDX_12b8b54f416ec9f5ec002f0a83"`); - await queryRunner.query(`DROP INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65"`); - await queryRunner.query(`DROP INDEX "IDX_fd4b0cb7a44ed914acdda55e29"`); - await queryRunner.query(`ALTER TABLE "key_result_update" RENAME TO "temporary_key_result_update"`); - await queryRunner.query( - `CREATE TABLE "key_result_update" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "update" integer NOT NULL, "progress" integer NOT NULL, "owner" varchar NOT NULL, "status" varchar NOT NULL, "keyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7497a70a581e5f56f792015dd37" FOREIGN KEY ("keyResultId") REFERENCES "key_result" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fd4b0cb7a44ed914acdda55e29c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cd9cbc0d5b6d62dbb63c3b3a65b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "key_result_update"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "update", "progress", "owner", "status", "keyResultId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result_update"` - ); - await queryRunner.query(`DROP TABLE "temporary_key_result_update"`); - await queryRunner.query(`CREATE INDEX "IDX_94aad97b26aede6545a3226fb3" ON "key_result_update" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_12b8b54f416ec9f5ec002f0a83" ON "key_result_update" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_cd9cbc0d5b6d62dbb63c3b3a65" ON "key_result_update" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_fd4b0cb7a44ed914acdda55e29" ON "key_result_update" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_aa0e9b0cfcba1926925b025512"`); - await queryRunner.query(`DROP INDEX "IDX_f4e813d72dc732f16497ee2c52"`); - await queryRunner.query(`DROP INDEX "IDX_86c09eb673b0e66129dbdc7211"`); - await queryRunner.query(`DROP INDEX "IDX_fab6b6200b9ed6fd002c1ff62a"`); - await queryRunner.query(`DROP INDEX "IDX_46426ea45456e240a092b73204"`); - await queryRunner.query(`ALTER TABLE "key_result_template" RENAME TO "temporary_key_result_template"`); - await queryRunner.query( - `CREATE TABLE "key_result_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "unit" varchar, "targetValue" integer, "initialValue" integer, "deadline" varchar NOT NULL, "kpiId" varchar, "goalId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_46426ea45456e240a092b732047" FOREIGN KEY ("goalId") REFERENCES "goal_template" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4bc62c3d2ffdd6f9c7f8b3dcd1c" FOREIGN KEY ("kpiId") REFERENCES "goal_kpi_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_fab6b6200b9ed6fd002c1ff62ab" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_86c09eb673b0e66129dbdc72111" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "key_result_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "unit", "targetValue", "initialValue", "deadline", "kpiId", "goalId", "isActive", "isArchived", "deletedAt" FROM "temporary_key_result_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_key_result_template"`); - await queryRunner.query( - `CREATE INDEX "IDX_aa0e9b0cfcba1926925b025512" ON "key_result_template" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_f4e813d72dc732f16497ee2c52" ON "key_result_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_86c09eb673b0e66129dbdc7211" ON "key_result_template" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_fab6b6200b9ed6fd002c1ff62a" ON "key_result_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_46426ea45456e240a092b73204" ON "key_result_template" ("goalId") `); - await queryRunner.query(`DROP INDEX "IDX_eabacf7474d75e53d7b7046f3e"`); - await queryRunner.query(`DROP INDEX "IDX_850ca385c1985c1808cd4ea241"`); - await queryRunner.query(`DROP INDEX "IDX_7fb52a5f267f53b7d93af3d8c3"`); - await queryRunner.query(`DROP INDEX "IDX_058ef835f99e28fc6717cd7c80"`); - await queryRunner.query(`DROP INDEX "IDX_b5c33892e630b66c65d623baf8"`); - await queryRunner.query(`DROP INDEX "IDX_d9e965da0f63c94983d3a1006a"`); - await queryRunner.query(`ALTER TABLE "invoice" RENAME TO "temporary_invoice"`); - await queryRunner.query( - `CREATE TABLE "invoice" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "invoiceDate" datetime, "invoiceNumber" numeric, "dueDate" datetime, "currency" varchar NOT NULL, "discountValue" numeric NOT NULL, "paid" boolean, "tax" numeric, "tax2" numeric, "terms" varchar NOT NULL, "totalValue" numeric, "status" varchar NOT NULL, "isEstimate" boolean, "isAccepted" boolean, "discountType" varchar, "taxType" varchar, "tax2Type" varchar, "invoiceType" varchar, "sentTo" varchar, "organizationContactId" varchar, "internalNote" varchar, "alreadyPaid" numeric, "amountDue" numeric, "hasRemainingAmountInvoiced" boolean, "token" varchar, "isArchived" boolean DEFAULT (0), "fromOrganizationId" varchar NOT NULL, "toContactId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "UQ_d7bed97fb47876e03fd7d7c285a" UNIQUE ("invoiceNumber"), CONSTRAINT "FK_d9e965da0f63c94983d3a1006ac" FOREIGN KEY ("toContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_b5c33892e630b66c65d623baf8e" FOREIGN KEY ("fromOrganizationId") REFERENCES "organization" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_058ef835f99e28fc6717cd7c80f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7fb52a5f267f53b7d93af3d8c3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "invoice"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "invoiceDate", "invoiceNumber", "dueDate", "currency", "discountValue", "paid", "tax", "tax2", "terms", "totalValue", "status", "isEstimate", "isAccepted", "discountType", "taxType", "tax2Type", "invoiceType", "sentTo", "organizationContactId", "internalNote", "alreadyPaid", "amountDue", "hasRemainingAmountInvoiced", "token", "isArchived", "fromOrganizationId", "toContactId", "isActive", "deletedAt" FROM "temporary_invoice"` - ); - await queryRunner.query(`DROP TABLE "temporary_invoice"`); - await queryRunner.query(`CREATE INDEX "IDX_eabacf7474d75e53d7b7046f3e" ON "invoice" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_850ca385c1985c1808cd4ea241" ON "invoice" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_7fb52a5f267f53b7d93af3d8c3" ON "invoice" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_058ef835f99e28fc6717cd7c80" ON "invoice" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_b5c33892e630b66c65d623baf8" ON "invoice" ("fromOrganizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_d9e965da0f63c94983d3a1006a" ON "invoice" ("toContactId") `); - await queryRunner.query(`DROP INDEX "IDX_b7da14d2b61cf1dd5c65188b9c"`); - await queryRunner.query(`DROP INDEX "IDX_e2835fd8776ae5d56d892e087e"`); - await queryRunner.query(`DROP INDEX "IDX_f78214cd9de76e80fe8a6305f5"`); - await queryRunner.query(`DROP INDEX "IDX_e89749c8e8258b2ec110c0776f"`); - await queryRunner.query(`ALTER TABLE "invoice_item" RENAME TO "temporary_invoice_item"`); - await queryRunner.query( - `CREATE TABLE "invoice_item" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "price" numeric NOT NULL, "quantity" numeric NOT NULL, "totalValue" numeric NOT NULL, "applyTax" boolean, "applyDiscount" boolean, "expenseId" varchar, "invoiceId" varchar, "taskId" varchar, "employeeId" varchar, "projectId" varchar, "productId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e558df60d7d9a3e412ef0bbb844" FOREIGN KEY ("productId") REFERENCES "product" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16f1d0e74b4d33e59c0eabdaac7" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_d4d92abde074b3da8054d7cfbc7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_62d486728b272e3b4d23a6b5db6" FOREIGN KEY ("taskId") REFERENCES "task" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_553d5aac210d22fdca5c8d48ead" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_897c33b49a04cf3db7acd336afc" FOREIGN KEY ("expenseId") REFERENCES "expense" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_e89749c8e8258b2ec110c0776ff" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f78214cd9de76e80fe8a6305f52" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "invoice_item"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "price", "quantity", "totalValue", "applyTax", "applyDiscount", "expenseId", "invoiceId", "taskId", "employeeId", "projectId", "productId", "isActive", "isArchived", "deletedAt" FROM "temporary_invoice_item"` - ); - await queryRunner.query(`DROP TABLE "temporary_invoice_item"`); - await queryRunner.query(`CREATE INDEX "IDX_b7da14d2b61cf1dd5c65188b9c" ON "invoice_item" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e2835fd8776ae5d56d892e087e" ON "invoice_item" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f78214cd9de76e80fe8a6305f5" ON "invoice_item" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e89749c8e8258b2ec110c0776f" ON "invoice_item" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_cc0ac824ba89deda98bb418e8c"`); - await queryRunner.query(`DROP INDEX "IDX_856f24297f120604f8ae294276"`); - await queryRunner.query(`DROP INDEX "IDX_da2893697d57368470952a76f6"`); - await queryRunner.query(`DROP INDEX "IDX_31ec3d5a6b0985cec544c64217"`); - await queryRunner.query(`DROP INDEX "IDX_483eb296a94d821ebedb375858"`); - await queryRunner.query(`DROP INDEX "IDX_8106063f79cce8e67790d79092"`); - await queryRunner.query( - `ALTER TABLE "invoice_estimate_history" RENAME TO "temporary_invoice_estimate_history"` - ); - await queryRunner.query( - `CREATE TABLE "invoice_estimate_history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "action" varchar NOT NULL, "userId" varchar, "invoiceId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "title" varchar, "deletedAt" datetime, CONSTRAINT "FK_cc0ac824ba89deda98bb418e8ca" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_856f24297f120604f8ae2942769" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_da2893697d57368470952a76f65" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_31ec3d5a6b0985cec544c642178" FOREIGN KEY ("invoiceId") REFERENCES "invoice" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "invoice_estimate_history"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "action", "userId", "invoiceId", "isActive", "isArchived", "title", "deletedAt" FROM "temporary_invoice_estimate_history"` - ); - await queryRunner.query(`DROP TABLE "temporary_invoice_estimate_history"`); - await queryRunner.query( - `CREATE INDEX "IDX_cc0ac824ba89deda98bb418e8c" ON "invoice_estimate_history" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_856f24297f120604f8ae294276" ON "invoice_estimate_history" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_da2893697d57368470952a76f6" ON "invoice_estimate_history" ("userId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_31ec3d5a6b0985cec544c64217" ON "invoice_estimate_history" ("invoiceId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_483eb296a94d821ebedb375858" ON "invoice_estimate_history" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8106063f79cce8e67790d79092" ON "invoice_estimate_history" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3cef860504647ccd52d39d7dc2"`); - await queryRunner.query(`DROP INDEX "IDX_bd44bcb10034bc0c5fe4427b3e"`); - await queryRunner.query(`DROP INDEX "IDX_91bfeec7a9574f458e5b592472"`); - await queryRunner.query(`DROP INDEX "IDX_900a3ed40499c79c1c289fec28"`); - await queryRunner.query(`DROP INDEX "IDX_5a182e8b3e225b14ddf6df7e6c"`); - await queryRunner.query(`DROP INDEX "IDX_68eef4ab86b67747f24f288a16"`); - await queryRunner.query(`DROP INDEX "IDX_7c2328f76efb850b8114797247"`); - await queryRunner.query(`ALTER TABLE "invite" RENAME TO "temporary_invite"`); - await queryRunner.query( - `CREATE TABLE "invite" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "status" varchar NOT NULL, "expireDate" datetime, "actionDate" datetime, "invitedById" varchar, "roleId" varchar, "code" varchar, "fullName" varchar, "userId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_7c2328f76efb850b81147972476" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_68eef4ab86b67747f24f288a16c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5a182e8b3e225b14ddf6df7e6c3" FOREIGN KEY ("invitedById") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_900a3ed40499c79c1c289fec284" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_91bfeec7a9574f458e5b592472d" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "invite"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "status", "expireDate", "actionDate", "invitedById", "roleId", "code", "fullName", "userId", "isActive", "isArchived", "deletedAt" FROM "temporary_invite"` - ); - await queryRunner.query(`DROP TABLE "temporary_invite"`); - await queryRunner.query(`CREATE INDEX "IDX_3cef860504647ccd52d39d7dc2" ON "invite" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_bd44bcb10034bc0c5fe4427b3e" ON "invite" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_91bfeec7a9574f458e5b592472" ON "invite" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_900a3ed40499c79c1c289fec28" ON "invite" ("roleId") `); - await queryRunner.query(`CREATE INDEX "IDX_5a182e8b3e225b14ddf6df7e6c" ON "invite" ("invitedById") `); - await queryRunner.query(`CREATE INDEX "IDX_68eef4ab86b67747f24f288a16" ON "invite" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_7c2328f76efb850b8114797247" ON "invite" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_85d7b0f07f3e3707b4586670a9"`); - await queryRunner.query(`DROP INDEX "IDX_24981cd300007cf88601c2d616"`); - await queryRunner.query(`ALTER TABLE "integration" RENAME TO "temporary_integration"`); - await queryRunner.query( - `CREATE TABLE "integration" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "imgSrc" varchar, "isComingSoon" boolean NOT NULL DEFAULT (0), "isPaid" boolean NOT NULL DEFAULT (0), "version" varchar, "docUrl" varchar, "isFreeTrial" boolean NOT NULL DEFAULT (0), "freeTrialPeriod" numeric DEFAULT (0), "order" integer, "provider" varchar, "redirectUrl" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_938c19d92ad3f290ff5fc163531" UNIQUE ("name"))` - ); - await queryRunner.query( - `INSERT INTO "integration"("id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "imgSrc", "isComingSoon", "isPaid", "version", "docUrl", "isFreeTrial", "freeTrialPeriod", "order", "provider", "redirectUrl", "isActive", "isArchived", "deletedAt" FROM "temporary_integration"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration"`); - await queryRunner.query(`CREATE INDEX "IDX_85d7b0f07f3e3707b4586670a9" ON "integration" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_24981cd300007cf88601c2d616" ON "integration" ("isActive") `); - await queryRunner.query(`DROP INDEX "IDX_e7b65ef60492b1c34007736f99"`); - await queryRunner.query(`DROP INDEX "IDX_34a49d941459e1031c766b941f"`); - await queryRunner.query(`ALTER TABLE "integration_type" RENAME TO "temporary_integration_type"`); - await queryRunner.query( - `CREATE TABLE "integration_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "groupName" varchar NOT NULL, "order" integer NOT NULL, "description" varchar, "icon" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "UQ_be0d67f4df84f036fab2ed89c47" UNIQUE ("name"))` - ); - await queryRunner.query( - `INSERT INTO "integration_type"("id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "groupName", "order", "description", "icon", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_type"`); - await queryRunner.query(`CREATE INDEX "IDX_e7b65ef60492b1c34007736f99" ON "integration_type" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_34a49d941459e1031c766b941f" ON "integration_type" ("isActive") `); - await queryRunner.query(`DROP INDEX "IDX_d0532ed8020981736b58748de6"`); - await queryRunner.query(`DROP INDEX "IDX_0d6ddc27d687ca879042c5f3ce"`); - await queryRunner.query(`DROP INDEX "IDX_24e37d03ef224f1a16a35069c2"`); - await queryRunner.query(`DROP INDEX "IDX_33ab224e7755a46fff5bc1e64e"`); - await queryRunner.query(`DROP INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46"`); - await queryRunner.query(`DROP INDEX "IDX_5487f9197c106d774bae20991c"`); - await queryRunner.query(`ALTER TABLE "integration_tenant" RENAME TO "temporary_integration_tenant"`); - await queryRunner.query( - `CREATE TABLE "integration_tenant" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "integrationId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "lastSyncedAt" datetime DEFAULT (CURRENT_TIMESTAMP), "deletedAt" datetime, CONSTRAINT "FK_33ab224e7755a46fff5bc1e64e5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_24e37d03ef224f1a16a35069c2c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0d6ddc27d687ca879042c5f3ce3" FOREIGN KEY ("integrationId") REFERENCES "integration" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "integration_tenant"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "integrationId", "isActive", "isArchived", "lastSyncedAt", "deletedAt" FROM "temporary_integration_tenant"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_tenant"`); - await queryRunner.query( - `CREATE INDEX "IDX_d0532ed8020981736b58748de6" ON "integration_tenant" ("lastSyncedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0d6ddc27d687ca879042c5f3ce" ON "integration_tenant" ("integrationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_24e37d03ef224f1a16a35069c2" ON "integration_tenant" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_33ab224e7755a46fff5bc1e64e" ON "integration_tenant" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c5ff5d3ab364b7da72bf3fbb46" ON "integration_tenant" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_5487f9197c106d774bae20991c" ON "integration_tenant" ("isArchived") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f515574f1251562c52fe25b6a3"`); - await queryRunner.query(`DROP INDEX "IDX_97c0d54aae21ccdbb5c3581642"`); - await queryRunner.query(`DROP INDEX "IDX_954c6b05297814776d9cb66ca7"`); - await queryRunner.query(`DROP INDEX "IDX_369eaafb13afe9903a170077ed"`); - await queryRunner.query(`DROP INDEX "IDX_34daf030004ad37b88f1f3d863"`); - await queryRunner.query(`ALTER TABLE "integration_setting" RENAME TO "temporary_integration_setting"`); - await queryRunner.query( - `CREATE TABLE "integration_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "settingsName" varchar NOT NULL, "settingsValue" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_34daf030004ad37b88f1f3d863c" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_369eaafb13afe9903a170077edb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_954c6b05297814776d9cb66ca77" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "integration_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "settingsName", "settingsValue", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_f515574f1251562c52fe25b6a3" ON "integration_setting" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_97c0d54aae21ccdbb5c3581642" ON "integration_setting" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_954c6b05297814776d9cb66ca7" ON "integration_setting" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_369eaafb13afe9903a170077ed" ON "integration_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_34daf030004ad37b88f1f3d863" ON "integration_setting" ("integrationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_e63f4791631e7572ca213ac4a4"`); - await queryRunner.query(`DROP INDEX "IDX_c79464c4ccf7e5195d69675c15"`); - await queryRunner.query(`DROP INDEX "IDX_c327ea26bda3d349a1eceb5658"`); - await queryRunner.query(`DROP INDEX "IDX_7022dafd72c1b92f7d50691441"`); - await queryRunner.query(`DROP INDEX "IDX_eec3d6064578610ddc609dd360"`); - await queryRunner.query(`ALTER TABLE "integration_map" RENAME TO "temporary_integration_map"`); - await queryRunner.query( - `CREATE TABLE "integration_map" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sourceId" varchar NOT NULL, "gauzyId" varchar NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c327ea26bda3d349a1eceb5658e" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_eec3d6064578610ddc609dd360e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7022dafd72c1b92f7d506914411" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "integration_map"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sourceId", "gauzyId", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_map"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_map"`); - await queryRunner.query(`CREATE INDEX "IDX_e63f4791631e7572ca213ac4a4" ON "integration_map" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_c79464c4ccf7e5195d69675c15" ON "integration_map" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_c327ea26bda3d349a1eceb5658" ON "integration_map" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7022dafd72c1b92f7d50691441" ON "integration_map" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_eec3d6064578610ddc609dd360" ON "integration_map" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_1c653ebceca3b9c8766131db91"`); - await queryRunner.query(`DROP INDEX "IDX_e3d407c5532edaceaa4df34623"`); - await queryRunner.query(`DROP INDEX "IDX_f80ff4ebbf0b33a67dce598911"`); - await queryRunner.query(`DROP INDEX "IDX_c6c01e38eebd8b26b9214b9044"`); - await queryRunner.query(`DROP INDEX "IDX_23e9cfcf1bfff07dcc3254378d"`); - await queryRunner.query( - `ALTER TABLE "integration_entity_setting" RENAME TO "temporary_integration_entity_setting"` - ); - await queryRunner.query( - `CREATE TABLE "integration_entity_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f80ff4ebbf0b33a67dce5989117" FOREIGN KEY ("integrationId") REFERENCES "integration_tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_23e9cfcf1bfff07dcc3254378df" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6c01e38eebd8b26b9214b90441" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "integration_entity_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_entity_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_entity_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_1c653ebceca3b9c8766131db91" ON "integration_entity_setting" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e3d407c5532edaceaa4df34623" ON "integration_entity_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f80ff4ebbf0b33a67dce598911" ON "integration_entity_setting" ("integrationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c6c01e38eebd8b26b9214b9044" ON "integration_entity_setting" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_23e9cfcf1bfff07dcc3254378d" ON "integration_entity_setting" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_101cd83aa75949cfb5b8eec084"`); - await queryRunner.query(`DROP INDEX "IDX_6d43cc33c80221dbe4854b38e6"`); - await queryRunner.query(`DROP INDEX "IDX_3fb863167095805e33f38a0fdc"`); - await queryRunner.query(`DROP INDEX "IDX_d5ac36aa3d5919908414154fca"`); - await queryRunner.query(`DROP INDEX "IDX_b208a754c7a538cb3422f39f5b"`); - await queryRunner.query( - `ALTER TABLE "integration_entity_setting_tied" RENAME TO "temporary_integration_entity_setting_tied"` - ); - await queryRunner.query( - `CREATE TABLE "integration_entity_setting_tied" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "entity" varchar NOT NULL, "sync" boolean NOT NULL, "integrationEntitySettingId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3fb863167095805e33f38a0fdcc" FOREIGN KEY ("integrationEntitySettingId") REFERENCES "integration_entity_setting" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b208a754c7a538cb3422f39f5b9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d5ac36aa3d5919908414154fca0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "integration_entity_setting_tied"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "entity", "sync", "integrationEntitySettingId", "isActive", "isArchived", "deletedAt" FROM "temporary_integration_entity_setting_tied"` - ); - await queryRunner.query(`DROP TABLE "temporary_integration_entity_setting_tied"`); - await queryRunner.query( - `CREATE INDEX "IDX_101cd83aa75949cfb5b8eec084" ON "integration_entity_setting_tied" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6d43cc33c80221dbe4854b38e6" ON "integration_entity_setting_tied" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3fb863167095805e33f38a0fdc" ON "integration_entity_setting_tied" ("integrationEntitySettingId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d5ac36aa3d5919908414154fca" ON "integration_entity_setting_tied" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b208a754c7a538cb3422f39f5b" ON "integration_entity_setting_tied" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_aedb8b1d10c498309bed9edf53"`); - await queryRunner.query(`DROP INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb"`); - await queryRunner.query(`DROP INDEX "IDX_8608b275644cfc7a0f3f585081"`); - await queryRunner.query(`DROP INDEX "IDX_64409de4711cd14e2c43371cc0"`); - await queryRunner.query(`DROP INDEX "IDX_bd39a647a2843177723ddf733e"`); - await queryRunner.query(`DROP INDEX "IDX_86b5a121b3775a1b0b7fa75680"`); - await queryRunner.query(`DROP INDEX "IDX_20207d9f915066dfbc2210bcf1"`); - await queryRunner.query(`DROP INDEX "IDX_a05d52b7ffe89140f9cbcf114b"`); - await queryRunner.query(`DROP INDEX "IDX_29fbd3a17710a27e6f856072c0"`); - await queryRunner.query(`ALTER TABLE "income" RENAME TO "temporary_income"`); - await queryRunner.query( - `CREATE TABLE "income" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "currency" varchar NOT NULL, "valueDate" datetime, "notes" varchar, "isBonus" boolean, "reference" varchar, "employeeId" varchar, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_29fbd3a17710a27e6f856072c01" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_a05d52b7ffe89140f9cbcf114b3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_64409de4711cd14e2c43371cc02" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8608b275644cfc7a0f3f5850814" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "income"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "currency", "valueDate", "notes", "isBonus", "reference", "employeeId", "clientId", "isActive", "isArchived", "deletedAt" FROM "temporary_income"` - ); - await queryRunner.query(`DROP TABLE "temporary_income"`); - await queryRunner.query(`CREATE INDEX "IDX_aedb8b1d10c498309bed9edf53" ON "income" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_904ab9ee6ac5e74bf3616c8ccb" ON "income" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8608b275644cfc7a0f3f585081" ON "income" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_64409de4711cd14e2c43371cc0" ON "income" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_bd39a647a2843177723ddf733e" ON "income" ("amount") `); - await queryRunner.query(`CREATE INDEX "IDX_86b5a121b3775a1b0b7fa75680" ON "income" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_20207d9f915066dfbc2210bcf1" ON "income" ("notes") `); - await queryRunner.query(`CREATE INDEX "IDX_a05d52b7ffe89140f9cbcf114b" ON "income" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_29fbd3a17710a27e6f856072c0" ON "income" ("clientId") `); - await queryRunner.query(`DROP INDEX "IDX_af1a212cb378bb0eed51c1b2bc"`); - await queryRunner.query(`DROP INDEX "IDX_9d44ce9eb8689e578b941a6a54"`); - await queryRunner.query(`DROP INDEX "IDX_d3675304df9971cccf96d9a7c3"`); - await queryRunner.query(`DROP INDEX "IDX_01856a9a730b7e79d70aa661cb"`); - await queryRunner.query(`ALTER TABLE "image_asset" RENAME TO "temporary_image_asset"`); - await queryRunner.query( - `CREATE TABLE "image_asset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "url" varchar NOT NULL, "width" integer NOT NULL DEFAULT (0), "height" integer NOT NULL DEFAULT (0), "isFeatured" boolean NOT NULL DEFAULT (0), "thumb" varchar, "size" numeric, "externalProviderId" varchar, "storageProvider" varchar CHECK( "storageProvider" IN ('LOCAL','S3','WASABI','CLOUDINARY','DIGITALOCEAN') ), "deletedAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), CONSTRAINT "FK_01856a9a730b7e79d70aa661cb0" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d3675304df9971cccf96d9a7c34" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "image_asset"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "url", "width", "height", "isFeatured", "thumb", "size", "externalProviderId", "storageProvider", "deletedAt", "isActive", "isArchived" FROM "temporary_image_asset"` - ); - await queryRunner.query(`DROP TABLE "temporary_image_asset"`); - await queryRunner.query(`CREATE INDEX "IDX_af1a212cb378bb0eed51c1b2bc" ON "image_asset" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_9d44ce9eb8689e578b941a6a54" ON "image_asset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d3675304df9971cccf96d9a7c3" ON "image_asset" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_01856a9a730b7e79d70aa661cb" ON "image_asset" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_4a2c00a44350a063d75be80ba9"`); - await queryRunner.query(`DROP INDEX "IDX_72641ffde44e1a1627aa2d040f"`); - await queryRunner.query(`DROP INDEX "IDX_6b4758a5442713070c9a366d0e"`); - await queryRunner.query(`DROP INDEX "IDX_c6e8ae55a4db3584686cbf6afe"`); - await queryRunner.query(`DROP INDEX "IDX_ac161c1a0c0ff8e83554f097e5"`); - await queryRunner.query(`DROP INDEX "IDX_35526ff1063ab5fa2b20e71bd6"`); - await queryRunner.query(`DROP INDEX "IDX_af0a11734e70412b742ac339c8"`); - await queryRunner.query(`DROP INDEX "IDX_4c8b4e887a994182fd6132e640"`); - await queryRunner.query(`ALTER TABLE "goal" RENAME TO "temporary_goal"`); - await queryRunner.query( - `CREATE TABLE "goal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar NOT NULL, "deadline" varchar NOT NULL, "level" varchar NOT NULL, "progress" integer NOT NULL, "ownerTeamId" varchar, "ownerEmployeeId" varchar, "leadId" varchar, "alignedKeyResultId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_4c8b4e887a994182fd6132e6400" FOREIGN KEY ("alignedKeyResultId") REFERENCES "key_result" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_af0a11734e70412b742ac339c88" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_35526ff1063ab5fa2b20e71bd66" FOREIGN KEY ("ownerEmployeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ac161c1a0c0ff8e83554f097e5e" FOREIGN KEY ("ownerTeamId") REFERENCES "organization_team" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6e8ae55a4db3584686cbf6afe1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b4758a5442713070c9a366d0e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "deadline", "level", "progress", "ownerTeamId", "ownerEmployeeId", "leadId", "alignedKeyResultId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal"`); - await queryRunner.query(`CREATE INDEX "IDX_4a2c00a44350a063d75be80ba9" ON "goal" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_72641ffde44e1a1627aa2d040f" ON "goal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6b4758a5442713070c9a366d0e" ON "goal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_c6e8ae55a4db3584686cbf6afe" ON "goal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_ac161c1a0c0ff8e83554f097e5" ON "goal" ("ownerTeamId") `); - await queryRunner.query(`CREATE INDEX "IDX_35526ff1063ab5fa2b20e71bd6" ON "goal" ("ownerEmployeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_af0a11734e70412b742ac339c8" ON "goal" ("leadId") `); - await queryRunner.query(`CREATE INDEX "IDX_4c8b4e887a994182fd6132e640" ON "goal" ("alignedKeyResultId") `); - await queryRunner.query(`DROP INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2"`); - await queryRunner.query(`DROP INDEX "IDX_646565982726362cc2ca4fb807"`); - await queryRunner.query(`DROP INDEX "IDX_b56723b53a76ca1c171890c479"`); - await queryRunner.query(`DROP INDEX "IDX_405bc5bba9ed71aefef84a29f1"`); - await queryRunner.query(`ALTER TABLE "goal_time_frame" RENAME TO "temporary_goal_time_frame"`); - await queryRunner.query( - `CREATE TABLE "goal_time_frame" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "status" varchar NOT NULL, "startDate" datetime NOT NULL, "endDate" datetime NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_405bc5bba9ed71aefef84a29f10" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b56723b53a76ca1c171890c479b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal_time_frame"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "status", "startDate", "endDate", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_time_frame"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal_time_frame"`); - await queryRunner.query(`CREATE INDEX "IDX_ef4ec26ca3a7e0d8c9e1748be2" ON "goal_time_frame" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_646565982726362cc2ca4fb807" ON "goal_time_frame" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_b56723b53a76ca1c171890c479" ON "goal_time_frame" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_405bc5bba9ed71aefef84a29f1" ON "goal_time_frame" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_056e869152a335f88c38c5b693"`); - await queryRunner.query(`DROP INDEX "IDX_cd91c5925942061527b1bc112c"`); - await queryRunner.query(`DROP INDEX "IDX_774bf82989475befe301fe1bca"`); - await queryRunner.query(`DROP INDEX "IDX_5708fe06608c72fc77b65ae651"`); - await queryRunner.query(`ALTER TABLE "goal_template" RENAME TO "temporary_goal_template"`); - await queryRunner.query( - `CREATE TABLE "goal_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "level" varchar NOT NULL, "category" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_5708fe06608c72fc77b65ae6519" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_774bf82989475befe301fe1bca5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "level", "category", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal_template"`); - await queryRunner.query(`CREATE INDEX "IDX_056e869152a335f88c38c5b693" ON "goal_template" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_cd91c5925942061527b1bc112c" ON "goal_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_774bf82989475befe301fe1bca" ON "goal_template" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_5708fe06608c72fc77b65ae651" ON "goal_template" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_a96c22c51607f878c8a98bc488"`); - await queryRunner.query(`DROP INDEX "IDX_cfc393bd9835d8259e73019226"`); - await queryRunner.query(`DROP INDEX "IDX_43aa2985216560cd9fa93f501e"`); - await queryRunner.query(`DROP INDEX "IDX_e49e37fe88a2725a38a3b05849"`); - await queryRunner.query(`DROP INDEX "IDX_d4f093ca4eb7c40db68d9a789d"`); - await queryRunner.query(`ALTER TABLE "goal_kpi" RENAME TO "temporary_goal_kpi"`); - await queryRunner.query( - `CREATE TABLE "goal_kpi" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d4f093ca4eb7c40db68d9a789d0" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_e49e37fe88a2725a38a3b058493" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_43aa2985216560cd9fa93f501e5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal_kpi"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_kpi"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal_kpi"`); - await queryRunner.query(`CREATE INDEX "IDX_a96c22c51607f878c8a98bc488" ON "goal_kpi" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_cfc393bd9835d8259e73019226" ON "goal_kpi" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_43aa2985216560cd9fa93f501e" ON "goal_kpi" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e49e37fe88a2725a38a3b05849" ON "goal_kpi" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_d4f093ca4eb7c40db68d9a789d" ON "goal_kpi" ("leadId") `); - await queryRunner.query(`DROP INDEX "IDX_26311c417ba945c901c65d515d"`); - await queryRunner.query(`DROP INDEX "IDX_b4f4701ddb0e973602445ed1c6"`); - await queryRunner.query(`DROP INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf"`); - await queryRunner.query(`DROP INDEX "IDX_df7ab026698c02859ff7540809"`); - await queryRunner.query(`ALTER TABLE "goal_kpi_template" RENAME TO "temporary_goal_kpi_template"`); - await queryRunner.query( - `CREATE TABLE "goal_kpi_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "type" varchar NOT NULL, "unit" varchar, "operator" varchar NOT NULL, "currentValue" integer NOT NULL, "targetValue" integer NOT NULL, "leadId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_f69e740b066c6469d1c68a4a28b" FOREIGN KEY ("leadId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_df7ab026698c02859ff75408093" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_cc72d4e8e4284dcc8ffbf96caf4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal_kpi_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "type", "unit", "operator", "currentValue", "targetValue", "leadId", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_kpi_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal_kpi_template"`); - await queryRunner.query(`CREATE INDEX "IDX_26311c417ba945c901c65d515d" ON "goal_kpi_template" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_b4f4701ddb0e973602445ed1c6" ON "goal_kpi_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_cc72d4e8e4284dcc8ffbf96caf" ON "goal_kpi_template" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_df7ab026698c02859ff7540809" ON "goal_kpi_template" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_4a44905db4ca1e40b62021fdfb"`); - await queryRunner.query(`DROP INDEX "IDX_bdee8704ebeb79368ff6154fc7"`); - await queryRunner.query(`DROP INDEX "IDX_d17a5159d888ac6320459eda39"`); - await queryRunner.query(`DROP INDEX "IDX_e35d0f7b794ca8850669d12c78"`); - await queryRunner.query(`ALTER TABLE "goal_general_setting" RENAME TO "temporary_goal_general_setting"`); - await queryRunner.query( - `CREATE TABLE "goal_general_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "maxObjectives" integer NOT NULL, "maxKeyResults" integer NOT NULL, "employeeCanCreateObjective" boolean NOT NULL, "canOwnObjectives" varchar NOT NULL, "canOwnKeyResult" varchar NOT NULL, "krTypeKPI" boolean NOT NULL, "krTypeTask" boolean NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e35d0f7b794ca8850669d12c78c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d17a5159d888ac6320459eda392" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "goal_general_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "maxObjectives", "maxKeyResults", "employeeCanCreateObjective", "canOwnObjectives", "canOwnKeyResult", "krTypeKPI", "krTypeTask", "isActive", "isArchived", "deletedAt" FROM "temporary_goal_general_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_goal_general_setting"`); - await queryRunner.query( - `CREATE INDEX "IDX_4a44905db4ca1e40b62021fdfb" ON "goal_general_setting" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bdee8704ebeb79368ff6154fc7" ON "goal_general_setting" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d17a5159d888ac6320459eda39" ON "goal_general_setting" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e35d0f7b794ca8850669d12c78" ON "goal_general_setting" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a26cc341268d22bd55f06e3ef6"`); - await queryRunner.query(`DROP INDEX "IDX_5405b67f1df904831a358df7c4"`); - await queryRunner.query(`DROP INDEX "IDX_4832be692a2dc63d67e8e93c75"`); - await queryRunner.query(`DROP INDEX "IDX_c30465b5a6e0fae1c8ee7e3120"`); - await queryRunner.query(`DROP INDEX "IDX_d4a28a8e70d450a412bf0cfb52"`); - await queryRunner.query(`ALTER TABLE "feature" RENAME TO "temporary_feature"`); - await queryRunner.query( - `CREATE TABLE "feature" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar NOT NULL, "code" varchar NOT NULL, "isPaid" boolean NOT NULL DEFAULT (0), "description" varchar, "image" varchar, "link" varchar NOT NULL, "status" varchar, "icon" varchar, "parentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_d4a28a8e70d450a412bf0cfb52a" FOREIGN KEY ("parentId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "feature"("id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "name", "code", "isPaid", "description", "image", "link", "status", "icon", "parentId", "isActive", "isArchived", "deletedAt" FROM "temporary_feature"` - ); - await queryRunner.query(`DROP TABLE "temporary_feature"`); - await queryRunner.query(`CREATE INDEX "IDX_a26cc341268d22bd55f06e3ef6" ON "feature" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_5405b67f1df904831a358df7c4" ON "feature" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4832be692a2dc63d67e8e93c75" ON "feature" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_c30465b5a6e0fae1c8ee7e3120" ON "feature" ("code") `); - await queryRunner.query(`CREATE INDEX "IDX_d4a28a8e70d450a412bf0cfb52" ON "feature" ("parentId") `); - await queryRunner.query(`DROP INDEX "IDX_e4c142f37091b47056012d34ba"`); - await queryRunner.query(`DROP INDEX "IDX_4ee685760ddb60ff71f763d8f6"`); - await queryRunner.query(`DROP INDEX "IDX_8f71803d96dcdbcc6b19bb28d3"`); - await queryRunner.query(`DROP INDEX "IDX_6a94e6b0a572f591288ac44a42"`); - await queryRunner.query(`DROP INDEX "IDX_6d413f9fdd5366b1b9add46483"`); - await queryRunner.query(`ALTER TABLE "feature_organization" RENAME TO "temporary_feature_organization"`); - await queryRunner.query( - `CREATE TABLE "feature_organization" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "isEnabled" boolean NOT NULL DEFAULT (1), "featureId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_6d413f9fdd5366b1b9add464836" FOREIGN KEY ("featureId") REFERENCES "feature" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6a94e6b0a572f591288ac44a421" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8f71803d96dcdbcc6b19bb28d38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "feature_organization"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "isEnabled", "featureId", "isActive", "isArchived", "deletedAt" FROM "temporary_feature_organization"` - ); - await queryRunner.query(`DROP TABLE "temporary_feature_organization"`); - await queryRunner.query( - `CREATE INDEX "IDX_e4c142f37091b47056012d34ba" ON "feature_organization" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_4ee685760ddb60ff71f763d8f6" ON "feature_organization" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8f71803d96dcdbcc6b19bb28d3" ON "feature_organization" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6a94e6b0a572f591288ac44a42" ON "feature_organization" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6d413f9fdd5366b1b9add46483" ON "feature_organization" ("featureId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_339328a7247aa09d061c642ae1"`); - await queryRunner.query(`DROP INDEX "IDX_b90957ef81e74c43d6ae037560"`); - await queryRunner.query(`DROP INDEX "IDX_a43b235c35c2c4d3263ada770c"`); - await queryRunner.query(`ALTER TABLE "import-record" RENAME TO "temporary_import-record"`); - await queryRunner.query( - `CREATE TABLE "import-record" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "entityType" varchar NOT NULL, "sourceId" varchar NOT NULL, "destinationId" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a43b235c35c2c4d3263ada770c6" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "import-record"("id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "entityType", "sourceId", "destinationId", "importDate", "isActive", "isArchived", "deletedAt" FROM "temporary_import-record"` - ); - await queryRunner.query(`DROP TABLE "temporary_import-record"`); - await queryRunner.query(`CREATE INDEX "IDX_339328a7247aa09d061c642ae1" ON "import-record" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_b90957ef81e74c43d6ae037560" ON "import-record" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_a43b235c35c2c4d3263ada770c" ON "import-record" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_d6a626bee6cddf4bc53a493bc3"`); - await queryRunner.query(`DROP INDEX "IDX_e339340014a6c4e2f57be00b0c"`); - await queryRunner.query(`DROP INDEX "IDX_54868607115e2fee3b0b764eec"`); - await queryRunner.query(`ALTER TABLE "import-history" RENAME TO "temporary_import-history"`); - await queryRunner.query( - `CREATE TABLE "import-history" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "file" varchar NOT NULL, "path" varchar NOT NULL, "size" integer, "status" varchar NOT NULL, "importDate" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_54868607115e2fee3b0b764eec2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "import-history"("id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "file", "path", "size", "status", "importDate", "isActive", "isArchived", "deletedAt" FROM "temporary_import-history"` - ); - await queryRunner.query(`DROP TABLE "temporary_import-history"`); - await queryRunner.query(`CREATE INDEX "IDX_d6a626bee6cddf4bc53a493bc3" ON "import-history" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e339340014a6c4e2f57be00b0c" ON "import-history" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_54868607115e2fee3b0b764eec" ON "import-history" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_d77aeb93f2439ebdf4babaab4c"`); - await queryRunner.query(`DROP INDEX "IDX_1aa0e5fd480214ae4851471e3c"`); - await queryRunner.query(`DROP INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4"`); - await queryRunner.query(`DROP INDEX "IDX_9971c4171ae051e74b833984a3"`); - await queryRunner.query(`DROP INDEX "IDX_42eea5debc63f4d1bf89881c10"`); - await queryRunner.query(`DROP INDEX "IDX_eacb116ab0521ad9b96f2bb53b"`); - await queryRunner.query(`DROP INDEX "IDX_5e7b197dbac69012dbdb4964f3"`); - await queryRunner.query(`DROP INDEX "IDX_5f57d077c28b378a6c885e81c5"`); - await queryRunner.query(`DROP INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9"`); - await queryRunner.query(`DROP INDEX "IDX_0006d3025b6c92fbd4089b9465"`); - await queryRunner.query(`DROP INDEX "IDX_dd8ab9312fb8d787982b9feebf"`); - await queryRunner.query(`DROP INDEX "IDX_cbfebdb1419f9b8036a8b0546e"`); - await queryRunner.query(`DROP INDEX "IDX_89508d119b1a279c037d9da151"`); - await queryRunner.query(`DROP INDEX "IDX_3826d6ca74a08a8498fa17d330"`); - await queryRunner.query(`DROP INDEX "IDX_b5bb8f62d401475fcc8c2ba35e"`); - await queryRunner.query(`DROP INDEX "IDX_846a933af451a33b95b7b198c6"`); - await queryRunner.query(`DROP INDEX "IDX_c5fb146726ff128e600f23d0a1"`); - await queryRunner.query(`DROP INDEX "IDX_6d171c9d5f81095436b99da5e6"`); - await queryRunner.query(`ALTER TABLE "expense" RENAME TO "temporary_expense"`); - await queryRunner.query( - `CREATE TABLE "expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "amount" numeric NOT NULL, "typeOfExpense" varchar, "notes" varchar, "currency" varchar NOT NULL, "valueDate" datetime, "purpose" varchar, "taxType" varchar, "taxLabel" varchar, "rateValue" numeric, "receipt" varchar, "splitExpense" boolean, "reference" varchar, "status" varchar, "employeeId" varchar, "vendorId" varchar, "categoryId" varchar, "projectId" varchar, "organizationContactId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_42eea5debc63f4d1bf89881c10a" FOREIGN KEY ("categoryId") REFERENCES "expense_category" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_eacb116ab0521ad9b96f2bb53ba" FOREIGN KEY ("vendorId") REFERENCES "organization_vendor" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_6d171c9d5f81095436b99da5e62" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c5fb146726ff128e600f23d0a1b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5e7b197dbac69012dbdb4964f37" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9971c4171ae051e74b833984a30" FOREIGN KEY ("projectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_047b8b5c0782d5a6d4c8bfc1a4e" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "amount", "typeOfExpense", "notes", "currency", "valueDate", "purpose", "taxType", "taxLabel", "rateValue", "receipt", "splitExpense", "reference", "status", "employeeId", "vendorId", "categoryId", "projectId", "organizationContactId", "isActive", "isArchived", "deletedAt" FROM "temporary_expense"` - ); - await queryRunner.query(`DROP TABLE "temporary_expense"`); - await queryRunner.query(`CREATE INDEX "IDX_d77aeb93f2439ebdf4babaab4c" ON "expense" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1aa0e5fd480214ae4851471e3c" ON "expense" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_047b8b5c0782d5a6d4c8bfc1a4" ON "expense" ("organizationContactId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9971c4171ae051e74b833984a3" ON "expense" ("projectId") `); - await queryRunner.query(`CREATE INDEX "IDX_42eea5debc63f4d1bf89881c10" ON "expense" ("categoryId") `); - await queryRunner.query(`CREATE INDEX "IDX_eacb116ab0521ad9b96f2bb53b" ON "expense" ("vendorId") `); - await queryRunner.query(`CREATE INDEX "IDX_5e7b197dbac69012dbdb4964f3" ON "expense" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_5f57d077c28b378a6c885e81c5" ON "expense" ("receipt") `); - await queryRunner.query(`CREATE INDEX "IDX_97ed0e2b80f2e7ec260fd81cd9" ON "expense" ("rateValue") `); - await queryRunner.query(`CREATE INDEX "IDX_0006d3025b6c92fbd4089b9465" ON "expense" ("taxLabel") `); - await queryRunner.query(`CREATE INDEX "IDX_dd8ab9312fb8d787982b9feebf" ON "expense" ("taxType") `); - await queryRunner.query(`CREATE INDEX "IDX_cbfebdb1419f9b8036a8b0546e" ON "expense" ("purpose") `); - await queryRunner.query(`CREATE INDEX "IDX_89508d119b1a279c037d9da151" ON "expense" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_3826d6ca74a08a8498fa17d330" ON "expense" ("notes") `); - await queryRunner.query(`CREATE INDEX "IDX_b5bb8f62d401475fcc8c2ba35e" ON "expense" ("typeOfExpense") `); - await queryRunner.query(`CREATE INDEX "IDX_846a933af451a33b95b7b198c6" ON "expense" ("amount") `); - await queryRunner.query(`CREATE INDEX "IDX_c5fb146726ff128e600f23d0a1" ON "expense" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_6d171c9d5f81095436b99da5e6" ON "expense" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc"`); - await queryRunner.query(`DROP INDEX "IDX_8376e41fd82aba147a433dc097"`); - await queryRunner.query(`DROP INDEX "IDX_37504e920ee5ca46a4000b89da"`); - await queryRunner.query(`DROP INDEX "IDX_9c9bfe5baaf83f53533ff035fc"`); - await queryRunner.query(`ALTER TABLE "expense_category" RENAME TO "temporary_expense_category"`); - await queryRunner.query( - `CREATE TABLE "expense_category" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9c9bfe5baaf83f53533ff035fc0" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_37504e920ee5ca46a4000b89da5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "expense_category"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_expense_category"` - ); - await queryRunner.query(`DROP TABLE "temporary_expense_category"`); - await queryRunner.query(`CREATE INDEX "IDX_e9cef5d359dfa48ee5d0cd5fcc" ON "expense_category" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_8376e41fd82aba147a433dc097" ON "expense_category" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_37504e920ee5ca46a4000b89da" ON "expense_category" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_9c9bfe5baaf83f53533ff035fc" ON "expense_category" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_613cfa5783e164cad10dc27e58"`); - await queryRunner.query(`DROP INDEX "IDX_f14eee32875b112fab1139b332"`); - await queryRunner.query(`DROP INDEX "IDX_92fc62260c0c7ff108622850bf"`); - await queryRunner.query(`DROP INDEX "IDX_fc8818d6fde74370ec703a0135"`); - await queryRunner.query(`DROP INDEX "IDX_4b02d8616129f39fca2b10e98b"`); - await queryRunner.query(`DROP INDEX "IDX_9d5980ff1064e2edb77509d312"`); - await queryRunner.query(`DROP INDEX "IDX_43459c650957e478203c738574"`); - await queryRunner.query(`DROP INDEX "IDX_5bde7aeb2c7fb3a421b175871e"`); - await queryRunner.query(`DROP INDEX "IDX_24d905ec9e127ade23754a363d"`); - await queryRunner.query(`ALTER TABLE "event_type" RENAME TO "temporary_event_type"`); - await queryRunner.query( - `CREATE TABLE "event_type" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "duration" numeric NOT NULL, "durationUnit" varchar, "title" varchar, "description" varchar, "isActive" boolean DEFAULT (1), "employeeId" varchar, "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_24d905ec9e127ade23754a363dd" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fc8818d6fde74370ec703a01352" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_92fc62260c0c7ff108622850bff" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "event_type"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "duration", "durationUnit", "title", "description", "isActive", "employeeId", "isArchived", "deletedAt" FROM "temporary_event_type"` - ); - await queryRunner.query(`DROP TABLE "temporary_event_type"`); - await queryRunner.query(`CREATE INDEX "IDX_613cfa5783e164cad10dc27e58" ON "event_type" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_f14eee32875b112fab1139b332" ON "event_type" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_92fc62260c0c7ff108622850bf" ON "event_type" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_fc8818d6fde74370ec703a0135" ON "event_type" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4b02d8616129f39fca2b10e98b" ON "event_type" ("duration") `); - await queryRunner.query(`CREATE INDEX "IDX_9d5980ff1064e2edb77509d312" ON "event_type" ("durationUnit") `); - await queryRunner.query(`CREATE INDEX "IDX_43459c650957e478203c738574" ON "event_type" ("title") `); - await queryRunner.query(`CREATE INDEX "IDX_5bde7aeb2c7fb3a421b175871e" ON "event_type" ("description") `); - await queryRunner.query(`CREATE INDEX "IDX_24d905ec9e127ade23754a363d" ON "event_type" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_f1fac79e17c475f00daa4db3d2"`); - await queryRunner.query(`DROP INDEX "IDX_1a4bd2a8034bb1309b4ea87882"`); - await queryRunner.query(`DROP INDEX "IDX_391d3f83244fea73c619aecadd"`); - await queryRunner.query(`DROP INDEX "IDX_233c1d351d63441aeb039d1164"`); - await queryRunner.query(`ALTER TABLE "estimate_email" RENAME TO "temporary_estimate_email"`); - await queryRunner.query( - `CREATE TABLE "estimate_email" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "token" varchar NOT NULL, "email" varchar NOT NULL, "expireDate" datetime NOT NULL, "convertAcceptedEstimates" boolean, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_233c1d351d63441aeb039d1164f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_391d3f83244fea73c619aecadd9" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "estimate_email"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "token", "email", "expireDate", "convertAcceptedEstimates", "isActive", "isArchived", "deletedAt" FROM "temporary_estimate_email"` - ); - await queryRunner.query(`DROP TABLE "temporary_estimate_email"`); - await queryRunner.query(`CREATE INDEX "IDX_f1fac79e17c475f00daa4db3d2" ON "estimate_email" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_1a4bd2a8034bb1309b4ea87882" ON "estimate_email" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_391d3f83244fea73c619aecadd" ON "estimate_email" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_233c1d351d63441aeb039d1164" ON "estimate_email" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_d8452bfe9f18ced4ce76c4b70b"`); - await queryRunner.query(`DROP INDEX "IDX_39e1b443404ea7fa42b3d36ccb"`); - await queryRunner.query(`DROP INDEX "IDX_fb6808468066849ab7b7454d5f"`); - await queryRunner.query(`DROP INDEX "IDX_f98ce0d210aa9f91b729d44780"`); - await queryRunner.query(`ALTER TABLE "equipment" RENAME TO "temporary_equipment"`); - await queryRunner.query( - `CREATE TABLE "equipment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "type" varchar NOT NULL, "serialNumber" varchar NOT NULL, "manufacturedYear" numeric, "initialCost" numeric, "currency" varchar NOT NULL, "maxSharePeriod" numeric, "autoApproveShare" boolean NOT NULL, "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ab80a66282582ae8b0282508e7" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_f98ce0d210aa9f91b729d447806" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fb6808468066849ab7b7454d5f3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "equipment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "type", "serialNumber", "manufacturedYear", "initialCost", "currency", "maxSharePeriod", "autoApproveShare", "imageId", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment"` - ); - await queryRunner.query(`DROP TABLE "temporary_equipment"`); - await queryRunner.query(`CREATE INDEX "IDX_d8452bfe9f18ced4ce76c4b70b" ON "equipment" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_39e1b443404ea7fa42b3d36ccb" ON "equipment" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_fb6808468066849ab7b7454d5f" ON "equipment" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_f98ce0d210aa9f91b729d44780" ON "equipment" ("organizationId") `); - await queryRunner.query(`DROP INDEX "IDX_a734598f5637cf1501288331e3"`); - await queryRunner.query(`DROP INDEX "IDX_70ff31cefa0f578f6fa82d2bcc"`); - await queryRunner.query(`DROP INDEX "IDX_fa525e61fb3d8d9efec0f364a4"`); - await queryRunner.query(`DROP INDEX "IDX_ea9254be07ae4a8604f0aaab19"`); - await queryRunner.query(`DROP INDEX "IDX_acad51a6362806fc499e583e40"`); - await queryRunner.query(`DROP INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10"`); - await queryRunner.query(`ALTER TABLE "equipment_sharing" RENAME TO "temporary_equipment_sharing"`); - await queryRunner.query( - `CREATE TABLE "equipment_sharing" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "shareRequestDay" datetime, "shareStartDay" datetime, "shareEndDay" datetime, "status" integer NOT NULL, "createdBy" varchar, "createdByName" varchar, "equipmentId" varchar, "equipmentSharingPolicyId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ecfe0ce0cd2b197249d5f1c105" FOREIGN KEY ("equipmentSharingPolicyId") REFERENCES "equipment_sharing_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_acad51a6362806fc499e583e402" FOREIGN KEY ("equipmentId") REFERENCES "equipment" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ea9254be07ae4a8604f0aaab196" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_fa525e61fb3d8d9efec0f364a4b" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "equipment_sharing"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "shareRequestDay", "shareStartDay", "shareEndDay", "status", "createdBy", "createdByName", "equipmentId", "equipmentSharingPolicyId", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment_sharing"` - ); - await queryRunner.query(`DROP TABLE "temporary_equipment_sharing"`); - await queryRunner.query(`CREATE INDEX "IDX_a734598f5637cf1501288331e3" ON "equipment_sharing" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_70ff31cefa0f578f6fa82d2bcc" ON "equipment_sharing" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_fa525e61fb3d8d9efec0f364a4" ON "equipment_sharing" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_ea9254be07ae4a8604f0aaab19" ON "equipment_sharing" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_acad51a6362806fc499e583e40" ON "equipment_sharing" ("equipmentId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0ecfe0ce0cd2b197249d5f1c10" ON "equipment_sharing" ("equipmentSharingPolicyId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b0fc293cf47f31ba512fd29bf0"`); - await queryRunner.query(`DROP INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae"`); - await queryRunner.query(`DROP INDEX "IDX_5443ca8ed830626656d8cfecef"`); - await queryRunner.query(`DROP INDEX "IDX_5311a833ff255881454bd5b3b5"`); - await queryRunner.query(`DROP INDEX "IDX_04c9e514ed70897f6ad8cadc3c"`); - await queryRunner.query( - `ALTER TABLE "equipment_sharing_policy" RENAME TO "temporary_equipment_sharing_policy"` - ); - await queryRunner.query( - `CREATE TABLE "equipment_sharing_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_5311a833ff255881454bd5b3b58" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5443ca8ed830626656d8cfecef7" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "equipment_sharing_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "isActive", "isArchived", "deletedAt" FROM "temporary_equipment_sharing_policy"` - ); - await queryRunner.query(`DROP TABLE "temporary_equipment_sharing_policy"`); - await queryRunner.query( - `CREATE INDEX "IDX_b0fc293cf47f31ba512fd29bf0" ON "equipment_sharing_policy" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0f3ee47a5fb7192d5eb00c71ae" ON "equipment_sharing_policy" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5443ca8ed830626656d8cfecef" ON "equipment_sharing_policy" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5311a833ff255881454bd5b3b5" ON "equipment_sharing_policy" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_04c9e514ed70897f6ad8cadc3c" ON "equipment_sharing_policy" ("name") ` - ); - await queryRunner.query(`DROP INDEX "IDX_5e719204dcafa8d6b2ecdeda13"`); - await queryRunner.query(`DROP INDEX "IDX_1c0c1370ecd98040259625e17e"`); - await queryRunner.query(`DROP INDEX "IDX_f4b0d329c4a3cf79ffe9d56504"`); - await queryRunner.query(`DROP INDEX "IDX_96dfbcaa2990df01fe5bb39ccc"`); - await queryRunner.query(`DROP INDEX "IDX_c6a48286f3aa8ae903bee0d1e7"`); - await queryRunner.query(`DROP INDEX "IDX_4b3303a6b7eb92d237a4379734"`); - await queryRunner.query(`DROP INDEX "IDX_510cb87f5da169e57e694d1a5c"`); - await queryRunner.query(`DROP INDEX "IDX_175b7be641928a31521224daa8"`); - await queryRunner.query(`ALTER TABLE "employee" RENAME TO "temporary_employee"`); - await queryRunner.query( - `CREATE TABLE "employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "valueDate" datetime, "isActive" boolean DEFAULT (1), "short_description" varchar(200), "description" varchar, "startedWorkOn" datetime, "endWork" datetime, "payPeriod" varchar, "billRateValue" integer, "billRateCurrency" varchar, "reWeeklyLimit" integer, "offerDate" datetime, "acceptDate" datetime, "rejectDate" datetime, "employeeLevel" varchar(500), "anonymousBonus" boolean, "averageIncome" numeric, "averageBonus" numeric, "totalWorkHours" numeric DEFAULT (0), "averageExpenses" numeric, "show_anonymous_bonus" boolean, "show_average_bonus" boolean, "show_average_expenses" boolean, "show_average_income" boolean, "show_billrate" boolean, "show_payperiod" boolean, "show_start_work_on" boolean, "isJobSearchActive" boolean, "linkedInUrl" varchar, "facebookUrl" varchar, "instagramUrl" varchar, "twitterUrl" varchar, "githubUrl" varchar, "gitlabUrl" varchar, "upworkUrl" varchar, "stackoverflowUrl" varchar, "isVerified" boolean, "isVetted" boolean, "totalJobs" numeric, "jobSuccess" numeric, "profile_link" varchar, "userId" varchar NOT NULL, "contactId" varchar, "organizationPositionId" varchar, "isTrackingEnabled" boolean DEFAULT (0), "deletedAt" datetime, "allowScreenshotCapture" boolean NOT NULL DEFAULT (1), "upworkId" varchar, "linkedInId" varchar, "isOnline" boolean DEFAULT (0), "isTrackingTime" boolean DEFAULT (0), "minimumBillingRate" integer, "isAway" boolean DEFAULT (0), "isArchived" boolean DEFAULT (0), "fix_relational_custom_fields" boolean, CONSTRAINT "REL_f4b0d329c4a3cf79ffe9d56504" UNIQUE ("userId"), CONSTRAINT "REL_1c0c1370ecd98040259625e17e" UNIQUE ("contactId"), CONSTRAINT "FK_4b3303a6b7eb92d237a4379734e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6a48286f3aa8ae903bee0d1e72" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f4b0d329c4a3cf79ffe9d565047" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c0c1370ecd98040259625e17e2" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_5e719204dcafa8d6b2ecdeda130" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "valueDate", "isActive", "short_description", "description", "startedWorkOn", "endWork", "payPeriod", "billRateValue", "billRateCurrency", "reWeeklyLimit", "offerDate", "acceptDate", "rejectDate", "employeeLevel", "anonymousBonus", "averageIncome", "averageBonus", "totalWorkHours", "averageExpenses", "show_anonymous_bonus", "show_average_bonus", "show_average_expenses", "show_average_income", "show_billrate", "show_payperiod", "show_start_work_on", "isJobSearchActive", "linkedInUrl", "facebookUrl", "instagramUrl", "twitterUrl", "githubUrl", "gitlabUrl", "upworkUrl", "stackoverflowUrl", "isVerified", "isVetted", "totalJobs", "jobSuccess", "profile_link", "userId", "contactId", "organizationPositionId", "isTrackingEnabled", "deletedAt", "allowScreenshotCapture", "upworkId", "linkedInId", "isOnline", "isTrackingTime", "minimumBillingRate", "isAway", "isArchived", "fix_relational_custom_fields" FROM "temporary_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_5e719204dcafa8d6b2ecdeda13" ON "employee" ("organizationPositionId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_1c0c1370ecd98040259625e17e" ON "employee" ("contactId") `); - await queryRunner.query(`CREATE INDEX "IDX_f4b0d329c4a3cf79ffe9d56504" ON "employee" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_96dfbcaa2990df01fe5bb39ccc" ON "employee" ("profile_link") `); - await queryRunner.query(`CREATE INDEX "IDX_c6a48286f3aa8ae903bee0d1e7" ON "employee" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4b3303a6b7eb92d237a4379734" ON "employee" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_510cb87f5da169e57e694d1a5c" ON "employee" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_175b7be641928a31521224daa8" ON "employee" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_01237d04f882cf1ea794678e8d"`); - await queryRunner.query(`DROP INDEX "IDX_48fae30026b4e166a3445fee6d"`); - await queryRunner.query(`DROP INDEX "IDX_9516a627a131626d2a5738a05a"`); - await queryRunner.query(`DROP INDEX "IDX_56e96cd218a185ed59b5a8e786"`); - await queryRunner.query(`DROP INDEX "IDX_9537fae454ebebc98ee5adb3a2"`); - await queryRunner.query(`DROP INDEX "IDX_710c71526edb89b2a7033abcdf"`); - await queryRunner.query(`DROP INDEX "IDX_95ea18af6ef8123503d332240c"`); - await queryRunner.query(`ALTER TABLE "employee_setting" RENAME TO "temporary_employee_setting"`); - await queryRunner.query( - `CREATE TABLE "employee_setting" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "month" integer NOT NULL, "year" integer NOT NULL, "settingType" varchar NOT NULL, "value" integer NOT NULL, "currency" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_95ea18af6ef8123503d332240c2" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_56e96cd218a185ed59b5a8e7869" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9516a627a131626d2a5738a05a8" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_setting"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "month", "year", "settingType", "value", "currency", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_setting"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_setting"`); - await queryRunner.query(`CREATE INDEX "IDX_01237d04f882cf1ea794678e8d" ON "employee_setting" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_48fae30026b4e166a3445fee6d" ON "employee_setting" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_9516a627a131626d2a5738a05a" ON "employee_setting" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_56e96cd218a185ed59b5a8e786" ON "employee_setting" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_9537fae454ebebc98ee5adb3a2" ON "employee_setting" ("settingType") `); - await queryRunner.query(`CREATE INDEX "IDX_710c71526edb89b2a7033abcdf" ON "employee_setting" ("currency") `); - await queryRunner.query(`CREATE INDEX "IDX_95ea18af6ef8123503d332240c" ON "employee_setting" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_3980b0fe1e757b092ea5323656"`); - await queryRunner.query(`DROP INDEX "IDX_25f8915182128f377d84b60d26"`); - await queryRunner.query(`DROP INDEX "IDX_0ac8526c48a3daa267c86225fb"`); - await queryRunner.query(`DROP INDEX "IDX_6e570174fda71e97616e9d2eea"`); - await queryRunner.query(`DROP INDEX "IDX_739f8cdce21cc72d400559ce00"`); - await queryRunner.query(`DROP INDEX "IDX_a4b5a2ea2afecf1ee254f1a704"`); - await queryRunner.query(`DROP INDEX "IDX_3ee5147bb1fde625fa33c0e956"`); - await queryRunner.query(`DROP INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6"`); - await queryRunner.query( - `ALTER TABLE "employee_recurring_expense" RENAME TO "temporary_employee_recurring_expense"` - ); - await queryRunner.query( - `CREATE TABLE "employee_recurring_expense" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startDay" integer NOT NULL, "startMonth" integer NOT NULL, "startYear" integer NOT NULL, "startDate" datetime NOT NULL, "endDay" integer, "endMonth" integer, "endYear" integer, "endDate" datetime, "categoryName" varchar NOT NULL, "value" numeric NOT NULL, "currency" varchar NOT NULL, "parentRecurringExpenseId" varchar, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0ac8526c48a3daa267c86225fb5" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3ee5147bb1fde625fa33c0e956b" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_5fde7be40b3c03bc0fdac0c2f66" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_recurring_expense"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startDay", "startMonth", "startYear", "startDate", "endDay", "endMonth", "endYear", "endDate", "categoryName", "value", "currency", "parentRecurringExpenseId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_recurring_expense"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_recurring_expense"`); - await queryRunner.query( - `CREATE INDEX "IDX_3980b0fe1e757b092ea5323656" ON "employee_recurring_expense" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25f8915182128f377d84b60d26" ON "employee_recurring_expense" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0ac8526c48a3daa267c86225fb" ON "employee_recurring_expense" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6e570174fda71e97616e9d2eea" ON "employee_recurring_expense" ("parentRecurringExpenseId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_739f8cdce21cc72d400559ce00" ON "employee_recurring_expense" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a4b5a2ea2afecf1ee254f1a704" ON "employee_recurring_expense" ("categoryName") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3ee5147bb1fde625fa33c0e956" ON "employee_recurring_expense" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5fde7be40b3c03bc0fdac0c2f6" ON "employee_recurring_expense" ("tenantId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_aa98ea786d490db300d3dbbdb6"`); - await queryRunner.query(`DROP INDEX "IDX_587d11ffbd87adb6dff367f3cd"`); - await queryRunner.query(`DROP INDEX "IDX_d543336994b1f764c449e0b1d3"`); - await queryRunner.query(`DROP INDEX "IDX_0f9cefa604913e1ab322591546"`); - await queryRunner.query(`DROP INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef"`); - await queryRunner.query(`DROP INDEX "IDX_329ebd01a757d1a0c3c4d628e2"`); - await queryRunner.query(`ALTER TABLE "employee_phone" RENAME TO "temporary_employee_phone"`); - await queryRunner.query( - `CREATE TABLE "employee_phone" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "type" varchar, "phoneNumber" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_329ebd01a757d1a0c3c4d628e29" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_0f9cefa604913e1ab3225915469" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d543336994b1f764c449e0b1d3c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_phone"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "type", "phoneNumber", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_phone"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_phone"`); - await queryRunner.query(`CREATE INDEX "IDX_aa98ea786d490db300d3dbbdb6" ON "employee_phone" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_587d11ffbd87adb6dff367f3cd" ON "employee_phone" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d543336994b1f764c449e0b1d3" ON "employee_phone" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_0f9cefa604913e1ab322591546" ON "employee_phone" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_ba7b2ef5a9cd165a1e4e2ad0ef" ON "employee_phone" ("phoneNumber") `); - await queryRunner.query(`CREATE INDEX "IDX_329ebd01a757d1a0c3c4d628e2" ON "employee_phone" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_88a58d149404145ed7b3385387"`); - await queryRunner.query(`DROP INDEX "IDX_90bd442869709bae9d1b18e489"`); - await queryRunner.query(`DROP INDEX "IDX_d3fc52d497bc44d6f493dbedc3"`); - await queryRunner.query(`DROP INDEX "IDX_c4668533292bf4526e61aedf74"`); - await queryRunner.query(`ALTER TABLE "employee_level" RENAME TO "temporary_employee_level"`); - await queryRunner.query( - `CREATE TABLE "employee_level" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "level" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c4668533292bf4526e61aedf74a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_d3fc52d497bc44d6f493dbedc3a" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_level"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "level", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_level"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_level"`); - await queryRunner.query(`CREATE INDEX "IDX_88a58d149404145ed7b3385387" ON "employee_level" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_90bd442869709bae9d1b18e489" ON "employee_level" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_d3fc52d497bc44d6f493dbedc3" ON "employee_level" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_c4668533292bf4526e61aedf74" ON "employee_level" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_8fb47e8bfd26340ddaeabd24e5"`); - await queryRunner.query(`DROP INDEX "IDX_c07390f325c847be7df93d0d17"`); - await queryRunner.query(`DROP INDEX "IDX_91e0f7efcd17d20b5029fb1342"`); - await queryRunner.query(`DROP INDEX "IDX_caf8363b0ed7d5f24ae866ba3b"`); - await queryRunner.query(`DROP INDEX "IDX_6912685bbb0e303eab392978d9"`); - await queryRunner.query(`DROP INDEX "IDX_0c5266f3f488add404f92d56ec"`); - await queryRunner.query(`ALTER TABLE "employee_award" RENAME TO "temporary_employee_award"`); - await queryRunner.query( - `CREATE TABLE "employee_award" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "year" varchar NOT NULL, "employeeId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_0c5266f3f488add404f92d56ec7" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_caf8363b0ed7d5f24ae866ba3bb" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91e0f7efcd17d20b5029fb1342d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_award"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "year", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_award"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_award"`); - await queryRunner.query(`CREATE INDEX "IDX_8fb47e8bfd26340ddaeabd24e5" ON "employee_award" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_c07390f325c847be7df93d0d17" ON "employee_award" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_91e0f7efcd17d20b5029fb1342" ON "employee_award" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_caf8363b0ed7d5f24ae866ba3b" ON "employee_award" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_6912685bbb0e303eab392978d9" ON "employee_award" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_0c5266f3f488add404f92d56ec" ON "employee_award" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_64c83df9d37d9ada96edb66557"`); - await queryRunner.query(`DROP INDEX "IDX_d0219ada2359ede9e7b0d511ba"`); - await queryRunner.query(`DROP INDEX "IDX_a35637bb659c59e18adb4f38f8"`); - await queryRunner.query(`DROP INDEX "IDX_86cf36c137712e779dd7e2301e"`); - await queryRunner.query(`ALTER TABLE "employee_appointment" RENAME TO "temporary_employee_appointment"`); - await queryRunner.query( - `CREATE TABLE "employee_appointment" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "employeeId" varchar, "agenda" varchar NOT NULL, "description" varchar, "location" varchar, "startDateTime" datetime NOT NULL, "endDateTime" datetime NOT NULL, "bufferTimeStart" boolean, "bufferTimeEnd" boolean, "bufferTimeInMins" integer, "breakTimeInMins" integer, "breakStartTime" datetime, "emails" varchar, "status" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2f58132c57108540887dc3e88eb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_86cf36c137712e779dd7e2301e6" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a35637bb659c59e18adb4f38f87" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "employee_appointment"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "employeeId", "agenda", "description", "location", "startDateTime", "endDateTime", "bufferTimeStart", "bufferTimeEnd", "bufferTimeInMins", "breakTimeInMins", "breakStartTime", "emails", "status", "isActive", "isArchived", "deletedAt" FROM "temporary_employee_appointment"` - ); - await queryRunner.query(`DROP TABLE "temporary_employee_appointment"`); - await queryRunner.query( - `CREATE INDEX "IDX_64c83df9d37d9ada96edb66557" ON "employee_appointment" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d0219ada2359ede9e7b0d511ba" ON "employee_appointment" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a35637bb659c59e18adb4f38f8" ON "employee_appointment" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_86cf36c137712e779dd7e2301e" ON "employee_appointment" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_29d60114e1968c0cd68a19e3c5"`); - await queryRunner.query(`DROP INDEX "IDX_e4932e0a726b9b07d81d8b6905"`); - await queryRunner.query(`DROP INDEX "IDX_753e005a45556b5909e11937aa"`); - await queryRunner.query(`DROP INDEX "IDX_c160fe6234675fac031aa3e7c5"`); - await queryRunner.query(`DROP INDEX "IDX_274708db64fcce5448f2c4541c"`); - await queryRunner.query(`DROP INDEX "IDX_7e688e6613930ba721b841db43"`); - await queryRunner.query(`ALTER TABLE "email_template" RENAME TO "temporary_email_template"`); - await queryRunner.query( - `CREATE TABLE "email_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_c160fe6234675fac031aa3e7c50" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_753e005a45556b5909e11937aaf" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "email_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "isActive", "isArchived", "deletedAt" FROM "temporary_email_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_email_template"`); - await queryRunner.query(`CREATE INDEX "IDX_29d60114e1968c0cd68a19e3c5" ON "email_template" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e4932e0a726b9b07d81d8b6905" ON "email_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_753e005a45556b5909e11937aa" ON "email_template" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_c160fe6234675fac031aa3e7c5" ON "email_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_274708db64fcce5448f2c4541c" ON "email_template" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_7e688e6613930ba721b841db43" ON "email_template" ("languageCode") `); - await queryRunner.query(`DROP INDEX "IDX_13247a755d17e7905d5bb4cfda"`); - await queryRunner.query(`DROP INDEX "IDX_e3321e3575289b7ee1e8eb1042"`); - await queryRunner.query(`DROP INDEX "IDX_4ac734f2a1a3c055dca04fba99"`); - await queryRunner.query(`DROP INDEX "IDX_93799dfaeff51de06f1e02ac41"`); - await queryRunner.query(`DROP INDEX "IDX_03d16a2fd43d7c601743440212"`); - await queryRunner.query(`DROP INDEX "IDX_4be518a169bbcbfe92025ac574"`); - await queryRunner.query(`DROP INDEX "IDX_9e80c9ec749dfda6dbe2cd9704"`); - await queryRunner.query(`DROP INDEX "IDX_e37af4ab2ba0bf268bfd982634"`); - await queryRunner.query(`ALTER TABLE "email_reset" RENAME TO "temporary_email_reset"`); - await queryRunner.query( - `CREATE TABLE "email_reset" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "email" varchar NOT NULL, "oldEmail" varchar NOT NULL, "code" varchar NOT NULL, "userId" varchar, "token" varchar, "expiredAt" datetime, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_93799dfaeff51de06f1e02ac414" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e37af4ab2ba0bf268bfd9826345" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "email_reset"("id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "email", "oldEmail", "code", "userId", "token", "expiredAt", "isActive", "isArchived", "deletedAt" FROM "temporary_email_reset"` - ); - await queryRunner.query(`DROP TABLE "temporary_email_reset"`); - await queryRunner.query(`CREATE INDEX "IDX_13247a755d17e7905d5bb4cfda" ON "email_reset" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e3321e3575289b7ee1e8eb1042" ON "email_reset" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4ac734f2a1a3c055dca04fba99" ON "email_reset" ("token") `); - await queryRunner.query(`CREATE INDEX "IDX_93799dfaeff51de06f1e02ac41" ON "email_reset" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_03d16a2fd43d7c601743440212" ON "email_reset" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_4be518a169bbcbfe92025ac574" ON "email_reset" ("oldEmail") `); - await queryRunner.query(`CREATE INDEX "IDX_9e80c9ec749dfda6dbe2cd9704" ON "email_reset" ("code") `); - await queryRunner.query(`CREATE INDEX "IDX_e37af4ab2ba0bf268bfd982634" ON "email_reset" ("userId") `); - await queryRunner.query(`DROP INDEX "IDX_5956ce758c01ebf8a539e8d4f0"`); - await queryRunner.query(`DROP INDEX "IDX_9033faf41b23c61ba201c48796"`); - await queryRunner.query(`DROP INDEX "IDX_a954fda57cca81dc48446e73b8"`); - await queryRunner.query(`DROP INDEX "IDX_0af511c44de7a16beb45cc3785"`); - await queryRunner.query(`DROP INDEX "IDX_525f4873c6edc3d94559f88900"`); - await queryRunner.query(`DROP INDEX "IDX_953df0eb0df3035baf140399f6"`); - await queryRunner.query(`DROP INDEX "IDX_1261c457b3035b77719556995b"`); - await queryRunner.query(`DROP INDEX "IDX_d825bc6da1c52a3900a9373260"`); - await queryRunner.query(`DROP INDEX "IDX_9a69f7077e0333d2c848895a1b"`); - await queryRunner.query(`ALTER TABLE "email_sent" RENAME TO "temporary_email_sent"`); - await queryRunner.query( - `CREATE TABLE "email_sent" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "content" varchar, "email" varchar NOT NULL, "isArchived" boolean DEFAULT (0), "userId" varchar, "emailTemplateId" varchar NOT NULL, "isActive" boolean DEFAULT (1), "status" varchar CHECK( "status" IN ('SENT','FAILED') ), "deletedAt" datetime, CONSTRAINT "FK_1261c457b3035b77719556995bf" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_525f4873c6edc3d94559f88900c" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_0af511c44de7a16beb45cc37852" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9033faf41b23c61ba201c487969" FOREIGN KEY ("emailTemplateId") REFERENCES "email_template" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "email_sent"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "content", "email", "isArchived", "userId", "emailTemplateId", "isActive", "status", "deletedAt" FROM "temporary_email_sent"` - ); - await queryRunner.query(`DROP TABLE "temporary_email_sent"`); - await queryRunner.query(`CREATE INDEX "IDX_5956ce758c01ebf8a539e8d4f0" ON "email_sent" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_9033faf41b23c61ba201c48796" ON "email_sent" ("emailTemplateId") `); - await queryRunner.query(`CREATE INDEX "IDX_a954fda57cca81dc48446e73b8" ON "email_sent" ("email") `); - await queryRunner.query(`CREATE INDEX "IDX_0af511c44de7a16beb45cc3785" ON "email_sent" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_525f4873c6edc3d94559f88900" ON "email_sent" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_953df0eb0df3035baf140399f6" ON "email_sent" ("name") `); - await queryRunner.query(`CREATE INDEX "IDX_1261c457b3035b77719556995b" ON "email_sent" ("userId") `); - await queryRunner.query(`CREATE INDEX "IDX_d825bc6da1c52a3900a9373260" ON "email_sent" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_9a69f7077e0333d2c848895a1b" ON "email_sent" ("isArchived") `); - await queryRunner.query(`DROP INDEX "IDX_443c561d45f6c57f3790a759ba"`); - await queryRunner.query(`DROP INDEX "IDX_0d8c964237e5061627de82df80"`); - await queryRunner.query(`DROP INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0"`); - await queryRunner.query(`DROP INDEX "IDX_38fb85abdf9995efcf217f5955"`); - await queryRunner.query(`DROP INDEX "IDX_4b1ff44e6bae5065429dbab554"`); - await queryRunner.query(`DROP INDEX "IDX_9211f5b62988df6e95522be7da"`); - await queryRunner.query(`ALTER TABLE "deal" RENAME TO "temporary_deal"`); - await queryRunner.query( - `CREATE TABLE "deal" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "probability" integer NOT NULL, "createdByUserId" varchar NOT NULL, "stageId" varchar NOT NULL, "clientId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_1ae3abc0ae1dcf6c13f49b62b5" UNIQUE ("clientId"), CONSTRAINT "FK_1ae3abc0ae1dcf6c13f49b62b56" FOREIGN KEY ("clientId") REFERENCES "organization_contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9211f5b62988df6e95522be7daa" FOREIGN KEY ("stageId") REFERENCES "pipeline_stage" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4b1ff44e6bae5065429dbab554b" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_38fb85abdf9995efcf217f59554" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_46a3c00bfc3e36b4412d8bcdb08" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "deal"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "probability", "createdByUserId", "stageId", "clientId", "isActive", "isArchived", "deletedAt" FROM "temporary_deal"` - ); - await queryRunner.query(`DROP TABLE "temporary_deal"`); - await queryRunner.query(`CREATE INDEX "IDX_443c561d45f6c57f3790a759ba" ON "deal" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_0d8c964237e5061627de82df80" ON "deal" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_46a3c00bfc3e36b4412d8bcdb0" ON "deal" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_38fb85abdf9995efcf217f5955" ON "deal" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_4b1ff44e6bae5065429dbab554" ON "deal" ("createdByUserId") `); - await queryRunner.query(`CREATE INDEX "IDX_9211f5b62988df6e95522be7da" ON "deal" ("stageId") `); - await queryRunner.query(`DROP INDEX "IDX_f10372f9d038d0954d5b20635a"`); - await queryRunner.query(`DROP INDEX "IDX_e2c7d28bb07adc915d74437c7b"`); - await queryRunner.query(`DROP INDEX "IDX_15a1306132d66c63ef31f7288c"`); - await queryRunner.query(`DROP INDEX "IDX_2aa3fc8daa25beec4788d2be26"`); - await queryRunner.query(`ALTER TABLE "custom_smtp" RENAME TO "temporary_custom_smtp"`); - await queryRunner.query( - `CREATE TABLE "custom_smtp" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "host" varchar NOT NULL, "port" integer NOT NULL, "secure" boolean NOT NULL, "username" varchar NOT NULL, "password" varchar NOT NULL, "isValidate" boolean NOT NULL DEFAULT (0), "fromAddress" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_2aa3fc8daa25beec4788d2be26c" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_15a1306132d66c63ef31f7288c1" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "custom_smtp"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "host", "port", "secure", "username", "password", "isValidate", "fromAddress", "isActive", "isArchived", "deletedAt" FROM "temporary_custom_smtp"` - ); - await queryRunner.query(`DROP TABLE "temporary_custom_smtp"`); - await queryRunner.query(`CREATE INDEX "IDX_f10372f9d038d0954d5b20635a" ON "custom_smtp" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_e2c7d28bb07adc915d74437c7b" ON "custom_smtp" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_15a1306132d66c63ef31f7288c" ON "custom_smtp" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_2aa3fc8daa25beec4788d2be26" ON "custom_smtp" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_8203f1410475748bbbc6d3029d"`); - await queryRunner.query(`DROP INDEX "IDX_03cc024ddc2f196dca7fead7cb"`); - await queryRunner.query(`DROP INDEX "IDX_0b0fbda74f6c82c943e706a3cc"`); - await queryRunner.query(`ALTER TABLE "currency" RENAME TO "temporary_currency"`); - await queryRunner.query( - `CREATE TABLE "currency" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "currency" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "currency"("id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "currency", "isActive", "isArchived", "deletedAt" FROM "temporary_currency"` - ); - await queryRunner.query(`DROP TABLE "temporary_currency"`); - await queryRunner.query(`CREATE INDEX "IDX_8203f1410475748bbbc6d3029d" ON "currency" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_03cc024ddc2f196dca7fead7cb" ON "currency" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_0b0fbda74f6c82c943e706a3cc" ON "currency" ("isoCode") `); - await queryRunner.query(`DROP INDEX "IDX_6cd9b7ea6818e862217035436c"`); - await queryRunner.query(`DROP INDEX "IDX_97ebcd8db30a408b5f907d6ff4"`); - await queryRunner.query(`DROP INDEX "IDX_6eba1a52ee121d100c8a0a6510"`); - await queryRunner.query(`ALTER TABLE "country" RENAME TO "temporary_country"`); - await queryRunner.query( - `CREATE TABLE "country" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isoCode" varchar NOT NULL, "country" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime)` - ); - await queryRunner.query( - `INSERT INTO "country"("id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "isoCode", "country", "isActive", "isArchived", "deletedAt" FROM "temporary_country"` - ); - await queryRunner.query(`DROP TABLE "temporary_country"`); - await queryRunner.query(`CREATE INDEX "IDX_6cd9b7ea6818e862217035436c" ON "country" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_97ebcd8db30a408b5f907d6ff4" ON "country" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6eba1a52ee121d100c8a0a6510" ON "country" ("isoCode") `); - await queryRunner.query(`DROP INDEX "IDX_4164bd34bdcce8754641f0e567"`); - await queryRunner.query(`DROP INDEX "IDX_05831d37eabeb6150f99c69784"`); - await queryRunner.query(`DROP INDEX "IDX_7719d73cd16a9f57ecc6ac24b3"`); - await queryRunner.query(`DROP INDEX "IDX_60468af1ce34043a900809c84f"`); - await queryRunner.query(`ALTER TABLE "contact" RENAME TO "temporary_contact"`); - await queryRunner.query( - `CREATE TABLE "contact" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar, "firstName" varchar, "lastName" varchar, "country" varchar, "city" varchar, "address" varchar, "address2" varchar, "postcode" varchar, "latitude" numeric, "longitude" numeric, "regionCode" varchar, "fax" varchar, "fiscalInformation" varchar, "website" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_60468af1ce34043a900809c84f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_7719d73cd16a9f57ecc6ac24b3d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE)` - ); - await queryRunner.query( - `INSERT INTO "contact"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "firstName", "lastName", "country", "city", "address", "address2", "postcode", "latitude", "longitude", "regionCode", "fax", "fiscalInformation", "website", "isActive", "isArchived", "deletedAt" FROM "temporary_contact"` - ); - await queryRunner.query(`DROP TABLE "temporary_contact"`); - await queryRunner.query(`CREATE INDEX "IDX_4164bd34bdcce8754641f0e567" ON "contact" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_05831d37eabeb6150f99c69784" ON "contact" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_7719d73cd16a9f57ecc6ac24b3" ON "contact" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_60468af1ce34043a900809c84f" ON "contact" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_af835b66fa10279103bd89e225"`); - await queryRunner.query(`DROP INDEX "IDX_2b8091376a529383e23ba3356a"`); - await queryRunner.query(`DROP INDEX "IDX_8b900e8a39f76125e610ab30c0"`); - await queryRunner.query(`DROP INDEX "IDX_77ac426e04553ff1654421bce4"`); - await queryRunner.query(`DROP INDEX "IDX_16fb27ffd1a99c6506c92ad57a"`); - await queryRunner.query(`DROP INDEX "IDX_b674793a804b7d69d74c8f6c5b"`); - await queryRunner.query(`DROP INDEX "IDX_1e3e8228e7df634fa4cec6322c"`); - await queryRunner.query(`DROP INDEX "IDX_4ea108fd8b089237964d5f98fb"`); - await queryRunner.query(`DROP INDEX "IDX_3930aa71e0fa24f09201811b1b"`); - await queryRunner.query(`ALTER TABLE "candidate" RENAME TO "temporary_candidate"`); - await queryRunner.query( - `CREATE TABLE "candidate" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" numeric, "valueDate" datetime, "appliedDate" datetime, "hiredDate" datetime, "status" varchar DEFAULT ('APPLIED'), "rejectDate" datetime, "candidateLevel" varchar(500), "reWeeklyLimit" integer, "billRateCurrency" varchar(255), "billRateValue" integer, "payPeriod" varchar, "cvUrl" varchar, "isArchived" boolean DEFAULT (0), "contactId" varchar, "organizationPositionId" varchar, "sourceId" varchar, "userId" varchar NOT NULL, "employeeId" varchar, "minimumBillingRate" integer, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "REL_3930aa71e0fa24f09201811b1b" UNIQUE ("userId"), CONSTRAINT "REL_4ea108fd8b089237964d5f98fb" UNIQUE ("sourceId"), CONSTRAINT "REL_b674793a804b7d69d74c8f6c5b" UNIQUE ("contactId"), CONSTRAINT "UQ_91b20077aa92f9115764033cd06" UNIQUE ("employeeId"), CONSTRAINT "FK_3930aa71e0fa24f09201811b1bb" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_4ea108fd8b089237964d5f98fba" FOREIGN KEY ("sourceId") REFERENCES "candidate_source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1e3e8228e7df634fa4cec6322c7" FOREIGN KEY ("organizationPositionId") REFERENCES "organization_position" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_b674793a804b7d69d74c8f6c5ba" FOREIGN KEY ("contactId") REFERENCES "contact" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_16fb27ffd1a99c6506c92ad57a7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_77ac426e04553ff1654421bce4d" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_8b900e8a39f76125e610ab30c0e" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "valueDate", "appliedDate", "hiredDate", "status", "rejectDate", "candidateLevel", "reWeeklyLimit", "billRateCurrency", "billRateValue", "payPeriod", "cvUrl", "isArchived", "contactId", "organizationPositionId", "sourceId", "userId", "employeeId", "minimumBillingRate", "isActive", "deletedAt" FROM "temporary_candidate"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate"`); - await queryRunner.query(`CREATE INDEX "IDX_af835b66fa10279103bd89e225" ON "candidate" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_2b8091376a529383e23ba3356a" ON "candidate" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8b900e8a39f76125e610ab30c0" ON "candidate" ("employeeId") `); - await queryRunner.query(`CREATE INDEX "IDX_77ac426e04553ff1654421bce4" ON "candidate" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_16fb27ffd1a99c6506c92ad57a" ON "candidate" ("organizationId") `); - await queryRunner.query(`CREATE INDEX "IDX_b674793a804b7d69d74c8f6c5b" ON "candidate" ("contactId") `); - await queryRunner.query( - `CREATE INDEX "IDX_1e3e8228e7df634fa4cec6322c" ON "candidate" ("organizationPositionId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_4ea108fd8b089237964d5f98fb" ON "candidate" ("sourceId") `); - await queryRunner.query(`CREATE INDEX "IDX_3930aa71e0fa24f09201811b1b" ON "candidate" ("userId") `); - await queryRunner.query(`DROP INDEX "IDX_97aa0328b72e1bf919e61bccdc"`); - await queryRunner.query(`DROP INDEX "IDX_199ca43300fa4e64239656a677"`); - await queryRunner.query(`DROP INDEX "IDX_a6fecb615b07987b480defac64"`); - await queryRunner.query(`DROP INDEX "IDX_9d46b8c5382acd4d4514bc5c62"`); - await queryRunner.query(`DROP INDEX "IDX_063663c7e61e45d172d1b83265"`); - await queryRunner.query(`ALTER TABLE "candidate_technology" RENAME TO "temporary_candidate_technology"`); - await queryRunner.query( - `CREATE TABLE "candidate_technology" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_063663c7e61e45d172d1b832656" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_9d46b8c5382acd4d4514bc5c62e" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a6fecb615b07987b480defac647" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_technology"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_technology"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_technology"`); - await queryRunner.query( - `CREATE INDEX "IDX_97aa0328b72e1bf919e61bccdc" ON "candidate_technology" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_199ca43300fa4e64239656a677" ON "candidate_technology" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a6fecb615b07987b480defac64" ON "candidate_technology" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d46b8c5382acd4d4514bc5c62" ON "candidate_technology" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_063663c7e61e45d172d1b83265" ON "candidate_technology" ("interviewId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_509101ab1a46a5934ee278d447"`); - await queryRunner.query(`DROP INDEX "IDX_2be9182096747fb18cb8afb1f0"`); - await queryRunner.query(`DROP INDEX "IDX_b2a1ba27a76dd819cd8294cce3"`); - await queryRunner.query(`DROP INDEX "IDX_e92027b5280828cadd7cd6ea71"`); - await queryRunner.query(`ALTER TABLE "candidate_source" RENAME TO "temporary_candidate_source"`); - await queryRunner.query( - `CREATE TABLE "candidate_source" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e92027b5280828cadd7cd6ea719" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_b2a1ba27a76dd819cd8294cce38" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_source"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_source"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_source"`); - await queryRunner.query(`CREATE INDEX "IDX_509101ab1a46a5934ee278d447" ON "candidate_source" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_2be9182096747fb18cb8afb1f0" ON "candidate_source" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_b2a1ba27a76dd819cd8294cce3" ON "candidate_source" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_e92027b5280828cadd7cd6ea71" ON "candidate_source" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347"`); - await queryRunner.query(`DROP INDEX "IDX_6907163d0bb8e9f0440b9bf2a7"`); - await queryRunner.query(`DROP INDEX "IDX_8a07f780c6fce2b82830ab0687"`); - await queryRunner.query(`DROP INDEX "IDX_d7986743e7f11720349a6c9557"`); - await queryRunner.query(`ALTER TABLE "candidate_skill" RENAME TO "temporary_candidate_skill"`); - await queryRunner.query( - `CREATE TABLE "candidate_skill" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_492548e6c176f5655adfae9f5ea" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d7986743e7f11720349a6c95572" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8a07f780c6fce2b82830ab06877" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_skill"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_skill"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_skill"`); - await queryRunner.query(`CREATE INDEX "IDX_a38fe0c3f2ff0a4e475f2a1347" ON "candidate_skill" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_6907163d0bb8e9f0440b9bf2a7" ON "candidate_skill" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_8a07f780c6fce2b82830ab0687" ON "candidate_skill" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d7986743e7f11720349a6c9557" ON "candidate_skill" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_ff6776d92db4ef71edbfba9903"`); - await queryRunner.query(`DROP INDEX "IDX_afe01503d4337c9623c06f22df"`); - await queryRunner.query(`DROP INDEX "IDX_045de7c208adcd0c68c0a65174"`); - await queryRunner.query(`DROP INDEX "IDX_d321f4547ed467d07cce1e7d9a"`); - await queryRunner.query(`DROP INDEX "IDX_a0d171f45bdbcf2b990c0c37c3"`); - await queryRunner.query( - `ALTER TABLE "candidate_personal_quality" RENAME TO "temporary_candidate_personal_quality"` - ); - await queryRunner.query( - `CREATE TABLE "candidate_personal_quality" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "rating" numeric, "interviewId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_a0d171f45bdbcf2b990c0c37c32" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d321f4547ed467d07cce1e7d9a5" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_045de7c208adcd0c68c0a651748" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_personal_quality"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "rating", "interviewId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_personal_quality"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_personal_quality"`); - await queryRunner.query( - `CREATE INDEX "IDX_ff6776d92db4ef71edbfba9903" ON "candidate_personal_quality" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_afe01503d4337c9623c06f22df" ON "candidate_personal_quality" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_045de7c208adcd0c68c0a65174" ON "candidate_personal_quality" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d321f4547ed467d07cce1e7d9a" ON "candidate_personal_quality" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a0d171f45bdbcf2b990c0c37c3" ON "candidate_personal_quality" ("interviewId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2043abff09f084fb8690009fb8"`); - await queryRunner.query(`DROP INDEX "IDX_b9132118c3a98c4c48e417c0c5"`); - await queryRunner.query(`DROP INDEX "IDX_f0ca69c78eea92c95d9044764a"`); - await queryRunner.query(`DROP INDEX "IDX_5f1e315db848990dfffa72817c"`); - await queryRunner.query(`DROP INDEX "IDX_ecb65075e94b47bbab11cfa5a1"`); - await queryRunner.query(`DROP INDEX "IDX_9e7b20eb3dfa082b83b198fdad"`); - await queryRunner.query(`ALTER TABLE "candidate_interviewer" RENAME TO "temporary_candidate_interviewer"`); - await queryRunner.query( - `CREATE TABLE "candidate_interviewer" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "interviewId" varchar NOT NULL, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_9e7b20eb3dfa082b83b198fdad4" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ecb65075e94b47bbab11cfa5a1e" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5f1e315db848990dfffa72817ca" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f0ca69c78eea92c95d9044764a2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_interviewer"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "interviewId", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_interviewer"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_interviewer"`); - await queryRunner.query( - `CREATE INDEX "IDX_2043abff09f084fb8690009fb8" ON "candidate_interviewer" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b9132118c3a98c4c48e417c0c5" ON "candidate_interviewer" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f0ca69c78eea92c95d9044764a" ON "candidate_interviewer" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_5f1e315db848990dfffa72817c" ON "candidate_interviewer" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ecb65075e94b47bbab11cfa5a1" ON "candidate_interviewer" ("interviewId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9e7b20eb3dfa082b83b198fdad" ON "candidate_interviewer" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_7b49ce2928b327213f2de66b95"`); - await queryRunner.query(`DROP INDEX "IDX_b9191cf49f8cd1f192cb74233c"`); - await queryRunner.query(`DROP INDEX "IDX_91996439c4baafee8395d3df15"`); - await queryRunner.query(`DROP INDEX "IDX_03be41e88b1fecfe4e24d6b04b"`); - await queryRunner.query(`DROP INDEX "IDX_59b765e6d13d83dba4852a43eb"`); - await queryRunner.query(`ALTER TABLE "candidate_interview" RENAME TO "temporary_candidate_interview"`); - await queryRunner.query( - `CREATE TABLE "candidate_interview" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "title" varchar NOT NULL, "startTime" datetime, "endTime" datetime, "location" varchar, "note" varchar, "isArchived" boolean DEFAULT (0), "rating" numeric, "candidateId" varchar, "isActive" boolean DEFAULT (1), "deletedAt" datetime, CONSTRAINT "FK_59b765e6d13d83dba4852a43eb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_03be41e88b1fecfe4e24d6b04b2" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_91996439c4baafee8395d3df153" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_interview"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "title", "startTime", "endTime", "location", "note", "isArchived", "rating", "candidateId", "isActive", "deletedAt" FROM "temporary_candidate_interview"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_interview"`); - await queryRunner.query( - `CREATE INDEX "IDX_7b49ce2928b327213f2de66b95" ON "candidate_interview" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_b9191cf49f8cd1f192cb74233c" ON "candidate_interview" ("isActive") `); - await queryRunner.query( - `CREATE INDEX "IDX_91996439c4baafee8395d3df15" ON "candidate_interview" ("candidateId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_03be41e88b1fecfe4e24d6b04b" ON "candidate_interview" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_59b765e6d13d83dba4852a43eb" ON "candidate_interview" ("tenantId") `); - await queryRunner.query(`DROP INDEX "IDX_05ed49a5ebdd5ec533f913b620"`); - await queryRunner.query(`DROP INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb"`); - await queryRunner.query(`DROP INDEX "IDX_6cb21fa0f65ff69679966c836f"`); - await queryRunner.query(`DROP INDEX "IDX_3a6928f8501fce33820721a8fe"`); - await queryRunner.query(`DROP INDEX "IDX_98c008fd8cf597e83dcdccfd16"`); - await queryRunner.query(`DROP INDEX "IDX_0862c274d336126b951bfe009a"`); - await queryRunner.query(`ALTER TABLE "candidate_feedback" RENAME TO "temporary_candidate_feedback"`); - await queryRunner.query( - `CREATE TABLE "candidate_feedback" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "description" varchar, "rating" numeric, "status" varchar, "candidateId" varchar, "interviewId" varchar, "interviewerId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "REL_44f3d80c3293e1de038c87f115" UNIQUE ("interviewerId"), CONSTRAINT "FK_44f3d80c3293e1de038c87f115d" FOREIGN KEY ("interviewerId") REFERENCES "candidate_interviewer" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT "FK_0862c274d336126b951bfe009a7" FOREIGN KEY ("interviewId") REFERENCES "candidate_interview" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_98c008fd8cf597e83dcdccfd161" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3a6928f8501fce33820721a8fe8" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6cb21fa0f65ff69679966c836f2" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_feedback"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "description", "rating", "status", "candidateId", "interviewId", "interviewerId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_feedback"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_feedback"`); - await queryRunner.query( - `CREATE INDEX "IDX_05ed49a5ebdd5ec533f913b620" ON "candidate_feedback" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_c660aef2ca5aff9dbf45a9a4bb" ON "candidate_feedback" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_6cb21fa0f65ff69679966c836f" ON "candidate_feedback" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_3a6928f8501fce33820721a8fe" ON "candidate_feedback" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_98c008fd8cf597e83dcdccfd16" ON "candidate_feedback" ("candidateId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0862c274d336126b951bfe009a" ON "candidate_feedback" ("interviewId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_c24bce6dd33e56ef8e8dacef1a"`); - await queryRunner.query(`DROP INDEX "IDX_dafa68d060cf401d5f62a57ad4"`); - await queryRunner.query(`DROP INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf"`); - await queryRunner.query(`DROP INDEX "IDX_a50eb955f940ca93e044d175c6"`); - await queryRunner.query(`ALTER TABLE "candidate_experience" RENAME TO "temporary_candidate_experience"`); - await queryRunner.query( - `CREATE TABLE "candidate_experience" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "occupation" varchar NOT NULL, "duration" varchar NOT NULL, "description" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_cf75465b3663652a28cf1841ce2" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a50eb955f940ca93e044d175c62" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_8dcf5fc8bc7f77a80b0fc648bfc" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_experience"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "occupation", "duration", "description", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_experience"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_experience"`); - await queryRunner.query( - `CREATE INDEX "IDX_c24bce6dd33e56ef8e8dacef1a" ON "candidate_experience" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_dafa68d060cf401d5f62a57ad4" ON "candidate_experience" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_8dcf5fc8bc7f77a80b0fc648bf" ON "candidate_experience" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a50eb955f940ca93e044d175c6" ON "candidate_experience" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_b443c78c3796f2e9aab05a2bb9"`); - await queryRunner.query(`DROP INDEX "IDX_336eb14606016757d2302efa4d"`); - await queryRunner.query(`DROP INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd"`); - await queryRunner.query(`DROP INDEX "IDX_f660af89b2c69fea2334508cbb"`); - await queryRunner.query(`ALTER TABLE "candidate_education" RENAME TO "temporary_candidate_education"`); - await queryRunner.query( - `CREATE TABLE "candidate_education" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "schoolName" varchar NOT NULL, "degree" varchar NOT NULL, "field" varchar NOT NULL, "completionDate" datetime NOT NULL, "notes" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_59b61ba52a58851cfc85b1e6c66" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_f660af89b2c69fea2334508cbbd" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_00cdd9ed7571be8e2c8d09e7cd4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_education"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "schoolName", "degree", "field", "completionDate", "notes", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_education"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_education"`); - await queryRunner.query( - `CREATE INDEX "IDX_b443c78c3796f2e9aab05a2bb9" ON "candidate_education" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_336eb14606016757d2302efa4d" ON "candidate_education" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_00cdd9ed7571be8e2c8d09e7cd" ON "candidate_education" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_f660af89b2c69fea2334508cbb" ON "candidate_education" ("organizationId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3ed4bac12d0ca32eada4ea5a49"`); - await queryRunner.query(`DROP INDEX "IDX_bf8070715e42b3afe9730e7b30"`); - await queryRunner.query(`DROP INDEX "IDX_4d9b7ab09f9f9517d488b5fed1"`); - await queryRunner.query(`DROP INDEX "IDX_d108a827199fda86a9ec216989"`); - await queryRunner.query(`DROP INDEX "IDX_3f9053719c9d11ebdea03e5a2d"`); - await queryRunner.query(`ALTER TABLE "candidate_document" RENAME TO "temporary_candidate_document"`); - await queryRunner.query( - `CREATE TABLE "candidate_document" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "documentUrl" varchar, "candidateId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_3f9053719c9d11ebdea03e5a2d4" FOREIGN KEY ("candidateId") REFERENCES "candidate" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d108a827199fda86a9ec216989a" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4d9b7ab09f9f9517d488b5fed1e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_document"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "documentUrl", "candidateId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_document"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_document"`); - await queryRunner.query( - `CREATE INDEX "IDX_3ed4bac12d0ca32eada4ea5a49" ON "candidate_document" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_bf8070715e42b3afe9730e7b30" ON "candidate_document" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_4d9b7ab09f9f9517d488b5fed1" ON "candidate_document" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d108a827199fda86a9ec216989" ON "candidate_document" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3f9053719c9d11ebdea03e5a2d" ON "candidate_document" ("candidateId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_fcab96cef60fd8bccac610ccef"`); - await queryRunner.query(`DROP INDEX "IDX_0a417dafb1dd14eb92a69fa641"`); - await queryRunner.query(`DROP INDEX "IDX_9d5bd131452ef689df2b46551b"`); - await queryRunner.query(`DROP INDEX "IDX_b106406e94bb7317493efc2c98"`); - await queryRunner.query(`DROP INDEX "IDX_d1d16bc87d3afaf387f34cdceb"`); - await queryRunner.query(`DROP INDEX "IDX_ba4c376b2069aa82745d4e9682"`); - await queryRunner.query(`DROP INDEX "IDX_159f821dd214792f1d2ad9cff7"`); - await queryRunner.query( - `ALTER TABLE "candidate_criterion_rating" RENAME TO "temporary_candidate_criterion_rating"` - ); - await queryRunner.query( - `CREATE TABLE "candidate_criterion_rating" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "rating" integer NOT NULL, "technologyId" varchar, "personalQualityId" varchar, "feedbackId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_159f821dd214792f1d2ad9cff7c" FOREIGN KEY ("feedbackId") REFERENCES "candidate_feedback" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_ba4c376b2069aa82745d4e96822" FOREIGN KEY ("personalQualityId") REFERENCES "candidate_personal_quality" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d1d16bc87d3afaf387f34cdceb7" FOREIGN KEY ("technologyId") REFERENCES "candidate_technology" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_b106406e94bb7317493efc2c989" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_9d5bd131452ef689df2b46551b4" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "candidate_criterion_rating"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "rating", "technologyId", "personalQualityId", "feedbackId", "isActive", "isArchived", "deletedAt" FROM "temporary_candidate_criterion_rating"` - ); - await queryRunner.query(`DROP TABLE "temporary_candidate_criterion_rating"`); - await queryRunner.query( - `CREATE INDEX "IDX_fcab96cef60fd8bccac610ccef" ON "candidate_criterion_rating" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0a417dafb1dd14eb92a69fa641" ON "candidate_criterion_rating" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d5bd131452ef689df2b46551b" ON "candidate_criterion_rating" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_b106406e94bb7317493efc2c98" ON "candidate_criterion_rating" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_d1d16bc87d3afaf387f34cdceb" ON "candidate_criterion_rating" ("technologyId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_ba4c376b2069aa82745d4e9682" ON "candidate_criterion_rating" ("personalQualityId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_159f821dd214792f1d2ad9cff7" ON "candidate_criterion_rating" ("feedbackId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_a2eb41b1d6ee72de9486558199"`); - await queryRunner.query(`DROP INDEX "IDX_1d8e3566b66fbad38b6e2290a2"`); - await queryRunner.query(`DROP INDEX "IDX_a3b32d609a4c884a776ab883be"`); - await queryRunner.query(`DROP INDEX "IDX_e8b7694e86fe9534778832f90c"`); - await queryRunner.query(`ALTER TABLE "social_account" RENAME TO "temporary_social_account"`); - await queryRunner.query( - `CREATE TABLE "social_account" ("deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "provider" varchar NOT NULL, "providerAccountId" varchar NOT NULL, "userId" varchar NOT NULL, CONSTRAINT "FK_e8b7694e86fe9534778832f90c0" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a3b32d609a4c884a776ab883be3" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "social_account"("deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId") SELECT "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "provider", "providerAccountId", "userId" FROM "temporary_social_account"` - ); - await queryRunner.query(`DROP TABLE "temporary_social_account"`); - await queryRunner.query(`CREATE INDEX "IDX_a2eb41b1d6ee72de9486558199" ON "social_account" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1d8e3566b66fbad38b6e2290a2" ON "social_account" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_a3b32d609a4c884a776ab883be" ON "social_account" ("tenantId") `); - await queryRunner.query(`CREATE INDEX "IDX_e8b7694e86fe9534778832f90c" ON "social_account" ("userId") `); - await queryRunner.query(`DROP INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca"`); - await queryRunner.query(`DROP INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe"`); - await queryRunner.query(`DROP INDEX "IDX_f008a481cb4eed547704bb9d83"`); - await queryRunner.query(`DROP INDEX "IDX_d544bd3a63634a4438509ac958"`); - await queryRunner.query(`DROP INDEX "IDX_46ed3c2287423f5dc089100fee"`); - await queryRunner.query(`ALTER TABLE "availability_slot" RENAME TO "temporary_availability_slot"`); - await queryRunner.query( - `CREATE TABLE "availability_slot" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "startTime" datetime NOT NULL, "endTime" datetime NOT NULL, "allDay" boolean NOT NULL, "type" text, "employeeId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_46ed3c2287423f5dc089100feeb" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_d544bd3a63634a4438509ac958d" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_f008a481cb4eed547704bb9d839" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "availability_slot"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "startTime", "endTime", "allDay", "type", "employeeId", "isActive", "isArchived", "deletedAt" FROM "temporary_availability_slot"` - ); - await queryRunner.query(`DROP TABLE "temporary_availability_slot"`); - await queryRunner.query(`CREATE INDEX "IDX_3aabb2cdf5b6e0df87cb94bdca" ON "availability_slot" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_3e20b617c7d7a87b8bf53ddcbe" ON "availability_slot" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_f008a481cb4eed547704bb9d83" ON "availability_slot" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_d544bd3a63634a4438509ac958" ON "availability_slot" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_46ed3c2287423f5dc089100fee" ON "availability_slot" ("employeeId") `); - await queryRunner.query(`DROP INDEX "IDX_f50ce5a39d610cfcd9da9652b1"`); - await queryRunner.query(`DROP INDEX "IDX_338364927c68961167606e989c"`); - await queryRunner.query(`DROP INDEX "IDX_1462391059ebe137645098d727"`); - await queryRunner.query(`DROP INDEX "IDX_dfe3b357df3ce136917b1f0984"`); - await queryRunner.query(`DROP INDEX "IDX_45f32a5a12d42fba17fe62a279"`); - await queryRunner.query(`ALTER TABLE "approval_policy" RENAME TO "temporary_approval_policy"`); - await queryRunner.query( - `CREATE TABLE "approval_policy" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "description" varchar, "approvalType" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_dfe3b357df3ce136917b1f09843" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_1462391059ebe137645098d7276" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "approval_policy"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "description", "approvalType", "isActive", "isArchived", "deletedAt" FROM "temporary_approval_policy"` - ); - await queryRunner.query(`DROP TABLE "temporary_approval_policy"`); - await queryRunner.query(`CREATE INDEX "IDX_f50ce5a39d610cfcd9da9652b1" ON "approval_policy" ("isArchived") `); - await queryRunner.query(`CREATE INDEX "IDX_338364927c68961167606e989c" ON "approval_policy" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_1462391059ebe137645098d727" ON "approval_policy" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_dfe3b357df3ce136917b1f0984" ON "approval_policy" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_45f32a5a12d42fba17fe62a279" ON "approval_policy" ("name") `); - await queryRunner.query(`DROP INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3"`); - await queryRunner.query(`DROP INDEX "IDX_379af16b0aeed6a4d8f15c53bc"`); - await queryRunner.query(`DROP INDEX "IDX_2c0494466d5a7e1165cea3dca9"`); - await queryRunner.query(`DROP INDEX "IDX_3c3a62226896345c4716bfe1d9"`); - await queryRunner.query(`DROP INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba"`); - await queryRunner.query(`DROP INDEX "IDX_e9ca170a0fae05e44a9bd137d8"`); - await queryRunner.query(`ALTER TABLE "appointment_employee" RENAME TO "temporary_appointment_employee"`); - await queryRunner.query( - `CREATE TABLE "appointment_employee" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "appointmentId" varchar NOT NULL, "employeeId" varchar NOT NULL, "employeeAppointmentId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e9ca170a0fae05e44a9bd137d8b" FOREIGN KEY ("employeeAppointmentId") REFERENCES "employee_appointment" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_0ddc50b7521b9a905d9ca8c8ba3" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_3c3a62226896345c4716bfe1d96" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2c0494466d5a7e1165cea3dca98" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "appointment_employee"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "appointmentId", "employeeId", "employeeAppointmentId", "isActive", "isArchived", "deletedAt" FROM "temporary_appointment_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_appointment_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_2a6f8c4b8da6f85e2903daf5c3" ON "appointment_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_379af16b0aeed6a4d8f15c53bc" ON "appointment_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2c0494466d5a7e1165cea3dca9" ON "appointment_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3c3a62226896345c4716bfe1d9" ON "appointment_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_0ddc50b7521b9a905d9ca8c8ba" ON "appointment_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_e9ca170a0fae05e44a9bd137d8" ON "appointment_employee" ("employeeAppointmentId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_7ac2c1c487dd77fe38c2d571ea"`); - await queryRunner.query(`DROP INDEX "IDX_5cf7c007fc9c83bee748f08806"`); - await queryRunner.query(`DROP INDEX "IDX_2ca6a49062a4ed884e413bf572"`); - await queryRunner.query(`DROP INDEX "IDX_e66511b175393255c6c4e7b007"`); - await queryRunner.query(`DROP INDEX "IDX_968c1c9a131a61a3720b3a72f6"`); - await queryRunner.query(`DROP INDEX "IDX_a841eabc6b656c965d8846223e"`); - await queryRunner.query(`ALTER TABLE "accounting_template" RENAME TO "temporary_accounting_template"`); - await queryRunner.query( - `CREATE TABLE "accounting_template" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "languageCode" varchar NOT NULL, "mjml" text, "hbs" varchar NOT NULL, "templateType" varchar NOT NULL, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "deletedAt" datetime, CONSTRAINT "FK_e66511b175393255c6c4e7b007f" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ca6a49062a4ed884e413bf572e" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "accounting_template"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "languageCode", "mjml", "hbs", "templateType", "isActive", "isArchived", "deletedAt" FROM "temporary_accounting_template"` - ); - await queryRunner.query(`DROP TABLE "temporary_accounting_template"`); - await queryRunner.query( - `CREATE INDEX "IDX_7ac2c1c487dd77fe38c2d571ea" ON "accounting_template" ("isArchived") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_5cf7c007fc9c83bee748f08806" ON "accounting_template" ("isActive") `); - await queryRunner.query(`CREATE INDEX "IDX_2ca6a49062a4ed884e413bf572" ON "accounting_template" ("tenantId") `); - await queryRunner.query( - `CREATE INDEX "IDX_e66511b175393255c6c4e7b007" ON "accounting_template" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_968c1c9a131a61a3720b3a72f6" ON "accounting_template" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_a841eabc6b656c965d8846223e" ON "accounting_template" ("languageCode") ` - ); - } - - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`accounting_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`approval_policy\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`availability_slot\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`social_account\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_document\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_education\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_experience\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_interview\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_skill\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_source\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate_technology\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`candidate\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`contact\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`country\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`currency\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`custom_smtp\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`deal\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`email_sent\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`email_reset\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`email_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_appointment\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_award\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_level\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_phone\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`equipment\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`estimate_email\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`event_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`expense_category\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`expense\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`import-history\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`import-record\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`feature_organization\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`feature\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal_general_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal_kpi\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal_time_frame\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`goal\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`image_asset\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`income\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_map\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_tenant\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`integration\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`invite\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`invoice\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`key_result_update\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`key_result\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`language\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`merchant\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_award\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_department\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_document\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_employment_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_language\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_position\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`status\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archiveTasksIn\` decimal NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`closeTasksIn\` decimal NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`managerId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`defaultAssigneeId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_module\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_sprint\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_team\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_vendor\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`password_reset\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`payment\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`pipeline_stage\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`pipeline\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_category_translation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_category\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_option_group\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_option_translation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_option\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_variant_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_type_translation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_variant_price\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_variant\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_translation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`report_category\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`report_organization\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`report\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`request_approval\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`role_permission\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`role\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`skill\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`tag\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`daily_plan\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`issue_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_priority\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_size\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_status\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`task_version\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`tenant_setting\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`tenant\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`time_off_policy\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`activity\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`screenshot\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`time_log\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`time_slot\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`time_slot_minute\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`timesheet\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`user_organization\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`user\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`warehouse\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`changelog\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_github_repository\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query( - `ALTER TABLE \`organization_github_repository_issue\` ADD \`archivedAt\` datetime NULL` - ); - await queryRunner.query(`ALTER TABLE \`proposal\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`job_search_occupation\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`job_search_category\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query( - `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD \`archivedAt\` datetime NULL` - ); - await queryRunner.query(`ALTER TABLE \`job_preset\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query( - `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD \`archivedAt\` datetime NULL` - ); - await queryRunner.query(`ALTER TABLE \`knowledge_base\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`product_review\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query( - `CREATE INDEX \`IDX_5d74a3f25e6acfb6caec05ec65\` ON \`accounting_template\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_e0c6443e0d2d5630067bc10ccf\` ON \`appointment_employee\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_829e02292a572f25476c4e426c\` ON \`approval_policy\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ada776a231239b8e99f78bf64\` ON \`availability_slot\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_c323aa830e10a871854d0a0408\` ON \`social_account\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_75bd5526e43c8801085225ffa9\` ON \`candidate_criterion_rating\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_4985a92870282574f6fec8dd98\` ON \`candidate_document\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_745780f5553e56a3ca19bccf86\` ON \`candidate_education\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_bb09aa3130d0e54007a98523c5\` ON \`candidate_experience\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_89ff7e0a8c37fdf7770b753776\` ON \`candidate_feedback\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_09f72a1a309aae91e0cd83949a\` ON \`candidate_interview\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_54b281d06e1a4e7e6ff640dab4\` ON \`candidate_interviewer\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_fa411cb89c9c6848d192d7f2e6\` ON \`candidate_personal_quality\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_f651e72ab42727f28c29441f1b\` ON \`candidate_skill\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_df0a9a4b6ae0e3cab9c4f35436\` ON \`candidate_source\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_5cb080756923318f19f1d2eabe\` ON \`candidate_technology\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_ac765cfc390ec77d765dd48b61\` ON \`candidate\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_67a4423093e3c311cb76275659\` ON \`contact\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_711fd0159178a0102abc4db336\` ON \`country\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_e99bb270f0fa89ea715a457d29\` ON \`currency\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_36106478339961c8a17674a031\` ON \`custom_smtp\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_284658fe519bca6048fd73ff72\` ON \`deal\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_753f4b022ec98a0c8f38b370c0\` ON \`email_sent\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_35ac91a92c521b68277e780e6e\` ON \`email_reset\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_ce96229ae8d1d1af61348730da\` ON \`email_template\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_e69d60f1adcded4445095c4787\` ON \`employee_appointment\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_cee87c9b8743f0e81db8152f68\` ON \`employee_award\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_9dff154a1be222c66c179ad14b\` ON \`employee_level\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_08e391262cb3d4fbe9db97ecf8\` ON \`employee_phone\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_185b880550575c61d4212896e2\` ON \`employee_recurring_expense\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a8e048dfb4d618068376407c86\` ON \`employee_setting\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_c17e703a7008f6b9c2770a5cba\` ON \`employee\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_0c5508f4c86446f84d609e3b76\` ON \`equipment_sharing_policy\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_21bb7aec28dbb12ebc58a41d02\` ON \`equipment_sharing\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_7ed01d2a28f6cc9acb72c5fcf8\` ON \`equipment\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_c029854e57e273cb30445e6417\` ON \`estimate_email\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_e261b3b6ed4c6e79901fb3e1bc\` ON \`event_type\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_0edbfb90f0bc4c28eb57892900\` ON \`expense_category\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_6620af16ccd56e7e52b6ad914d\` ON \`expense\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_ca5fc2af0a26e454779d014a6a\` ON \`import-history\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_b1669a96371cbdb8fd8d4724d6\` ON \`import-record\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_c795b7a18f1213b980bcc91ffe\` ON \`feature_organization\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_3c0aa9d1eabc26757fbddc2bb9\` ON \`feature\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_03dbd727034c431934185d1d6f\` ON \`goal_general_setting\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_84a5a399408725b9c8612767e0\` ON \`goal_kpi_template\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_dae34450bed722e897370e2aec\` ON \`goal_kpi\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_25e0f8060ed921994873391253\` ON \`goal_template\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_cc3487eb32dd8baa86a8043540\` ON \`goal_time_frame\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_265b5cbc3e414bb3bb2facbb22\` ON \`goal\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_2a8cd17a33093bb6afed97e9d3\` ON \`image_asset\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_263e874cebea17ad3f2ba39e11\` ON \`income\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_2a9f9f6fa9064b328e277063a1\` ON \`integration_entity_setting_tied\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_5053bf22f9e0a5e9e8df7850da\` ON \`integration_entity_setting\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_3907c6f563fc45d824558d239d\` ON \`integration_map\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_02f667ad727ca0975d5022e695\` ON \`integration_setting\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_b6654519fbad729cdb490069be\` ON \`integration_tenant\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_842e81def8eef9f71a97496ff1\` ON \`integration_type\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_90aec772805c7fd508d71bedfe\` ON \`integration\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_00a3c849694b6f8be7b193c888\` ON \`invite\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_599de8ec6ea69550c6d49c4ae1\` ON \`invoice_estimate_history\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_457cbab434fc9a031f03eb6211\` ON \`invoice_item\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_40ee7b28c0ea835534a93b54bf\` ON \`invoice\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_04b8ef5663b40baa58e1b65160\` ON \`key_result_template\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_c5df67196c2aca0a7fb6ffd274\` ON \`key_result_update\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_30bf8575f0744aa3b68b611985\` ON \`key_result\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_745828269219870069b3b46a7f\` ON \`language\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_ebff440aec581d4893ad743c7e\` ON \`merchant\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_20aebc4219b9f9196f5ca2344d\` ON \`organization_award\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_cdf46b38fd75cd7baebce81cc6\` ON \`organization_contact\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_8cf81262c7cddfcf3fedcbc106\` ON \`organization_department\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_bf9a2edebcda9ac2c59e4439cb\` ON \`organization_document\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_8a11abe644b2cb5810bb65c8f9\` ON \`organization_employment_type\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_94330f9121dd1e72fe31fdb3c5\` ON \`organization_language\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_1bff92d7a3b4b1f1a0e62a5122\` ON \`organization_position\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_fdd58e4f13a3f4a92c70bcdb30\` ON \`organization_project\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\` (\`status\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\` (\`managerId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\` (\`defaultAssigneeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_21510dbb86b763f55a8bf4ec93\` ON \`organization_project_module\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_636a95bda1eaf9fab00849dec2\` ON \`organization_recurring_expense\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_cbb3f1eb241abc47103df48f83\` ON \`organization_sprint\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_60683da6db3f64a0767d40b291\` ON \`organization_task_setting\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_d109b8470a4cf2662bec0a672b\` ON \`organization_team_employee\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_5deae148453dfaf555b24d151f\` ON \`organization_team_join_request\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_af48bbfa76f6261a5520e5e90f\` ON \`organization_team\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6c41095093c47ac91434a1bdf9\` ON \`organization_vendor\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_3c5fdf6c34ed7a20fae6c9ae94\` ON \`organization\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_7f8ba01a73690cbabe6c6ab93c\` ON \`password_reset\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_523b77d9dcbace8377fbca05ae\` ON \`payment\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_c5075efc6dab483721af36616f\` ON \`pipeline_stage\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_8b0d255d8f0ec4ca22e36249a8\` ON \`pipeline\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_2dce278beac80aebe7e179d7c9\` ON \`product_category_translation\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_89d6d92ce60b7b6de00449b30d\` ON \`product_category\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_e69de0d6c91d71407822a95bc9\` ON \`product_option_group\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_fdca637f69b879c6e95525a01f\` ON \`product_option_group_translation\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_eed2b389448b96ec1118ca38ef\` ON \`product_option_translation\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_41bff03b05f43a4e22e54cb83e\` ON \`product_option\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_18a46a61494103f9db1c42285d\` ON \`product_variant_setting\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_7c3776ae0d403baebc8a9387d8\` ON \`product_type_translation\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_577cfbbd0e9dedad955108df36\` ON \`product_type\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_3041f4d50857a4bc37dd72f233\` ON \`product_variant_price\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_0eb547a970dfecff424eb2098b\` ON \`product_variant\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_98c2019d4a108469e30b265972\` ON \`product\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_12de5ef2de583b2e92a1dfee3d\` ON \`product_translation\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_0ad88d687468141532bef9cc5e\` ON \`report_category\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_3619176cb8845c5c03803caf9d\` ON \`report_organization\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_5a453f466165d928a495e158ac\` ON \`report\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_f6c789158e91e7a6242174aaae\` ON \`request_approval_employee\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_1c02d6337074841598e6952fed\` ON \`request_approval_team\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_aac7b3092d5d02d80deb5808b3\` ON \`request_approval\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_8cdc64dbd7f2ed3f8850bd2592\` ON \`role_permission\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_6c388c8d50b4238ab077fdc800\` ON \`role\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_0d379f40301224bfa5043dc7cc\` ON \`skill\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_1ddd19850ad49f4e61ad727018\` ON \`tag\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_1255e02d6dddd4e09a5ddb10d4\` ON \`daily_plan\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_da2990e3e7d2047d950ab8edea\` ON \`task_estimation\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_2ff61d100d00793724c099b86c\` ON \`issue_type\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_93bb4c9fb014dda0d984e9060a\` ON \`task\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_024d5a6727f6f4804d8cecfe32\` ON \`task_linked_issues\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_f9fdc26bc564bf9f7963489f23\` ON \`task_priority\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_d1689daf93e2cb6029a9ff96d2\` ON \`task_related_issue_type\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_c364d9cb885e274666950b1afc\` ON \`task_size\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_259cb3e6d0d59edad2798b0ac3\` ON \`task_status\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_526e175838190ccc3c350df01a\` ON \`task_version\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_6e8dc5c9992499a05248237e58\` ON \`tenant_setting\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_10ede978ae7c1b67755932eac6\` ON \`tenant\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_21aa702abacf7dabe11da12818\` ON \`time_off_policy\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a5c6d8b62974fb9e4161e09499\` ON \`time_off_request\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_83df5ca85dae51ff9341e47785\` ON \`activity\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_afad5ae421b31768c4232f7224\` ON \`screenshot\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_2cbd790171893d994992116f19\` ON \`time_log\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_b520b83e91a6d3c8ef33675efe\` ON \`time_slot\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_bb9f95f639ced2a5b71395169e\` ON \`time_slot_minute\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_43f3709ff2b8dcc90c1809b023\` ON \`timesheet\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_6f87e00eb9e37242f01e6e5566\` ON \`user_organization\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_e49cb4b6b256bd4a5edab1e4dd\` ON \`user\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_fa9bdc44b90c4f32e658938a2d\` ON \`warehouse_product\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_21bba7ad2249260cc9d0022af9\` ON \`warehouse_product_variant\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_66abaca4fc9c367203403310aa\` ON \`warehouse\` (\`archivedAt\`)`); - await queryRunner.query(`CREATE INDEX \`IDX_888ffe5a395d1cf7afb001dc3a\` ON \`changelog\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_55dbb0b04712921d3c5dd7664e\` ON \`organization_github_repository\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_290ccd540d1e1f450c408539a1\` ON \`organization_github_repository_issue\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_811cc78a6e4df2ae75d237e40e\` ON \`proposal\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_6b73b978dcd27856a83df0d23c\` ON \`employee_proposal_template\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_551be2742a129d5d8ff461e9fe\` ON \`job_search_occupation\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_4b69eac7a9f1b9e93eebe3a850\` ON \`job_search_category\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_0d66c27013f4c34b339738f210\` ON \`employee_upwork_job_search_criterion\` (\`archivedAt\`)` - ); - await queryRunner.query(`CREATE INDEX \`IDX_c271c2698e24de252f1fd148f0\` ON \`job_preset\` (\`archivedAt\`)`); - await queryRunner.query( - `CREATE INDEX \`IDX_84a641af24ce125f296142216b\` ON \`job_preset_upwork_job_search_criterion\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_407463aef81b89c8bc5943ac8a\` ON \`knowledge_base\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_bd8360d2c539ae6b351129c86d\` ON \`knowledge_base_article\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_eb418dd0f3234df01222bcf438\` ON \`knowledge_base_author\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_c94775caea731394d690d67db1\` ON \`product_review\` (\`archivedAt\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_05edb214d298384f9f918d6b5d2\` FOREIGN KEY (\`managerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_489012234f53089d4b508f4aa12\` FOREIGN KEY (\`defaultAssigneeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_489012234f53089d4b508f4aa12\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_05edb214d298384f9f918d6b5d2\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_c94775caea731394d690d67db1\` ON \`product_review\``); - await queryRunner.query(`DROP INDEX \`IDX_eb418dd0f3234df01222bcf438\` ON \`knowledge_base_author\``); - await queryRunner.query(`DROP INDEX \`IDX_bd8360d2c539ae6b351129c86d\` ON \`knowledge_base_article\``); - await queryRunner.query(`DROP INDEX \`IDX_407463aef81b89c8bc5943ac8a\` ON \`knowledge_base\``); - await queryRunner.query( - `DROP INDEX \`IDX_84a641af24ce125f296142216b\` ON \`job_preset_upwork_job_search_criterion\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_c271c2698e24de252f1fd148f0\` ON \`job_preset\``); - await queryRunner.query( - `DROP INDEX \`IDX_0d66c27013f4c34b339738f210\` ON \`employee_upwork_job_search_criterion\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_4b69eac7a9f1b9e93eebe3a850\` ON \`job_search_category\``); - await queryRunner.query(`DROP INDEX \`IDX_551be2742a129d5d8ff461e9fe\` ON \`job_search_occupation\``); - await queryRunner.query(`DROP INDEX \`IDX_6b73b978dcd27856a83df0d23c\` ON \`employee_proposal_template\``); - await queryRunner.query(`DROP INDEX \`IDX_811cc78a6e4df2ae75d237e40e\` ON \`proposal\``); - await queryRunner.query( - `DROP INDEX \`IDX_290ccd540d1e1f450c408539a1\` ON \`organization_github_repository_issue\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_55dbb0b04712921d3c5dd7664e\` ON \`organization_github_repository\``); - await queryRunner.query(`DROP INDEX \`IDX_888ffe5a395d1cf7afb001dc3a\` ON \`changelog\``); - await queryRunner.query(`DROP INDEX \`IDX_66abaca4fc9c367203403310aa\` ON \`warehouse\``); - await queryRunner.query(`DROP INDEX \`IDX_21bba7ad2249260cc9d0022af9\` ON \`warehouse_product_variant\``); - await queryRunner.query(`DROP INDEX \`IDX_fa9bdc44b90c4f32e658938a2d\` ON \`warehouse_product\``); - await queryRunner.query(`DROP INDEX \`IDX_e49cb4b6b256bd4a5edab1e4dd\` ON \`user\``); - await queryRunner.query(`DROP INDEX \`IDX_6f87e00eb9e37242f01e6e5566\` ON \`user_organization\``); - await queryRunner.query(`DROP INDEX \`IDX_43f3709ff2b8dcc90c1809b023\` ON \`timesheet\``); - await queryRunner.query(`DROP INDEX \`IDX_bb9f95f639ced2a5b71395169e\` ON \`time_slot_minute\``); - await queryRunner.query(`DROP INDEX \`IDX_b520b83e91a6d3c8ef33675efe\` ON \`time_slot\``); - await queryRunner.query(`DROP INDEX \`IDX_2cbd790171893d994992116f19\` ON \`time_log\``); - await queryRunner.query(`DROP INDEX \`IDX_afad5ae421b31768c4232f7224\` ON \`screenshot\``); - await queryRunner.query(`DROP INDEX \`IDX_83df5ca85dae51ff9341e47785\` ON \`activity\``); - await queryRunner.query(`DROP INDEX \`IDX_a5c6d8b62974fb9e4161e09499\` ON \`time_off_request\``); - await queryRunner.query(`DROP INDEX \`IDX_21aa702abacf7dabe11da12818\` ON \`time_off_policy\``); - await queryRunner.query(`DROP INDEX \`IDX_10ede978ae7c1b67755932eac6\` ON \`tenant\``); - await queryRunner.query(`DROP INDEX \`IDX_6e8dc5c9992499a05248237e58\` ON \`tenant_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_526e175838190ccc3c350df01a\` ON \`task_version\``); - await queryRunner.query(`DROP INDEX \`IDX_259cb3e6d0d59edad2798b0ac3\` ON \`task_status\``); - await queryRunner.query(`DROP INDEX \`IDX_c364d9cb885e274666950b1afc\` ON \`task_size\``); - await queryRunner.query(`DROP INDEX \`IDX_d1689daf93e2cb6029a9ff96d2\` ON \`task_related_issue_type\``); - await queryRunner.query(`DROP INDEX \`IDX_f9fdc26bc564bf9f7963489f23\` ON \`task_priority\``); - await queryRunner.query(`DROP INDEX \`IDX_024d5a6727f6f4804d8cecfe32\` ON \`task_linked_issues\``); - await queryRunner.query(`DROP INDEX \`IDX_93bb4c9fb014dda0d984e9060a\` ON \`task\``); - await queryRunner.query(`DROP INDEX \`IDX_2ff61d100d00793724c099b86c\` ON \`issue_type\``); - await queryRunner.query(`DROP INDEX \`IDX_da2990e3e7d2047d950ab8edea\` ON \`task_estimation\``); - await queryRunner.query(`DROP INDEX \`IDX_1255e02d6dddd4e09a5ddb10d4\` ON \`daily_plan\``); - await queryRunner.query(`DROP INDEX \`IDX_1ddd19850ad49f4e61ad727018\` ON \`tag\``); - await queryRunner.query(`DROP INDEX \`IDX_0d379f40301224bfa5043dc7cc\` ON \`skill\``); - await queryRunner.query(`DROP INDEX \`IDX_6c388c8d50b4238ab077fdc800\` ON \`role\``); - await queryRunner.query(`DROP INDEX \`IDX_8cdc64dbd7f2ed3f8850bd2592\` ON \`role_permission\``); - await queryRunner.query(`DROP INDEX \`IDX_aac7b3092d5d02d80deb5808b3\` ON \`request_approval\``); - await queryRunner.query(`DROP INDEX \`IDX_1c02d6337074841598e6952fed\` ON \`request_approval_team\``); - await queryRunner.query(`DROP INDEX \`IDX_f6c789158e91e7a6242174aaae\` ON \`request_approval_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_5a453f466165d928a495e158ac\` ON \`report\``); - await queryRunner.query(`DROP INDEX \`IDX_3619176cb8845c5c03803caf9d\` ON \`report_organization\``); - await queryRunner.query(`DROP INDEX \`IDX_0ad88d687468141532bef9cc5e\` ON \`report_category\``); - await queryRunner.query(`DROP INDEX \`IDX_12de5ef2de583b2e92a1dfee3d\` ON \`product_translation\``); - await queryRunner.query(`DROP INDEX \`IDX_98c2019d4a108469e30b265972\` ON \`product\``); - await queryRunner.query(`DROP INDEX \`IDX_0eb547a970dfecff424eb2098b\` ON \`product_variant\``); - await queryRunner.query(`DROP INDEX \`IDX_3041f4d50857a4bc37dd72f233\` ON \`product_variant_price\``); - await queryRunner.query(`DROP INDEX \`IDX_577cfbbd0e9dedad955108df36\` ON \`product_type\``); - await queryRunner.query(`DROP INDEX \`IDX_7c3776ae0d403baebc8a9387d8\` ON \`product_type_translation\``); - await queryRunner.query(`DROP INDEX \`IDX_18a46a61494103f9db1c42285d\` ON \`product_variant_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_41bff03b05f43a4e22e54cb83e\` ON \`product_option\``); - await queryRunner.query(`DROP INDEX \`IDX_eed2b389448b96ec1118ca38ef\` ON \`product_option_translation\``); - await queryRunner.query( - `DROP INDEX \`IDX_fdca637f69b879c6e95525a01f\` ON \`product_option_group_translation\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_e69de0d6c91d71407822a95bc9\` ON \`product_option_group\``); - await queryRunner.query(`DROP INDEX \`IDX_89d6d92ce60b7b6de00449b30d\` ON \`product_category\``); - await queryRunner.query(`DROP INDEX \`IDX_2dce278beac80aebe7e179d7c9\` ON \`product_category_translation\``); - await queryRunner.query(`DROP INDEX \`IDX_8b0d255d8f0ec4ca22e36249a8\` ON \`pipeline\``); - await queryRunner.query(`DROP INDEX \`IDX_c5075efc6dab483721af36616f\` ON \`pipeline_stage\``); - await queryRunner.query(`DROP INDEX \`IDX_523b77d9dcbace8377fbca05ae\` ON \`payment\``); - await queryRunner.query(`DROP INDEX \`IDX_7f8ba01a73690cbabe6c6ab93c\` ON \`password_reset\``); - await queryRunner.query(`DROP INDEX \`IDX_3c5fdf6c34ed7a20fae6c9ae94\` ON \`organization\``); - await queryRunner.query(`DROP INDEX \`IDX_6c41095093c47ac91434a1bdf9\` ON \`organization_vendor\``); - await queryRunner.query(`DROP INDEX \`IDX_af48bbfa76f6261a5520e5e90f\` ON \`organization_team\``); - await queryRunner.query(`DROP INDEX \`IDX_5deae148453dfaf555b24d151f\` ON \`organization_team_join_request\``); - await queryRunner.query(`DROP INDEX \`IDX_d109b8470a4cf2662bec0a672b\` ON \`organization_team_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_60683da6db3f64a0767d40b291\` ON \`organization_task_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_cbb3f1eb241abc47103df48f83\` ON \`organization_sprint\``); - await queryRunner.query(`DROP INDEX \`IDX_636a95bda1eaf9fab00849dec2\` ON \`organization_recurring_expense\``); - await queryRunner.query(`DROP INDEX \`IDX_21510dbb86b763f55a8bf4ec93\` ON \`organization_project_module\``); - await queryRunner.query(`DROP INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\``); - await queryRunner.query(`DROP INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\``); - await queryRunner.query(`DROP INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\``); - await queryRunner.query(`DROP INDEX \`IDX_fdd58e4f13a3f4a92c70bcdb30\` ON \`organization_project\``); - await queryRunner.query(`DROP INDEX \`IDX_1bff92d7a3b4b1f1a0e62a5122\` ON \`organization_position\``); - await queryRunner.query(`DROP INDEX \`IDX_94330f9121dd1e72fe31fdb3c5\` ON \`organization_language\``); - await queryRunner.query(`DROP INDEX \`IDX_8a11abe644b2cb5810bb65c8f9\` ON \`organization_employment_type\``); - await queryRunner.query(`DROP INDEX \`IDX_bf9a2edebcda9ac2c59e4439cb\` ON \`organization_document\``); - await queryRunner.query(`DROP INDEX \`IDX_8cf81262c7cddfcf3fedcbc106\` ON \`organization_department\``); - await queryRunner.query(`DROP INDEX \`IDX_cdf46b38fd75cd7baebce81cc6\` ON \`organization_contact\``); - await queryRunner.query(`DROP INDEX \`IDX_20aebc4219b9f9196f5ca2344d\` ON \`organization_award\``); - await queryRunner.query(`DROP INDEX \`IDX_ebff440aec581d4893ad743c7e\` ON \`merchant\``); - await queryRunner.query(`DROP INDEX \`IDX_745828269219870069b3b46a7f\` ON \`language\``); - await queryRunner.query(`DROP INDEX \`IDX_30bf8575f0744aa3b68b611985\` ON \`key_result\``); - await queryRunner.query(`DROP INDEX \`IDX_c5df67196c2aca0a7fb6ffd274\` ON \`key_result_update\``); - await queryRunner.query(`DROP INDEX \`IDX_04b8ef5663b40baa58e1b65160\` ON \`key_result_template\``); - await queryRunner.query(`DROP INDEX \`IDX_40ee7b28c0ea835534a93b54bf\` ON \`invoice\``); - await queryRunner.query(`DROP INDEX \`IDX_457cbab434fc9a031f03eb6211\` ON \`invoice_item\``); - await queryRunner.query(`DROP INDEX \`IDX_599de8ec6ea69550c6d49c4ae1\` ON \`invoice_estimate_history\``); - await queryRunner.query(`DROP INDEX \`IDX_00a3c849694b6f8be7b193c888\` ON \`invite\``); - await queryRunner.query(`DROP INDEX \`IDX_90aec772805c7fd508d71bedfe\` ON \`integration\``); - await queryRunner.query(`DROP INDEX \`IDX_842e81def8eef9f71a97496ff1\` ON \`integration_type\``); - await queryRunner.query(`DROP INDEX \`IDX_b6654519fbad729cdb490069be\` ON \`integration_tenant\``); - await queryRunner.query(`DROP INDEX \`IDX_02f667ad727ca0975d5022e695\` ON \`integration_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_3907c6f563fc45d824558d239d\` ON \`integration_map\``); - await queryRunner.query(`DROP INDEX \`IDX_5053bf22f9e0a5e9e8df7850da\` ON \`integration_entity_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_2a9f9f6fa9064b328e277063a1\` ON \`integration_entity_setting_tied\``); - await queryRunner.query(`DROP INDEX \`IDX_263e874cebea17ad3f2ba39e11\` ON \`income\``); - await queryRunner.query(`DROP INDEX \`IDX_2a8cd17a33093bb6afed97e9d3\` ON \`image_asset\``); - await queryRunner.query(`DROP INDEX \`IDX_265b5cbc3e414bb3bb2facbb22\` ON \`goal\``); - await queryRunner.query(`DROP INDEX \`IDX_cc3487eb32dd8baa86a8043540\` ON \`goal_time_frame\``); - await queryRunner.query(`DROP INDEX \`IDX_25e0f8060ed921994873391253\` ON \`goal_template\``); - await queryRunner.query(`DROP INDEX \`IDX_dae34450bed722e897370e2aec\` ON \`goal_kpi\``); - await queryRunner.query(`DROP INDEX \`IDX_84a5a399408725b9c8612767e0\` ON \`goal_kpi_template\``); - await queryRunner.query(`DROP INDEX \`IDX_03dbd727034c431934185d1d6f\` ON \`goal_general_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_3c0aa9d1eabc26757fbddc2bb9\` ON \`feature\``); - await queryRunner.query(`DROP INDEX \`IDX_c795b7a18f1213b980bcc91ffe\` ON \`feature_organization\``); - await queryRunner.query(`DROP INDEX \`IDX_b1669a96371cbdb8fd8d4724d6\` ON \`import-record\``); - await queryRunner.query(`DROP INDEX \`IDX_ca5fc2af0a26e454779d014a6a\` ON \`import-history\``); - await queryRunner.query(`DROP INDEX \`IDX_6620af16ccd56e7e52b6ad914d\` ON \`expense\``); - await queryRunner.query(`DROP INDEX \`IDX_0edbfb90f0bc4c28eb57892900\` ON \`expense_category\``); - await queryRunner.query(`DROP INDEX \`IDX_e261b3b6ed4c6e79901fb3e1bc\` ON \`event_type\``); - await queryRunner.query(`DROP INDEX \`IDX_c029854e57e273cb30445e6417\` ON \`estimate_email\``); - await queryRunner.query(`DROP INDEX \`IDX_7ed01d2a28f6cc9acb72c5fcf8\` ON \`equipment\``); - await queryRunner.query(`DROP INDEX \`IDX_21bb7aec28dbb12ebc58a41d02\` ON \`equipment_sharing\``); - await queryRunner.query(`DROP INDEX \`IDX_0c5508f4c86446f84d609e3b76\` ON \`equipment_sharing_policy\``); - await queryRunner.query(`DROP INDEX \`IDX_c17e703a7008f6b9c2770a5cba\` ON \`employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a8e048dfb4d618068376407c86\` ON \`employee_setting\``); - await queryRunner.query(`DROP INDEX \`IDX_185b880550575c61d4212896e2\` ON \`employee_recurring_expense\``); - await queryRunner.query(`DROP INDEX \`IDX_08e391262cb3d4fbe9db97ecf8\` ON \`employee_phone\``); - await queryRunner.query(`DROP INDEX \`IDX_9dff154a1be222c66c179ad14b\` ON \`employee_level\``); - await queryRunner.query(`DROP INDEX \`IDX_cee87c9b8743f0e81db8152f68\` ON \`employee_award\``); - await queryRunner.query(`DROP INDEX \`IDX_e69d60f1adcded4445095c4787\` ON \`employee_appointment\``); - await queryRunner.query(`DROP INDEX \`IDX_ce96229ae8d1d1af61348730da\` ON \`email_template\``); - await queryRunner.query(`DROP INDEX \`IDX_35ac91a92c521b68277e780e6e\` ON \`email_reset\``); - await queryRunner.query(`DROP INDEX \`IDX_753f4b022ec98a0c8f38b370c0\` ON \`email_sent\``); - await queryRunner.query(`DROP INDEX \`IDX_284658fe519bca6048fd73ff72\` ON \`deal\``); - await queryRunner.query(`DROP INDEX \`IDX_36106478339961c8a17674a031\` ON \`custom_smtp\``); - await queryRunner.query(`DROP INDEX \`IDX_e99bb270f0fa89ea715a457d29\` ON \`currency\``); - await queryRunner.query(`DROP INDEX \`IDX_711fd0159178a0102abc4db336\` ON \`country\``); - await queryRunner.query(`DROP INDEX \`IDX_67a4423093e3c311cb76275659\` ON \`contact\``); - await queryRunner.query(`DROP INDEX \`IDX_ac765cfc390ec77d765dd48b61\` ON \`candidate\``); - await queryRunner.query(`DROP INDEX \`IDX_5cb080756923318f19f1d2eabe\` ON \`candidate_technology\``); - await queryRunner.query(`DROP INDEX \`IDX_df0a9a4b6ae0e3cab9c4f35436\` ON \`candidate_source\``); - await queryRunner.query(`DROP INDEX \`IDX_f651e72ab42727f28c29441f1b\` ON \`candidate_skill\``); - await queryRunner.query(`DROP INDEX \`IDX_fa411cb89c9c6848d192d7f2e6\` ON \`candidate_personal_quality\``); - await queryRunner.query(`DROP INDEX \`IDX_54b281d06e1a4e7e6ff640dab4\` ON \`candidate_interviewer\``); - await queryRunner.query(`DROP INDEX \`IDX_09f72a1a309aae91e0cd83949a\` ON \`candidate_interview\``); - await queryRunner.query(`DROP INDEX \`IDX_89ff7e0a8c37fdf7770b753776\` ON \`candidate_feedback\``); - await queryRunner.query(`DROP INDEX \`IDX_bb09aa3130d0e54007a98523c5\` ON \`candidate_experience\``); - await queryRunner.query(`DROP INDEX \`IDX_745780f5553e56a3ca19bccf86\` ON \`candidate_education\``); - await queryRunner.query(`DROP INDEX \`IDX_4985a92870282574f6fec8dd98\` ON \`candidate_document\``); - await queryRunner.query(`DROP INDEX \`IDX_75bd5526e43c8801085225ffa9\` ON \`candidate_criterion_rating\``); - await queryRunner.query(`DROP INDEX \`IDX_c323aa830e10a871854d0a0408\` ON \`social_account\``); - await queryRunner.query(`DROP INDEX \`IDX_2ada776a231239b8e99f78bf64\` ON \`availability_slot\``); - await queryRunner.query(`DROP INDEX \`IDX_829e02292a572f25476c4e426c\` ON \`approval_policy\``); - await queryRunner.query(`DROP INDEX \`IDX_e0c6443e0d2d5630067bc10ccf\` ON \`appointment_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_5d74a3f25e6acfb6caec05ec65\` ON \`accounting_template\``); - await queryRunner.query(`ALTER TABLE \`product_review\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`job_preset\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`job_search_category\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`job_search_occupation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`proposal\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_github_repository\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`changelog\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`warehouse\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`user\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`user_organization\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`timesheet\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`time_slot\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`time_log\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`screenshot\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`activity\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`tenant\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`tenant_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_version\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_status\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_size\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_priority\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`issue_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`daily_plan\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`tag\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`skill\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`role\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`role_permission\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`request_approval\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`report\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`report_organization\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`report_category\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_translation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_variant\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_variant_price\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_type_translation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_variant_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_option\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_option_translation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_option_group\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_category\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`product_category_translation\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`pipeline\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`payment\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`password_reset\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_vendor\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_team\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_sprint\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_module\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`defaultAssigneeId\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`managerId\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`closeTasksIn\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archiveTasksIn\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`icon\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`status\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_position\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_language\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_employment_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_document\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_department\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_award\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`merchant\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`language\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`key_result\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`key_result_update\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`invoice\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`invite\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_tenant\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_map\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`income\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`image_asset\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal_template\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`goal_general_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`feature\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`feature_organization\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`import-record\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`import-history\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`expense\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`expense_category\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`event_type\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`equipment\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_level\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_award\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`employee_appointment\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`email_template\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`email_reset\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`email_sent\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`deal\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`currency\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`country\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`contact\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_technology\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_interview\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_experience\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_education\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_document\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`social_account\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`availability_slot\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`accounting_template\` DROP COLUMN \`archivedAt\``); - } -} diff --git a/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts b/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts deleted file mode 100644 index ba88edc6419..00000000000 --- a/packages/core/src/database/migrations/1725809437414-AlterOrganizationProjectEmployeeRelation.ts +++ /dev/null @@ -1,707 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { yellow } from 'chalk'; -import { DatabaseTypeEnum } from '@gauzy/config'; - -export class AlterOrganizationProjectEmployeeRelation1725809437414 implements MigrationInterface { - name = 'AlterOrganizationProjectEmployeeRelation1725809437414'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_05edb214d298384f9f918d6b5d2"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query(`DROP INDEX "public"."IDX_05edb214d298384f9f918d6b5d"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "managerId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("id", "employeeId")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "id", "organizationProjectId")` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` - ); - await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_472eee165488bb8d0e7597e935"`); - await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "organizationId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "tenantId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isArchived"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "managerId" uuid`); - await queryRunner.query( - `CREATE INDEX "IDX_05edb214d298384f9f918d6b5d" ON "organization_project" ("managerId") ` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_05edb214d298384f9f918d6b5d2" FOREIGN KEY ("managerId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); // refers - - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_472eee165488bb8d0e7597e935"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_472eee165488bb8d0e7597e935" ON "organization_project_employee" ("archivedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_472eee165488bb8d0e7597e935"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - } - - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_05edb214d298384f9f918d6b5d2\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`managerId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_472eee165488bb8d0e7597e935\` ON \`organization_project_employee\` (\`archivedAt\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_472eee165488bb8d0e7597e935\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`managerId\` varchar(255) NULL`); - await queryRunner.query( - `CREATE INDEX \`IDX_05edb214d298384f9f918d6b5d\` ON \`organization_project\` (\`managerId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_05edb214d298384f9f918d6b5d2\` FOREIGN KEY (\`managerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } -} diff --git a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts new file mode 100644 index 00000000000..b69d62005a5 --- /dev/null +++ b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts @@ -0,0 +1,275 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006 implements MigrationInterface { + name = 'AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "status" character varying`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "icon" character varying`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "archiveTasksIn" numeric`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "closeTasksIn" numeric`); + await queryRunner.query(`ALTER TABLE "organization_project" ADD "defaultAssigneeId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("id", "employeeId")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "id", "organizationProjectId")` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` + ); + await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_489012234f53089d4b508f4aa12"`); + await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "public"."IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "public"."IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "organizationId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "tenantId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isArchived"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "defaultAssigneeId"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "closeTasksIn"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archiveTasksIn"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "icon"`); + await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "status"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} +} From f243ceb957a54e5cb1dcf6e36c90bda6347e5e24 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Mon, 9 Sep 2024 09:01:33 +0200 Subject: [PATCH 11/47] refact: project sqlite migration --- ...ationProjectAndProjectEmployeeAddFields.ts | 464 +++++++++++++++++- 1 file changed, 462 insertions(+), 2 deletions(-) diff --git a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts index b69d62005a5..e42d3ca51d5 100644 --- a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts +++ b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts @@ -250,14 +250,474 @@ export class AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006 im * * @param queryRunner */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "organization_project"` + ); + await queryRunner.query(`DROP TABLE "organization_project"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId" FROM "organization_project"` + ); + await queryRunner.query(`DROP TABLE "organization_project"`); + await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + } /** * SqliteDB and BetterSQlite3DB Down Migration * * @param queryRunner */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); + await queryRunner.query( + `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId" FROM "temporary_organization_project"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project"`); + await queryRunner.query( + `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); + await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); + await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); + await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); + await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); + await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); + await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); + await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); + await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); + await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); + await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); + await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); + await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); + await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); + await queryRunner.query( + `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "temporary_organization_project"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project"`); + await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); + await queryRunner.query( + `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); + await queryRunner.query( + `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` + ); + await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); + await queryRunner.query( + `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + } /** * MySQL Up Migration From 18b5e2e96c35a03212c8e2266eb4580f81c07f82 Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Mon, 9 Sep 2024 12:04:15 +0200 Subject: [PATCH 12/47] feat: mysql migration and fix module mysql migrations --- .../1724929664505-CreateProjectModuleTable.ts | 2 - ...ationProjectAndProjectEmployeeAddFields.ts | 212 +++++++++++++++++- 2 files changed, 210 insertions(+), 4 deletions(-) diff --git a/packages/core/src/database/migrations/1724929664505-CreateProjectModuleTable.ts b/packages/core/src/database/migrations/1724929664505-CreateProjectModuleTable.ts index d09ab31335f..4bf51f00163 100644 --- a/packages/core/src/database/migrations/1724929664505-CreateProjectModuleTable.ts +++ b/packages/core/src/database/migrations/1724929664505-CreateProjectModuleTable.ts @@ -655,7 +655,6 @@ export class CreateProjectModuleTable1724929664505 implements MigrationInterface await queryRunner.query( `CREATE TABLE \`project_module_employee\` (\`organizationProjectModuleId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_e9fd7310fc93849b1d55e64d28\` (\`organizationProjectModuleId\`), INDEX \`IDX_18e428e909e48a4b7df43d7e01\` (\`employeeId\`), PRIMARY KEY (\`organizationProjectModuleId\`, \`employeeId\`)) ENGINE=InnoDB` ); - await queryRunner.query(`ALTER TABLE \`issue_type\` ADD \`isDefault\` tinyint NOT NULL DEFAULT 0`); await queryRunner.query(`ALTER TABLE \`task\` ADD \`projectModuleId\` varchar(255) NULL`); await queryRunner.query(`CREATE INDEX \`IDX_579534d8e12f22d308d6bd5f42\` ON \`task\` (\`projectModuleId\`)`); await queryRunner.query( @@ -744,7 +743,6 @@ export class CreateProjectModuleTable1724929664505 implements MigrationInterface ); await queryRunner.query(`DROP INDEX \`IDX_579534d8e12f22d308d6bd5f42\` ON \`task\``); await queryRunner.query(`ALTER TABLE \`task\` DROP COLUMN \`projectModuleId\``); - await queryRunner.query(`ALTER TABLE \`issue_type\` DROP COLUMN \`isDefault\``); await queryRunner.query(`DROP INDEX \`IDX_18e428e909e48a4b7df43d7e01\` ON \`project_module_employee\``); await queryRunner.query(`DROP INDEX \`IDX_e9fd7310fc93849b1d55e64d28\` ON \`project_module_employee\``); await queryRunner.query(`DROP TABLE \`project_module_employee\``); diff --git a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts index e42d3ca51d5..a3a59cac023 100644 --- a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts +++ b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts @@ -724,12 +724,220 @@ export class AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006 im * * @param queryRunner */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`status\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`icon\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archiveTasksIn\` decimal NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`closeTasksIn\` decimal NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`defaultAssigneeId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\` (\`status\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\` (\`defaultAssigneeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_489012234f53089d4b508f4aa12\` FOREIGN KEY (\`defaultAssigneeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } /** * MySQL Down Migration * * @param queryRunner */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_489012234f53089d4b508f4aa12\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`defaultAssigneeId\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`closeTasksIn\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archiveTasksIn\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`icon\``); + await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`status\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + } } From 165ae8d03f4d6d701914f2649ca7d4f31ad681bd Mon Sep 17 00:00:00 2001 From: GloireMutaliko21 Date: Mon, 9 Sep 2024 14:59:22 +0200 Subject: [PATCH 13/47] fix: build issues models --- packages/contracts/src/organization-projects.model.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index d4c66005feb..ed63ae20d00 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -1,4 +1,4 @@ -import { IEmployee, IRelationalEmployee } from './employee.model'; +import { IEmployee, IEmployeeEntityInput } from './employee.model'; import { IOrganizationContact, IRelationalOrganizationContact } from './organization-contact.model'; import { CrudActionEnum, ProjectBillingEnum, ProjectOwnerEnum } from './organization.model'; import { ITag } from './tag.model'; @@ -138,5 +138,5 @@ export interface IOrganizationProjectStoreState { export interface IOrganizationProjectEmployee extends IBasePerTenantAndOrganizationEntityModel, IRelationalOrganizationProject, - IRelationalEmployee, + IEmployeeEntityInput, IRelationalRole {} From c2ffea9ab068bc494a11e51cde61fa3d8e45e2a3 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Mon, 9 Sep 2024 18:37:52 +0530 Subject: [PATCH 14/47] fix: removed unnecessary code --- packages/contracts/src/base-entity.model.ts | 1 - packages/core/src/core/entities/base.entity.ts | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/packages/contracts/src/base-entity.model.ts b/packages/contracts/src/base-entity.model.ts index 364a1c8db5e..54155aa5231 100644 --- a/packages/contracts/src/base-entity.model.ts +++ b/packages/contracts/src/base-entity.model.ts @@ -29,7 +29,6 @@ export interface IBaseEntityModel extends IBaseSoftDeleteEntityModel { isActive?: boolean; // Indicates if the record is currently active isArchived?: boolean; // Indicates if the record is archived - // archivedAt?: Date; // Date when the record was archived } // Common properties for entities associated with a tenant diff --git a/packages/core/src/core/entities/base.entity.ts b/packages/core/src/core/entities/base.entity.ts index 43a2c90d5a1..6df2ebc26c1 100644 --- a/packages/core/src/core/entities/base.entity.ts +++ b/packages/core/src/core/entities/base.entity.ts @@ -105,16 +105,4 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas @ColumnIndex() @MultiORMColumn({ nullable: true, default: false }) // TypeORM and Mikro-ORM compatibility isArchived?: boolean; - - // Indicates the date when record was archived - // @ApiPropertyOptional({ - // type: 'string', - // format: 'date-time', - // example: '2018-11-21T06:20:32.232Z' - // }) - // @IsOptional() - // @IsDateString() - // @ColumnIndex() - // @MultiORMColumn({ nullable: true }) - // archivedAt?: Date; } From 4bb30993826cc9778829664bbba217f458419565 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 10 Sep 2024 12:02:12 +0530 Subject: [PATCH 15/47] fix: updated organization project DTOs --- .../src/organization-projects.model.ts | 10 +++--- .../dto/create-organization-project.dto.ts | 15 ++++----- .../dto/organization-project.dto.ts | 33 +++---------------- .../dto/update-organization-project.dto.ts | 15 ++++----- .../dto/update-project-setting.dto.ts | 31 ++++++----------- .../dto/update-task-mode.dto.ts | 17 ++++------ .../organization-project-employee.entity.ts | 10 +++--- .../organization-project.entity.ts | 24 +++++++++++--- 8 files changed, 65 insertions(+), 90 deletions(-) diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index ed63ae20d00..8a455a4edf3 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -126,9 +126,7 @@ export interface IOrganizationProjectCreateInput closeTasksIn?: number; } -export interface IOrganizationProjectUpdateInput extends IOrganizationProjectCreateInput, IOrganizationProjectSetting { - id?: ID; -} +export interface IOrganizationProjectUpdateInput extends IOrganizationProjectCreateInput, IOrganizationProjectSetting {} export interface IOrganizationProjectStoreState { project: IOrganizationProject; @@ -137,6 +135,8 @@ export interface IOrganizationProjectStoreState { export interface IOrganizationProjectEmployee extends IBasePerTenantAndOrganizationEntityModel, - IRelationalOrganizationProject, IEmployeeEntityInput, - IRelationalRole {} + IRelationalRole { + organizationProject: IOrganizationProject; + organizationProjectId: ID; +} diff --git a/packages/core/src/organization-project/dto/create-organization-project.dto.ts b/packages/core/src/organization-project/dto/create-organization-project.dto.ts index ce104a53be0..844692acea4 100644 --- a/packages/core/src/organization-project/dto/create-organization-project.dto.ts +++ b/packages/core/src/organization-project/dto/create-organization-project.dto.ts @@ -1,12 +1,11 @@ -import { IntersectionType } from "@nestjs/swagger"; -import { IOrganizationProjectCreateInput } from "@gauzy/contracts"; -import { TenantOrganizationBaseDTO } from "./../../core/dto"; -import { OrganizationProjectDTO } from "./organization-project.dto"; +import { IntersectionType } from '@nestjs/swagger'; +import { IOrganizationProjectCreateInput } from '@gauzy/contracts'; +import { TenantOrganizationBaseDTO } from './../../core/dto'; +import { OrganizationProjectDTO } from './organization-project.dto'; /** * Create Organization Project DTO request validation */ -export class CreateOrganizationProjectDTO extends IntersectionType( - OrganizationProjectDTO, - TenantOrganizationBaseDTO -) implements IOrganizationProjectCreateInput { } +export class CreateOrganizationProjectDTO + extends IntersectionType(OrganizationProjectDTO, TenantOrganizationBaseDTO) + implements IOrganizationProjectCreateInput {} diff --git a/packages/core/src/organization-project/dto/organization-project.dto.ts b/packages/core/src/organization-project/dto/organization-project.dto.ts index 690723594b3..d2baf43a7ab 100644 --- a/packages/core/src/organization-project/dto/organization-project.dto.ts +++ b/packages/core/src/organization-project/dto/organization-project.dto.ts @@ -1,31 +1,8 @@ -import { ApiProperty, ApiPropertyOptional, IntersectionType, PartialType, PickType } from "@nestjs/swagger"; -import { OrganizationProjectBudgetTypeEnum, ProjectBillingEnum } from "@gauzy/contracts"; -import { IsEnum, IsNotEmpty, IsOptional } from "class-validator"; -import { OrganizationProject } from "./../organization-project.entity"; -import { UpdateTaskModeDTO } from "./update-task-mode.dto"; +import { IntersectionType, PartialType, PickType } from '@nestjs/swagger'; +import { OrganizationProject } from './../organization-project.entity'; +import { UpdateTaskModeDTO } from './update-task-mode.dto'; export class OrganizationProjectDTO extends IntersectionType( - PickType(OrganizationProject, ['imageId']), + PickType(OrganizationProject, ['imageId', 'name', 'billing', 'budgetType'] as const), PartialType(UpdateTaskModeDTO) -) { - - @ApiProperty({ type: () => String }) - @IsNotEmpty() - readonly name: string; - - @ApiPropertyOptional({ - enum: ProjectBillingEnum, - example: ProjectBillingEnum.FLAT_FEE - }) - @IsOptional() - @IsEnum(ProjectBillingEnum) - readonly billing: ProjectBillingEnum; - - @ApiPropertyOptional({ - enum: OrganizationProjectBudgetTypeEnum, - example: OrganizationProjectBudgetTypeEnum.COST - }) - @IsOptional() - @IsEnum(OrganizationProjectBudgetTypeEnum) - readonly budgetType: OrganizationProjectBudgetTypeEnum; -} +) {} diff --git a/packages/core/src/organization-project/dto/update-organization-project.dto.ts b/packages/core/src/organization-project/dto/update-organization-project.dto.ts index d9c8f30cdc4..6a0795d2ee1 100644 --- a/packages/core/src/organization-project/dto/update-organization-project.dto.ts +++ b/packages/core/src/organization-project/dto/update-organization-project.dto.ts @@ -1,12 +1,11 @@ -import { IntersectionType, PartialType } from "@nestjs/swagger"; -import { IOrganizationProjectUpdateInput } from "@gauzy/contracts"; -import { TenantOrganizationBaseDTO } from "./../../core/dto"; -import { OrganizationProjectDTO } from "./organization-project.dto"; +import { IntersectionType, PartialType } from '@nestjs/swagger'; +import { IOrganizationProjectUpdateInput } from '@gauzy/contracts'; +import { TenantOrganizationBaseDTO } from './../../core/dto'; +import { OrganizationProjectDTO } from './organization-project.dto'; /** * Update Organization Project DTO request validation */ -export class UpdateOrganizationProjectDTO extends IntersectionType( - PartialType(OrganizationProjectDTO), - TenantOrganizationBaseDTO -) implements IOrganizationProjectUpdateInput { } +export class UpdateOrganizationProjectDTO + extends IntersectionType(PartialType(OrganizationProjectDTO), TenantOrganizationBaseDTO) + implements IOrganizationProjectUpdateInput {} diff --git a/packages/core/src/organization-project/dto/update-project-setting.dto.ts b/packages/core/src/organization-project/dto/update-project-setting.dto.ts index a6608432756..3f90cca9a9e 100644 --- a/packages/core/src/organization-project/dto/update-project-setting.dto.ts +++ b/packages/core/src/organization-project/dto/update-project-setting.dto.ts @@ -1,9 +1,16 @@ import { IOrganizationProjectSetting } from '@gauzy/contracts'; -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsBoolean, IsOptional, IsString } from 'class-validator'; +import { ApiPropertyOptional, IntersectionType, PickType } from '@nestjs/swagger'; +import { IsOptional } from 'class-validator'; import { TenantOrganizationBaseDTO } from '../../core/dto'; +import { OrganizationProject } from '../organization-project.entity'; -export class UpdateProjectSettingDTO extends TenantOrganizationBaseDTO implements IOrganizationProjectSetting { +export class UpdateProjectSettingDTO + extends IntersectionType( + TenantOrganizationBaseDTO, + PickType(OrganizationProject, ['isTasksAutoSync', 'isTasksAutoSyncOnLabel', 'syncTag'] as const) + ) + implements IOrganizationProjectSetting +{ /* |-------------------------------------------------------------------------- | Embeddable Columns @@ -12,22 +19,4 @@ export class UpdateProjectSettingDTO extends TenantOrganizationBaseDTO implement @ApiPropertyOptional({ type: 'object' }) @IsOptional() readonly customFields?: Record; - - // Auto-sync tasks property - @ApiPropertyOptional({ type: Boolean }) - @IsOptional() - @IsBoolean() - readonly isTasksAutoSync: boolean; - - // Auto-sync on label property - @ApiPropertyOptional({ type: Boolean }) - @IsOptional() - @IsBoolean() - readonly isTasksAutoSyncOnLabel: boolean; - - // Auto-sync tasks label property - @ApiPropertyOptional({ type: String }) - @IsOptional() - @IsString() - readonly syncTag: string; } diff --git a/packages/core/src/organization-project/dto/update-task-mode.dto.ts b/packages/core/src/organization-project/dto/update-task-mode.dto.ts index 7a6526443f3..f77841649ba 100644 --- a/packages/core/src/organization-project/dto/update-task-mode.dto.ts +++ b/packages/core/src/organization-project/dto/update-task-mode.dto.ts @@ -1,14 +1,11 @@ -import { ApiProperty } from "@nestjs/swagger"; -import { IsEnum } from "class-validator"; -import { IOrganizationProjectUpdateInput, TaskListTypeEnum } from "@gauzy/contracts"; -import { TenantOrganizationBaseDTO } from "./../../core/dto"; +import { IntersectionType, PickType } from '@nestjs/swagger'; +import { IOrganizationProjectUpdateInput } from '@gauzy/contracts'; +import { TenantOrganizationBaseDTO } from './../../core/dto'; +import { OrganizationProject } from '../organization-project.entity'; /** * Update task list view mode DTO validation */ -export class UpdateTaskModeDTO extends TenantOrganizationBaseDTO implements IOrganizationProjectUpdateInput { - - @ApiProperty({ enum: TaskListTypeEnum, example: TaskListTypeEnum.GRID }) - @IsEnum(TaskListTypeEnum) - readonly taskListType: TaskListTypeEnum; -} +export class UpdateTaskModeDTO + extends IntersectionType(TenantOrganizationBaseDTO, PickType(OrganizationProject, ['taskListType'] as const)) + implements IOrganizationProjectUpdateInput {} diff --git a/packages/core/src/organization-project/organization-project-employee.entity.ts b/packages/core/src/organization-project/organization-project-employee.entity.ts index d71ba30d7ea..beb078c0de2 100644 --- a/packages/core/src/organization-project/organization-project-employee.entity.ts +++ b/packages/core/src/organization-project/organization-project-employee.entity.ts @@ -1,7 +1,7 @@ import { RelationId } from 'typeorm'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsNotEmpty, IsOptional, IsUUID } from 'class-validator'; -import { ID, IEmployee, IOrganizationProjectEmployee, IRole } from '@gauzy/contracts'; +import { ID, IEmployee, IOrganizationProject, IOrganizationProjectEmployee, IRole } from '@gauzy/contracts'; import { Employee, OrganizationProject, Role, TenantOrganizationBaseEntity } from '../core/entities/internal'; import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToOne } from './../core/decorators/entity'; import { MikroOrmOrganizationProjectEmployeeRepository } from './repository/mikro-orm-organization-project-employee.repository'; @@ -23,7 +23,7 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im /** Database cascade action on delete. */ onDelete: 'CASCADE' }) - organizationProject!: IOrganizationProjectEmployee; + organizationProject!: IOrganizationProject; @ApiProperty({ type: () => String }) @IsNotEmpty() @@ -40,7 +40,7 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im /** Database cascade action on delete. */ onDelete: 'CASCADE' }) - employee: IEmployee; + employee!: IEmployee; @ApiProperty({ type: () => String }) @IsNotEmpty() @@ -48,7 +48,7 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im @RelationId((it: OrganizationProjectEmployee) => it.employee) @ColumnIndex() @MultiORMColumn({ relationId: true }) - employeeId: ID; + employeeId?: ID; /** * Role @@ -60,7 +60,7 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im /** Database cascade action on delete. */ onDelete: 'CASCADE' }) - role?: IRole; + role!: IRole; @ApiPropertyOptional({ type: () => String }) @IsOptional() diff --git a/packages/core/src/organization-project/organization-project.entity.ts b/packages/core/src/organization-project/organization-project.entity.ts index 76d8db383c8..480e7601193 100644 --- a/packages/core/src/organization-project/organization-project.entity.ts +++ b/packages/core/src/organization-project/organization-project.entity.ts @@ -1,6 +1,6 @@ import { JoinColumn, RelationId, JoinTable } from 'typeorm'; -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsBoolean, IsEnum, IsNumber, IsObject, IsOptional, IsString, IsUUID } from 'class-validator'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsObject, IsOptional, IsString, IsUUID } from 'class-validator'; import { CurrenciesEnum, IActivity, @@ -74,6 +74,8 @@ export class OrganizationProject extends TenantOrganizationBaseEntity implements IOrganizationProject, Taggable, HasCustomFields { + @ApiProperty({ type: () => String }) + @IsNotEmpty() @ColumnIndex() @MultiORMColumn() name: string; @@ -84,6 +86,9 @@ export class OrganizationProject @MultiORMColumn({ nullable: true }) endDate?: Date; + @ApiPropertyOptional({ enum: ProjectBillingEnum, example: ProjectBillingEnum.FLAT_FEE }) + @IsOptional() + @IsEnum(ProjectBillingEnum) @MultiORMColumn({ nullable: true }) billing: ProjectBillingEnum; @@ -97,6 +102,8 @@ export class OrganizationProject @MultiORMColumn({ nullable: true }) owner: ProjectOwnerEnum; + @ApiProperty({ type: () => String, enum: TaskListTypeEnum, example: TaskListTypeEnum.GRID }) + @IsEnum(TaskListTypeEnum) @MultiORMColumn({ default: TaskListTypeEnum.GRID }) taskListType: TaskListTypeEnum; @@ -127,6 +134,13 @@ export class OrganizationProject @MultiORMColumn({ nullable: true }) budget?: number; + @ApiPropertyOptional({ + type: () => String, + enum: OrganizationProjectBudgetTypeEnum, + example: OrganizationProjectBudgetTypeEnum.COST + }) + @IsOptional() + @IsEnum(OrganizationProjectBudgetTypeEnum) @MultiORMColumn({ nullable: true, default: OrganizationProjectBudgetTypeEnum.COST, @@ -140,6 +154,7 @@ export class OrganizationProject @MultiORMColumn({ length: 500, nullable: true }) imageUrl?: string; + // Auto-sync tasks property @ApiPropertyOptional({ type: () => Boolean }) @IsOptional() @IsBoolean() @@ -147,6 +162,7 @@ export class OrganizationProject @MultiORMColumn({ default: true, nullable: true }) isTasksAutoSync?: boolean; + // Auto-sync on label property @ApiPropertyOptional({ type: () => Boolean }) @IsOptional() @IsBoolean() @@ -154,6 +170,7 @@ export class OrganizationProject @MultiORMColumn({ default: true, nullable: true }) isTasksAutoSyncOnLabel?: boolean; + // Auto-sync tasks label property @ApiPropertyOptional({ type: () => String }) @IsOptional() @IsString() @@ -249,9 +266,6 @@ export class OrganizationProject /** * Project default member assignee */ - @ApiPropertyOptional({ type: () => Object }) - @IsOptional() - @IsObject() @MultiORMManyToOne(() => Employee, (it) => it.projectDefaultAssignments, { /** Indicates if the relation column value can be nullable or not. */ nullable: true, From 77903d576b0b52e03380a2c0c4d8dd9a83d38fa6 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 10 Sep 2024 21:17:50 +0530 Subject: [PATCH 16/47] fix: updated migration for organization project member & manager --- packages/contracts/src/employee.model.ts | 1 - .../src/organization-projects.model.ts | 17 +- ...ationProjectAndProjectEmployeeAddFields.ts | 943 ------------------ ...umnsToOrganizationProjectEmployeeEntity.ts | 649 ++++++++++++ packages/core/src/employee/employee.entity.ts | 9 - 5 files changed, 663 insertions(+), 956 deletions(-) delete mode 100644 packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts create mode 100644 packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts diff --git a/packages/contracts/src/employee.model.ts b/packages/contracts/src/employee.model.ts index be19b831e42..c4ec13d958a 100644 --- a/packages/contracts/src/employee.model.ts +++ b/packages/contracts/src/employee.model.ts @@ -61,7 +61,6 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel, ITa organizationDepartments?: IOrganizationDepartment[]; organizationContacts?: IOrganizationContact[]; projects?: IOrganizationProject[]; - projectDefaultAssignments?: IOrganizationProject[]; organizationPosition?: IOrganizationPosition; skills?: ISkill[]; awards?: IEmployeeAward[]; diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index bc7f5b778f1..9c289eebfcb 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -1,4 +1,4 @@ -import { IEmployee } from './employee.model'; +import { IEmployee, IEmployeeEntityInput } from './employee.model'; import { IRelationalOrganizationContact } from './organization-contact.model'; import { ITaggable } from './tag.model'; import { ITask } from './task.model'; @@ -11,6 +11,7 @@ import { IOrganizationProjectModule } from './organization-project-module.model' import { CrudActionEnum, ProjectBillingEnum, ProjectOwnerEnum } from './organization.model'; import { CurrenciesEnum } from './currency.model'; import { TaskStatusEnum } from './task-status.model'; +import { IRelationalRole } from './role.model'; import { IBasePerTenantAndOrganizationEntityModel, ID } from './base-entity.model'; // Base Entities import { CustomFieldsObject } from './shared-types'; // Shared Types @@ -84,15 +85,25 @@ export interface IOrganizationProjectsFindInput organizationTeamId?: ID; } -export interface IOrganizationProjectCreateInput extends IOrganizationProjectBase {} +export interface IOrganizationProjectCreateInput extends IOrganizationProjectBase { + managers?: IOrganizationProjectEmployee[]; +} -export interface IOrganizationProjectUpdateInput extends IOrganizationProjectBase, IOrganizationProjectSetting {} +export interface IOrganizationProjectUpdateInput extends IOrganizationProjectCreateInput {} export interface IOrganizationProjectStoreState { project: IOrganizationProject; action: CrudActionEnum; } +export interface IOrganizationProjectEmployee + extends IBasePerTenantAndOrganizationEntityModel, + IEmployeeEntityInput, + IRelationalRole { + organizationProject: IOrganizationProject; + organizationProjectId: ID; +} + // Task List Type Enum export enum TaskListTypeEnum { GRID = 'GRID', diff --git a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts b/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts deleted file mode 100644 index a3a59cac023..00000000000 --- a/packages/core/src/database/migrations/1725864010006-AlterOrganizationProjectAndProjectEmployeeAddFields.ts +++ /dev/null @@ -1,943 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { yellow } from 'chalk'; -import { DatabaseTypeEnum } from '@gauzy/config'; - -export class AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006 implements MigrationInterface { - name = 'AlterOrganizationProjectAndProjectEmployeeAddFields1725864010006'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "status" character varying`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "icon" character varying`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "archiveTasksIn" numeric`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "closeTasksIn" numeric`); - await queryRunner.query(`ALTER TABLE "organization_project" ADD "defaultAssigneeId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("id", "employeeId")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "id", "organizationProjectId")` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `ALTER TABLE "organization_project" ADD CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` - ); - await queryRunner.query(`ALTER TABLE "organization_project" DROP CONSTRAINT "FK_489012234f53089d4b508f4aa12"`); - await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "public"."IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "organizationId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "tenantId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isArchived"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "defaultAssigneeId"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "closeTasksIn"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "archiveTasksIn"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "icon"`); - await queryRunner.query(`ALTER TABLE "organization_project" DROP COLUMN "status"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "organization_project"` - ); - await queryRunner.query(`DROP TABLE "organization_project"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_489012234f53089d4b508f4aa12" FOREIGN KEY ("defaultAssigneeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId" FROM "organization_project"` - ); - await queryRunner.query(`DROP TABLE "organization_project"`); - await queryRunner.query(`ALTER TABLE "temporary_organization_project" RENAME TO "organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); - await queryRunner.query( - `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, "status" varchar, "icon" varchar, "archiveTasksIn" decimal, "closeTasksIn" decimal, "defaultAssigneeId" varchar, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields", "status", "icon", "archiveTasksIn", "closeTasksIn", "defaultAssigneeId" FROM "temporary_organization_project"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project"`); - await queryRunner.query( - `CREATE INDEX "IDX_489012234f53089d4b508f4aa1" ON "organization_project" ("defaultAssigneeId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_16c34de330ae8d59d9b31cce14" ON "organization_project" ("status") `); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_489012234f53089d4b508f4aa1"`); - await queryRunner.query(`DROP INDEX "IDX_16c34de330ae8d59d9b31cce14"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_3e128d30e9910ff920eee4ef37"`); - await queryRunner.query(`DROP INDEX "IDX_c5c4366237dc2bb176c1503426"`); - await queryRunner.query(`DROP INDEX "IDX_75855b44250686f84b7c4bc1f1"`); - await queryRunner.query(`DROP INDEX "IDX_063324fdceb51f7086e401ed2c"`); - await queryRunner.query(`DROP INDEX "IDX_7cf84e8b5775f349f81a1f3cc4"`); - await queryRunner.query(`DROP INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d"`); - await queryRunner.query(`DROP INDEX "IDX_37215da8dee9503d759adb3538"`); - await queryRunner.query(`DROP INDEX "IDX_c210effeb6314d325bc024d21e"`); - await queryRunner.query(`DROP INDEX "IDX_bc1e32c13683dbb16ada1c6da1"`); - await queryRunner.query(`DROP INDEX "IDX_18e22d4b569159bb91dec869aa"`); - await queryRunner.query(`DROP INDEX "IDX_3590135ac2034d7aa88efa7e52"`); - await queryRunner.query(`DROP INDEX "IDX_904ae0b765faef6ba2db8b1e69"`); - await queryRunner.query(`ALTER TABLE "organization_project" RENAME TO "temporary_organization_project"`); - await queryRunner.query( - `CREATE TABLE "organization_project" ("id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "tenantId" varchar, "organizationId" varchar, "name" varchar NOT NULL, "startDate" datetime, "endDate" datetime, "billing" varchar, "currency" varchar, "public" boolean, "owner" varchar, "taskListType" varchar NOT NULL DEFAULT ('GRID'), "code" varchar, "description" varchar, "color" varchar, "billable" boolean, "billingFlat" boolean, "openSource" boolean, "projectUrl" varchar, "openSourceProjectUrl" varchar, "budget" integer, "budgetType" text DEFAULT ('cost'), "organizationContactId" varchar, "membersCount" integer DEFAULT (0), "imageUrl" varchar(500), "imageId" varchar, "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "repositoryId" varchar, "isTasksAutoSync" boolean DEFAULT (1), "isTasksAutoSyncOnLabel" boolean DEFAULT (1), "syncTag" varchar, "deletedAt" datetime, "fix_relational_custom_fields" boolean, CONSTRAINT "FK_904ae0b765faef6ba2db8b1e698" FOREIGN KEY ("repositoryId") REFERENCES "organization_github_repository" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_bc1e32c13683dbb16ada1c6da14" FOREIGN KEY ("organizationContactId") REFERENCES "organization_contact" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "FK_9d8afc1e1e64d4b7d48dd2229d7" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_7cf84e8b5775f349f81a1f3cc44" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_063324fdceb51f7086e401ed2c9" FOREIGN KEY ("imageId") REFERENCES "image_asset" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project"("id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields") SELECT "id", "createdAt", "updatedAt", "tenantId", "organizationId", "name", "startDate", "endDate", "billing", "currency", "public", "owner", "taskListType", "code", "description", "color", "billable", "billingFlat", "openSource", "projectUrl", "openSourceProjectUrl", "budget", "budgetType", "organizationContactId", "membersCount", "imageUrl", "imageId", "isActive", "isArchived", "repositoryId", "isTasksAutoSync", "isTasksAutoSyncOnLabel", "syncTag", "deletedAt", "fix_relational_custom_fields" FROM "temporary_organization_project"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project"`); - await queryRunner.query(`CREATE INDEX "IDX_3e128d30e9910ff920eee4ef37" ON "organization_project" ("syncTag") `); - await queryRunner.query( - `CREATE INDEX "IDX_c5c4366237dc2bb176c1503426" ON "organization_project" ("isTasksAutoSyncOnLabel") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_75855b44250686f84b7c4bc1f1" ON "organization_project" ("isTasksAutoSync") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_063324fdceb51f7086e401ed2c" ON "organization_project" ("imageId") `); - await queryRunner.query( - `CREATE INDEX "IDX_7cf84e8b5775f349f81a1f3cc4" ON "organization_project" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_9d8afc1e1e64d4b7d48dd2229d" ON "organization_project" ("organizationId") ` - ); - await queryRunner.query(`CREATE INDEX "IDX_37215da8dee9503d759adb3538" ON "organization_project" ("name") `); - await queryRunner.query( - `CREATE INDEX "IDX_c210effeb6314d325bc024d21e" ON "organization_project" ("currency") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_bc1e32c13683dbb16ada1c6da1" ON "organization_project" ("organizationContactId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_18e22d4b569159bb91dec869aa" ON "organization_project" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_3590135ac2034d7aa88efa7e52" ON "organization_project" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_904ae0b765faef6ba2db8b1e69" ON "organization_project" ("repositoryId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - } - - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`status\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`archiveTasksIn\` decimal NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`closeTasksIn\` decimal NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project\` ADD \`defaultAssigneeId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\` (\`status\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\` (\`defaultAssigneeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_489012234f53089d4b508f4aa12\` FOREIGN KEY (\`defaultAssigneeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_489012234f53089d4b508f4aa12\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_489012234f53089d4b508f4aa1\` ON \`organization_project\``); - await queryRunner.query(`DROP INDEX \`IDX_16c34de330ae8d59d9b31cce14\` ON \`organization_project\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`defaultAssigneeId\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`closeTasksIn\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`archiveTasksIn\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`icon\``); - await queryRunner.query(`ALTER TABLE \`organization_project\` DROP COLUMN \`status\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - } -} diff --git a/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts new file mode 100644 index 00000000000..283f28d65d7 --- /dev/null +++ b/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -0,0 +1,649 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AddColumnsToOrganizationProjectEmployeeEntity1725982927532 implements MigrationInterface { + name = 'AddColumnsToOrganizationProjectEmployeeEntity1725982927532'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + // Drop unnecessary foreign key constraints + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_6b5b0c3d994f59d9c800922257f"` + ); + + // Add necessary columns + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` + ); + + // Drop old primary key + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "PK_5be2464327d74ba4e2b2240aac4"` + ); + + // Add new primary key (combination of id, employeeId, and organizationProjectId) + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("id", "employeeId", "organizationProjectId")` + ); + + // Add additional necessary columns + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); + + // Create indexes + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId")` + ); + + // Re-add foreign key constraints + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + // Drop foreign key constraints + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_1c5e006185395a6193ede3456c6"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_a77a507b7402f0adb6a6b41e412"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_a9abd98013154ec1edfa1ec18cd"` + ); + + // Drop indexes + await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); + + // Drop primary key + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "PK_ce1fc15962d70f8776be4e19c36"` + ); + + // Remove added columns + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "roleId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "organizationId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "tenantId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "isArchived"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "isActive"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "updatedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "createdAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "deletedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "id"`); + + // Restore the original primary key + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + + // Restore the original foreign key constraints + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + } + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + } +} diff --git a/packages/core/src/employee/employee.entity.ts b/packages/core/src/employee/employee.entity.ts index 61b80c02989..7cf3358587d 100644 --- a/packages/core/src/employee/employee.entity.ts +++ b/packages/core/src/employee/employee.entity.ts @@ -568,15 +568,6 @@ export class Employee extends TenantOrganizationBaseEntity implements IEmployee, }) dailyPlans?: IDailyPlan[]; - /** - * Projects for whom employee is default assigned - */ - @ApiPropertyOptional({ type: () => OrganizationProject, isArray: true }) - @MultiORMOneToMany(() => OrganizationProject, (project) => project.defaultAssignee, { - cascade: true - }) - projectDefaultAssignments?: IOrganizationProject[]; - /* |-------------------------------------------------------------------------- | @ManyToMany From 0e3021b4bbbaa8761b1b338215184ef926e8e53d Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Mon, 16 Sep 2024 15:08:50 +0530 Subject: [PATCH 17/47] feat: add table migration for PostgreSQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 649 ------------------ ...umnsToOrganizationProjectEmployeeEntity.ts | 241 +++++++ 2 files changed, 241 insertions(+), 649 deletions(-) delete mode 100644 packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts create mode 100644 packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts diff --git a/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts deleted file mode 100644 index 283f28d65d7..00000000000 --- a/packages/core/src/database/migrations/1725982927532-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ /dev/null @@ -1,649 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { yellow } from 'chalk'; -import { DatabaseTypeEnum } from '@gauzy/config'; - -export class AddColumnsToOrganizationProjectEmployeeEntity1725982927532 implements MigrationInterface { - name = 'AddColumnsToOrganizationProjectEmployeeEntity1725982927532'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - // Drop unnecessary foreign key constraints - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_6b5b0c3d994f59d9c800922257f"` - ); - - // Add necessary columns - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` - ); - - // Drop old primary key - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "PK_5be2464327d74ba4e2b2240aac4"` - ); - - // Add new primary key (combination of id, employeeId, and organizationProjectId) - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("id", "employeeId", "organizationProjectId")` - ); - - // Add additional necessary columns - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` - ); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "archivedAt" TIMESTAMP`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); - - // Create indexes - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive")` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived")` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId")` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId")` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId")` - ); - - // Re-add foreign key constraints - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { - // Drop foreign key constraints - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_1c5e006185395a6193ede3456c6"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_6b5b0c3d994f59d9c800922257f"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_2ba868f42c2301075b7c141359e"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_a77a507b7402f0adb6a6b41e412"` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "FK_a9abd98013154ec1edfa1ec18cd"` - ); - - // Drop indexes - await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); - - // Drop primary key - await queryRunner.query( - `ALTER TABLE "organization_project_employee" DROP CONSTRAINT IF EXISTS "PK_ce1fc15962d70f8776be4e19c36"` - ); - - // Remove added columns - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "roleId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "organizationId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "tenantId"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "archivedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "isArchived"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "isActive"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "updatedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "createdAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "deletedAt"`); - await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN IF EXISTS "id"`); - - // Restore the original primary key - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` - ); - - // Restore the original foreign key constraints - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - } - - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - } - - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` - ); - await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`, \`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - } -} diff --git a/packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts new file mode 100644 index 00000000000..97890659c4e --- /dev/null +++ b/packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -0,0 +1,241 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implements MigrationInterface { + name = 'AddColumnsToOrganizationProjectEmployeeEntity1726406901894'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_a8d924902879f0a3349678c86f"`); + await queryRunner.query(`DROP INDEX "public"."IDX_b4734abeedbb9c724c980f7f54"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isActive" boolean DEFAULT true`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isArchived" boolean DEFAULT false`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "archivedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "tenantId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "organizationId" uuid`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isManager" boolean DEFAULT false`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "assignedAt" TIMESTAMP`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` + ); + await queryRunner.query(`CREATE INDEX "IDX_837468421e96f22a2e12022ef0" ON "favorite" ("entity") `); + await queryRunner.query(`CREATE INDEX "IDX_e88acab853ab012582c6d0f3f6" ON "favorite" ("entityId") `); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` + ); + await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "public"."IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "public"."IDX_e88acab853ab012582c6d0f3f6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_837468421e96f22a2e12022ef0"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd" PRIMARY KEY ("employeeId", "id")` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ef7ed5fb243d49d55cecf1ae8bd"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "assignedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isManager"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "organizationId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "tenantId"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "archivedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isArchived"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` + ); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); + await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); + await queryRunner.query(`CREATE INDEX "IDX_b4734abeedbb9c724c980f7f54" ON "favorite" ("entityId") `); + await queryRunner.query(`CREATE INDEX "IDX_a8d924902879f0a3349678c86f" ON "favorite" ("entity") `); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project"("id") ON DELETE CASCADE ON UPDATE CASCADE` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} +} From fab13e1f6c8138328dae2bb3239cab6efd7f615e Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Mon, 16 Sep 2024 15:11:03 +0530 Subject: [PATCH 18/47] fix: updated project/contact mutation according new project employee entity --- .../contact-mutation.component.ts | 113 ++++++++++++++---- .../components/project-list/list.component.ts | 25 ++-- .../src/organization-projects.model.ts | 4 +- packages/core/src/email-template/utils.ts | 2 + packages/core/src/employee/employee.entity.ts | 23 ++-- .../invite.accept-employee.handler.ts | 50 +++++--- .../organization-contact-create.handler.ts | 44 ++++--- .../organization-project-employee.entity.ts | 18 ++- .../organization-project.entity.ts | 30 ++--- .../lib/components/avatar/avatar.component.ts | 14 ++- .../project-mutation.component.ts | 7 +- ...ject-organization-employees.component.html | 34 +++--- ...roject-organization-employees.component.ts | 58 +++++---- 13 files changed, 273 insertions(+), 149 deletions(-) diff --git a/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts b/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts index 12bbb2f1cc5..440e46b84b5 100644 --- a/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts +++ b/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts @@ -8,7 +8,9 @@ import { IOrganization, OrganizationContactBudgetTypeEnum, IOrganizationContact, - IImageAsset + IImageAsset, + IOrganizationProjectEmployee, + ID } from '@gauzy/contracts'; import { NbStepperComponent } from '@nebular/theme'; import { debounceTime, filter, tap } from 'rxjs/operators'; @@ -332,18 +334,16 @@ export class ContactMutationComponent extends TranslationBaseComponent implement } const { id: organizationId, tenantId } = this.organization; - const data = this.contMainForm.value; const budget = this.budgetForm.value; - const location = this.locationFormDirective.getValue(); - const { fax, fiscalInformation, website } = this.contMainForm.getRawValue(); - - const { coordinates } = location['loc']; - delete location['loc']; + const locationData = this.locationFormDirective.getValue(); + const { fax, fiscalInformation, website } = this.contMainForm.value; + // Extract and destructure coordinates + const { coordinates, ...location } = locationData.loc; const [latitude, longitude] = coordinates; - // Combining form data with additional properties + // Construct the contact object const contact = { latitude, longitude, @@ -351,31 +351,74 @@ export class ContactMutationComponent extends TranslationBaseComponent implement website, fax, ...location, + organizationId, organization: { id: organizationId }, tenantId, tenant: { id: tenantId }, - ...(this.organizationContact?.contact?.id ? { id: this.organizationContact?.contact?.id } : {}) + ...(this.organizationContact?.contact?.id && { id: this.organizationContact.contact.id }) }; - /** - * Constructs an array of member objects from a list of member or selected employee IDs. - * Each ID is mapped to a corresponding employee object, filtering out any non-existent (falsy) members. - */ - let memberIds = this.members || this.selectedEmployeeIds || []; - let members = memberIds.map((id) => this.employees.find((e) => e.id === id)).filter(Boolean); + // Consolidate member IDs and retrieve corresponding employees + const members = this.getSelectedMembers(); - if (!members.length) members = this.selectedMembers; + // Retrieve and process projects with assigned members + const projects = this.assignMembersToProjects(data.projects ?? [], members); - // - let projects = data.projects ?? []; - projects.forEach((project: IOrganizationProject) => { - if (Array.isArray(project.members)) { - project.members.push(...members); - } else { - project.members = [...members]; - } + // Step 5: Emit the consolidated data + this.emitConsolidatedData({ budget, data, projects, members, contact }); + } + + /** + * Retrieves selected members based on member IDs or selected employees. + * @returns An array of IEmployee objects. + */ + private getSelectedMembers(): IEmployee[] { + // Step 1: Get the list of member IDs + const memberIds = this.members || this.selectedEmployeeIds || []; + + // Step 2: Find corresponding IEmployee objects and filter out any falsy values + const members = memberIds.map((id) => this.employees.find((e) => e.id === id)).filter(Boolean); + + // Fallback to selectedMembers if no members found + return members.length ? members : this.selectedMembers; + } + + /** + * Assigns selected members to each project by transforming them into IOrganizationProjectEmployee objects. + * @param projects The array of projects to which members will be assigned. + * @param members The array of selected IEmployee objects. + * @returns The updated array of projects with assigned members. + */ + private assignMembersToProjects(projects: IOrganizationProject[], members: IEmployee[]): IOrganizationProject[] { + return projects.map((project: IOrganizationProject) => { + // Get the project members and transform them into IOrganizationProjectEmployee objects + const projectMembers: IOrganizationProjectEmployee[] = members.map((employee: IEmployee) => + this.transformToProjectEmployee(employee, project, this.organization) + ); + + return { + ...project, + members: Array.isArray(project.members) ? [...project.members, ...projectMembers] : [...projectMembers] + }; }); + } + /** + * Emits the consolidated data for further processing. + * + * @param payload The data to be emitted. + */ + private emitConsolidatedData(payload: { + budget: any; + data: any; + projects: IOrganizationProject[]; + members: IEmployee[]; + contact: any; + }) { + const { budget, data, projects, members, contact } = payload; + const { id: organizationId, tenantId } = this.organization; + + // Emit the consolidated data this.addOrEditOrganizationContact.emit({ ...budget, ...data, @@ -386,10 +429,30 @@ export class ContactMutationComponent extends TranslationBaseComponent implement organization: { id: organizationId }, tenantId, tenant: { id: tenantId }, - ...(this.organizationContact?.id ? { id: this.organizationContact?.id } : {}) + ...(this.organizationContact?.id && { id: this.organizationContact.id }) }); } + /** + * Transforms an IEmployee into an IOrganizationProjectEmployee. + * + * @param employee The employee to transform. + * @param project The project to associate with the employee. + * @param organization The organization context. + * @returns The transformed IOrganizationProjectEmployee object. + */ + private transformToProjectEmployee = ( + employee: IEmployee, + project: IOrganizationProject, + organization: IOrganization + ): IOrganizationProjectEmployee => ({ + ...employee, + organizationProject: project, // Assign the current project + organizationProjectId: project.id, // Assign the project's ID + organizationId: organization.id, // Assign the organization's ID + tenantId: organization.tenantId // Assign the organization's tenant ID + }); + /** * Updates the 'tags' field in 'contMainForm' with the selected tags and validate the form. * @param tags An array of selected tag objects. diff --git a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts index 0deb2ab702c..1326e9fe61e 100644 --- a/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts +++ b/apps/gauzy/src/app/pages/projects/components/project-list/list.component.ts @@ -12,9 +12,10 @@ import { PermissionsEnum, ComponentLayoutStyleEnum, CrudActionEnum, - IEmployee, ITag, - IOrganizationProject + IOrganizationProject, + ID, + IOrganizationProjectEmployee } from '@gauzy/contracts'; import { API_PREFIX, ComponentEnum, distinctUntilChange } from '@gauzy/ui-core/common'; import { @@ -54,7 +55,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen public viewComponentName: ComponentEnum; public dataLayoutStyle = ComponentLayoutStyleEnum.TABLE; public componentLayoutStyleEnum = ComponentLayoutStyleEnum; - public selectedEmployeeId: IEmployee['id'] | null; + public selectedEmployeeId: ID | null; public selectedProject: IOrganizationProject; public organization: IOrganization; public smartTableSource: ServerDataSource; @@ -218,12 +219,12 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen return; } - const { tenantId } = this._store.user; - const { id: organizationId } = this.organization; + // Extract organization ID and tenant ID from the organization object + const { id: organizationId, tenantId } = this.organization; this.smartTableSource = new ServerDataSource(this._httpClient, { endPoint: `${API_PREFIX}/organization-projects/pagination`, - relations: ['organizationContact', 'organization', 'members', 'members.user', 'tags', 'teams'], + relations: ['organizationContact', 'members.employee.user', 'tags', 'teams'], join: { alias: 'organization_project', leftJoin: { @@ -245,7 +246,9 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen resultMap: (project: IOrganizationProject) => { return Object.assign({}, project, { ...this.privatePublicProjectMapper(project), - employeesMergedTeams: [project.members] + employeesMergedTeams: [ + project.members.map((member: IOrganizationProjectEmployee) => member.employee) + ] }); }, finalize: () => { @@ -301,6 +304,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen /** * Maps an organization project based on user permissions and project visibility. + * * @param project The project to be mapped. * @returns The mapped project. */ @@ -316,11 +320,14 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen /** * Filters project members to include only the ones that match the current user's ID. + * * @param project The project with members. * @returns The project with filtered members. */ private filterProjectMembers(project: IOrganizationProject): IOrganizationProject { - project.members = project.members.filter((member: IEmployee) => member.id === this._store.userId); + project.members = project.members.filter( + (member: IOrganizationProjectEmployee) => member.employeeId === this._store.user?.employeeId + ); return project; } @@ -438,7 +445,7 @@ export class ProjectListComponent extends PaginationFilterBaseComponent implemen } this.setFilter({ field: 'tags', search: tagIds }); }, - sort: false + isSortable: false } }; break; diff --git a/packages/contracts/src/organization-projects.model.ts b/packages/contracts/src/organization-projects.model.ts index 9c289eebfcb..281243e08f1 100644 --- a/packages/contracts/src/organization-projects.model.ts +++ b/packages/contracts/src/organization-projects.model.ts @@ -33,7 +33,7 @@ export interface IOrganizationProjectBase endDate?: Date; billing?: ProjectBillingEnum; currency?: CurrenciesEnum; - members?: IEmployee[]; + members?: IOrganizationProjectEmployee[]; public?: boolean; owner?: ProjectOwnerEnum; tasks?: ITask[]; @@ -102,6 +102,8 @@ export interface IOrganizationProjectEmployee IRelationalRole { organizationProject: IOrganizationProject; organizationProjectId: ID; + isManager?: boolean; + assignedAt?: Date; } // Task List Type Enum diff --git a/packages/core/src/email-template/utils.ts b/packages/core/src/email-template/utils.ts index 480aff245be..7954275a4e3 100644 --- a/packages/core/src/email-template/utils.ts +++ b/packages/core/src/email-template/utils.ts @@ -248,8 +248,10 @@ export class EmailTemplateUtils { // Update if exists, otherwise insert if (parseInt(template.count, 10) > 0) { await queryRunner.connection.manager.query(updateQuery, [hbs, mjml, name, languageCode]); + console.log(`email template updated: ${updateQuery}`); } else { await queryRunner.connection.manager.query(insertQuery, payload); + console.log(`email template created: ${insertQuery}`); } } } diff --git a/packages/core/src/employee/employee.entity.ts b/packages/core/src/employee/employee.entity.ts index 7c699d3dd6a..f337d2d196b 100644 --- a/packages/core/src/employee/employee.entity.ts +++ b/packages/core/src/employee/employee.entity.ts @@ -66,6 +66,7 @@ import { OrganizationEmploymentType, OrganizationPosition, OrganizationProject, + OrganizationProjectEmployee, OrganizationProjectModule, OrganizationTeamEmployee, RequestApprovalEmployee, @@ -490,6 +491,12 @@ export class Employee extends TenantOrganizationBaseEntity implements IEmployee, }) teams?: IOrganizationTeam[]; + // Employee Project + @MultiORMOneToMany(() => OrganizationProjectEmployee, (it) => it.employee, { + cascade: true + }) + projects?: IOrganizationProject[]; + /** * Estimations */ @@ -586,22 +593,6 @@ export class Employee extends TenantOrganizationBaseEntity implements IEmployee, |-------------------------------------------------------------------------- */ - /** - * Employee Organization Projects - */ - @MultiORMManyToMany(() => OrganizationProject, (it) => it.members, { - onUpdate: 'CASCADE', - onDelete: 'CASCADE', - owner: true, - pivotTable: 'organization_project_employee', - joinColumn: 'employeeId', - inverseJoinColumn: 'organizationProjectId' - }) - @JoinTable({ - name: 'organization_project_employee' - }) - projects?: IOrganizationProject[]; - /** * Employee Tags */ diff --git a/packages/core/src/invite/commands/handlers/invite.accept-employee.handler.ts b/packages/core/src/invite/commands/handlers/invite.accept-employee.handler.ts index 39f071a5fed..8e11b4fe8f9 100644 --- a/packages/core/src/invite/commands/handlers/invite.accept-employee.handler.ts +++ b/packages/core/src/invite/commands/handlers/invite.accept-employee.handler.ts @@ -1,6 +1,8 @@ +import { NotFoundException } from '@nestjs/common'; import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'; import { InjectRepository } from '@nestjs/typeorm'; import { UpdateResult } from 'typeorm'; +import { IAppIntegrationConfig } from '@gauzy/common'; import { IEmployee, IInvite, @@ -22,6 +24,7 @@ import { OrganizationContact, OrganizationDepartment, OrganizationProject, + OrganizationProjectEmployee, OrganizationTeam, OrganizationTeamEmployee, User @@ -32,8 +35,6 @@ import { TypeOrmOrganizationDepartmentRepository } from '../../../organization-d import { TypeOrmOrganizationProjectRepository } from '../../../organization-project/repository/type-orm-organization-project.repository'; import { TypeOrmOrganizationTeamRepository } from '../../../organization-team/repository/type-orm-organization-team.repository'; import { TypeOrmUserRepository } from '../../../user/repository/type-orm-user.repository'; -import { IAppIntegrationConfig } from '@gauzy/common'; -import { NotFoundException } from '@nestjs/common'; /** * Use this command for registering employees. @@ -215,23 +216,6 @@ export class InviteAcceptEmployeeHandler implements ICommandHandler { - //Update project members - if (invite.projects) { - invite.projects.forEach(async (project: IOrganizationProject) => { - let members = project.members || []; - members = [...members, employee]; - /** - * Creates a new entity instance and copies all entity properties from this object into a new entity. - */ - const create = this.typeOrmOrganizationProjectRepository.create({ - ...project, - members - }); - //This will call save() on the project (and not really create a new organization project) - await this.typeOrmOrganizationProjectRepository.save(create); - }); - } - //Update organization Contacts members if (invite.organizationContacts) { invite.organizationContacts.forEach(async (organizationContact: IOrganizationContact) => { @@ -271,11 +255,13 @@ export class InviteAcceptEmployeeHandler implements ICommandHandler { let members = team.members || []; + // Create new team member const member = new OrganizationTeamEmployee(); member.organizationId = employee.organizationId; member.tenantId = employee.tenantId; member.employee = employee; + // Add member to team members = [...members, member]; /** @@ -289,5 +275,31 @@ export class InviteAcceptEmployeeHandler implements ICommandHandler { + // Get existing project members + let members = project.members || []; + + // Create new project member + const member = new OrganizationProjectEmployee(); + member.employee = employee; + member.organizationId = employee.organizationId; + member.tenantId = employee.tenantId; + + // Add member to project + members = [...members, member]; + + // Create new project + const create = this.typeOrmOrganizationProjectRepository.create({ + ...project, + members + }); + + //This will call save() on the project (and not really create a new organization project) + await this.typeOrmOrganizationProjectRepository.save(create); + }); + } } } diff --git a/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts b/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts index 1552159ba9a..a134af71c03 100644 --- a/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts +++ b/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts @@ -1,11 +1,12 @@ import { CommandHandler, ICommandHandler } from '@nestjs/cqrs'; +import { BadRequestException } from '@nestjs/common'; import { In } from 'typeorm'; -import { IOrganizationContact, IOrganizationProject } from '@gauzy/contracts'; +import { IEmployee, IOrganizationContact, IOrganizationProject, IOrganizationProjectEmployee } from '@gauzy/contracts'; import { isEmpty, isNotEmpty } from '@gauzy/common'; +import { RequestContext } from '../../../core/context'; import { OrganizationContactCreateCommand } from '../organization-contact-create.command'; import { OrganizationContactService } from '../../organization-contact.service'; import { OrganizationProjectService } from '../../../organization-project/organization-project.service'; -import { RequestContext } from '../../../core/context'; import { ContactService } from '../../../contact/contact.service'; @CommandHandler(OrganizationContactCreateCommand) @@ -24,18 +25,16 @@ export class OrganizationContactCreateHandler implements ICommandHandler { try { - // Destructure the input from the command. const { input } = command; - // Destructure organizationId from the input, and get tenantId either from the current RequestContext or from the input. - let { organizationId } = input; + + const organizationId = input.organizationId; const tenantId = RequestContext.currentTenantId() || input.tenantId; - // Check if the input members are empty and projects are defined. + // If members are empty and projects are provided, populate members from projects if (isEmpty(input.members) && isNotEmpty(input.projects)) { - // Map the projects to their IDs. - const projectIds = input.projects.map((project) => project.id); + const projectIds = input.projects.map((project: IOrganizationProject) => project.id); - // Retrieve projects with specified IDs, belonging to the given organization and tenant. + // Fetch projects with members const projects = await this._organizationProjectService.find({ where: { id: In(projectIds), @@ -45,30 +44,41 @@ export class OrganizationContactCreateHandler implements ICommandHandler project.members); + // Extract all project employees + const projectEmployees: IOrganizationProjectEmployee[] = projects.flatMap( + (project: IOrganizationProject) => project.members + ); + + // Map each project employee to IEmployee + const projectMembers: IEmployee[] = await Promise.all( + projectEmployees + .flatMap((projectEmployee: IOrganizationProjectEmployee) => projectEmployee.employee) + .map((employee: IEmployee) => employee) + ); + + // Assign to input.members, ensuring input.members is initialized + input.members = [...(input.members || []), ...projectMembers]; } // Create contact details of organization try { input.contact = await this._contactService.create({ ...input.contact, + organizationId, + tenantId, organization: { id: organizationId } }); } catch (error) { - console.log( - 'Error occurred during creation of contact details or creating the organization contact:', - error - ); + throw new BadRequestException('Failed to create contact details', error.message); } - // Create a new organization contact with the modified input. + // Create a new organization contact with the modified input return await this._organizationContactService.create({ ...input, organization: { id: organizationId } }); } catch (error) { - console.error('Error while creating new organization contact', error); + throw new BadRequestException('Failed to create organization contact', error.message); } } } diff --git a/packages/core/src/organization-project/organization-project-employee.entity.ts b/packages/core/src/organization-project/organization-project-employee.entity.ts index beb078c0de2..15fa58aa1ca 100644 --- a/packages/core/src/organization-project/organization-project-employee.entity.ts +++ b/packages/core/src/organization-project/organization-project-employee.entity.ts @@ -1,6 +1,6 @@ import { RelationId } from 'typeorm'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { IsNotEmpty, IsOptional, IsUUID } from 'class-validator'; +import { IsBoolean, IsDateString, IsNotEmpty, IsOptional, IsUUID } from 'class-validator'; import { ID, IEmployee, IOrganizationProject, IOrganizationProjectEmployee, IRole } from '@gauzy/contracts'; import { Employee, OrganizationProject, Role, TenantOrganizationBaseEntity } from '../core/entities/internal'; import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToOne } from './../core/decorators/entity'; @@ -10,6 +10,22 @@ import { MikroOrmOrganizationProjectEmployeeRepository } from './repository/mikr mikroOrmRepository: () => MikroOrmOrganizationProjectEmployeeRepository }) export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity implements IOrganizationProjectEmployee { + // Manager of the organization project + @ApiPropertyOptional({ type: () => Boolean, default: false }) + @IsOptional() + @IsBoolean() + @ColumnIndex() + @MultiORMColumn({ type: Boolean, nullable: true, default: false }) + isManager?: boolean; + + // Assigned At Manager of the organization project + @ApiPropertyOptional({ type: () => Date }) + @IsOptional() + @IsDateString() + @ColumnIndex() + @MultiORMColumn({ nullable: true }) + assignedAt?: Date; + /* |-------------------------------------------------------------------------- | @ManyToOne diff --git a/packages/core/src/organization-project/organization-project.entity.ts b/packages/core/src/organization-project/organization-project.entity.ts index 670302c2629..9b86f2d922e 100644 --- a/packages/core/src/organization-project/organization-project.entity.ts +++ b/packages/core/src/organization-project/organization-project.entity.ts @@ -11,6 +11,7 @@ import { IInvoiceItem, IOrganizationContact, IOrganizationProject, + IOrganizationProjectEmployee, IOrganizationProjectModule, IOrganizationSprint, IOrganizationTeam, @@ -37,6 +38,7 @@ import { ImageAsset, InvoiceItem, OrganizationContact, + OrganizationProjectEmployee, OrganizationProjectModule, OrganizationSprint, OrganizationTeam, @@ -187,10 +189,6 @@ export class OrganizationProject }) budgetType?: OrganizationProjectBudgetTypeEnum; - // Specifies the number of members in the project, if provided. - @MultiORMColumn({ nullable: true, default: 0 }) - membersCount?: number; - @ApiPropertyOptional({ type: () => String }) @IsOptional() @IsString() @@ -253,6 +251,10 @@ export class OrganizationProject @MultiORMColumn({ nullable: true, type: 'decimal' }) closeTasksIn?: number; + // Specifies the number of members in the project, if provided. + @MultiORMColumn({ nullable: true, default: 0 }) + membersCount?: number; + /* |-------------------------------------------------------------------------- | @ManyToOne @@ -339,6 +341,15 @@ export class OrganizationProject |-------------------------------------------------------------------------- */ + /** + * OrganizationTeamEmployee + */ + @MultiORMOneToMany(() => OrganizationProjectEmployee, (it) => it.organizationProject, { + /** If set to true then it means that related object can be allowed to be inserted or updated in the database. */ + cascade: true + }) + members?: IOrganizationProjectEmployee[]; + /** * Organization Tasks Relationship */ @@ -441,17 +452,6 @@ export class OrganizationProject }) tags?: ITag[]; - /** - * Project Members Relationship - */ - @MultiORMManyToMany(() => Employee, (it) => it.projects, { - /** Defines the database action to perform on update. */ - onUpdate: 'CASCADE', - /** Defines the database cascade action on delete. */ - onDelete: 'CASCADE' - }) - members?: IEmployee[]; - /** * Organization Teams Relationship */ diff --git a/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts b/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts index 310c0047225..ccaec5b43a2 100644 --- a/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts +++ b/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts @@ -1,12 +1,13 @@ import { Component, OnInit, Input } from '@angular/core'; import { Router } from '@angular/router'; +import { ID } from '@gauzy/contracts'; @Component({ selector: 'ngx-avatar', templateUrl: './avatar.component.html', styleUrls: ['./avatar.component.scss'] }) -export class AvatarComponent implements OnInit { +export class AvatarComponent { @Input() size: 'lg' | 'sm' | 'md' = 'md'; @Input() src: string; @Input() appendCaption: string; @@ -46,11 +47,14 @@ export class AvatarComponent implements OnInit { constructor(private readonly router: Router) {} - ngOnInit() {} - - edit(id: string) { + /** + * Navigates to the employee edit page based on the provided employee ID. + * + * @param id - The ID of the employee to edit. + */ + edit(id: ID): void { if (id) { - this.router.navigate(['/pages/employees/edit/', id]); + this.router.navigate([`/pages/employees/edit/${id}`]); } } } diff --git a/packages/ui-core/shared/src/lib/project/project-mutation/project-mutation.component.ts b/packages/ui-core/shared/src/lib/project/project-mutation/project-mutation.component.ts index c433a552461..b882b805cbf 100644 --- a/packages/ui-core/shared/src/lib/project/project-mutation/project-mutation.component.ts +++ b/packages/ui-core/shared/src/lib/project/project-mutation/project-mutation.component.ts @@ -28,7 +28,8 @@ import { IOrganizationProjectSetting, IIntegrationMapSyncRepository, IOrganizationGithubRepository, - SYNC_TAG_GAUZY + SYNC_TAG_GAUZY, + IOrganizationProjectEmployee } from '@gauzy/contracts'; import { GithubService, @@ -288,9 +289,11 @@ export class ProjectMutationComponent extends TranslationBaseComponent implement } const project: IOrganizationProject = this.project; - this.selectedEmployeeIds = project.members.map((member: IEmployee) => member.id); + // Selected Members Ids + this.selectedEmployeeIds = project.members.map((member: IOrganizationProjectEmployee) => member.employeeId); this.members = this.selectedEmployeeIds; + this.form.patchValue({ imageUrl: project.imageUrl || null, imageId: project.imageId || null, diff --git a/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.html b/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.html index e064fd049c6..53012cf6360 100644 --- a/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.html +++ b/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.html @@ -1,33 +1,29 @@ -
+
{{ 'ORGANIZATIONS_PAGE.EDIT.MEMBERS' | translate }}
+ + + + + + {{ member?.employee?.fullName }} + + diff --git a/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.ts b/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.ts index dfcfcd14fc4..819b342d558 100644 --- a/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.ts +++ b/packages/ui-core/shared/src/lib/table-components/project-organization-employees/project-organization-employees.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; -import { IEmployee } from '@gauzy/contracts'; import { Router } from '@angular/router'; +import { ID, IEmployee } from '@gauzy/contracts'; @Component({ selector: 'gauzy-project-organization-employees', @@ -8,33 +8,51 @@ import { Router } from '@angular/router'; styleUrls: ['./project-organization-employees.component.scss'] }) export class ProjectOrganizationEmployeesComponent implements OnInit { - @Input() - value: string | number; - @Input() - rowData: any; + @Input() value: string | number; + @Input() rowData: any; + employeesFirstHalf: IEmployee[] = []; employeesLastHalf: IEmployee[] = []; - constructor(private readonly router: Router) { } + constructor(readonly router: Router) {} + /** + * Lifecycle hook that is called after data-bound properties are initialized. + * Splits the members into two halves for display. + */ ngOnInit(): void { - if (this.rowData.members.length > 0) { - const size: number = this.rowData.members.length; - const half: number = size / 2; - for (let i = 0; i < size; i++) { - if (i < Math.ceil(half)) { - this.employeesFirstHalf[i] = this.rowData.members[i]; - } else { - this.employeesLastHalf[i - Math.ceil(half)] = - this.rowData.members[i]; - } - } - } + this.splitEmployeesIntoHalves(); } - edit(id: string) { + /** + * Splits the members array into two halves: first half and last half. + */ + private splitEmployeesIntoHalves(): void { + const members = this.rowData?.members || []; + const halfIndex = Math.ceil(members.length / 2); + + this.employeesFirstHalf = members.slice(0, halfIndex); + this.employeesLastHalf = members.slice(halfIndex); + } + + /** + * Navigates to the employee edit page based on the provided employee ID. + * + * @param id - The ID of the employee to edit. + */ + edit(id: ID): void { if (id) { - this.router.navigate(['/pages/employees/edit/' + id]); + this.router.navigate([`/pages/employees/edit/${id}`]); } } + + /** + * Tracks employees by their unique ID to optimize ngFor performance. + * @param index - The index of the item in the list. + * @param member - The employee member object. + * @returns The unique ID of the employee. + */ + trackByEmployeeId(index: number, member: IEmployee): ID { + return member.employee?.id; + } } From 51b0808826d4a9733eb786f0de70939a18824579 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Mon, 16 Sep 2024 17:15:11 +0530 Subject: [PATCH 19/47] fix(deepscan): removed unused import --- .../contacts/contact-mutation/contact-mutation.component.ts | 3 +-- packages/core/src/employee/employee.entity.ts | 1 - .../shared/src/lib/components/avatar/avatar.component.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts b/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts index 440e46b84b5..ea17b97eaea 100644 --- a/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts +++ b/apps/gauzy/src/app/pages/contacts/contact-mutation/contact-mutation.component.ts @@ -9,8 +9,7 @@ import { OrganizationContactBudgetTypeEnum, IOrganizationContact, IImageAsset, - IOrganizationProjectEmployee, - ID + IOrganizationProjectEmployee } from '@gauzy/contracts'; import { NbStepperComponent } from '@nebular/theme'; import { debounceTime, filter, tap } from 'rxjs/operators'; diff --git a/packages/core/src/employee/employee.entity.ts b/packages/core/src/employee/employee.entity.ts index f337d2d196b..1c2243481e1 100644 --- a/packages/core/src/employee/employee.entity.ts +++ b/packages/core/src/employee/employee.entity.ts @@ -65,7 +65,6 @@ import { OrganizationDepartment, OrganizationEmploymentType, OrganizationPosition, - OrganizationProject, OrganizationProjectEmployee, OrganizationProjectModule, OrganizationTeamEmployee, diff --git a/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts b/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts index ccaec5b43a2..f624d537673 100644 --- a/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts +++ b/packages/ui-core/shared/src/lib/components/avatar/avatar.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { Router } from '@angular/router'; import { ID } from '@gauzy/contracts'; From ac4d4c65744e0aaf2fbac1c0881a841acdc5dbaf Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Mon, 16 Sep 2024 23:35:17 +0530 Subject: [PATCH 20/47] fix: add table migration for PostgreSQL --- ...AddColumnsToOrganizationProjectEmployeeEntity.ts} | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) rename packages/core/src/database/migrations/{1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts => 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts} (92%) diff --git a/packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts similarity index 92% rename from packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts rename to packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 97890659c4e..8f7989d78c5 100644 --- a/packages/core/src/database/migrations/1726406901894-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -2,8 +2,8 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; import { yellow } from 'chalk'; import { DatabaseTypeEnum } from '@gauzy/config'; -export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implements MigrationInterface { - name = 'AddColumnsToOrganizationProjectEmployeeEntity1726406901894'; +export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implements MigrationInterface { + name = 'AddColumnsToOrganizationProjectEmployeeEntity1726509769379'; /** * Up Migration @@ -63,8 +63,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` ); - await queryRunner.query(`DROP INDEX "public"."IDX_a8d924902879f0a3349678c86f"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b4734abeedbb9c724c980f7f54"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` @@ -101,8 +99,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` ); - await queryRunner.query(`CREATE INDEX "IDX_837468421e96f22a2e12022ef0" ON "favorite" ("entity") `); - await queryRunner.query(`CREATE INDEX "IDX_e88acab853ab012582c6d0f3f6" ON "favorite" ("entityId") `); await queryRunner.query( `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` ); @@ -169,8 +165,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implemen await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "public"."IDX_e88acab853ab012582c6d0f3f6"`); - await queryRunner.query(`DROP INDEX "public"."IDX_837468421e96f22a2e12022ef0"`); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` ); @@ -201,8 +195,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726406901894 implemen ); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); - await queryRunner.query(`CREATE INDEX "IDX_b4734abeedbb9c724c980f7f54" ON "favorite" ("entityId") `); - await queryRunner.query(`CREATE INDEX "IDX_a8d924902879f0a3349678c86f" ON "favorite" ("entity") `); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` ); From db979580d1c4181a88ccc3906ddff2595a3ccf07 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 12:44:25 +0530 Subject: [PATCH 21/47] fix: add table migration for MySQL --- .../1705138670108-MysqlTablesMigration.ts | 4918 ++++++++++++++++- ...umnsToOrganizationProjectEmployeeEntity.ts | 160 +- 2 files changed, 4979 insertions(+), 99 deletions(-) diff --git a/packages/core/src/database/migrations/1705138670108-MysqlTablesMigration.ts b/packages/core/src/database/migrations/1705138670108-MysqlTablesMigration.ts index 0563ba22064..660010fa3d0 100644 --- a/packages/core/src/database/migrations/1705138670108-MysqlTablesMigration.ts +++ b/packages/core/src/database/migrations/1705138670108-MysqlTablesMigration.ts @@ -1,109 +1,4833 @@ - -import { MigrationInterface, QueryRunner } from "typeorm"; -import { DatabaseTypeEnum } from "@gauzy/config"; -import { yellow } from "chalk"; +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { DatabaseTypeEnum } from '@gauzy/config'; +import { yellow } from 'chalk'; export class MysqlTablesMigration1705138670108 implements MigrationInterface { + name = 'MysqlTablesMigration1705138670108'; - name = 'MysqlTablesMigration1705138670108'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { - - } + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } - } + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise {} - } + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise {} - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} - } + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`accounting_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`mjml\` text NULL, \`hbs\` longtext NOT NULL, \`templateType\` varchar(255) NOT NULL, INDEX \`IDX_5cf7c007fc9c83bee748f08806\` (\`isActive\`), INDEX \`IDX_7ac2c1c487dd77fe38c2d571ea\` (\`isArchived\`), INDEX \`IDX_2ca6a49062a4ed884e413bf572\` (\`tenantId\`), INDEX \`IDX_e66511b175393255c6c4e7b007\` (\`organizationId\`), INDEX \`IDX_968c1c9a131a61a3720b3a72f6\` (\`name\`), INDEX \`IDX_a841eabc6b656c965d8846223e\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`appointment_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`appointmentId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`employeeAppointmentId\` varchar(255) NULL, INDEX \`IDX_379af16b0aeed6a4d8f15c53bc\` (\`isActive\`), INDEX \`IDX_2a6f8c4b8da6f85e2903daf5c3\` (\`isArchived\`), INDEX \`IDX_2c0494466d5a7e1165cea3dca9\` (\`tenantId\`), INDEX \`IDX_3c3a62226896345c4716bfe1d9\` (\`organizationId\`), INDEX \`IDX_0ddc50b7521b9a905d9ca8c8ba\` (\`employeeId\`), INDEX \`IDX_e9ca170a0fae05e44a9bd137d8\` (\`employeeAppointmentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`approval_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`approvalType\` varchar(255) NULL, INDEX \`IDX_338364927c68961167606e989c\` (\`isActive\`), INDEX \`IDX_f50ce5a39d610cfcd9da9652b1\` (\`isArchived\`), INDEX \`IDX_1462391059ebe137645098d727\` (\`tenantId\`), INDEX \`IDX_dfe3b357df3ce136917b1f0984\` (\`organizationId\`), INDEX \`IDX_45f32a5a12d42fba17fe62a279\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`availability_slot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startTime\` datetime NOT NULL, \`endTime\` datetime NOT NULL, \`allDay\` tinyint NOT NULL, \`type\` text NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_3e20b617c7d7a87b8bf53ddcbe\` (\`isActive\`), INDEX \`IDX_3aabb2cdf5b6e0df87cb94bdca\` (\`isArchived\`), INDEX \`IDX_f008a481cb4eed547704bb9d83\` (\`tenantId\`), INDEX \`IDX_d544bd3a63634a4438509ac958\` (\`organizationId\`), INDEX \`IDX_46ed3c2287423f5dc089100fee\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_criterion_rating\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`rating\` int NOT NULL, \`technologyId\` varchar(255) NULL, \`personalQualityId\` varchar(255) NULL, \`feedbackId\` varchar(255) NULL, INDEX \`IDX_0a417dafb1dd14eb92a69fa641\` (\`isActive\`), INDEX \`IDX_fcab96cef60fd8bccac610ccef\` (\`isArchived\`), INDEX \`IDX_9d5bd131452ef689df2b46551b\` (\`tenantId\`), INDEX \`IDX_b106406e94bb7317493efc2c98\` (\`organizationId\`), INDEX \`IDX_d1d16bc87d3afaf387f34cdceb\` (\`technologyId\`), INDEX \`IDX_ba4c376b2069aa82745d4e9682\` (\`personalQualityId\`), INDEX \`IDX_159f821dd214792f1d2ad9cff7\` (\`feedbackId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_document\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`documentUrl\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_bf8070715e42b3afe9730e7b30\` (\`isActive\`), INDEX \`IDX_3ed4bac12d0ca32eada4ea5a49\` (\`isArchived\`), INDEX \`IDX_4d9b7ab09f9f9517d488b5fed1\` (\`tenantId\`), INDEX \`IDX_d108a827199fda86a9ec216989\` (\`organizationId\`), INDEX \`IDX_3f9053719c9d11ebdea03e5a2d\` (\`candidateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_education\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`schoolName\` varchar(255) NOT NULL, \`degree\` varchar(255) NOT NULL, \`field\` varchar(255) NOT NULL, \`completionDate\` datetime NOT NULL, \`notes\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_336eb14606016757d2302efa4d\` (\`isActive\`), INDEX \`IDX_b443c78c3796f2e9aab05a2bb9\` (\`isArchived\`), INDEX \`IDX_00cdd9ed7571be8e2c8d09e7cd\` (\`tenantId\`), INDEX \`IDX_f660af89b2c69fea2334508cbb\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_experience\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`occupation\` varchar(255) NOT NULL, \`duration\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_dafa68d060cf401d5f62a57ad4\` (\`isActive\`), INDEX \`IDX_c24bce6dd33e56ef8e8dacef1a\` (\`isArchived\`), INDEX \`IDX_8dcf5fc8bc7f77a80b0fc648bf\` (\`tenantId\`), INDEX \`IDX_a50eb955f940ca93e044d175c6\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_feedback\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` varchar(255) NULL, \`rating\` decimal NULL, \`status\` enum ('APPLIED', 'REJECTED', 'HIRED') NULL, \`candidateId\` varchar(255) NULL, \`interviewId\` varchar(255) NULL, \`interviewerId\` varchar(255) NULL, INDEX \`IDX_c660aef2ca5aff9dbf45a9a4bb\` (\`isActive\`), INDEX \`IDX_05ed49a5ebdd5ec533f913b620\` (\`isArchived\`), INDEX \`IDX_6cb21fa0f65ff69679966c836f\` (\`tenantId\`), INDEX \`IDX_3a6928f8501fce33820721a8fe\` (\`organizationId\`), INDEX \`IDX_98c008fd8cf597e83dcdccfd16\` (\`candidateId\`), INDEX \`IDX_0862c274d336126b951bfe009a\` (\`interviewId\`), UNIQUE INDEX \`REL_44f3d80c3293e1de038c87f115\` (\`interviewerId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_interview\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`startTime\` datetime NULL, \`endTime\` datetime NULL, \`location\` varchar(255) NULL, \`note\` varchar(255) NULL, \`rating\` decimal NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_b9191cf49f8cd1f192cb74233c\` (\`isActive\`), INDEX \`IDX_7b49ce2928b327213f2de66b95\` (\`isArchived\`), INDEX \`IDX_59b765e6d13d83dba4852a43eb\` (\`tenantId\`), INDEX \`IDX_03be41e88b1fecfe4e24d6b04b\` (\`organizationId\`), INDEX \`IDX_91996439c4baafee8395d3df15\` (\`candidateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_interviewer\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`interviewId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_b9132118c3a98c4c48e417c0c5\` (\`isActive\`), INDEX \`IDX_2043abff09f084fb8690009fb8\` (\`isArchived\`), INDEX \`IDX_f0ca69c78eea92c95d9044764a\` (\`tenantId\`), INDEX \`IDX_5f1e315db848990dfffa72817c\` (\`organizationId\`), INDEX \`IDX_ecb65075e94b47bbab11cfa5a1\` (\`interviewId\`), INDEX \`IDX_9e7b20eb3dfa082b83b198fdad\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_personal_quality\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`rating\` decimal NULL, \`interviewId\` varchar(255) NULL, INDEX \`IDX_afe01503d4337c9623c06f22df\` (\`isActive\`), INDEX \`IDX_ff6776d92db4ef71edbfba9903\` (\`isArchived\`), INDEX \`IDX_045de7c208adcd0c68c0a65174\` (\`tenantId\`), INDEX \`IDX_d321f4547ed467d07cce1e7d9a\` (\`organizationId\`), INDEX \`IDX_a0d171f45bdbcf2b990c0c37c3\` (\`interviewId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_skill\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_6907163d0bb8e9f0440b9bf2a7\` (\`isActive\`), INDEX \`IDX_a38fe0c3f2ff0a4e475f2a1347\` (\`isArchived\`), INDEX \`IDX_8a07f780c6fce2b82830ab0687\` (\`tenantId\`), INDEX \`IDX_d7986743e7f11720349a6c9557\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_source\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_2be9182096747fb18cb8afb1f0\` (\`isActive\`), INDEX \`IDX_509101ab1a46a5934ee278d447\` (\`isArchived\`), INDEX \`IDX_b2a1ba27a76dd819cd8294cce3\` (\`tenantId\`), INDEX \`IDX_e92027b5280828cadd7cd6ea71\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_technology\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`rating\` decimal NULL, \`interviewId\` varchar(255) NULL, INDEX \`IDX_199ca43300fa4e64239656a677\` (\`isActive\`), INDEX \`IDX_97aa0328b72e1bf919e61bccdc\` (\`isArchived\`), INDEX \`IDX_a6fecb615b07987b480defac64\` (\`tenantId\`), INDEX \`IDX_9d46b8c5382acd4d4514bc5c62\` (\`organizationId\`), INDEX \`IDX_063663c7e61e45d172d1b83265\` (\`interviewId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`rating\` decimal NULL, \`valueDate\` datetime NULL, \`appliedDate\` datetime NULL, \`hiredDate\` datetime NULL, \`status\` varchar(255) NULL DEFAULT 'APPLIED', \`rejectDate\` datetime NULL, \`candidateLevel\` varchar(500) NULL, \`reWeeklyLimit\` int NULL, \`billRateCurrency\` varchar(255) NULL, \`billRateValue\` int NULL, \`minimumBillingRate\` int NULL, \`payPeriod\` varchar(255) NULL, \`cvUrl\` varchar(255) NULL, \`contactId\` varchar(255) NULL, \`organizationPositionId\` varchar(255) NULL, \`sourceId\` varchar(255) NULL, \`userId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_2b8091376a529383e23ba3356a\` (\`isActive\`), INDEX \`IDX_af835b66fa10279103bd89e225\` (\`isArchived\`), INDEX \`IDX_77ac426e04553ff1654421bce4\` (\`tenantId\`), INDEX \`IDX_16fb27ffd1a99c6506c92ad57a\` (\`organizationId\`), INDEX \`IDX_b674793a804b7d69d74c8f6c5b\` (\`contactId\`), INDEX \`IDX_1e3e8228e7df634fa4cec6322c\` (\`organizationPositionId\`), INDEX \`IDX_4ea108fd8b089237964d5f98fb\` (\`sourceId\`), INDEX \`IDX_3930aa71e0fa24f09201811b1b\` (\`userId\`), INDEX \`IDX_8b900e8a39f76125e610ab30c0\` (\`employeeId\`), UNIQUE INDEX \`REL_b674793a804b7d69d74c8f6c5b\` (\`contactId\`), UNIQUE INDEX \`REL_4ea108fd8b089237964d5f98fb\` (\`sourceId\`), UNIQUE INDEX \`REL_3930aa71e0fa24f09201811b1b\` (\`userId\`), UNIQUE INDEX \`REL_8b900e8a39f76125e610ab30c0\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`contact\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`firstName\` varchar(255) NULL, \`lastName\` varchar(255) NULL, \`country\` varchar(255) NULL, \`city\` varchar(255) NULL, \`address\` varchar(255) NULL, \`address2\` varchar(255) NULL, \`postcode\` varchar(255) NULL, \`latitude\` decimal NULL, \`longitude\` decimal NULL, \`regionCode\` varchar(255) NULL, \`fax\` varchar(255) NULL, \`fiscalInformation\` varchar(255) NULL, \`website\` varchar(255) NULL, INDEX \`IDX_05831d37eabeb6150f99c69784\` (\`isActive\`), INDEX \`IDX_4164bd34bdcce8754641f0e567\` (\`isArchived\`), INDEX \`IDX_60468af1ce34043a900809c84f\` (\`tenantId\`), INDEX \`IDX_7719d73cd16a9f57ecc6ac24b3\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`country\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`isoCode\` varchar(255) NOT NULL, \`country\` varchar(255) NOT NULL, INDEX \`IDX_97ebcd8db30a408b5f907d6ff4\` (\`isActive\`), INDEX \`IDX_6cd9b7ea6818e862217035436c\` (\`isArchived\`), INDEX \`IDX_6eba1a52ee121d100c8a0a6510\` (\`isoCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`currency\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`isoCode\` varchar(255) NOT NULL, \`currency\` varchar(255) NOT NULL, INDEX \`IDX_03cc024ddc2f196dca7fead7cb\` (\`isActive\`), INDEX \`IDX_8203f1410475748bbbc6d3029d\` (\`isArchived\`), INDEX \`IDX_0b0fbda74f6c82c943e706a3cc\` (\`isoCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`custom_smtp\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`fromAddress\` varchar(255) NULL, \`host\` varchar(255) NOT NULL, \`port\` int NOT NULL, \`secure\` tinyint NOT NULL, \`username\` varchar(255) NOT NULL, \`password\` varchar(255) NOT NULL, \`isValidate\` tinyint NOT NULL DEFAULT 0, INDEX \`IDX_e2c7d28bb07adc915d74437c7b\` (\`isActive\`), INDEX \`IDX_f10372f9d038d0954d5b20635a\` (\`isArchived\`), INDEX \`IDX_2aa3fc8daa25beec4788d2be26\` (\`tenantId\`), INDEX \`IDX_15a1306132d66c63ef31f7288c\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`deal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`probability\` int NOT NULL, \`createdByUserId\` varchar(255) NOT NULL, \`stageId\` varchar(255) NOT NULL, \`clientId\` varchar(255) NULL, INDEX \`IDX_0d8c964237e5061627de82df80\` (\`isActive\`), INDEX \`IDX_443c561d45f6c57f3790a759ba\` (\`isArchived\`), INDEX \`IDX_46a3c00bfc3e36b4412d8bcdb0\` (\`tenantId\`), INDEX \`IDX_38fb85abdf9995efcf217f5955\` (\`organizationId\`), INDEX \`IDX_4b1ff44e6bae5065429dbab554\` (\`createdByUserId\`), INDEX \`IDX_9211f5b62988df6e95522be7da\` (\`stageId\`), UNIQUE INDEX \`REL_1ae3abc0ae1dcf6c13f49b62b5\` (\`clientId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`email_sent\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`content\` text NULL, \`email\` varchar(255) NOT NULL, \`userId\` varchar(255) NULL, \`emailTemplateId\` varchar(255) NOT NULL, \`status\` enum ('SENT', 'FAILED') NULL, INDEX \`IDX_d825bc6da1c52a3900a9373260\` (\`isActive\`), INDEX \`IDX_9a69f7077e0333d2c848895a1b\` (\`isArchived\`), INDEX \`IDX_0af511c44de7a16beb45cc3785\` (\`tenantId\`), INDEX \`IDX_525f4873c6edc3d94559f88900\` (\`organizationId\`), INDEX \`IDX_953df0eb0df3035baf140399f6\` (\`name\`), INDEX \`IDX_a954fda57cca81dc48446e73b8\` (\`email\`), INDEX \`IDX_1261c457b3035b77719556995b\` (\`userId\`), INDEX \`IDX_9033faf41b23c61ba201c48796\` (\`emailTemplateId\`), INDEX \`IDX_5956ce758c01ebf8a539e8d4f0\` (\`status\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`email_reset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`oldEmail\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`token\` varchar(255) NULL, \`expiredAt\` datetime NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_e3321e3575289b7ee1e8eb1042\` (\`isActive\`), INDEX \`IDX_13247a755d17e7905d5bb4cfda\` (\`isArchived\`), INDEX \`IDX_93799dfaeff51de06f1e02ac41\` (\`tenantId\`), INDEX \`IDX_03d16a2fd43d7c601743440212\` (\`email\`), INDEX \`IDX_4be518a169bbcbfe92025ac574\` (\`oldEmail\`), INDEX \`IDX_9e80c9ec749dfda6dbe2cd9704\` (\`code\`), INDEX \`IDX_4ac734f2a1a3c055dca04fba99\` (\`token\`), INDEX \`IDX_e37af4ab2ba0bf268bfd982634\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`email_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`mjml\` text NULL, \`hbs\` longtext NOT NULL, INDEX \`IDX_e4932e0a726b9b07d81d8b6905\` (\`isActive\`), INDEX \`IDX_29d60114e1968c0cd68a19e3c5\` (\`isArchived\`), INDEX \`IDX_753e005a45556b5909e11937aa\` (\`tenantId\`), INDEX \`IDX_c160fe6234675fac031aa3e7c5\` (\`organizationId\`), INDEX \`IDX_274708db64fcce5448f2c4541c\` (\`name\`), INDEX \`IDX_7e688e6613930ba721b841db43\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_appointment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`agenda\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`location\` varchar(255) NULL, \`startDateTime\` datetime NOT NULL, \`endDateTime\` datetime NOT NULL, \`bufferTimeStart\` tinyint NULL, \`bufferTimeEnd\` tinyint NULL, \`bufferTimeInMins\` int NULL, \`breakTimeInMins\` int NULL, \`breakStartTime\` datetime NULL, \`emails\` varchar(255) NULL, \`status\` varchar(255) NULL, INDEX \`IDX_d0219ada2359ede9e7b0d511ba\` (\`isActive\`), INDEX \`IDX_64c83df9d37d9ada96edb66557\` (\`isArchived\`), INDEX \`IDX_a35637bb659c59e18adb4f38f8\` (\`tenantId\`), INDEX \`IDX_86cf36c137712e779dd7e2301e\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_award\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`year\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_c07390f325c847be7df93d0d17\` (\`isActive\`), INDEX \`IDX_8fb47e8bfd26340ddaeabd24e5\` (\`isArchived\`), INDEX \`IDX_91e0f7efcd17d20b5029fb1342\` (\`tenantId\`), INDEX \`IDX_caf8363b0ed7d5f24ae866ba3b\` (\`organizationId\`), INDEX \`IDX_6912685bbb0e303eab392978d9\` (\`name\`), INDEX \`IDX_0c5266f3f488add404f92d56ec\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_upwork_job_search_criterion\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPresetId\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`occupationId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`keyword\` varchar(255) NULL, \`jobType\` text NULL, INDEX \`IDX_6bae61744663a416e73903d9af\` (\`isActive\`), INDEX \`IDX_0e130a25bb4abe1b27c8a0adf4\` (\`isArchived\`), INDEX \`IDX_afe6c40d3d9951388fa05f83f2\` (\`tenantId\`), INDEX \`IDX_630337302efe97cc93deeb2151\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`job_preset_upwork_job_search_criterion\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPresetId\` varchar(255) NOT NULL, \`occupationId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`keyword\` varchar(255) NULL, \`jobType\` text NULL, INDEX \`IDX_af850e1fa48af82d66e9bf81c7\` (\`isActive\`), INDEX \`IDX_4070b6f3480e9c4b2dcf3f7b56\` (\`isArchived\`), INDEX \`IDX_2323220b4decfd2f4d8307fd78\` (\`tenantId\`), INDEX \`IDX_d5ca48cfacfb516543d6507ca4\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`job_preset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_46226c3185e3ca3d7033831d7a\` (\`isActive\`), INDEX \`IDX_e210f70c3904cf84ab5113be8f\` (\`isArchived\`), INDEX \`IDX_7e53ea80aca15da11a8a5ec038\` (\`tenantId\`), INDEX \`IDX_a4b038417e3221c0791dd8c771\` (\`organizationId\`), INDEX \`IDX_f2c1b6770dd2a3abfa35f49411\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`job_search_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`jobSourceCategoryId\` varchar(255) NULL, \`jobSource\` enum ('upwork', 'web', 'linkedin') NOT NULL DEFAULT 'upwork', INDEX \`IDX_36333846c37e5f8812a5c9f7ff\` (\`isActive\`), INDEX \`IDX_015231c6e28cfb2b789ca4b76f\` (\`isArchived\`), INDEX \`IDX_35e120f2b6e5188391cf068d3b\` (\`tenantId\`), INDEX \`IDX_86381fb6d28978b101b3aec8ca\` (\`organizationId\`), INDEX \`IDX_3b335bbcbf7d5e00853acaa165\` (\`name\`), INDEX \`IDX_d0a798419c775b9157bf0269f4\` (\`jobSourceCategoryId\`), INDEX \`IDX_6ee5218c869b57197e4a209bed\` (\`jobSource\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`job_search_occupation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`jobSourceOccupationId\` varchar(255) NULL, \`jobSource\` enum ('upwork', 'web', 'linkedin') NOT NULL DEFAULT 'upwork', INDEX \`IDX_4b8450a24233df8b47ca472923\` (\`isActive\`), INDEX \`IDX_e4bc75a1cbb07d117a0acfcdba\` (\`isArchived\`), INDEX \`IDX_44e22d88b47daf2095491b7cac\` (\`tenantId\`), INDEX \`IDX_1a62a99e1016e4a2b461e886ec\` (\`organizationId\`), INDEX \`IDX_9f1288205ae91f91cf356cac2f\` (\`name\`), INDEX \`IDX_cb64573b18dd7b23f591f15502\` (\`jobSourceOccupationId\`), INDEX \`IDX_c8723c90a6f007f8d7e882a04f\` (\`jobSource\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_level\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`level\` varchar(255) NOT NULL, INDEX \`IDX_90bd442869709bae9d1b18e489\` (\`isActive\`), INDEX \`IDX_88a58d149404145ed7b3385387\` (\`isArchived\`), INDEX \`IDX_d3fc52d497bc44d6f493dbedc3\` (\`tenantId\`), INDEX \`IDX_c4668533292bf4526e61aedf74\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_phone\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`type\` varchar(255) NULL, \`phoneNumber\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_587d11ffbd87adb6dff367f3cd\` (\`isActive\`), INDEX \`IDX_aa98ea786d490db300d3dbbdb6\` (\`isArchived\`), INDEX \`IDX_d543336994b1f764c449e0b1d3\` (\`tenantId\`), INDEX \`IDX_0f9cefa604913e1ab322591546\` (\`organizationId\`), INDEX \`IDX_ba7b2ef5a9cd165a1e4e2ad0ef\` (\`phoneNumber\`), INDEX \`IDX_329ebd01a757d1a0c3c4d628e2\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_proposal_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`content\` text NULL, \`isDefault\` tinyint NOT NULL DEFAULT 0, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_2bb17670e2bea3980ff960bbcf\` (\`isActive\`), INDEX \`IDX_e396663e1a31114eac39087829\` (\`isArchived\`), INDEX \`IDX_f577c9bc6183c1d1eae1e154bb\` (\`tenantId\`), INDEX \`IDX_ee780fbd8f91de31c004929eec\` (\`organizationId\`), INDEX \`IDX_dc2ff85f7de16dea6453a833dd\` (\`name\`), FULLTEXT INDEX \`IDX_0111963c9cb4dd14565c0d9c84\` (\`content\`), INDEX \`IDX_a13f3564eae9db44ddc4308afc\` (\`isDefault\`), INDEX \`IDX_2be728a7f8b118712a4200990d\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_recurring_expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startDay\` int NOT NULL, \`startMonth\` int NOT NULL, \`startYear\` int NOT NULL, \`startDate\` datetime NOT NULL, \`endDay\` int NULL, \`endMonth\` int NULL, \`endYear\` int NULL, \`endDate\` datetime NULL, \`categoryName\` varchar(255) NOT NULL, \`value\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`parentRecurringExpenseId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_25f8915182128f377d84b60d26\` (\`isActive\`), INDEX \`IDX_3980b0fe1e757b092ea5323656\` (\`isArchived\`), INDEX \`IDX_5fde7be40b3c03bc0fdac0c2f6\` (\`tenantId\`), INDEX \`IDX_3ee5147bb1fde625fa33c0e956\` (\`organizationId\`), INDEX \`IDX_a4b5a2ea2afecf1ee254f1a704\` (\`categoryName\`), INDEX \`IDX_739f8cdce21cc72d400559ce00\` (\`currency\`), INDEX \`IDX_6e570174fda71e97616e9d2eea\` (\`parentRecurringExpenseId\`), INDEX \`IDX_0ac8526c48a3daa267c86225fb\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`month\` int NOT NULL, \`year\` int NOT NULL, \`settingType\` varchar(255) NOT NULL, \`value\` int NOT NULL, \`currency\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_48fae30026b4e166a3445fee6d\` (\`isActive\`), INDEX \`IDX_01237d04f882cf1ea794678e8d\` (\`isArchived\`), INDEX \`IDX_9516a627a131626d2a5738a05a\` (\`tenantId\`), INDEX \`IDX_56e96cd218a185ed59b5a8e786\` (\`organizationId\`), INDEX \`IDX_9537fae454ebebc98ee5adb3a2\` (\`settingType\`), INDEX \`IDX_710c71526edb89b2a7033abcdf\` (\`currency\`), INDEX \`IDX_95ea18af6ef8123503d332240c\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`valueDate\` datetime NULL, \`short_description\` varchar(200) NULL, \`description\` varchar(255) NULL, \`startedWorkOn\` datetime NULL, \`endWork\` datetime NULL, \`payPeriod\` varchar(255) NULL, \`billRateValue\` int NULL, \`minimumBillingRate\` int NULL, \`billRateCurrency\` varchar(255) NULL, \`reWeeklyLimit\` int NULL, \`offerDate\` datetime NULL, \`acceptDate\` datetime NULL, \`rejectDate\` datetime NULL, \`employeeLevel\` varchar(500) NULL, \`anonymousBonus\` tinyint NULL, \`averageIncome\` decimal NULL, \`averageBonus\` decimal NULL, \`totalWorkHours\` decimal NULL DEFAULT '0', \`averageExpenses\` decimal NULL, \`show_anonymous_bonus\` tinyint NULL, \`show_average_bonus\` tinyint NULL, \`show_average_expenses\` tinyint NULL, \`show_average_income\` tinyint NULL, \`show_billrate\` tinyint NULL, \`show_payperiod\` tinyint NULL, \`show_start_work_on\` tinyint NULL, \`isJobSearchActive\` tinyint NULL, \`linkedInUrl\` varchar(255) NULL, \`facebookUrl\` varchar(255) NULL, \`instagramUrl\` varchar(255) NULL, \`twitterUrl\` varchar(255) NULL, \`githubUrl\` varchar(255) NULL, \`gitlabUrl\` varchar(255) NULL, \`upworkUrl\` varchar(255) NULL, \`stackoverflowUrl\` varchar(255) NULL, \`isVerified\` tinyint NULL, \`isVetted\` tinyint NULL, \`totalJobs\` decimal NULL, \`jobSuccess\` decimal NULL, \`profile_link\` varchar(255) NULL, \`isTrackingEnabled\` tinyint NULL DEFAULT 0, \`isOnline\` tinyint NULL DEFAULT 0, \`isAway\` tinyint NULL DEFAULT 0, \`isTrackingTime\` tinyint NULL DEFAULT 0, \`allowScreenshotCapture\` tinyint NOT NULL DEFAULT 1, \`upworkId\` varchar(255) NULL, \`linkedInId\` varchar(255) NULL, \`userId\` varchar(255) NOT NULL, \`contactId\` varchar(255) NULL, \`organizationPositionId\` varchar(255) NULL, INDEX \`IDX_510cb87f5da169e57e694d1a5c\` (\`isActive\`), INDEX \`IDX_175b7be641928a31521224daa8\` (\`isArchived\`), INDEX \`IDX_4b3303a6b7eb92d237a4379734\` (\`tenantId\`), INDEX \`IDX_c6a48286f3aa8ae903bee0d1e7\` (\`organizationId\`), INDEX \`IDX_96dfbcaa2990df01fe5bb39ccc\` (\`profile_link\`), INDEX \`IDX_f4b0d329c4a3cf79ffe9d56504\` (\`userId\`), INDEX \`IDX_1c0c1370ecd98040259625e17e\` (\`contactId\`), INDEX \`IDX_5e719204dcafa8d6b2ecdeda13\` (\`organizationPositionId\`), UNIQUE INDEX \`REL_f4b0d329c4a3cf79ffe9d56504\` (\`userId\`), UNIQUE INDEX \`REL_1c0c1370ecd98040259625e17e\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`equipment_sharing_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, INDEX \`IDX_0f3ee47a5fb7192d5eb00c71ae\` (\`isActive\`), INDEX \`IDX_b0fc293cf47f31ba512fd29bf0\` (\`isArchived\`), INDEX \`IDX_5443ca8ed830626656d8cfecef\` (\`tenantId\`), INDEX \`IDX_5311a833ff255881454bd5b3b5\` (\`organizationId\`), INDEX \`IDX_04c9e514ed70897f6ad8cadc3c\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`equipment_sharing\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`shareRequestDay\` datetime NULL, \`shareStartDay\` datetime NULL, \`shareEndDay\` datetime NULL, \`status\` int NOT NULL, \`createdBy\` varchar(255) NULL, \`createdByName\` varchar(255) NULL, \`equipmentId\` varchar(255) NULL, \`equipmentSharingPolicyId\` varchar(255) NULL, INDEX \`IDX_70ff31cefa0f578f6fa82d2bcc\` (\`isActive\`), INDEX \`IDX_a734598f5637cf1501288331e3\` (\`isArchived\`), INDEX \`IDX_fa525e61fb3d8d9efec0f364a4\` (\`tenantId\`), INDEX \`IDX_ea9254be07ae4a8604f0aaab19\` (\`organizationId\`), INDEX \`IDX_acad51a6362806fc499e583e40\` (\`equipmentId\`), INDEX \`IDX_0ecfe0ce0cd2b197249d5f1c10\` (\`equipmentSharingPolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`equipment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`serialNumber\` varchar(255) NOT NULL, \`manufacturedYear\` decimal NULL, \`initialCost\` decimal NULL, \`currency\` varchar(255) NOT NULL, \`maxSharePeriod\` decimal NULL, \`autoApproveShare\` tinyint NOT NULL, \`imageId\` varchar(36) NULL, INDEX \`IDX_39e1b443404ea7fa42b3d36ccb\` (\`isActive\`), INDEX \`IDX_d8452bfe9f18ced4ce76c4b70b\` (\`isArchived\`), INDEX \`IDX_fb6808468066849ab7b7454d5f\` (\`tenantId\`), INDEX \`IDX_f98ce0d210aa9f91b729d44780\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`estimate_email\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`token\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`expireDate\` datetime NOT NULL, \`convertAcceptedEstimates\` tinyint NULL, INDEX \`IDX_1a4bd2a8034bb1309b4ea87882\` (\`isActive\`), INDEX \`IDX_f1fac79e17c475f00daa4db3d2\` (\`isArchived\`), INDEX \`IDX_391d3f83244fea73c619aecadd\` (\`tenantId\`), INDEX \`IDX_233c1d351d63441aeb039d1164\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`event_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` decimal NOT NULL, \`durationUnit\` varchar(255) NULL, \`title\` varchar(255) NULL, \`description\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_f14eee32875b112fab1139b332\` (\`isActive\`), INDEX \`IDX_613cfa5783e164cad10dc27e58\` (\`isArchived\`), INDEX \`IDX_92fc62260c0c7ff108622850bf\` (\`tenantId\`), INDEX \`IDX_fc8818d6fde74370ec703a0135\` (\`organizationId\`), INDEX \`IDX_4b02d8616129f39fca2b10e98b\` (\`duration\`), INDEX \`IDX_9d5980ff1064e2edb77509d312\` (\`durationUnit\`), INDEX \`IDX_43459c650957e478203c738574\` (\`title\`), INDEX \`IDX_5bde7aeb2c7fb3a421b175871e\` (\`description\`), INDEX \`IDX_24d905ec9e127ade23754a363d\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`expense_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_8376e41fd82aba147a433dc097\` (\`isActive\`), INDEX \`IDX_e9cef5d359dfa48ee5d0cd5fcc\` (\`isArchived\`), INDEX \`IDX_37504e920ee5ca46a4000b89da\` (\`tenantId\`), INDEX \`IDX_9c9bfe5baaf83f53533ff035fc\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`amount\` decimal NOT NULL, \`typeOfExpense\` varchar(255) NULL, \`notes\` varchar(255) NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`purpose\` varchar(255) NULL, \`taxType\` varchar(255) NULL, \`taxLabel\` varchar(255) NULL, \`rateValue\` decimal NULL, \`receipt\` varchar(255) NULL, \`splitExpense\` tinyint NULL, \`reference\` varchar(255) NULL, \`status\` enum ('INVOICED', 'UNINVOICED', 'PAID', 'NOT_BILLABLE') NULL, \`employeeId\` varchar(255) NULL, \`vendorId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_1aa0e5fd480214ae4851471e3c\` (\`isActive\`), INDEX \`IDX_d77aeb93f2439ebdf4babaab4c\` (\`isArchived\`), INDEX \`IDX_6d171c9d5f81095436b99da5e6\` (\`tenantId\`), INDEX \`IDX_c5fb146726ff128e600f23d0a1\` (\`organizationId\`), INDEX \`IDX_846a933af451a33b95b7b198c6\` (\`amount\`), INDEX \`IDX_b5bb8f62d401475fcc8c2ba35e\` (\`typeOfExpense\`), INDEX \`IDX_3826d6ca74a08a8498fa17d330\` (\`notes\`), INDEX \`IDX_89508d119b1a279c037d9da151\` (\`currency\`), INDEX \`IDX_cbfebdb1419f9b8036a8b0546e\` (\`purpose\`), INDEX \`IDX_dd8ab9312fb8d787982b9feebf\` (\`taxType\`), INDEX \`IDX_0006d3025b6c92fbd4089b9465\` (\`taxLabel\`), INDEX \`IDX_97ed0e2b80f2e7ec260fd81cd9\` (\`rateValue\`), INDEX \`IDX_5f57d077c28b378a6c885e81c5\` (\`receipt\`), INDEX \`IDX_5e7b197dbac69012dbdb4964f3\` (\`employeeId\`), INDEX \`IDX_eacb116ab0521ad9b96f2bb53b\` (\`vendorId\`), INDEX \`IDX_42eea5debc63f4d1bf89881c10\` (\`categoryId\`), INDEX \`IDX_9971c4171ae051e74b833984a3\` (\`projectId\`), INDEX \`IDX_047b8b5c0782d5a6d4c8bfc1a4\` (\`organizationContactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`import-history\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`file\` varchar(255) NOT NULL, \`path\` varchar(255) NOT NULL, \`size\` int NULL, \`status\` varchar(255) NOT NULL, \`importDate\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX \`IDX_e339340014a6c4e2f57be00b0c\` (\`isActive\`), INDEX \`IDX_d6a626bee6cddf4bc53a493bc3\` (\`isArchived\`), INDEX \`IDX_54868607115e2fee3b0b764eec\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`import-record\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`entityType\` varchar(255) NOT NULL, \`sourceId\` varchar(255) NOT NULL, \`destinationId\` varchar(255) NOT NULL, \`importDate\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX \`IDX_b90957ef81e74c43d6ae037560\` (\`isActive\`), INDEX \`IDX_339328a7247aa09d061c642ae1\` (\`isArchived\`), INDEX \`IDX_a43b235c35c2c4d3263ada770c\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`feature_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isEnabled\` tinyint NOT NULL DEFAULT 1, \`featureId\` varchar(255) NOT NULL, INDEX \`IDX_4ee685760ddb60ff71f763d8f6\` (\`isActive\`), INDEX \`IDX_e4c142f37091b47056012d34ba\` (\`isArchived\`), INDEX \`IDX_8f71803d96dcdbcc6b19bb28d3\` (\`tenantId\`), INDEX \`IDX_6a94e6b0a572f591288ac44a42\` (\`organizationId\`), INDEX \`IDX_6d413f9fdd5366b1b9add46483\` (\`featureId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`feature\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`isPaid\` tinyint NOT NULL DEFAULT 0, \`description\` varchar(255) NULL, \`image\` varchar(255) NULL, \`link\` varchar(255) NOT NULL, \`status\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`parentId\` varchar(255) NULL, INDEX \`IDX_5405b67f1df904831a358df7c4\` (\`isActive\`), INDEX \`IDX_a26cc341268d22bd55f06e3ef6\` (\`isArchived\`), INDEX \`IDX_4832be692a2dc63d67e8e93c75\` (\`name\`), INDEX \`IDX_c30465b5a6e0fae1c8ee7e3120\` (\`code\`), INDEX \`IDX_d4a28a8e70d450a412bf0cfb52\` (\`parentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal_general_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`maxObjectives\` int NOT NULL, \`maxKeyResults\` int NOT NULL, \`employeeCanCreateObjective\` tinyint NOT NULL, \`canOwnObjectives\` varchar(255) NOT NULL, \`canOwnKeyResult\` varchar(255) NOT NULL, \`krTypeKPI\` tinyint NOT NULL, \`krTypeTask\` tinyint NOT NULL, INDEX \`IDX_bdee8704ebeb79368ff6154fc7\` (\`isActive\`), INDEX \`IDX_4a44905db4ca1e40b62021fdfb\` (\`isArchived\`), INDEX \`IDX_d17a5159d888ac6320459eda39\` (\`tenantId\`), INDEX \`IDX_e35d0f7b794ca8850669d12c78\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal_kpi_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`operator\` varchar(255) NOT NULL, \`currentValue\` int NOT NULL, \`targetValue\` int NOT NULL, \`leadId\` varchar(36) NULL, INDEX \`IDX_b4f4701ddb0e973602445ed1c6\` (\`isActive\`), INDEX \`IDX_26311c417ba945c901c65d515d\` (\`isArchived\`), INDEX \`IDX_cc72d4e8e4284dcc8ffbf96caf\` (\`tenantId\`), INDEX \`IDX_df7ab026698c02859ff7540809\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal_kpi\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`operator\` varchar(255) NOT NULL, \`currentValue\` int NOT NULL, \`targetValue\` int NOT NULL, \`leadId\` varchar(255) NULL, INDEX \`IDX_cfc393bd9835d8259e73019226\` (\`isActive\`), INDEX \`IDX_a96c22c51607f878c8a98bc488\` (\`isArchived\`), INDEX \`IDX_43aa2985216560cd9fa93f501e\` (\`tenantId\`), INDEX \`IDX_e49e37fe88a2725a38a3b05849\` (\`organizationId\`), INDEX \`IDX_d4f093ca4eb7c40db68d9a789d\` (\`leadId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, \`category\` varchar(255) NOT NULL, INDEX \`IDX_cd91c5925942061527b1bc112c\` (\`isActive\`), INDEX \`IDX_056e869152a335f88c38c5b693\` (\`isArchived\`), INDEX \`IDX_774bf82989475befe301fe1bca\` (\`tenantId\`), INDEX \`IDX_5708fe06608c72fc77b65ae651\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal_time_frame\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`startDate\` datetime NOT NULL, \`endDate\` datetime NOT NULL, INDEX \`IDX_646565982726362cc2ca4fb807\` (\`isActive\`), INDEX \`IDX_ef4ec26ca3a7e0d8c9e1748be2\` (\`isArchived\`), INDEX \`IDX_b56723b53a76ca1c171890c479\` (\`tenantId\`), INDEX \`IDX_405bc5bba9ed71aefef84a29f1\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`goal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NOT NULL, \`deadline\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, \`progress\` int NOT NULL, \`ownerTeamId\` varchar(255) NULL, \`ownerEmployeeId\` varchar(255) NULL, \`leadId\` varchar(255) NULL, \`alignedKeyResultId\` varchar(255) NULL, INDEX \`IDX_72641ffde44e1a1627aa2d040f\` (\`isActive\`), INDEX \`IDX_4a2c00a44350a063d75be80ba9\` (\`isArchived\`), INDEX \`IDX_6b4758a5442713070c9a366d0e\` (\`tenantId\`), INDEX \`IDX_c6e8ae55a4db3584686cbf6afe\` (\`organizationId\`), INDEX \`IDX_ac161c1a0c0ff8e83554f097e5\` (\`ownerTeamId\`), INDEX \`IDX_35526ff1063ab5fa2b20e71bd6\` (\`ownerEmployeeId\`), INDEX \`IDX_af0a11734e70412b742ac339c8\` (\`leadId\`), INDEX \`IDX_4c8b4e887a994182fd6132e640\` (\`alignedKeyResultId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`image_asset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`url\` varchar(255) NOT NULL, \`thumb\` varchar(255) NULL, \`width\` int NOT NULL DEFAULT '0', \`height\` int NOT NULL DEFAULT '0', \`size\` decimal NULL, \`isFeatured\` tinyint NOT NULL DEFAULT 0, \`externalProviderId\` varchar(255) NULL, \`storageProvider\` enum ('LOCAL', 'S3', 'WASABI', 'CLOUDINARY') NULL, INDEX \`IDX_9d44ce9eb8689e578b941a6a54\` (\`isActive\`), INDEX \`IDX_af1a212cb378bb0eed51c1b2bc\` (\`isArchived\`), INDEX \`IDX_01856a9a730b7e79d70aa661cb\` (\`tenantId\`), INDEX \`IDX_d3675304df9971cccf96d9a7c3\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`income\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`amount\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`notes\` varchar(255) NULL, \`isBonus\` tinyint NULL, \`reference\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`clientId\` varchar(255) NULL, INDEX \`IDX_904ab9ee6ac5e74bf3616c8ccb\` (\`isActive\`), INDEX \`IDX_aedb8b1d10c498309bed9edf53\` (\`isArchived\`), INDEX \`IDX_8608b275644cfc7a0f3f585081\` (\`tenantId\`), INDEX \`IDX_64409de4711cd14e2c43371cc0\` (\`organizationId\`), INDEX \`IDX_bd39a647a2843177723ddf733e\` (\`amount\`), INDEX \`IDX_86b5a121b3775a1b0b7fa75680\` (\`currency\`), INDEX \`IDX_20207d9f915066dfbc2210bcf1\` (\`notes\`), INDEX \`IDX_a05d52b7ffe89140f9cbcf114b\` (\`employeeId\`), INDEX \`IDX_29fbd3a17710a27e6f856072c0\` (\`clientId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_entity_setting_tied\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sync\` tinyint NOT NULL, \`integrationEntitySettingId\` varchar(255) NULL, INDEX \`IDX_6d43cc33c80221dbe4854b38e6\` (\`isActive\`), INDEX \`IDX_101cd83aa75949cfb5b8eec084\` (\`isArchived\`), INDEX \`IDX_b208a754c7a538cb3422f39f5b\` (\`tenantId\`), INDEX \`IDX_d5ac36aa3d5919908414154fca\` (\`organizationId\`), INDEX \`IDX_3fb863167095805e33f38a0fdc\` (\`integrationEntitySettingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_entity_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sync\` tinyint NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_e3d407c5532edaceaa4df34623\` (\`isActive\`), INDEX \`IDX_1c653ebceca3b9c8766131db91\` (\`isArchived\`), INDEX \`IDX_23e9cfcf1bfff07dcc3254378d\` (\`tenantId\`), INDEX \`IDX_c6c01e38eebd8b26b9214b9044\` (\`organizationId\`), INDEX \`IDX_f80ff4ebbf0b33a67dce598911\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_map\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sourceId\` varchar(255) NOT NULL, \`gauzyId\` varchar(255) NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_c79464c4ccf7e5195d69675c15\` (\`isActive\`), INDEX \`IDX_e63f4791631e7572ca213ac4a4\` (\`isArchived\`), INDEX \`IDX_eec3d6064578610ddc609dd360\` (\`tenantId\`), INDEX \`IDX_7022dafd72c1b92f7d50691441\` (\`organizationId\`), INDEX \`IDX_c327ea26bda3d349a1eceb5658\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`settingsName\` varchar(255) NOT NULL, \`settingsValue\` varchar(255) NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_97c0d54aae21ccdbb5c3581642\` (\`isActive\`), INDEX \`IDX_f515574f1251562c52fe25b6a3\` (\`isArchived\`), INDEX \`IDX_954c6b05297814776d9cb66ca7\` (\`tenantId\`), INDEX \`IDX_369eaafb13afe9903a170077ed\` (\`organizationId\`), INDEX \`IDX_34daf030004ad37b88f1f3d863\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_tenant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`lastSyncedAt\` datetime NULL DEFAULT CURRENT_TIMESTAMP, \`integrationId\` varchar(255) NULL, INDEX \`IDX_c5ff5d3ab364b7da72bf3fbb46\` (\`isActive\`), INDEX \`IDX_5487f9197c106d774bae20991c\` (\`isArchived\`), INDEX \`IDX_24e37d03ef224f1a16a35069c2\` (\`tenantId\`), INDEX \`IDX_33ab224e7755a46fff5bc1e64e\` (\`organizationId\`), INDEX \`IDX_d0532ed8020981736b58748de6\` (\`lastSyncedAt\`), INDEX \`IDX_0d6ddc27d687ca879042c5f3ce\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_github_repository\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`repositoryId\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`fullName\` varchar(255) NOT NULL, \`owner\` varchar(255) NOT NULL, \`issuesCount\` int NULL, \`hasSyncEnabled\` tinyint NULL DEFAULT 1, \`private\` tinyint NULL DEFAULT 0, \`status\` varchar(255) NULL, \`integrationId\` varchar(255) NULL, INDEX \`IDX_5e97728cfda96f49cc7f95bbaf\` (\`isActive\`), INDEX \`IDX_ef65338e8597b9f56fd0fe3c94\` (\`isArchived\`), INDEX \`IDX_480158f21938444e4f62fb3185\` (\`tenantId\`), INDEX \`IDX_69d75a47af6bfcda545a865691\` (\`organizationId\`), INDEX \`IDX_ca0fa80f50baed7287a499dc2c\` (\`repositoryId\`), INDEX \`IDX_6eea42a69e130bbd14b7ea3659\` (\`name\`), INDEX \`IDX_a146e202c19f521bf5ec69bb26\` (\`fullName\`), INDEX \`IDX_9e8a77c1d330554fab9230100a\` (\`owner\`), INDEX \`IDX_04717f25bea7d9cef0d51cac50\` (\`issuesCount\`), INDEX \`IDX_34c48d11eb82ef42e89370bdc7\` (\`hasSyncEnabled\`), INDEX \`IDX_2eec784cadcb7847b64937fb58\` (\`private\`), INDEX \`IDX_59407d03d189560ac1a0a4b0eb\` (\`status\`), INDEX \`IDX_add7dbec156589dd0b27e2e0c4\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_github_repository_issue\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`issueId\` int NOT NULL, \`issueNumber\` int NOT NULL, \`repositoryId\` varchar(255) NULL, INDEX \`IDX_d706210d377ece2a1bc3386388\` (\`isActive\`), INDEX \`IDX_c774c276d6b7ea05a7e12d3c81\` (\`isArchived\`), INDEX \`IDX_b3234be5b70c2362cdf67bb188\` (\`tenantId\`), INDEX \`IDX_6c8e119fc6a2a7d3413aa76d3b\` (\`organizationId\`), INDEX \`IDX_055f310a04a928343494a5255a\` (\`issueId\`), INDEX \`IDX_a8709a9c5cc142c6fbe92df274\` (\`issueNumber\`), INDEX \`IDX_5065401113abb6e9608225e567\` (\`repositoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`groupName\` varchar(255) NOT NULL, \`order\` int NOT NULL, INDEX \`IDX_34a49d941459e1031c766b941f\` (\`isActive\`), INDEX \`IDX_e7b65ef60492b1c34007736f99\` (\`isArchived\`), UNIQUE INDEX \`IDX_83443d669822bbbf2bd0ebdacd\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`provider\` varchar(255) NULL, \`redirectUrl\` varchar(255) NULL, \`imgSrc\` varchar(255) NULL, \`isComingSoon\` tinyint NOT NULL DEFAULT 0, \`isPaid\` tinyint NOT NULL DEFAULT 0, \`version\` varchar(255) NULL, \`docUrl\` varchar(255) NULL, \`isFreeTrial\` tinyint NOT NULL DEFAULT 0, \`freeTrialPeriod\` decimal NULL DEFAULT '0', \`order\` int NULL, INDEX \`IDX_24981cd300007cf88601c2d616\` (\`isActive\`), INDEX \`IDX_85d7b0f07f3e3707b4586670a9\` (\`isArchived\`), UNIQUE INDEX \`IDX_52d7fa32a7832b377fc2d7f619\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invite\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`token\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`expireDate\` datetime NULL, \`actionDate\` datetime NULL, \`code\` varchar(255) NULL, \`fullName\` varchar(255) NULL, \`invitedById\` varchar(255) NULL, \`roleId\` varchar(255) NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_bd44bcb10034bc0c5fe4427b3e\` (\`isActive\`), INDEX \`IDX_3cef860504647ccd52d39d7dc2\` (\`isArchived\`), INDEX \`IDX_7c2328f76efb850b8114797247\` (\`tenantId\`), INDEX \`IDX_68eef4ab86b67747f24f288a16\` (\`organizationId\`), INDEX \`IDX_5a182e8b3e225b14ddf6df7e6c\` (\`invitedById\`), INDEX \`IDX_900a3ed40499c79c1c289fec28\` (\`roleId\`), INDEX \`IDX_91bfeec7a9574f458e5b592472\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invoice_estimate_history\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`action\` varchar(255) NOT NULL, \`title\` varchar(255) NULL, \`userId\` varchar(255) NULL, \`invoiceId\` varchar(255) NOT NULL, INDEX \`IDX_483eb296a94d821ebedb375858\` (\`isActive\`), INDEX \`IDX_8106063f79cce8e67790d79092\` (\`isArchived\`), INDEX \`IDX_cc0ac824ba89deda98bb418e8c\` (\`tenantId\`), INDEX \`IDX_856f24297f120604f8ae294276\` (\`organizationId\`), INDEX \`IDX_da2893697d57368470952a76f6\` (\`userId\`), INDEX \`IDX_31ec3d5a6b0985cec544c64217\` (\`invoiceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invoice_item\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` varchar(255) NULL, \`price\` decimal NOT NULL, \`quantity\` decimal NOT NULL, \`totalValue\` decimal NOT NULL, \`applyTax\` tinyint NULL, \`applyDiscount\` tinyint NULL, \`expenseId\` varchar(255) NULL, \`invoiceId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`productId\` varchar(255) NULL, INDEX \`IDX_e2835fd8776ae5d56d892e087e\` (\`isActive\`), INDEX \`IDX_b7da14d2b61cf1dd5c65188b9c\` (\`isArchived\`), INDEX \`IDX_f78214cd9de76e80fe8a6305f5\` (\`tenantId\`), INDEX \`IDX_e89749c8e8258b2ec110c0776f\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invoice\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`invoiceDate\` datetime NULL, \`invoiceNumber\` bigint NULL, \`dueDate\` datetime NULL, \`currency\` varchar(255) NOT NULL, \`discountValue\` decimal NOT NULL, \`paid\` tinyint NULL, \`tax\` decimal NULL, \`tax2\` decimal NULL, \`terms\` varchar(255) NOT NULL, \`totalValue\` decimal NULL, \`status\` varchar(255) NOT NULL, \`isEstimate\` tinyint NULL, \`isAccepted\` tinyint NULL, \`discountType\` varchar(255) NULL, \`taxType\` varchar(255) NULL, \`tax2Type\` varchar(255) NULL, \`invoiceType\` varchar(255) NULL, \`sentTo\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`internalNote\` varchar(255) NULL, \`alreadyPaid\` decimal NULL, \`amountDue\` decimal NULL, \`hasRemainingAmountInvoiced\` tinyint NULL, \`token\` text NULL, \`fromOrganizationId\` varchar(255) NOT NULL, \`toContactId\` varchar(255) NULL, INDEX \`IDX_850ca385c1985c1808cd4ea241\` (\`isActive\`), INDEX \`IDX_eabacf7474d75e53d7b7046f3e\` (\`isArchived\`), INDEX \`IDX_7fb52a5f267f53b7d93af3d8c3\` (\`tenantId\`), INDEX \`IDX_058ef835f99e28fc6717cd7c80\` (\`organizationId\`), INDEX \`IDX_b5c33892e630b66c65d623baf8\` (\`fromOrganizationId\`), INDEX \`IDX_d9e965da0f63c94983d3a1006a\` (\`toContactId\`), UNIQUE INDEX \`IDX_d7bed97fb47876e03fd7d7c285\` (\`invoiceNumber\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`key_result_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`targetValue\` int NULL, \`initialValue\` int NULL, \`deadline\` varchar(255) NOT NULL, \`kpiId\` varchar(255) NULL, \`goalId\` varchar(255) NULL, INDEX \`IDX_f4e813d72dc732f16497ee2c52\` (\`isActive\`), INDEX \`IDX_aa0e9b0cfcba1926925b025512\` (\`isArchived\`), INDEX \`IDX_86c09eb673b0e66129dbdc7211\` (\`tenantId\`), INDEX \`IDX_fab6b6200b9ed6fd002c1ff62a\` (\`organizationId\`), INDEX \`IDX_46426ea45456e240a092b73204\` (\`goalId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`key_result_update\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`update\` int NOT NULL, \`progress\` int NOT NULL, \`owner\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`keyResultId\` varchar(255) NULL, INDEX \`IDX_12b8b54f416ec9f5ec002f0a83\` (\`isActive\`), INDEX \`IDX_94aad97b26aede6545a3226fb3\` (\`isArchived\`), INDEX \`IDX_cd9cbc0d5b6d62dbb63c3b3a65\` (\`tenantId\`), INDEX \`IDX_fd4b0cb7a44ed914acdda55e29\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`key_result\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`targetValue\` int NULL, \`initialValue\` int NULL, \`unit\` varchar(255) NULL, \`update\` int NOT NULL, \`progress\` int NOT NULL, \`deadline\` varchar(255) NOT NULL, \`hardDeadline\` datetime NULL, \`softDeadline\` datetime NULL, \`status\` varchar(255) NOT NULL, \`weight\` varchar(255) NULL, \`ownerId\` varchar(255) NOT NULL, \`leadId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`kpiId\` varchar(255) NULL, \`goalId\` varchar(255) NULL, INDEX \`IDX_9b62dd2dddcde032f46a981733\` (\`isActive\`), INDEX \`IDX_8889e2618366faefa575a8049b\` (\`isArchived\`), INDEX \`IDX_8ac2c6b487d03157adda874789\` (\`tenantId\`), INDEX \`IDX_d1f45ca98f17bd84a5e430feaf\` (\`organizationId\`), INDEX \`IDX_5880347716f9ec5056ec15112c\` (\`ownerId\`), INDEX \`IDX_c89adeff0de3aedb2e772a5bf4\` (\`leadId\`), INDEX \`IDX_38dc003f3484eff4b59918e9ae\` (\`projectId\`), INDEX \`IDX_d8547e21ccb8e37ac9f0d69c1a\` (\`taskId\`), INDEX \`IDX_4e1e975124c1d717814a4bb2ec\` (\`kpiId\`), INDEX \`IDX_3e1d08761a717c1dd71fe67249\` (\`goalId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`language\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NULL, \`is_system\` tinyint NULL DEFAULT 1, \`description\` varchar(255) NULL, \`color\` varchar(255) NOT NULL, INDEX \`IDX_3a7abee35dfa3c90ed491583eb\` (\`isActive\`), INDEX \`IDX_15fcb8179bc7b0642ca78da69e\` (\`isArchived\`), UNIQUE INDEX \`IDX_465b3173cdddf0ac2d3fe73a33\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`merchant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`phone\` varchar(255) NULL, \`description\` varchar(255) NULL, \`active\` tinyint NOT NULL DEFAULT 1, \`currency\` varchar(255) NOT NULL DEFAULT 'USD', \`contactId\` varchar(255) NULL, \`logoId\` varchar(255) NULL, INDEX \`IDX_a03be8a86e528e2720504a041f\` (\`isActive\`), INDEX \`IDX_0a0f972564e74c9c4905e3abcb\` (\`isArchived\`), INDEX \`IDX_533144d7ae94180235ea456625\` (\`tenantId\`), INDEX \`IDX_d306a524b507f72fa8550aeffe\` (\`organizationId\`), INDEX \`IDX_e03ddff05652be527e04abdc56\` (\`contactId\`), INDEX \`IDX_20acc3c3a6c900c6ef9fc68199\` (\`logoId\`), UNIQUE INDEX \`REL_e03ddff05652be527e04abdc56\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_award\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`year\` varchar(255) NOT NULL, INDEX \`IDX_4062b5d54aa740aaff9a6c5fbb\` (\`isActive\`), INDEX \`IDX_34c6749e2bc94b2e52e9572f32\` (\`isArchived\`), INDEX \`IDX_af6423760433da72002a7f369e\` (\`tenantId\`), INDEX \`IDX_2e0d21aab892b5993abaac09bc\` (\`organizationId\`), INDEX \`IDX_31626e7d39eb95b710d5a2d80f\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_contact\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`primaryEmail\` varchar(255) NULL, \`primaryPhone\` varchar(255) NULL, \`inviteStatus\` enum ('NOT_INVITED', 'INVITED', 'ACCEPTED') NULL, \`notes\` varchar(255) NULL, \`contactType\` enum ('CLIENT', 'CUSTOMER', 'LEAD') NOT NULL DEFAULT 'CLIENT', \`imageUrl\` varchar(500) NULL, \`budget\` int NULL, \`budgetType\` enum ('hours', 'cost') NULL DEFAULT 'cost', \`createdBy\` varchar(255) NULL, \`contactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_53627a383c9817dbf1164d7dc6\` (\`isActive\`), INDEX \`IDX_f91783c7a8565c648b65635efc\` (\`isArchived\`), INDEX \`IDX_e68c43e315ad3aaea4e99cf461\` (\`tenantId\`), INDEX \`IDX_6200736cb4d3617b004e5b647f\` (\`organizationId\`), INDEX \`IDX_de33f92e042365d196d959e774\` (\`name\`), INDEX \`IDX_a86d2e378b953cb39261f457d2\` (\`contactId\`), INDEX \`IDX_8cfcdc6bc8fb55e273d9ace5fd\` (\`imageId\`), UNIQUE INDEX \`REL_a86d2e378b953cb39261f457d2\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_department\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_6139cd4c620e81aefd4895d370\` (\`isActive\`), INDEX \`IDX_b65059949804b20048b1c86c3d\` (\`isArchived\`), INDEX \`IDX_b3644ff7cd65239e29d292a41d\` (\`tenantId\`), INDEX \`IDX_c61a562a2379d1c0077fe7de33\` (\`organizationId\`), INDEX \`IDX_91b652409dc1fb2f712590dd21\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_document\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`documentUrl\` varchar(255) NULL, \`documentId\` varchar(255) NULL, INDEX \`IDX_e5edb48261db95f46c3b4d34a5\` (\`isActive\`), INDEX \`IDX_72c6a8ad9de5c04b2b689fd229\` (\`isArchived\`), INDEX \`IDX_4bc83945c022a862a33629ff1e\` (\`tenantId\`), INDEX \`IDX_1057ec001a4c6b258658143047\` (\`organizationId\`), INDEX \`IDX_c129dee7d1cb84e01e69b5e2c6\` (\`documentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_employment_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_880f3cce5e03f42bec3da6e6dc\` (\`isActive\`), INDEX \`IDX_cc096d49e2399e89cdf32297da\` (\`isArchived\`), INDEX \`IDX_227b5bd9867287cbbeece8f6ba\` (\`tenantId\`), INDEX \`IDX_a583cfe32f492f5ba99b7bb205\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_language\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`name\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, INDEX \`IDX_b79e8d45a3ef5503579643f5de\` (\`isActive\`), INDEX \`IDX_6577ec9ca4cef331a507264d44\` (\`isArchived\`), INDEX \`IDX_225e476592214e32e117a85213\` (\`tenantId\`), INDEX \`IDX_4513931e2d530f78d7144c8c7c\` (\`organizationId\`), INDEX \`IDX_020516e74a57cb85d75381e841\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_position\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_7317abf7a05a169783b6aa7932\` (\`isActive\`), INDEX \`IDX_ce8721ddf715f0efa4bd3d2c5f\` (\`isArchived\`), INDEX \`IDX_a8f497b1006ec967964abb0d49\` (\`tenantId\`), INDEX \`IDX_a0409e39f23ff6d418f2c03df5\` (\`organizationId\`), INDEX \`IDX_3f02c20145af9997253531349c\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_project\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`startDate\` datetime NULL, \`endDate\` datetime NULL, \`billing\` varchar(255) NULL, \`currency\` varchar(255) NULL, \`public\` tinyint NULL, \`owner\` varchar(255) NULL, \`taskListType\` varchar(255) NOT NULL DEFAULT 'GRID', \`code\` varchar(255) NULL, \`description\` varchar(255) NULL, \`color\` varchar(255) NULL, \`billable\` tinyint NULL, \`billingFlat\` tinyint NULL, \`openSource\` tinyint NULL, \`projectUrl\` varchar(255) NULL, \`openSourceProjectUrl\` varchar(255) NULL, \`budget\` int NULL, \`budgetType\` enum ('hours', 'cost') NULL DEFAULT 'cost', \`membersCount\` int NULL DEFAULT '0', \`imageUrl\` varchar(500) NULL, \`isTasksAutoSync\` tinyint NULL DEFAULT 1, \`isTasksAutoSyncOnLabel\` tinyint NULL DEFAULT 1, \`syncTag\` varchar(255) NULL, \`repositoryId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_18e22d4b569159bb91dec869aa\` (\`isActive\`), INDEX \`IDX_3590135ac2034d7aa88efa7e52\` (\`isArchived\`), INDEX \`IDX_7cf84e8b5775f349f81a1f3cc4\` (\`tenantId\`), INDEX \`IDX_9d8afc1e1e64d4b7d48dd2229d\` (\`organizationId\`), INDEX \`IDX_37215da8dee9503d759adb3538\` (\`name\`), INDEX \`IDX_c210effeb6314d325bc024d21e\` (\`currency\`), INDEX \`IDX_75855b44250686f84b7c4bc1f1\` (\`isTasksAutoSync\`), INDEX \`IDX_c5c4366237dc2bb176c1503426\` (\`isTasksAutoSyncOnLabel\`), INDEX \`IDX_3e128d30e9910ff920eee4ef37\` (\`syncTag\`), INDEX \`IDX_904ae0b765faef6ba2db8b1e69\` (\`repositoryId\`), INDEX \`IDX_bc1e32c13683dbb16ada1c6da1\` (\`organizationContactId\`), INDEX \`IDX_063324fdceb51f7086e401ed2c\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_recurring_expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startDay\` int NOT NULL, \`startMonth\` int NOT NULL, \`startYear\` int NOT NULL, \`startDate\` datetime NOT NULL, \`endDay\` int NULL, \`endMonth\` int NULL, \`endYear\` int NULL, \`endDate\` datetime NULL, \`categoryName\` varchar(255) NOT NULL, \`value\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`splitExpense\` tinyint NULL, \`parentRecurringExpenseId\` varchar(255) NULL, INDEX \`IDX_9ad08dbc039d08279dae2dd94e\` (\`isActive\`), INDEX \`IDX_f3ef2000abb9762b138cc5a1b3\` (\`isArchived\`), INDEX \`IDX_0b19a287858af40661bd3eb741\` (\`tenantId\`), INDEX \`IDX_8a12e7a0d47d3c6a6b35f7984e\` (\`organizationId\`), INDEX \`IDX_f1e5497ee6be7ba3f2ee90bf4b\` (\`categoryName\`), INDEX \`IDX_61387780d015923453f4b015b4\` (\`currency\`), INDEX \`IDX_637ac2c467df4bc3b71795a866\` (\`parentRecurringExpenseId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_sprint\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`projectId\` varchar(255) NOT NULL, \`goal\` varchar(255) NULL, \`length\` int NOT NULL DEFAULT '7', \`startDate\` datetime NULL, \`endDate\` datetime NULL, \`dayStart\` int NULL, INDEX \`IDX_5596b4fa7fb2ceb0955580becd\` (\`isActive\`), INDEX \`IDX_76e53f9609ca05477d50980743\` (\`isArchived\`), INDEX \`IDX_f57ad03c4e471bd8530494ea63\` (\`tenantId\`), INDEX \`IDX_8a1fe8afb3aa672bae5993fbe7\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_task_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isTasksPrivacyEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksMultipleAssigneesEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksManualTimeEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksGroupEstimationEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksEstimationInHoursEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksEstimationInStoryPointsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksProofOfCompletionEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksProofOfCompletionType\` varchar(255) NOT NULL DEFAULT 'PRIVATE', \`isTasksLinkedEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksCommentsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksHistoryEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksAcceptanceCriteriaEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksDraftsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksNotifyLeftEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksNotifyLeftPeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoCloseEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksAutoClosePeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoArchiveEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksAutoArchivePeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoStatusEnabled\` tinyint NOT NULL DEFAULT 1, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_f0e2385b2d5f176f9ed3b6a9e3\` (\`isActive\`), INDEX \`IDX_b7be7e61daf2b5af3232c9c4d6\` (\`isArchived\`), INDEX \`IDX_582768159ef0c749e8552ea9bc\` (\`tenantId\`), INDEX \`IDX_5830901876e426adfc15fb7341\` (\`organizationId\`), INDEX \`IDX_19ab7adf33199bc6f913db277d\` (\`projectId\`), INDEX \`IDX_20a290f166c0810eafbf271717\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_team_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isTrackingEnabled\` tinyint NULL DEFAULT 1, \`activeTaskId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`roleId\` varchar(255) NULL, \`order\` int NULL, INDEX \`IDX_70fcc451944fbde73d223c2af3\` (\`isActive\`), INDEX \`IDX_752d7a0fe6597ee6bbc6502a12\` (\`isArchived\`), INDEX \`IDX_fe12e1b76bbb76209134d9bdc2\` (\`tenantId\`), INDEX \`IDX_d8eba1c0e500c60be1b69c1e77\` (\`organizationId\`), INDEX \`IDX_719aeb37fa7a1dd80d25336a0c\` (\`activeTaskId\`), INDEX \`IDX_8dc83cdd7c519d73afc0d8bdf0\` (\`organizationTeamId\`), INDEX \`IDX_a2a5601d799fbfc29c17b99243\` (\`employeeId\`), INDEX \`IDX_ce83034f38496f5fe3f1979697\` (\`roleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_team_join_request\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`fullName\` varchar(255) NULL, \`linkAddress\` varchar(255) NULL, \`position\` varchar(255) NULL, \`status\` varchar(255) NULL, \`code\` varchar(255) NULL, \`token\` varchar(255) NULL, \`expiredAt\` datetime NULL, \`userId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NOT NULL, INDEX \`IDX_29ece7e3bb764028387cdbc888\` (\`isActive\`), INDEX \`IDX_b027ee2cb18245356b8d963d2f\` (\`isArchived\`), INDEX \`IDX_d9529008c733cb90044b8c2ad6\` (\`tenantId\`), INDEX \`IDX_c15823bf3f63b1fe331d9de662\` (\`organizationId\`), INDEX \`IDX_5e73656ce0355347477c42ae19\` (\`userId\`), INDEX \`IDX_171b852be7c1f387eca93775aa\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_team\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`color\` varchar(255) NULL, \`emoji\` varchar(255) NULL, \`teamSize\` varchar(255) NULL, \`logo\` varchar(255) NULL, \`prefix\` varchar(255) NULL, \`public\` tinyint NULL DEFAULT 0, \`profile_link\` varchar(255) NULL, \`createdById\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_722d648e0b83267d4a66332ccb\` (\`isActive\`), INDEX \`IDX_38f1d96e8c2d59e4f0f84209ab\` (\`isArchived\`), INDEX \`IDX_176f5ed3c4534f3110d423d569\` (\`tenantId\`), INDEX \`IDX_eef1c19a0cb5321223cfe3286c\` (\`organizationId\`), INDEX \`IDX_103ae3eb65f4b091efc55cb532\` (\`name\`), INDEX \`IDX_e22ab0f1236b1a07785b641727\` (\`profile_link\`), INDEX \`IDX_da625f694eb1e23e585f301008\` (\`createdById\`), INDEX \`IDX_51e91be110fa0b8e70066f5727\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_vendor\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`email\` varchar(255) NULL, \`phone\` varchar(255) NULL, \`website\` varchar(255) NULL, INDEX \`IDX_04c6320f910056ecb11b147ac8\` (\`isActive\`), INDEX \`IDX_266972cd6ff9656eec8818e12d\` (\`isArchived\`), INDEX \`IDX_7e0bf6063e1728c9813d5da7ca\` (\`tenantId\`), INDEX \`IDX_56dd132aa3743cfa9b034d020e\` (\`organizationId\`), INDEX \`IDX_e56e80136b07ecd52545368611\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`isDefault\` tinyint NOT NULL DEFAULT 0, \`profile_link\` varchar(255) NULL, \`banner\` varchar(255) NULL, \`totalEmployees\` int NULL, \`short_description\` varchar(255) NULL, \`client_focus\` varchar(255) NULL, \`overview\` varchar(255) NULL, \`imageUrl\` varchar(500) NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`defaultValueDateType\` enum ('TODAY', 'END_OF_MONTH', 'START_OF_MONTH') NULL DEFAULT 'TODAY', \`defaultAlignmentType\` varchar(255) NULL, \`timeZone\` varchar(255) NULL, \`regionCode\` varchar(255) NULL, \`brandColor\` varchar(255) NULL, \`dateFormat\` varchar(255) NULL, \`officialName\` varchar(255) NULL, \`startWeekOn\` varchar(255) NULL, \`taxId\` varchar(255) NULL, \`numberFormat\` varchar(255) NULL, \`minimumProjectSize\` varchar(255) NULL, \`bonusType\` varchar(255) NULL, \`bonusPercentage\` int NULL, \`invitesAllowed\` tinyint NULL DEFAULT 1, \`show_income\` tinyint NULL, \`show_profits\` tinyint NULL, \`show_bonuses_paid\` tinyint NULL, \`show_total_hours\` tinyint NULL, \`show_minimum_project_size\` tinyint NULL, \`show_projects_count\` tinyint NULL, \`show_clients_count\` tinyint NULL, \`show_clients\` tinyint NULL, \`show_employees_count\` tinyint NULL, \`inviteExpiryPeriod\` int NULL, \`fiscalStartDate\` datetime NULL, \`fiscalEndDate\` datetime NULL, \`registrationDate\` datetime NULL, \`futureDateAllowed\` tinyint NULL, \`allowManualTime\` tinyint NOT NULL DEFAULT 1, \`allowModifyTime\` tinyint NOT NULL DEFAULT 1, \`allowDeleteTime\` tinyint NOT NULL DEFAULT 1, \`allowTrackInactivity\` tinyint NOT NULL DEFAULT 1, \`inactivityTimeLimit\` int NOT NULL DEFAULT '10', \`activityProofDuration\` int NOT NULL DEFAULT '1', \`requireReason\` tinyint NOT NULL DEFAULT 0, \`requireDescription\` tinyint NOT NULL DEFAULT 0, \`requireProject\` tinyint NOT NULL DEFAULT 0, \`requireTask\` tinyint NOT NULL DEFAULT 0, \`requireClient\` tinyint NOT NULL DEFAULT 0, \`timeFormat\` int NOT NULL DEFAULT '12', \`separateInvoiceItemTaxAndDiscount\` tinyint NULL, \`website\` varchar(255) NULL, \`fiscalInformation\` varchar(255) NULL, \`currencyPosition\` varchar(255) NOT NULL DEFAULT 'LEFT', \`discountAfterTax\` tinyint NULL, \`defaultStartTime\` varchar(255) NULL, \`defaultEndTime\` varchar(255) NULL, \`defaultInvoiceEstimateTerms\` varchar(255) NULL, \`convertAcceptedEstimates\` tinyint NULL, \`daysUntilDue\` int NULL, \`isRemoveIdleTime\` tinyint NOT NULL DEFAULT 0, \`allowScreenshotCapture\` tinyint NOT NULL DEFAULT 1, \`upworkOrganizationId\` varchar(255) NULL, \`upworkOrganizationName\` varchar(255) NULL, \`randomScreenshot\` tinyint NULL DEFAULT 0, \`trackOnSleep\` tinyint NULL DEFAULT 0, \`screenshotFrequency\` decimal NOT NULL DEFAULT '10', \`enforced\` tinyint NULL DEFAULT 0, \`contactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_6de52b8f3de32abee3df2628a3\` (\`isActive\`), INDEX \`IDX_b2091c1795f1d0d919b278ab23\` (\`isArchived\`), INDEX \`IDX_745a293c8b2c750bc421fa0633\` (\`tenantId\`), INDEX \`IDX_c21e615583a3ebbb0977452afb\` (\`name\`), INDEX \`IDX_03e5eecc2328eb545ff748cbdd\` (\`isDefault\`), INDEX \`IDX_40460ab803bf6e5a62b75a35c5\` (\`profile_link\`), INDEX \`IDX_6cc2b2052744e352834a4c9e78\` (\`banner\`), INDEX \`IDX_b03a8a28f6ebdb6df8f630216b\` (\`totalEmployees\`), INDEX \`IDX_f37d866c3326eca5f579cef35c\` (\`short_description\`), INDEX \`IDX_c75285bf286b17c7ca5537857b\` (\`client_focus\`), INDEX \`IDX_9ea70bf5c390b00e7bb96b86ed\` (\`overview\`), INDEX \`IDX_15458cef74076623c270500053\` (\`currency\`), INDEX \`IDX_2360aa7a4b5ab99e026584f305\` (\`defaultValueDateType\`), INDEX \`IDX_7965db2b12872551b586f76dd7\` (\`contactId\`), INDEX \`IDX_47b6a97e09895a06606a4a8042\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`password_reset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`token\` varchar(255) NOT NULL, INDEX \`IDX_380c03025a41ad032191f1ef2d\` (\`isActive\`), INDEX \`IDX_e71a736d52820b568f6b0ca203\` (\`isArchived\`), INDEX \`IDX_1fa632f2d12a06ef8dcc00858f\` (\`tenantId\`), INDEX \`IDX_1c88db6e50f0704688d1f1978c\` (\`email\`), INDEX \`IDX_36e929b98372d961bb63bd4b4e\` (\`token\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`payment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`paymentDate\` datetime NULL, \`amount\` decimal NULL, \`note\` varchar(255) NULL, \`currency\` varchar(255) NOT NULL, \`paymentMethod\` enum ('BANK_TRANSFER', 'CASH', 'CHEQUE', 'CREDIT_CARD', 'DEBIT', 'ONLINE') NULL, \`overdue\` tinyint NULL, \`employeeId\` varchar(255) NULL, \`invoiceId\` varchar(255) NULL, \`recordedById\` varchar(255) NOT NULL, \`projectId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_16a49d62227bf23686b77b5a21\` (\`isActive\`), INDEX \`IDX_8c4018eab11e92c3b09583495f\` (\`isArchived\`), INDEX \`IDX_6959c37c3acf0832103a253570\` (\`tenantId\`), INDEX \`IDX_be7fcc9fb8cd5a74cb602ec6c9\` (\`organizationId\`), INDEX \`IDX_62ef561a3bb084a7d12dad8a2d\` (\`employeeId\`), INDEX \`IDX_87223c7f1d4c2ca51cf6992784\` (\`invoiceId\`), INDEX \`IDX_3f13c738eff604a85700746ec7\` (\`recordedById\`), INDEX \`IDX_8846e403ec45e1ad8c309f91a3\` (\`projectId\`), INDEX \`IDX_82753b9e315af84b20eaf84d77\` (\`organizationContactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`pipeline_stage\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` text NULL, \`index\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`pipelineId\` varchar(255) NOT NULL, INDEX \`IDX_a6acee4ad726734b73f3886c14\` (\`isActive\`), INDEX \`IDX_074caa106ee22d5d675a696a98\` (\`isArchived\`), INDEX \`IDX_28965bf63ad4c0976892d0fd5e\` (\`tenantId\`), INDEX \`IDX_04d16bdd72668de12c3e41a85a\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`pipeline\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` text NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_f3027eabd451ec18b93fab7ed5\` (\`isActive\`), INDEX \`IDX_1adf9f97094bc93e176ede2482\` (\`isArchived\`), INDEX \`IDX_683274c59fb08b21249096e305\` (\`tenantId\`), INDEX \`IDX_873ade98fbd6ca71c8b4d1bbca\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_category_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_e690dd59b69e74a6bb5d94f32b\` (\`isActive\`), INDEX \`IDX_d32c5d5e4451acf44fd5b212ce\` (\`isArchived\`), INDEX \`IDX_27d71aa2e843f07fbf36329be3\` (\`tenantId\`), INDEX \`IDX_e46203bf1dbf3291d174f02cb3\` (\`organizationId\`), INDEX \`IDX_586294149d24cd835678878ef1\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`imageUrl\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_198fba43f049ea621407e7d188\` (\`isActive\`), INDEX \`IDX_06cd3959f09e0b12793a763515\` (\`isArchived\`), INDEX \`IDX_0a0cf25cd8232a154d1cce2641\` (\`tenantId\`), INDEX \`IDX_853302351eaa4daa39920c270a\` (\`organizationId\`), INDEX \`IDX_f38e86bd280ff9c9c7d9cb7839\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_option_group\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`productId\` varchar(255) NOT NULL, INDEX \`IDX_0fc743f2bc16502dbc5e85420c\` (\`isActive\`), INDEX \`IDX_76bda4c33c83614617278617ae\` (\`isArchived\`), INDEX \`IDX_462a7fd3ce68935cf973c6709f\` (\`tenantId\`), INDEX \`IDX_4a1430a01b71ecdfcd54b2b6c5\` (\`organizationId\`), INDEX \`IDX_a6e91739227bf4d442f23c52c7\` (\`productId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_option_group_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_75b7065234a6d32fbd03d8703f\` (\`isActive\`), INDEX \`IDX_e9e50109d3054fb81205c0a74e\` (\`isArchived\`), INDEX \`IDX_fd6b39f1fd1db026b5dcc3c795\` (\`tenantId\`), INDEX \`IDX_0e2fcc31743e20a45fc3cf0211\` (\`organizationId\`), INDEX \`IDX_c9ce1da98b6d93293daafee63a\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_option_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_f284f666950392c55afa0806c8\` (\`isActive\`), INDEX \`IDX_2f581c3477a5c7a66de5d7f264\` (\`isArchived\`), INDEX \`IDX_9869d7680f48487e584f5d2fca\` (\`tenantId\`), INDEX \`IDX_4dc2f466cfa3d0b7fef19d1273\` (\`organizationId\`), INDEX \`IDX_f43c46e12db0580af320db7738\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_option\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NULL, \`groupId\` varchar(255) NOT NULL, INDEX \`IDX_d81028785f188c253e0bd49a03\` (\`isActive\`), INDEX \`IDX_35d083f4ecfe72cce72ee88f58\` (\`isArchived\`), INDEX \`IDX_985d235aa5394937c4493262c7\` (\`tenantId\`), INDEX \`IDX_47ffb82a65c43f102b7e0efa41\` (\`organizationId\`), INDEX \`IDX_a6debf9198e2fbfa006aa10d71\` (\`groupId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_variant_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isSubscription\` tinyint NOT NULL DEFAULT 0, \`isPurchaseAutomatically\` tinyint NOT NULL DEFAULT 0, \`canBeSold\` tinyint NOT NULL DEFAULT 1, \`canBePurchased\` tinyint NOT NULL DEFAULT 1, \`canBeCharged\` tinyint NOT NULL DEFAULT 0, \`canBeRented\` tinyint NOT NULL DEFAULT 0, \`isEquipment\` tinyint NOT NULL DEFAULT 0, \`trackInventory\` tinyint NOT NULL DEFAULT 0, \`productVariantId\` varchar(36) NULL, INDEX \`IDX_ad107ba78e487cd8b13313593b\` (\`isActive\`), INDEX \`IDX_ae78776111e1906accfd61511d\` (\`isArchived\`), INDEX \`IDX_2efe48435d4ba480a4bb8b96fa\` (\`tenantId\`), INDEX \`IDX_bed9d45e15866d9b8e87e7a7bf\` (\`organizationId\`), UNIQUE INDEX \`REL_b0d86990fe7160a5f3e4011fb2\` (\`productVariantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_type_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_e9dca49bad996f1761db3b2f56\` (\`isActive\`), INDEX \`IDX_65874d6bab7fefcaeccd2252c1\` (\`isArchived\`), INDEX \`IDX_30aafca59cdb456bf5231f9e46\` (\`tenantId\`), INDEX \`IDX_2dd271bdeb602b8c3956287e33\` (\`organizationId\`), INDEX \`IDX_f4b767c43b4e9130c63382c9b2\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`icon\` varchar(255) NULL, INDEX \`IDX_90cc635a1065702ed3b79da6ec\` (\`isActive\`), INDEX \`IDX_49064ee0f3acd5882f4d893f3d\` (\`isArchived\`), INDEX \`IDX_f206c807fc7e41fc8a8b6679ae\` (\`tenantId\`), INDEX \`IDX_e4e4120b0c19d3a207ce38d758\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_variant_price\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`unitCost\` int NOT NULL DEFAULT '0', \`unitCostCurrency\` varchar(255) NOT NULL DEFAULT 'USD', \`retailPrice\` int NOT NULL DEFAULT '0', \`retailPriceCurrency\` varchar(255) NOT NULL DEFAULT 'USD', \`productVariantId\` varchar(36) NULL, INDEX \`IDX_562ef5984b6d4bed640bfcc6a2\` (\`isActive\`), INDEX \`IDX_24ac11e35221577e4ba4fdd229\` (\`isArchived\`), INDEX \`IDX_7052eaf00a5795afa5ebf35995\` (\`tenantId\`), INDEX \`IDX_0cfba32db58a952f58b1e35cf1\` (\`organizationId\`), UNIQUE INDEX \`REL_5842f603bd85d924127d63d73c\` (\`productVariantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_variant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`taxes\` int NOT NULL DEFAULT '0', \`notes\` varchar(255) NULL, \`quantity\` int NOT NULL DEFAULT '0', \`billingInvoicingPolicy\` varchar(255) NOT NULL DEFAULT 'Quantity ordered', \`internalReference\` varchar(255) NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`productId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, \`priceId\` varchar(36) NULL, \`settingId\` varchar(36) NULL, INDEX \`IDX_e0d896cadbc695a490f64bb7e7\` (\`isActive\`), INDEX \`IDX_e0005cbdabb760488f66f3fbba\` (\`isArchived\`), INDEX \`IDX_9121e00c4dc3500dc610cf8722\` (\`tenantId\`), INDEX \`IDX_6a289b10030ae86903406e3c9b\` (\`organizationId\`), INDEX \`IDX_6e420052844edf3a5506d863ce\` (\`productId\`), INDEX \`IDX_b83f23626741630a8629960715\` (\`imageId\`), UNIQUE INDEX \`REL_41b31a71dda350cfe5da07e0e4\` (\`priceId\`), UNIQUE INDEX \`REL_9f0fd369dfeb275415c649d110\` (\`settingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`code\` varchar(255) NOT NULL, \`imageUrl\` varchar(255) NULL, \`featuredImageId\` varchar(255) NULL, \`productTypeId\` varchar(255) NULL, \`productCategoryId\` varchar(255) NULL, INDEX \`IDX_7bb2b2f7a4c8a4916d4339d7f4\` (\`isActive\`), INDEX \`IDX_6f58935aa2175d930e47e97c9f\` (\`isArchived\`), INDEX \`IDX_08293ca31a601d3cd0228120bc\` (\`tenantId\`), INDEX \`IDX_32a4bdd261ec81f4ca6b3abe26\` (\`organizationId\`), INDEX \`IDX_4627873dbc1af07d732e6eec7b\` (\`featuredImageId\`), INDEX \`IDX_374bfd0d1b0e1398d7206456d9\` (\`productTypeId\`), INDEX \`IDX_618194d24a7ea86a165d7ec628\` (\`productCategoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_1d9ca23c7e1c606061fec8bb74\` (\`isActive\`), INDEX \`IDX_96413a8061ff4ccdc418d4e16a\` (\`isArchived\`), INDEX \`IDX_7533fd275bfb3219ce9eb4004c\` (\`tenantId\`), INDEX \`IDX_e6abcacc3d3a4f9cf5ca97f2b2\` (\`organizationId\`), INDEX \`IDX_d24bc28e54f1dc296452a25591\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`proposal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPostUrl\` varchar(255) NULL, \`valueDate\` datetime NULL, \`jobPostContent\` varchar(255) NOT NULL, \`proposalContent\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_61a30a7d83666bf265fd86a72d\` (\`isActive\`), INDEX \`IDX_e2836e856f491dd4676e1ec8d3\` (\`isArchived\`), INDEX \`IDX_4177329f5e6ddbfb6416592713\` (\`tenantId\`), INDEX \`IDX_d59ec6899d435f430799795ad7\` (\`organizationId\`), INDEX \`IDX_cc28a54171231fbd9a127051f0\` (\`jobPostUrl\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`report_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`iconClass\` varchar(255) NULL, INDEX \`IDX_dd9fcd7916d0a22189ecea6a36\` (\`isActive\`), INDEX \`IDX_656f05f951faa13d7195853424\` (\`isArchived\`), INDEX \`IDX_fa278d337ba5e200d44ade6697\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`report_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`reportId\` varchar(255) NOT NULL, \`isEnabled\` tinyint NOT NULL DEFAULT 1, INDEX \`IDX_a6bde8f44e18f17b1ca603e150\` (\`isActive\`), INDEX \`IDX_40459267d68604655aa6df4251\` (\`isArchived\`), INDEX \`IDX_edf9bd011d7f08e3e18a5becb8\` (\`tenantId\`), INDEX \`IDX_5193788a3ebc1143bedb74cf72\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`report\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`slug\` varchar(255) NULL, \`description\` varchar(255) NULL, \`image\` varchar(255) NULL, \`iconClass\` varchar(255) NULL, \`showInMenu\` tinyint NOT NULL DEFAULT 0, \`categoryId\` varchar(255) NOT NULL, INDEX \`IDX_143ead1a6ac5f73125d8c4c3aa\` (\`isActive\`), INDEX \`IDX_1316fdd7b9a2926437a13271bf\` (\`isArchived\`), INDEX \`IDX_6f9ee54eb839117e83b937648d\` (\`name\`), INDEX \`IDX_ef16fed5f7e6951027502e6458\` (\`slug\`), INDEX \`IDX_230652e48daa99c50c000fc5d1\` (\`categoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`request_approval_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`status\` int NULL, \`requestApprovalId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_2634ff04775e659c4792325f38\` (\`isActive\`), INDEX \`IDX_3d66190c19b9fe69a8bbb300df\` (\`isArchived\`), INDEX \`IDX_a5445b38b780b29b09369e36a9\` (\`tenantId\`), INDEX \`IDX_4071f027554eefff65ac8123e6\` (\`organizationId\`), INDEX \`IDX_563fec5539b89a57f40731f985\` (\`requestApprovalId\`), INDEX \`IDX_ce2113039f070b3f003aa0db61\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`request_approval_team\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`status\` int NULL, \`requestApprovalId\` varchar(255) NOT NULL, \`teamId\` varchar(255) NOT NULL, INDEX \`IDX_34b2e8f794e0336b9ac410d8bd\` (\`isActive\`), INDEX \`IDX_bdcb4ea389bdb794bae75b0170\` (\`isArchived\`), INDEX \`IDX_94b2a3d0f17c9549dea1493dc9\` (\`tenantId\`), INDEX \`IDX_77e1050669b32cfff482f96016\` (\`organizationId\`), INDEX \`IDX_6c75d8a8c609e88896b2653cc4\` (\`requestApprovalId\`), INDEX \`IDX_9ccdaee6c5c62cda8f7375e841\` (\`teamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`request_approval\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`status\` int NULL, \`createdBy\` varchar(255) NULL, \`createdByName\` varchar(255) NULL, \`min_count\` int NULL, \`requestId\` varchar(255) NULL, \`requestType\` varchar(255) NULL, \`approvalPolicyId\` varchar(255) NULL, INDEX \`IDX_db152600f88a9a4888df0b626e\` (\`isActive\`), INDEX \`IDX_c77295d7f5d6086c815de3c120\` (\`isArchived\`), INDEX \`IDX_9feaa23ed7bc47d51315e304bb\` (\`tenantId\`), INDEX \`IDX_8343741e7929043b2a7de89f73\` (\`organizationId\`), INDEX \`IDX_c63fafc733ff8ab37dede8ffec\` (\`name\`), INDEX \`IDX_26bb3420001d31337393ed05bc\` (\`approvalPolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`role_permission\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`permission\` varchar(255) NOT NULL, \`enabled\` tinyint NULL DEFAULT 0, \`description\` varchar(255) NULL, \`roleId\` varchar(255) NOT NULL, INDEX \`IDX_78f93dbb42a97f6785bcf53efd\` (\`isActive\`), INDEX \`IDX_5c36df1a5c85016952e90d760f\` (\`isArchived\`), INDEX \`IDX_cbd053921056e77c0a8e03122a\` (\`tenantId\`), INDEX \`IDX_8307c5c44a4ad6210b767b17a9\` (\`permission\`), INDEX \`IDX_e3130a39c1e4a740d044e68573\` (\`roleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`role\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, INDEX \`IDX_c5f75cd3367769b6f22b298d29\` (\`isActive\`), INDEX \`IDX_09868c0733ba37a4753ff8931f\` (\`isArchived\`), INDEX \`IDX_1751a572e91385a09d41c62471\` (\`tenantId\`), INDEX \`IDX_ae4578dcaed5adff96595e6166\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`skill\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`color\` varchar(255) NOT NULL, INDEX \`IDX_f4cdbe61d68413f4d6a671f8c2\` (\`isActive\`), INDEX \`IDX_ca52119f9e4857399706d723e9\` (\`isArchived\`), INDEX \`IDX_8e502eac7ed1347c71c26beae8\` (\`tenantId\`), INDEX \`IDX_b2923d394f3636671ff9b3c3e8\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`color\` varchar(255) NOT NULL, \`textColor\` varchar(255) NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_1f22c73374bcca1ea84a4dca59\` (\`isActive\`), INDEX \`IDX_58876ee26a90170551027459bf\` (\`isArchived\`), INDEX \`IDX_b08dd29fb6a8acdf83c83d8988\` (\`tenantId\`), INDEX \`IDX_c2f6bec0b39eaa3a6d90903ae9\` (\`organizationId\`), INDEX \`IDX_49746602acc4e5e8721062b69e\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_estimation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`estimate\` int NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`taskId\` varchar(255) NOT NULL, INDEX \`IDX_b1a7086c279309b20e8384d0d9\` (\`isActive\`), INDEX \`IDX_1f3ffda4fce02682e76308b476\` (\`isArchived\`), INDEX \`IDX_87bfea6d0b9a1ec602ee88e5f6\` (\`tenantId\`), INDEX \`IDX_16507eb222e3c50be077fb4ace\` (\`organizationId\`), INDEX \`IDX_8f274646f2bdf4e12990feeb04\` (\`employeeId\`), INDEX \`IDX_a3ee022203211f678376cd919b\` (\`taskId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`issue_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`imageId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_722ce5d7535524b96c6d03f7c4\` (\`isActive\`), INDEX \`IDX_1909e9bae7d8b2c920b3e4d859\` (\`isArchived\`), INDEX \`IDX_8b12c913c39c72fe5980427c96\` (\`tenantId\`), INDEX \`IDX_16dbef9d1b2b422abdce8ee3ae\` (\`organizationId\`), INDEX \`IDX_4af451ab46a94e94394c72d911\` (\`name\`), INDEX \`IDX_af2d743ed61571bcdc5d9a27a0\` (\`value\`), INDEX \`IDX_33779b0395f72af0b50dc526d1\` (\`imageId\`), INDEX \`IDX_131331557078611a68b4a5b2e7\` (\`projectId\`), INDEX \`IDX_586513cceb16777fd14a17bfe1\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`number\` bigint NULL, \`prefix\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`description\` text NULL, \`status\` varchar(255) NULL, \`priority\` varchar(255) NULL, \`size\` varchar(255) NULL, \`issueType\` varchar(255) NULL, \`estimate\` int NULL, \`dueDate\` datetime NULL, \`public\` tinyint NULL DEFAULT 1, \`startDate\` datetime NULL, \`resolvedAt\` datetime NULL, \`version\` varchar(255) NULL, \`parentId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`creatorId\` varchar(255) NULL, \`organizationSprintId\` varchar(255) NULL, \`taskStatusId\` varchar(255) NULL, \`taskSizeId\` varchar(255) NULL, \`taskPriorityId\` varchar(255) NULL, INDEX \`IDX_3e16c81005c389a4db83c0e5e3\` (\`isActive\`), INDEX \`IDX_ca2f7edd5a5ce8f14b257c9d54\` (\`isArchived\`), INDEX \`IDX_e91cbff3d206f150ccc14d0c3a\` (\`tenantId\`), INDEX \`IDX_5b0272d923a31c972bed1a1ac4\` (\`organizationId\`), INDEX \`IDX_2fe7a278e6f08d2be55740a939\` (\`status\`), INDEX \`IDX_f092f3386f10f2e2ef5b0b6ad1\` (\`priority\`), INDEX \`IDX_7127880d6fae956ecc1c84ac31\` (\`size\`), INDEX \`IDX_ed5441fb13e82854a994da5a78\` (\`issueType\`), INDEX \`IDX_3797a20ef5553ae87af126bc2f\` (\`projectId\`), INDEX \`IDX_94fe6b3a5aec5f85427df4f8cd\` (\`creatorId\`), INDEX \`IDX_1e1f64696aa3a26d3e12c840e5\` (\`organizationSprintId\`), INDEX \`IDX_0cbe714983eb0aae5feeee8212\` (\`taskStatusId\`), INDEX \`IDX_2f4bdd2593fd6038aaa91fd107\` (\`taskSizeId\`), INDEX \`IDX_b8616deefe44d0622233e73fbf\` (\`taskPriorityId\`), UNIQUE INDEX \`taskNumber\` (\`projectId\`, \`number\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_linked_issues\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`action\` int NOT NULL, \`taskFromId\` varchar(255) NOT NULL, \`taskToId\` varchar(255) NOT NULL, INDEX \`IDX_d49853e18e5bc772f5435b01a5\` (\`isActive\`), INDEX \`IDX_88021c0cd9508757d3d90333f8\` (\`isArchived\`), INDEX \`IDX_20b50abc5c97610a75d49ad381\` (\`tenantId\`), INDEX \`IDX_24114c4059e6b6991daba541b1\` (\`organizationId\`), INDEX \`IDX_6deea7b3671e45973e191a1502\` (\`taskFromId\`), INDEX \`IDX_0848fd2b8c23c0ab55146297cf\` (\`taskToId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_priority\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_8ddcc5eeaf96314f53ca486821\` (\`isActive\`), INDEX \`IDX_e6adb82db368af15f2b8cdd4e8\` (\`isArchived\`), INDEX \`IDX_1818655f27b8cf4f0d1dbfeb8d\` (\`tenantId\`), INDEX \`IDX_7fd1b30d159b608cbf59009f68\` (\`organizationId\`), INDEX \`IDX_7d656b4cba8f11e639dbc5aab3\` (\`name\`), INDEX \`IDX_46daede7b19176b6ad959d70da\` (\`value\`), INDEX \`IDX_db4237960ca989eb7a48cd433b\` (\`projectId\`), INDEX \`IDX_52b039cff6a1adf6b7f9e49ee4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_related_issue_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_5a341f51d8f5ec12db24ab033f\` (\`isActive\`), INDEX \`IDX_8177dd93be8044b37d3bb9285d\` (\`isArchived\`), INDEX \`IDX_b7b0ea8ac2825fb981c1181d11\` (\`tenantId\`), INDEX \`IDX_bed691e21fe01cf5aceee72295\` (\`organizationId\`), INDEX \`IDX_9423f99da972c150f85dbc11c1\` (\`name\`), INDEX \`IDX_61a7cb4452d9e23f91231b7fd6\` (\`value\`), INDEX \`IDX_d99fe5b50dbe5078e0d9a9b6a9\` (\`projectId\`), INDEX \`IDX_4967ebdca0aefb9d43e56695e4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_size\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_d65afcfe2d64e49d43931579a3\` (\`isActive\`), INDEX \`IDX_8f26ffc61abaef417b0f807695\` (\`isArchived\`), INDEX \`IDX_f6ec2207e50680a475d71c8979\` (\`tenantId\`), INDEX \`IDX_596512cc6508a482cc23ae6ab7\` (\`organizationId\`), INDEX \`IDX_90c54f57b29cc8b67edc2738ae\` (\`name\`), INDEX \`IDX_1a7b137d009616a2ff1aa6834f\` (\`value\`), INDEX \`IDX_ad6792b26526bd96ab18d63454\` (\`projectId\`), INDEX \`IDX_f4438327b3c2afb0832569b2a1\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_status\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`order\` int NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`isCollapsed\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_25d9737ee153411871b4d20c67\` (\`isActive\`), INDEX \`IDX_79c525a8c2209e90186bfcbea9\` (\`isArchived\`), INDEX \`IDX_efbaf00a743316b394cc31e4a2\` (\`tenantId\`), INDEX \`IDX_9b9a828a49f4bd6383a4073fe2\` (\`organizationId\`), INDEX \`IDX_b0c955f276679dd2b2735c3936\` (\`name\`), INDEX \`IDX_68eaba689ed6d3e27ec93d3e88\` (\`value\`), INDEX \`IDX_a19e8975e5c296640d457dfc11\` (\`projectId\`), INDEX \`IDX_0330b4a942b536d8d1f264abe3\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_version\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_7e509a66367ecaf8e3bc96f263\` (\`isActive\`), INDEX \`IDX_313b0e55871c1c9b6c22341536\` (\`isArchived\`), INDEX \`IDX_379c8bd0ce203341148c1f99ee\` (\`tenantId\`), INDEX \`IDX_9c845f353378371ee3aa60f686\` (\`organizationId\`), INDEX \`IDX_3396dda57286ca17ab61fd3704\` (\`name\`), INDEX \`IDX_e9fd8df772ad2d955a65f4c68a\` (\`value\`), INDEX \`IDX_91988120385964f213aec8aa84\` (\`projectId\`), INDEX \`IDX_959e77718a2e76ee56498c1106\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tenant_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NULL, INDEX \`IDX_1d9975b98d82f385ae14b4d7c6\` (\`isActive\`), INDEX \`IDX_a7500f9b1b7917bf10882c820e\` (\`isArchived\`), INDEX \`IDX_affdab301e348b892175f30fa3\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tenant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`logo\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_b8eb9f3e420aa846f30e291960\` (\`isActive\`), INDEX \`IDX_eeedffab85b3534a1068d9270f\` (\`isArchived\`), INDEX \`IDX_56211336b5ff35fd944f225917\` (\`name\`), INDEX \`IDX_d154d06dac0d0e0a5d9a083e25\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_off_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`requiresApproval\` tinyint NOT NULL, \`paid\` tinyint NOT NULL, INDEX \`IDX_cf9377d3bcb7cb996f72268941\` (\`isActive\`), INDEX \`IDX_22d919e53cf5f6d836b18d407a\` (\`isArchived\`), INDEX \`IDX_1c0ed84d54f8fbe4af10dfcda1\` (\`tenantId\`), INDEX \`IDX_c2744cffeca55c3c9c52bb9789\` (\`organizationId\`), INDEX \`IDX_7d7f69c79df4a6f152b0e362b1\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_off_request\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`documentUrl\` varchar(255) NULL, \`description\` varchar(255) NULL, \`start\` datetime NOT NULL, \`end\` datetime NOT NULL, \`requestDate\` datetime NOT NULL, \`status\` varchar(255) NOT NULL, \`isHoliday\` tinyint NULL DEFAULT 0, \`policyId\` varchar(255) NOT NULL, \`documentId\` varchar(255) NULL, INDEX \`IDX_45e4bc4476681f4db2097cc2d5\` (\`isActive\`), INDEX \`IDX_5ddef92c4694e6d650d9e557b3\` (\`isArchived\`), INDEX \`IDX_4989834dd1c9c8ea3576ed99ce\` (\`tenantId\`), INDEX \`IDX_981333982a6df8b815957dcbf2\` (\`organizationId\`), INDEX \`IDX_c1f8ae47dc2f1882afc5045c73\` (\`policyId\`), INDEX \`IDX_c009cdd795be674c2047062374\` (\`documentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`activity\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NULL, \`description\` longtext NULL, \`metaData\` json NULL, \`date\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`time\` time(6) NOT NULL DEFAULT '0', \`duration\` int NOT NULL DEFAULT '0', \`type\` varchar(255) NULL, \`source\` varchar(255) NOT NULL DEFAULT 'BROWSER', \`recordedAt\` datetime NULL, \`employeeId\` varchar(255) NOT NULL, \`projectId\` varchar(255) NULL, \`timeSlotId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, INDEX \`IDX_ae6ac57aafef59f561d4db3dd7\` (\`isActive\`), INDEX \`IDX_d2d6db7f03da5632687e5d140e\` (\`isArchived\`), INDEX \`IDX_f2401d8fdff5d8970dfe30d3ae\` (\`tenantId\`), INDEX \`IDX_fdb3f018c2bba4885bfa5757d1\` (\`organizationId\`), INDEX \`IDX_a28a1682ea80f10d1ecc7babaa\` (\`title\`), INDEX \`IDX_302b60a4970ffe94d5223f1c23\` (\`date\`), INDEX \`IDX_b5525385e85f7429e233d4a0fa\` (\`time\`), INDEX \`IDX_f27285af15ef48363745ab2d79\` (\`type\`), INDEX \`IDX_0e36a2c95e2f1df7f1b3059d24\` (\`source\`), INDEX \`IDX_ffd736f18ba71b3221e4f835a9\` (\`recordedAt\`), INDEX \`IDX_a6f74ae99d549932391f0f4460\` (\`employeeId\`), INDEX \`IDX_5a898f44fa31ef7916f0c38b01\` (\`projectId\`), INDEX \`IDX_4e382caaf07ab0923b2e06bf91\` (\`timeSlotId\`), INDEX \`IDX_2743f8990fde12f9586287eb09\` (\`taskId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`screenshot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`file\` varchar(255) NOT NULL, \`thumb\` varchar(255) NULL, \`recordedAt\` datetime NULL, \`storageProvider\` enum ('LOCAL', 'S3', 'WASABI', 'CLOUDINARY') NULL, \`isWorkRelated\` tinyint NULL, \`description\` varchar(255) NULL, \`apps\` json NULL, \`timeSlotId\` varchar(255) NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_742688858e0484d66f04e4d4c4\` (\`isActive\`), INDEX \`IDX_892e285e1da2b3e61e51e50628\` (\`isArchived\`), INDEX \`IDX_235004f3dafac90692cd64d915\` (\`tenantId\`), INDEX \`IDX_0951aacffe3f8d0cff54cf2f34\` (\`organizationId\`), INDEX \`IDX_3d7feb5fe793e4811cdb79f983\` (\`recordedAt\`), INDEX \`IDX_2b374e5cdee1145ebb2a832f20\` (\`storageProvider\`), INDEX \`IDX_1b0867d86ead2332f3d4edba7d\` (\`isWorkRelated\`), INDEX \`IDX_eea7986acfb827bf5d0622c41f\` (\`description\`), INDEX \`IDX_5b594d02d98d5defcde323abe5\` (\`timeSlotId\`), INDEX \`IDX_fa1896dc735403799311968f7e\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_log\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startedAt\` datetime NULL, \`stoppedAt\` datetime NULL, \`editedAt\` datetime NULL, \`logType\` varchar(255) NOT NULL DEFAULT 'TRACKED', \`source\` varchar(255) NOT NULL DEFAULT 'BROWSER', \`description\` longtext NULL, \`reason\` varchar(255) NULL, \`isBillable\` tinyint NOT NULL DEFAULT 0, \`isRunning\` tinyint NULL, \`version\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`timesheetId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_a1910a76044b971609b75ea165\` (\`isActive\`), INDEX \`IDX_91a64228fbbe1516730a0cab5d\` (\`isArchived\`), INDEX \`IDX_fa9018cb248ea0f3b2b30ef143\` (\`tenantId\`), INDEX \`IDX_aed2d5cc5680fba9d387c7f931\` (\`organizationId\`), INDEX \`IDX_189b79acd611870aba62b3594e\` (\`startedAt\`), INDEX \`IDX_a1f8fcd70164d915fe7dd4a1ec\` (\`stoppedAt\`), INDEX \`IDX_154e9120e2acb632d8bd9b91ff\` (\`editedAt\`), INDEX \`IDX_e80fb588b1086ce2a4f2244814\` (\`logType\`), INDEX \`IDX_402290e7045e0c10ef97d9f982\` (\`source\`), INDEX \`IDX_722b9cb3a991c964d86396b6bc\` (\`isBillable\`), INDEX \`IDX_f447474d185cd70b3015853874\` (\`isRunning\`), INDEX \`IDX_79001d281ecb766005b3d331c1\` (\`version\`), INDEX \`IDX_a89a849957e005bafb8e4220bc\` (\`employeeId\`), INDEX \`IDX_e65393bb52aa8275b1392c73f7\` (\`timesheetId\`), INDEX \`IDX_54776f6f5fd3c13c3bc1fbfac5\` (\`projectId\`), INDEX \`IDX_1ddf2da35e34378fd845d80a18\` (\`taskId\`), INDEX \`IDX_d1e8f22c02c5e949453dde7f2d\` (\`organizationContactId\`), INDEX \`IDX_18dcdf754396f0cb0308dc91f4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_slot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` int NOT NULL DEFAULT '0', \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`overall\` int NOT NULL DEFAULT '0', \`startedAt\` datetime NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_645a6bc3f1141d4a111a3166d8\` (\`isActive\`), INDEX \`IDX_81060c5dbe69efa1f3b6e1a2e5\` (\`isArchived\`), INDEX \`IDX_b8284109257b5137256b5b3e84\` (\`tenantId\`), INDEX \`IDX_b407841271245501dd1a8c7551\` (\`organizationId\`), INDEX \`IDX_0c707825a7c2ecc4e186b07ebf\` (\`duration\`), INDEX \`IDX_f44e721669d5c6bed32cd6a3bf\` (\`overall\`), INDEX \`IDX_c6e7d1075bfd97eea6643b1479\` (\`startedAt\`), INDEX \`IDX_7913305b850c7afc89b6ed96a3\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_slot_minute\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`datetime\` datetime NOT NULL, \`timeSlotId\` varchar(255) NOT NULL, INDEX \`IDX_8260fdc7862ca27d8cf10e6290\` (\`isActive\`), INDEX \`IDX_a3eeb9629f550c367bb752855e\` (\`isArchived\`), INDEX \`IDX_c7f72cb68b22b8ab988158e4d2\` (\`tenantId\`), INDEX \`IDX_82c5edbd179359212f16f0d386\` (\`organizationId\`), INDEX \`IDX_9272701d3da8bd8507f316c915\` (\`timeSlotId\`), UNIQUE INDEX \`IDX_0ac1d2777eefcee82db52ca366\` (\`timeSlotId\`, \`datetime\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`timesheet\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` int NOT NULL DEFAULT '0', \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`overall\` int NOT NULL DEFAULT '0', \`startedAt\` datetime NULL, \`stoppedAt\` datetime NULL, \`approvedAt\` datetime NULL, \`submittedAt\` datetime NULL, \`lockedAt\` datetime NULL, \`editedAt\` datetime NULL, \`isBilled\` tinyint NOT NULL DEFAULT 0, \`status\` varchar(255) NOT NULL DEFAULT 'PENDING', \`employeeId\` varchar(255) NOT NULL, \`approvedById\` varchar(255) NULL, INDEX \`IDX_42205a9e6af108364e5cc62dd4\` (\`isActive\`), INDEX \`IDX_f2d4cd3a7e839bfc7cb6b993ff\` (\`isArchived\`), INDEX \`IDX_25b8df69c9b7f5752c6a6a6ef7\` (\`tenantId\`), INDEX \`IDX_aca65a79fe0c1ec9e6a59022c5\` (\`organizationId\`), INDEX \`IDX_930e2b28de9ecb1ea689d5a97a\` (\`startedAt\`), INDEX \`IDX_f6558fbb3158ab90da1c41d943\` (\`stoppedAt\`), INDEX \`IDX_6a79eb7534066b11f59243ede1\` (\`approvedAt\`), INDEX \`IDX_3f8fc4b5718fcaa913f9438e27\` (\`submittedAt\`), INDEX \`IDX_3502c60f98a7cda58dea75bcb5\` (\`lockedAt\`), INDEX \`IDX_ea81b5247ecdf5d82cf71fa096\` (\`editedAt\`), INDEX \`IDX_c828facbb4250117f83416d9f7\` (\`isBilled\`), INDEX \`IDX_23fdffa8369387d87101090684\` (\`status\`), INDEX \`IDX_8c8f821cb0fe0dd387491ea7d9\` (\`employeeId\`), INDEX \`IDX_6c1f81934a3f597b3b1a17f562\` (\`approvedById\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`user_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isDefault\` tinyint NOT NULL DEFAULT 1, \`userId\` varchar(255) NOT NULL, INDEX \`IDX_ca24fc59aac015d9660955f5f6\` (\`isActive\`), INDEX \`IDX_c764336019c69cc4927f317cb0\` (\`isArchived\`), INDEX \`IDX_611e1392c8cc9b101e3ea7ad80\` (\`tenantId\`), INDEX \`IDX_7143f31467178a6164a42426c1\` (\`organizationId\`), INDEX \`IDX_1f97ff07fb198bd0a7786b2abd\` (\`isDefault\`), INDEX \`IDX_29c3c8cc3ea9db22e4a347f4b5\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`user\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`thirdPartyId\` varchar(255) NULL, \`firstName\` varchar(255) NULL, \`lastName\` varchar(255) NULL, \`email\` varchar(255) NULL, \`phoneNumber\` varchar(255) NULL, \`username\` varchar(255) NULL, \`timeZone\` varchar(255) NULL, \`hash\` varchar(255) NULL, \`refreshToken\` varchar(255) NULL, \`imageUrl\` varchar(500) NULL, \`preferredLanguage\` varchar(255) NULL DEFAULT 'en', \`preferredComponentLayout\` enum ('CARDS_GRID', 'TABLE') NULL DEFAULT 'TABLE', \`code\` varchar(255) NULL, \`codeExpireAt\` datetime NULL, \`emailVerifiedAt\` datetime NULL, \`emailToken\` varchar(255) NULL, \`roleId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_fde2ce12ab12b02ae583dd76c7\` (\`isActive\`), INDEX \`IDX_557cb712d32a9ad9ffbb4cd50d\` (\`isArchived\`), INDEX \`IDX_685bf353c85f23b6f848e4dcde\` (\`tenantId\`), INDEX \`IDX_19de43e9f1842360ce646253d7\` (\`thirdPartyId\`), INDEX \`IDX_58e4dbff0e1a32a9bdc861bb29\` (\`firstName\`), INDEX \`IDX_f0e1b4ecdca13b177e2e3a0613\` (\`lastName\`), INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` (\`email\`), INDEX \`IDX_f2578043e491921209f5dadd08\` (\`phoneNumber\`), INDEX \`IDX_78a916df40e02a9deb1c4b75ed\` (\`username\`), INDEX \`IDX_c28e52f758e7bbc53828db9219\` (\`roleId\`), INDEX \`IDX_5e028298e103e1694147ada69e\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`warehouse_product\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`quantity\` decimal NULL DEFAULT '0', \`warehouseId\` varchar(255) NOT NULL, \`productId\` varchar(255) NOT NULL, INDEX \`IDX_7a584a02d15a022e9c4f06ea72\` (\`isActive\`), INDEX \`IDX_3370818c940a51996d80bb4d16\` (\`isArchived\`), INDEX \`IDX_62573a939f834f2de343f98288\` (\`tenantId\`), INDEX \`IDX_c899e17322d11e1977832e8c65\` (\`organizationId\`), INDEX \`IDX_a8c9aee14d47ec7b3f2ac429eb\` (\`warehouseId\`), INDEX \`IDX_3f934c4772e7c7f2c66d7ea4e7\` (\`productId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`warehouse_product_variant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`quantity\` decimal NULL DEFAULT '0', \`variantId\` varchar(255) NOT NULL, \`warehouseProductId\` varchar(255) NOT NULL, INDEX \`IDX_5f32a52e9bd19bf323b02efcd1\` (\`isActive\`), INDEX \`IDX_40aa52eaed1ce133f5fee76bca\` (\`isArchived\`), INDEX \`IDX_a1c4a97b928b547c3041d3ac1f\` (\`tenantId\`), INDEX \`IDX_d5f4b64e6a80546fd6dd4ac3ed\` (\`organizationId\`), INDEX \`IDX_a2f863689d1316810c41c1ea38\` (\`variantId\`), INDEX \`IDX_617306cb3613dd8d59301ae16f\` (\`warehouseProductId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`warehouse\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`active\` tinyint NOT NULL DEFAULT 1, \`logoId\` varchar(255) NULL, \`contactId\` varchar(255) NULL, INDEX \`IDX_ee85901ae866ffe2061d5b35c8\` (\`isActive\`), INDEX \`IDX_835691d3dd62d0b705302cbb2d\` (\`isArchived\`), INDEX \`IDX_9b2f00761a6b1b77cb6289e3ff\` (\`tenantId\`), INDEX \`IDX_f5735eafddabdb4b20f621a976\` (\`organizationId\`), INDEX \`IDX_f502dc6d9802306f9d1584932b\` (\`logoId\`), INDEX \`IDX_84594016a98da8b87e0f51cd93\` (\`contactId\`), UNIQUE INDEX \`REL_84594016a98da8b87e0f51cd93\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`knowledge_base\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`flag\` varchar(255) NOT NULL, \`icon\` varchar(255) NOT NULL, \`privacy\` varchar(255) NOT NULL, \`language\` varchar(255) NOT NULL, \`color\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`data\` varchar(255) NULL, \`index\` int NULL, \`parentId\` varchar(255) NULL, INDEX \`IDX_9b22423b8cb20087c16613ecba\` (\`isActive\`), INDEX \`IDX_0765098c5a6f93f51a55bda026\` (\`isArchived\`), INDEX \`IDX_bcb30c9893f4c8d0c4e556b4ed\` (\`tenantId\`), INDEX \`IDX_2ba72a9dec732a10e8c05bcdec\` (\`organizationId\`), INDEX \`IDX_ff979040ce93cbc60863d322ec\` (\`parentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`knowledge_base_article\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`data\` varchar(255) NULL, \`draft\` tinyint NOT NULL, \`privacy\` tinyint NOT NULL, \`index\` int NOT NULL, \`categoryId\` varchar(255) NOT NULL, INDEX \`IDX_1544c43e36e1ccf7d578c70607\` (\`isActive\`), INDEX \`IDX_e9720156c57ff1ad841e95ace7\` (\`isArchived\`), INDEX \`IDX_06a9902fedc1f9dcdbaf14afb0\` (\`tenantId\`), INDEX \`IDX_3547f82f867489542ceae58a49\` (\`organizationId\`), INDEX \`IDX_66af194845635058239e794e1b\` (\`categoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`knowledge_base_author\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`articleId\` varchar(255) NOT NULL, INDEX \`IDX_b9623984c84eb7be4c0eb076c2\` (\`isActive\`), INDEX \`IDX_a9130ad7824fb843f06103971e\` (\`isArchived\`), INDEX \`IDX_1551e821871d9230cc0dafbbe5\` (\`tenantId\`), INDEX \`IDX_81558bb2bef673628d92540b4e\` (\`organizationId\`), INDEX \`IDX_8eb7e413257d7a26104f4e326f\` (\`employeeId\`), INDEX \`IDX_2d5ecab1f06b327bad54553614\` (\`articleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`changelog\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`title\` varchar(255) NULL, \`date\` datetime NOT NULL, \`content\` varchar(255) NOT NULL, \`isFeature\` tinyint NULL, \`learnMoreUrl\` varchar(255) NULL, \`imageUrl\` varchar(255) NULL, INDEX \`IDX_cc89233c87fcf64b01df07e038\` (\`isActive\`), INDEX \`IDX_cbc2b8338d45e774afd8682ffe\` (\`isArchived\`), INDEX \`IDX_744268ee0ec6073883267bc3b6\` (\`tenantId\`), INDEX \`IDX_c2037b621d2e8023898aee4ac7\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_candidate\` (\`candidateId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_34e4625cc9b010079f1b5758b3\` (\`candidateId\`), INDEX \`IDX_7e0891bb331b08bd4abb6776b7\` (\`tagId\`), PRIMARY KEY (\`candidateId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_job_preset\` (\`jobPresetId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_7ae5b4d4bdec77971dab319f2e\` (\`jobPresetId\`), INDEX \`IDX_68e75e49f06409fd385b4f8774\` (\`employeeId\`), PRIMARY KEY (\`jobPresetId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_employee_level\` (\`employeeLevelId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_b3565ff8073d4f66c46d27fe88\` (\`employeeLevelId\`), INDEX \`IDX_f3caf4cc158fe8b8e06578e792\` (\`tagId\`), PRIMARY KEY (\`employeeLevelId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_project_employee\` (\`employeeId\` varchar(36) NOT NULL, \`organizationProjectId\` varchar(36) NOT NULL, INDEX \`IDX_6b5b0c3d994f59d9c800922257\` (\`employeeId\`), INDEX \`IDX_2ba868f42c2301075b7c141359\` (\`organizationProjectId\`), PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_employee\` (\`employeeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e0ddfccfe9816681c410ebf2b9\` (\`employeeId\`), INDEX \`IDX_b1ffe2a63a48b486e18dc59d1b\` (\`tagId\`), PRIMARY KEY (\`employeeId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_off_policy_employee\` (\`employeeId\` varchar(36) NOT NULL, \`timeOffPolicyId\` varchar(36) NOT NULL, INDEX \`IDX_c451f53f5a6cd97db94e1c9482\` (\`employeeId\`), INDEX \`IDX_0f823750ac5a7d899cc5d8d040\` (\`timeOffPolicyId\`), PRIMARY KEY (\`employeeId\`, \`timeOffPolicyId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_off_request_employee\` (\`employeeId\` varchar(36) NOT NULL, \`timeOffRequestId\` varchar(36) NOT NULL, INDEX \`IDX_cd312469204347b1210397770a\` (\`employeeId\`), INDEX \`IDX_0a8cf0aacf95ce66e73e75a95c\` (\`timeOffRequestId\`), PRIMARY KEY (\`employeeId\`, \`timeOffRequestId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`employee_tasks_task\` (\`employeeId\` varchar(36) NOT NULL, \`taskId\` varchar(36) NOT NULL, INDEX \`IDX_eae5eea1c6a3fcf4a2c95f1a5f\` (\`employeeId\`), INDEX \`IDX_6bbbe677c5fc5115916b4eccfb\` (\`taskId\`), PRIMARY KEY (\`employeeId\`, \`taskId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`equipment_shares_employees\` (\`equipmentSharingId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_8676224f55a965c53e4bb7cbf8\` (\`equipmentSharingId\`), INDEX \`IDX_57f6461f1a710f0f4abdcb8d0e\` (\`employeeId\`), PRIMARY KEY (\`equipmentSharingId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`equipment_shares_teams\` (\`equipmentSharingId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_f84171695b7aedfc454483bcf2\` (\`equipmentSharingId\`), INDEX \`IDX_7ccef49dd56c8c74daa8d12186\` (\`organizationTeamId\`), PRIMARY KEY (\`equipmentSharingId\`, \`organizationTeamId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_equipment\` (\`equipmentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_bb0062d51a75164fcb64041ee7\` (\`equipmentId\`), INDEX \`IDX_0360b8197c2a38d6fe882cb1af\` (\`tagId\`), PRIMARY KEY (\`equipmentId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_event_type\` (\`eventTypeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_094af399a26d4a1d3ae17ea11e\` (\`eventTypeId\`), INDEX \`IDX_34b8f471aac00eaec6f2830e5b\` (\`tagId\`), PRIMARY KEY (\`eventTypeId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_expense_category\` (\`expenseCategoryId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_107a93f89c8f31f4386ae4b19d\` (\`expenseCategoryId\`), INDEX \`IDX_727dbf5e1100023681e216d6a9\` (\`tagId\`), PRIMARY KEY (\`expenseCategoryId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_expense\` (\`expenseId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_6f1108552ea7a70a4d958b338c\` (\`expenseId\`), INDEX \`IDX_8dcfbd0d960672fefe681bcba9\` (\`tagId\`), PRIMARY KEY (\`expenseId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_income\` (\`incomeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_55c9568ebe1c4addc3deb6922e\` (\`incomeId\`), INDEX \`IDX_00e2fd30761a36911648166044\` (\`tagId\`), PRIMARY KEY (\`incomeId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`integration_integration_type\` (\`integrationId\` varchar(36) NOT NULL, \`integrationTypeId\` varchar(36) NOT NULL, INDEX \`IDX_34c86921ee9b462bc5c7b61fad\` (\`integrationId\`), INDEX \`IDX_8dd2062499a6c2a708ddd05650\` (\`integrationTypeId\`), PRIMARY KEY (\`integrationId\`, \`integrationTypeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_integration\` (\`integrationId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_c9a85b16615bc5c3035802adb0\` (\`integrationId\`), INDEX \`IDX_0f19ad9872190b7a67a9652d5e\` (\`tagId\`), PRIMARY KEY (\`integrationId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invite_organization_project\` (\`inviteId\` varchar(36) NOT NULL, \`organizationProjectId\` varchar(36) NOT NULL, INDEX \`IDX_020325728f0979a2822a829565\` (\`inviteId\`), INDEX \`IDX_f2806968dd846cb49fcdac195a\` (\`organizationProjectId\`), PRIMARY KEY (\`inviteId\`, \`organizationProjectId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invite_organization_contact\` (\`inviteId\` varchar(36) NOT NULL, \`organizationContactId\` varchar(36) NOT NULL, INDEX \`IDX_a0c92b6393c7a13266003d552e\` (\`inviteId\`), INDEX \`IDX_c5a147ce2a0ec69ccc61149262\` (\`organizationContactId\`), PRIMARY KEY (\`inviteId\`, \`organizationContactId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invite_organization_department\` (\`inviteId\` varchar(36) NOT NULL, \`organizationDepartmentId\` varchar(36) NOT NULL, INDEX \`IDX_0935b93b3498a0f98db1af7176\` (\`inviteId\`), INDEX \`IDX_fe2eea7a939442efde885303ef\` (\`organizationDepartmentId\`), PRIMARY KEY (\`inviteId\`, \`organizationDepartmentId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`invite_organization_team\` (\`inviteId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_104140c94e838a058a34b30a09\` (\`inviteId\`), INDEX \`IDX_1132ec0c3618e53fc8cf7ed669\` (\`organizationTeamId\`), PRIMARY KEY (\`inviteId\`, \`organizationTeamId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_invoice\` (\`invoiceId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_5a07958d7c6253b311dbdc34ff\` (\`invoiceId\`), INDEX \`IDX_0728fc2cc26e8802cbf41aaf27\` (\`tagId\`), PRIMARY KEY (\`invoiceId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_merchant\` (\`merchantId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e7d60a4e9906d056a8966e279f\` (\`merchantId\`), INDEX \`IDX_4af822b453c7d7d5f033e6ea16\` (\`tagId\`), PRIMARY KEY (\`merchantId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`warehouse_merchant\` (\`merchantId\` varchar(36) NOT NULL, \`warehouseId\` varchar(36) NOT NULL, INDEX \`IDX_812f0cfb560ac6dda0d1345765\` (\`merchantId\`), INDEX \`IDX_a6bfc0dc6e5234e8e7ef698a36\` (\`warehouseId\`), PRIMARY KEY (\`merchantId\`, \`warehouseId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_contact\` (\`organizationContactId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1fb664a63f20bea6a3f0b38771\` (\`organizationContactId\`), INDEX \`IDX_8a06f5aded97d1b5e81005e121\` (\`tagId\`), PRIMARY KEY (\`organizationContactId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_contact_employee\` (\`organizationContactId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_beffeb7f338fa98354948c0789\` (\`organizationContactId\`), INDEX \`IDX_cd2bd8302bfb6093d0908c36dc\` (\`employeeId\`), PRIMARY KEY (\`organizationContactId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_department\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_c2c9cd2ea533d5442de455fb3e\` (\`organizationDepartmentId\`), INDEX \`IDX_0eb285a6b1ac7e3d0a542e50a4\` (\`tagId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_department_employee\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_c34e79a3aa682bbd3f0e8cf4c4\` (\`organizationDepartmentId\`), INDEX \`IDX_0d4f83695591ae3c98a0544ac8\` (\`employeeId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_department\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`candidateId\` varchar(36) NOT NULL, INDEX \`IDX_c58533f9ba63f42fef682e1ee7\` (\`organizationDepartmentId\`), INDEX \`IDX_ef6e8d34b95dcb2b21d5de08a6\` (\`candidateId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`candidateId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_employment_type\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_41a87d3cfa58c851bbf03ad4e8\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_904a731b2ae6bc1aa52c8302a9\` (\`tagId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_employment_type_employee\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_3bfdb894d67e6a29aa95780bb4\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_3ed17d3e624435e9f2ad71e058\` (\`employeeId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`candidate_employment_type\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`candidateId\` varchar(36) NOT NULL, INDEX \`IDX_b4b51067c538f78b8585ef2a17\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_8c5db3a96baffba025729ebe86\` (\`candidateId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`candidateId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_position\` (\`organizationPositionId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1f7e0230bc542d703781020378\` (\`organizationPositionId\`), INDEX \`IDX_c71c381e77b0543ed4023aeef7\` (\`tagId\`), PRIMARY KEY (\`organizationPositionId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_project\` (\`organizationProjectId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_b69fa5d1b1d02cdbe301ea6b10\` (\`organizationProjectId\`), INDEX \`IDX_18be859b371e9159dfc2cecbe1\` (\`tagId\`), PRIMARY KEY (\`organizationProjectId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_project_team\` (\`organizationProjectId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_7c31431ff2173c2c939a0aa036\` (\`organizationProjectId\`), INDEX \`IDX_599a5f7f6c190822dcfdbbb6eb\` (\`organizationTeamId\`), PRIMARY KEY (\`organizationProjectId\`, \`organizationTeamId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_team\` (\`organizationTeamId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_4b5e0ca086e6124eeddf84252f\` (\`organizationTeamId\`), INDEX \`IDX_2382356b63c832a137079210bd\` (\`tagId\`), PRIMARY KEY (\`organizationTeamId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`organization_team_tasks_task\` (\`organizationTeamId\` varchar(36) NOT NULL, \`taskId\` varchar(36) NOT NULL, INDEX \`IDX_2a6fb43dc7e7aebcda95e32a10\` (\`organizationTeamId\`), INDEX \`IDX_d15fbe1e1d9c1f56651d8d3831\` (\`taskId\`), PRIMARY KEY (\`organizationTeamId\`, \`taskId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization_vendor\` (\`organizationVendorId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_7dde3307daf6d6dec1513ecc56\` (\`organizationVendorId\`), INDEX \`IDX_f71369c1cb86ae9fd4d5452f9a\` (\`tagId\`), PRIMARY KEY (\`organizationVendorId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_organization\` (\`organizationId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_7ca79ff010025397cf9f216bde\` (\`organizationId\`), INDEX \`IDX_f5e70849adc6f2f81fcbccae77\` (\`tagId\`), PRIMARY KEY (\`organizationId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_payment\` (\`paymentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1fcb2a337ee905ab36c4aea3a3\` (\`paymentId\`), INDEX \`IDX_e087c0540b5098d115b50d954c\` (\`tagId\`), PRIMARY KEY (\`paymentId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_variant_options_product_option\` (\`productVariantId\` varchar(36) NOT NULL, \`productOptionId\` varchar(36) NOT NULL, INDEX \`IDX_526f0131260eec308a3bd2b61b\` (\`productVariantId\`), INDEX \`IDX_e96a71affe63c97f7fa2f076da\` (\`productOptionId\`), PRIMARY KEY (\`productVariantId\`, \`productOptionId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_product\` (\`productId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e516b4a2a1a8d4beda7217eeac\` (\`productId\`), INDEX \`IDX_f75a28915b38d926902c0f85b2\` (\`tagId\`), PRIMARY KEY (\`productId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`product_gallery_item\` (\`productId\` varchar(36) NOT NULL, \`imageAssetId\` varchar(36) NOT NULL, INDEX \`IDX_f7187fa710c6a5d22f46192637\` (\`productId\`), INDEX \`IDX_825848065557eac3678b164cee\` (\`imageAssetId\`), PRIMARY KEY (\`productId\`, \`imageAssetId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_proposal\` (\`proposalId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_3f55851a03524e567594d50774\` (\`proposalId\`), INDEX \`IDX_451853704de278eef61a37fa7a\` (\`tagId\`), PRIMARY KEY (\`proposalId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_request_approval\` (\`requestApprovalId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_74938a30181630c480b36e27d7\` (\`requestApprovalId\`), INDEX \`IDX_6c6576bff4b497a4975337fa5e\` (\`tagId\`), PRIMARY KEY (\`requestApprovalId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`skill_employee\` (\`skillId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_e699b50ca468e75bbd36913dcc\` (\`skillId\`), INDEX \`IDX_760034f54e598d519b5f0c4ece\` (\`employeeId\`), PRIMARY KEY (\`skillId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`skill_organization\` (\`skillId\` varchar(36) NOT NULL, \`organizationId\` varchar(36) NOT NULL, INDEX \`IDX_61593ade5fed9445738ddbe39c\` (\`skillId\`), INDEX \`IDX_b65cfda00c52e1fc26cc96e52c\` (\`organizationId\`), PRIMARY KEY (\`skillId\`, \`organizationId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_task\` (\`taskId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_4b4e8f61e866248f2ddf8ce181\` (\`taskId\`), INDEX \`IDX_bf7c34187a346f499e4dbc4b08\` (\`tagId\`), PRIMARY KEY (\`taskId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_employee\` (\`taskId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_790858593698e54cba501eb690\` (\`taskId\`), INDEX \`IDX_f38b1bd46f8831704348003bbf\` (\`employeeId\`), PRIMARY KEY (\`taskId\`, \`employeeId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`task_team\` (\`taskId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_47689f911b0cbb16c94a56a9c5\` (\`taskId\`), INDEX \`IDX_0ef34c9f9d6dc8d14f1fbb10e8\` (\`organizationTeamId\`), PRIMARY KEY (\`taskId\`, \`organizationTeamId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`time_slot_time_logs\` (\`timeSlotId\` varchar(36) NOT NULL, \`timeLogId\` varchar(36) NOT NULL, INDEX \`IDX_63c61a88461ff5c115c3b6bcde\` (\`timeSlotId\`), INDEX \`IDX_2fc2675c79cb3cbceb32bf2dc7\` (\`timeLogId\`), PRIMARY KEY (\`timeSlotId\`, \`timeLogId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_user\` (\`userId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_6a58ed56a12604c076a8e0cfda\` (\`userId\`), INDEX \`IDX_e64a306f3215dbb99bbb26ca59\` (\`tagId\`), PRIMARY KEY (\`userId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`CREATE TABLE \`tag_warehouse\` (\`warehouseId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_08385e1e045b83d25978568743\` (\`warehouseId\`), INDEX \`IDX_3557d514afd3794d40128e0542\` (\`tagId\`), PRIMARY KEY (\`warehouseId\`, \`tagId\`)) ENGINE=InnoDB`); await queryRunner.query(`ALTER TABLE \`accounting_template\` ADD CONSTRAINT \`FK_2ca6a49062a4ed884e413bf572e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`accounting_template\` ADD CONSTRAINT \`FK_e66511b175393255c6c4e7b007f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_2c0494466d5a7e1165cea3dca98\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_3c3a62226896345c4716bfe1d96\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_0ddc50b7521b9a905d9ca8c8ba3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_e9ca170a0fae05e44a9bd137d8b\` FOREIGN KEY (\`employeeAppointmentId\`) REFERENCES \`employee_appointment\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`approval_policy\` ADD CONSTRAINT \`FK_1462391059ebe137645098d7276\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`approval_policy\` ADD CONSTRAINT \`FK_dfe3b357df3ce136917b1f09843\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_f008a481cb4eed547704bb9d839\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_d544bd3a63634a4438509ac958d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_46ed3c2287423f5dc089100feeb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_9d5bd131452ef689df2b46551b4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_b106406e94bb7317493efc2c989\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_d1d16bc87d3afaf387f34cdceb7\` FOREIGN KEY (\`technologyId\`) REFERENCES \`candidate_technology\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_ba4c376b2069aa82745d4e96822\` FOREIGN KEY (\`personalQualityId\`) REFERENCES \`candidate_personal_quality\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_159f821dd214792f1d2ad9cff7c\` FOREIGN KEY (\`feedbackId\`) REFERENCES \`candidate_feedback\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_4d9b7ab09f9f9517d488b5fed1e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_d108a827199fda86a9ec216989a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_3f9053719c9d11ebdea03e5a2d4\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_00cdd9ed7571be8e2c8d09e7cd4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_f660af89b2c69fea2334508cbbd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_59b61ba52a58851cfc85b1e6c66\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_8dcf5fc8bc7f77a80b0fc648bfc\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_a50eb955f940ca93e044d175c62\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_cf75465b3663652a28cf1841ce2\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_6cb21fa0f65ff69679966c836f2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_3a6928f8501fce33820721a8fe8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_98c008fd8cf597e83dcdccfd161\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_0862c274d336126b951bfe009a7\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_44f3d80c3293e1de038c87f115d\` FOREIGN KEY (\`interviewerId\`) REFERENCES \`candidate_interviewer\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_59b765e6d13d83dba4852a43eb5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_03be41e88b1fecfe4e24d6b04b2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_91996439c4baafee8395d3df153\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_f0ca69c78eea92c95d9044764a2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_5f1e315db848990dfffa72817ca\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_ecb65075e94b47bbab11cfa5a1e\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_9e7b20eb3dfa082b83b198fdad4\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_045de7c208adcd0c68c0a651748\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_d321f4547ed467d07cce1e7d9a5\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_a0d171f45bdbcf2b990c0c37c32\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_8a07f780c6fce2b82830ab06877\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_d7986743e7f11720349a6c95572\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_492548e6c176f5655adfae9f5ea\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_source\` ADD CONSTRAINT \`FK_b2a1ba27a76dd819cd8294cce38\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_source\` ADD CONSTRAINT \`FK_e92027b5280828cadd7cd6ea719\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_a6fecb615b07987b480defac647\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_9d46b8c5382acd4d4514bc5c62e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_063663c7e61e45d172d1b832656\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_77ac426e04553ff1654421bce4d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_16fb27ffd1a99c6506c92ad57a7\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_b674793a804b7d69d74c8f6c5ba\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_1e3e8228e7df634fa4cec6322c7\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_4ea108fd8b089237964d5f98fba\` FOREIGN KEY (\`sourceId\`) REFERENCES \`candidate_source\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_3930aa71e0fa24f09201811b1bb\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_8b900e8a39f76125e610ab30c0e\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`contact\` ADD CONSTRAINT \`FK_60468af1ce34043a900809c84f2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`contact\` ADD CONSTRAINT \`FK_7719d73cd16a9f57ecc6ac24b3d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`custom_smtp\` ADD CONSTRAINT \`FK_2aa3fc8daa25beec4788d2be26c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`custom_smtp\` ADD CONSTRAINT \`FK_15a1306132d66c63ef31f7288c1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_46a3c00bfc3e36b4412d8bcdb08\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_38fb85abdf9995efcf217f59554\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_4b1ff44e6bae5065429dbab554b\` FOREIGN KEY (\`createdByUserId\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_9211f5b62988df6e95522be7daa\` FOREIGN KEY (\`stageId\`) REFERENCES \`pipeline_stage\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_1ae3abc0ae1dcf6c13f49b62b56\` FOREIGN KEY (\`clientId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_0af511c44de7a16beb45cc37852\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_525f4873c6edc3d94559f88900c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_1261c457b3035b77719556995bf\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_9033faf41b23c61ba201c487969\` FOREIGN KEY (\`emailTemplateId\`) REFERENCES \`email_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_reset\` ADD CONSTRAINT \`FK_93799dfaeff51de06f1e02ac414\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_reset\` ADD CONSTRAINT \`FK_e37af4ab2ba0bf268bfd9826345\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_template\` ADD CONSTRAINT \`FK_753e005a45556b5909e11937aaf\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`email_template\` ADD CONSTRAINT \`FK_c160fe6234675fac031aa3e7c50\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_a35637bb659c59e18adb4f38f87\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_86cf36c137712e779dd7e2301e6\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_2f58132c57108540887dc3e88eb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_91e0f7efcd17d20b5029fb1342d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_caf8363b0ed7d5f24ae866ba3bb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_0c5266f3f488add404f92d56ec7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_afe6c40d3d9951388fa05f83f28\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_630337302efe97cc93deeb21516\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_2dc73e07ac7040f273cea3c999d\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_c872e6e3ab28e813c2324d1f4fb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_b6bcd5ceb60e4bb493344a6b4f2\` FOREIGN KEY (\`occupationId\`) REFERENCES \`job_search_occupation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d2b148ddd67e520fb8061f4c133\` FOREIGN KEY (\`categoryId\`) REFERENCES \`job_search_category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_2323220b4decfd2f4d8307fd78f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d5ca48cfacfb516543d6507ca4a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_9a687ce1a10a3abda460922cf84\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d45b36b85ffbd5189f7e70f29f5\` FOREIGN KEY (\`occupationId\`) REFERENCES \`job_search_occupation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_b909a3df761d7e489aca80f138a\` FOREIGN KEY (\`categoryId\`) REFERENCES \`job_search_category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset\` ADD CONSTRAINT \`FK_7e53ea80aca15da11a8a5ec0380\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_preset\` ADD CONSTRAINT \`FK_a4b038417e3221c0791dd8c7714\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`job_search_category\` ADD CONSTRAINT \`FK_35e120f2b6e5188391cf068d3ba\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_search_category\` ADD CONSTRAINT \`FK_86381fb6d28978b101b3aec8ca4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`job_search_occupation\` ADD CONSTRAINT \`FK_44e22d88b47daf2095491b7cac3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`job_search_occupation\` ADD CONSTRAINT \`FK_1a62a99e1016e4a2b461e886ecd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_level\` ADD CONSTRAINT \`FK_d3fc52d497bc44d6f493dbedc3a\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_level\` ADD CONSTRAINT \`FK_c4668533292bf4526e61aedf74a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_d543336994b1f764c449e0b1d3c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_0f9cefa604913e1ab3225915469\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_329ebd01a757d1a0c3c4d628e29\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_f577c9bc6183c1d1eae1e154bbc\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_ee780fbd8f91de31c004929eecb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_2be728a7f8b118712a4200990d4\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_5fde7be40b3c03bc0fdac0c2f66\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_3ee5147bb1fde625fa33c0e956b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_0ac8526c48a3daa267c86225fb5\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_9516a627a131626d2a5738a05a8\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_56e96cd218a185ed59b5a8e7869\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_95ea18af6ef8123503d332240c2\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_4b3303a6b7eb92d237a4379734e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_c6a48286f3aa8ae903bee0d1e72\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_f4b0d329c4a3cf79ffe9d565047\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_1c0c1370ecd98040259625e17e2\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_5e719204dcafa8d6b2ecdeda130\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` ADD CONSTRAINT \`FK_5443ca8ed830626656d8cfecef7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` ADD CONSTRAINT \`FK_5311a833ff255881454bd5b3b58\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_fa525e61fb3d8d9efec0f364a4b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_ea9254be07ae4a8604f0aaab196\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_acad51a6362806fc499e583e402\` FOREIGN KEY (\`equipmentId\`) REFERENCES \`equipment\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_0ecfe0ce0cd2b197249d5f1c105\` FOREIGN KEY (\`equipmentSharingPolicyId\`) REFERENCES \`equipment_sharing_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_fb6808468066849ab7b7454d5f3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_f98ce0d210aa9f91b729d447806\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_0ab80a66282582ae8b0282508e7\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`estimate_email\` ADD CONSTRAINT \`FK_391d3f83244fea73c619aecadd9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`estimate_email\` ADD CONSTRAINT \`FK_233c1d351d63441aeb039d1164f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_92fc62260c0c7ff108622850bff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_fc8818d6fde74370ec703a01352\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_24d905ec9e127ade23754a363dd\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense_category\` ADD CONSTRAINT \`FK_37504e920ee5ca46a4000b89da5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense_category\` ADD CONSTRAINT \`FK_9c9bfe5baaf83f53533ff035fc0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_6d171c9d5f81095436b99da5e62\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_c5fb146726ff128e600f23d0a1b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_5e7b197dbac69012dbdb4964f37\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_eacb116ab0521ad9b96f2bb53ba\` FOREIGN KEY (\`vendorId\`) REFERENCES \`organization_vendor\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_42eea5debc63f4d1bf89881c10a\` FOREIGN KEY (\`categoryId\`) REFERENCES \`expense_category\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_9971c4171ae051e74b833984a30\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_047b8b5c0782d5a6d4c8bfc1a4e\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`import-history\` ADD CONSTRAINT \`FK_54868607115e2fee3b0b764eec2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`import-record\` ADD CONSTRAINT \`FK_a43b235c35c2c4d3263ada770c6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_8f71803d96dcdbcc6b19bb28d38\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_6a94e6b0a572f591288ac44a421\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_6d413f9fdd5366b1b9add464836\` FOREIGN KEY (\`featureId\`) REFERENCES \`feature\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`feature\` ADD CONSTRAINT \`FK_d4a28a8e70d450a412bf0cfb52a\` FOREIGN KEY (\`parentId\`) REFERENCES \`feature\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_general_setting\` ADD CONSTRAINT \`FK_d17a5159d888ac6320459eda392\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_general_setting\` ADD CONSTRAINT \`FK_e35d0f7b794ca8850669d12c78c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_cc72d4e8e4284dcc8ffbf96caf4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_df7ab026698c02859ff75408093\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_f69e740b066c6469d1c68a4a28b\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_43aa2985216560cd9fa93f501e5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_e49e37fe88a2725a38a3b058493\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_d4f093ca4eb7c40db68d9a789d0\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_template\` ADD CONSTRAINT \`FK_774bf82989475befe301fe1bca5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_template\` ADD CONSTRAINT \`FK_5708fe06608c72fc77b65ae6519\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal_time_frame\` ADD CONSTRAINT \`FK_b56723b53a76ca1c171890c479b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal_time_frame\` ADD CONSTRAINT \`FK_405bc5bba9ed71aefef84a29f10\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_6b4758a5442713070c9a366d0e5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_c6e8ae55a4db3584686cbf6afe1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_ac161c1a0c0ff8e83554f097e5e\` FOREIGN KEY (\`ownerTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_35526ff1063ab5fa2b20e71bd66\` FOREIGN KEY (\`ownerEmployeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_af0a11734e70412b742ac339c88\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_4c8b4e887a994182fd6132e6400\` FOREIGN KEY (\`alignedKeyResultId\`) REFERENCES \`key_result\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`image_asset\` ADD CONSTRAINT \`FK_01856a9a730b7e79d70aa661cb0\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`image_asset\` ADD CONSTRAINT \`FK_d3675304df9971cccf96d9a7c34\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`income\` ADD CONSTRAINT \`FK_8608b275644cfc7a0f3f5850814\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`income\` ADD CONSTRAINT \`FK_64409de4711cd14e2c43371cc02\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`income\` ADD CONSTRAINT \`FK_a05d52b7ffe89140f9cbcf114b3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`income\` ADD CONSTRAINT \`FK_29fbd3a17710a27e6f856072c01\` FOREIGN KEY (\`clientId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_b208a754c7a538cb3422f39f5b9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_d5ac36aa3d5919908414154fca0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_3fb863167095805e33f38a0fdcc\` FOREIGN KEY (\`integrationEntitySettingId\`) REFERENCES \`integration_entity_setting\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_23e9cfcf1bfff07dcc3254378df\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_c6c01e38eebd8b26b9214b90441\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_f80ff4ebbf0b33a67dce5989117\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_eec3d6064578610ddc609dd360e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_7022dafd72c1b92f7d506914411\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_c327ea26bda3d349a1eceb5658e\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_954c6b05297814776d9cb66ca77\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_369eaafb13afe9903a170077edb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_34daf030004ad37b88f1f3d863c\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_24e37d03ef224f1a16a35069c2c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_33ab224e7755a46fff5bc1e64e5\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_0d6ddc27d687ca879042c5f3ce3\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_480158f21938444e4f62fb31857\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_69d75a47af6bfcda545a865691b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_add7dbec156589dd0b27e2e0c49\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_b3234be5b70c2362cdf67bb1889\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_6c8e119fc6a2a7d3413aa76d3bd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_5065401113abb6e9608225e5678\` FOREIGN KEY (\`repositoryId\`) REFERENCES \`organization_github_repository\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_7c2328f76efb850b81147972476\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_68eef4ab86b67747f24f288a16c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_5a182e8b3e225b14ddf6df7e6c3\` FOREIGN KEY (\`invitedById\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_900a3ed40499c79c1c289fec284\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_91bfeec7a9574f458e5b592472d\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_cc0ac824ba89deda98bb418e8ca\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_856f24297f120604f8ae2942769\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_da2893697d57368470952a76f65\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_31ec3d5a6b0985cec544c642178\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_f78214cd9de76e80fe8a6305f52\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_e89749c8e8258b2ec110c0776ff\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_897c33b49a04cf3db7acd336afc\` FOREIGN KEY (\`expenseId\`) REFERENCES \`expense\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_553d5aac210d22fdca5c8d48ead\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_62d486728b272e3b4d23a6b5db6\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_d4d92abde074b3da8054d7cfbc7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_16f1d0e74b4d33e59c0eabdaac7\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_e558df60d7d9a3e412ef0bbb844\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_7fb52a5f267f53b7d93af3d8c3c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_058ef835f99e28fc6717cd7c80f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_b5c33892e630b66c65d623baf8e\` FOREIGN KEY (\`fromOrganizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_d9e965da0f63c94983d3a1006ac\` FOREIGN KEY (\`toContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_86c09eb673b0e66129dbdc72111\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_fab6b6200b9ed6fd002c1ff62ab\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_4bc62c3d2ffdd6f9c7f8b3dcd1c\` FOREIGN KEY (\`kpiId\`) REFERENCES \`goal_kpi_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_46426ea45456e240a092b732047\` FOREIGN KEY (\`goalId\`) REFERENCES \`goal_template\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_cd9cbc0d5b6d62dbb63c3b3a65b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_fd4b0cb7a44ed914acdda55e29c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_7497a70a581e5f56f792015dd37\` FOREIGN KEY (\`keyResultId\`) REFERENCES \`key_result\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_8ac2c6b487d03157adda874789f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_d1f45ca98f17bd84a5e430feaf4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_5880347716f9ec5056ec15112cc\` FOREIGN KEY (\`ownerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_c89adeff0de3aedb2e772a5bf4c\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_38dc003f3484eff4b59918e9ae3\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_d8547e21ccb8e37ac9f0d69c1af\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_4e1e975124c1d717814a4bb2ec8\` FOREIGN KEY (\`kpiId\`) REFERENCES \`goal_kpi\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_3e1d08761a717c1dd71fe67249b\` FOREIGN KEY (\`goalId\`) REFERENCES \`goal\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_533144d7ae94180235ea456625b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_d306a524b507f72fa8550aeffe4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_e03ddff05652be527e04abdc56f\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_20acc3c3a6c900c6ef9fc681996\` FOREIGN KEY (\`logoId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_award\` ADD CONSTRAINT \`FK_af6423760433da72002a7f369eb\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_award\` ADD CONSTRAINT \`FK_2e0d21aab892b5993abaac09bcd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_e68c43e315ad3aaea4e99cf461d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_6200736cb4d3617b004e5b647ff\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_a86d2e378b953cb39261f457d26\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_8cfcdc6bc8fb55e273d9ace5fd5\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_department\` ADD CONSTRAINT \`FK_b3644ff7cd65239e29d292a41d1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_department\` ADD CONSTRAINT \`FK_c61a562a2379d1c0077fe7de332\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_4bc83945c022a862a33629ff1e1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_1057ec001a4c6b258658143047a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_c129dee7d1cb84e01e69b5e2c66\` FOREIGN KEY (\`documentId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_employment_type\` ADD CONSTRAINT \`FK_227b5bd9867287cbbeece8f6ba9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_employment_type\` ADD CONSTRAINT \`FK_a583cfe32f492f5ba99b7bb2050\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_225e476592214e32e117a85213c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_4513931e2d530f78d7144c8c7cd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_020516e74a57cb85d75381e841a\` FOREIGN KEY (\`languageCode\`) REFERENCES \`language\`(\`code\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_position\` ADD CONSTRAINT \`FK_a8f497b1006ec967964abb0d497\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_position\` ADD CONSTRAINT \`FK_a0409e39f23ff6d418f2c03df58\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_7cf84e8b5775f349f81a1f3cc44\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_9d8afc1e1e64d4b7d48dd2229d7\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_904ae0b765faef6ba2db8b1e698\` FOREIGN KEY (\`repositoryId\`) REFERENCES \`organization_github_repository\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_bc1e32c13683dbb16ada1c6da14\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_063324fdceb51f7086e401ed2c9\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` ADD CONSTRAINT \`FK_0b19a287858af40661bd3eb7411\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` ADD CONSTRAINT \`FK_8a12e7a0d47d3c6a6b35f7984e3\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_f57ad03c4e471bd8530494ea63d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_8a1fe8afb3aa672bae5993fbe7d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_a140b7e30ff3455551a0fd599fb\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_582768159ef0c749e8552ea9bcd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_5830901876e426adfc15fb7341b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_19ab7adf33199bc6f913db277d7\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_20a290f166c0810eafbf2717171\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_fe12e1b76bbb76209134d9bdc2e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_d8eba1c0e500c60be1b69c1e777\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_719aeb37fa7a1dd80d25336a0cf\` FOREIGN KEY (\`activeTaskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_8dc83cdd7c519d73afc0d8bdf09\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_a2a5601d799fbfc29c17b99243f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_ce83034f38496f5fe3f19796977\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_d9529008c733cb90044b8c2ad6b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_c15823bf3f63b1fe331d9de6625\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_5e73656ce0355347477c42ae19b\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_171b852be7c1f387eca93775aad\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_176f5ed3c4534f3110d423d5690\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_eef1c19a0cb5321223cfe3286c4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_da625f694eb1e23e585f3010082\` FOREIGN KEY (\`createdById\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_51e91be110fa0b8e70066f5727f\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_vendor\` ADD CONSTRAINT \`FK_7e0bf6063e1728c9813d5da7caa\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_vendor\` ADD CONSTRAINT \`FK_56dd132aa3743cfa9b034d020eb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_745a293c8b2c750bc421fa06332\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7965db2b12872551b586f76dd79\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_47b6a97e09895a06606a4a80421\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`password_reset\` ADD CONSTRAINT \`FK_1fa632f2d12a06ef8dcc00858ff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_6959c37c3acf0832103a2535703\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_be7fcc9fb8cd5a74cb602ec6c9b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_62ef561a3bb084a7d12dad8a2d9\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_87223c7f1d4c2ca51cf69927844\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_3f13c738eff604a85700746ec7d\` FOREIGN KEY (\`recordedById\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_8846e403ec45e1ad8c309f91a37\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_82753b9e315af84b20eaf84d778\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_28965bf63ad4c0976892d0fd5e8\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_04d16bdd72668de12c3e41a85a6\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_73ec3158bf224b485fd715cb3a6\` FOREIGN KEY (\`pipelineId\`) REFERENCES \`pipeline\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`pipeline\` ADD CONSTRAINT \`FK_683274c59fb08b21249096e305c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`pipeline\` ADD CONSTRAINT \`FK_873ade98fbd6ca71c8b4d1bbcac\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_27d71aa2e843f07fbf36329be3f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_e46203bf1dbf3291d174f02cb34\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_586294149d24cd835678878ef12\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_category\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0a0cf25cd8232a154d1cce2641c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_853302351eaa4daa39920c270a9\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_f38e86bd280ff9c9c7d9cb78393\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_462a7fd3ce68935cf973c6709f9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_4a1430a01b71ecdfcd54b2b6c5c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_a6e91739227bf4d442f23c52c75\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_fd6b39f1fd1db026b5dcc3c7953\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_0e2fcc31743e20a45fc3cf0211d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_c9ce1da98b6d93293daafee63aa\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_option_group\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_9869d7680f48487e584f5d2fca7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_4dc2f466cfa3d0b7fef19d12731\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_f43c46e12db0580af320db77381\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_option\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_985d235aa5394937c4493262c7f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_47ffb82a65c43f102b7e0efa41a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_a6debf9198e2fbfa006aa10d710\` FOREIGN KEY (\`groupId\`) REFERENCES \`product_option_group\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_2efe48435d4ba480a4bb8b96fa6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_bed9d45e15866d9b8e87e7a7bfe\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_b0d86990fe7160a5f3e4011fb23\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_30aafca59cdb456bf5231f9e463\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_2dd271bdeb602b8c3956287e33c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_f4b767c43b4e9130c63382c9b28\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_type\` ADD CONSTRAINT \`FK_f206c807fc7e41fc8a8b6679ae0\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_type\` ADD CONSTRAINT \`FK_e4e4120b0c19d3a207ce38d7581\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_7052eaf00a5795afa5ebf359950\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_0cfba32db58a952f58b1e35cf1c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_5842f603bd85d924127d63d73cd\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_9121e00c4dc3500dc610cf8722e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_6a289b10030ae86903406e3c9bd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_41b31a71dda350cfe5da07e0e4f\` FOREIGN KEY (\`priceId\`) REFERENCES \`product_variant_price\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_9f0fd369dfeb275415c649d110b\` FOREIGN KEY (\`settingId\`) REFERENCES \`product_variant_setting\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_6e420052844edf3a5506d863ce6\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_b83f23626741630a86299607156\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product\` ADD CONSTRAINT \`FK_08293ca31a601d3cd0228120bc9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product\` ADD CONSTRAINT \`FK_32a4bdd261ec81f4ca6b3abe262\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product\` ADD CONSTRAINT \`FK_4627873dbc1af07d732e6eec7be\` FOREIGN KEY (\`featuredImageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product\` ADD CONSTRAINT \`FK_374bfd0d1b0e1398d7206456d98\` FOREIGN KEY (\`productTypeId\`) REFERENCES \`product_type\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product\` ADD CONSTRAINT \`FK_618194d24a7ea86a165d7ec628e\` FOREIGN KEY (\`productCategoryId\`) REFERENCES \`product_category\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_7533fd275bfb3219ce9eb4004c7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_e6abcacc3d3a4f9cf5ca97f2b28\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_d24bc28e54f1dc296452a255917\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_4177329f5e6ddbfb64165927134\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_d59ec6899d435f430799795ad7b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_f399488a0f3ea10bb511e3f5aa3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_61c45ab51852e4b0e539756d40f\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_edf9bd011d7f08e3e18a5becb8b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_5193788a3ebc1143bedb74cf725\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_a085d6f9bcfd19f8bae1dbfe135\` FOREIGN KEY (\`reportId\`) REFERENCES \`report\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`report\` ADD CONSTRAINT \`FK_230652e48daa99c50c000fc5d10\` FOREIGN KEY (\`categoryId\`) REFERENCES \`report_category\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_a5445b38b780b29b09369e36a9b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_4071f027554eefff65ac8123e6e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_563fec5539b89a57f40731f9858\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_ce2113039f070b3f003aa0db611\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_94b2a3d0f17c9549dea1493dc96\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_77e1050669b32cfff482f960169\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_6c75d8a8c609e88896b2653cc41\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_9ccdaee6c5c62cda8f7375e8417\` FOREIGN KEY (\`teamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_9feaa23ed7bc47d51315e304bb5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_8343741e7929043b2a7de89f739\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_26bb3420001d31337393ed05bc3\` FOREIGN KEY (\`approvalPolicyId\`) REFERENCES \`approval_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`role_permission\` ADD CONSTRAINT \`FK_cbd053921056e77c0a8e03122af\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`role_permission\` ADD CONSTRAINT \`FK_e3130a39c1e4a740d044e685730\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`role\` ADD CONSTRAINT \`FK_1751a572e91385a09d41c624714\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`skill\` ADD CONSTRAINT \`FK_8e502eac7ed1347c71c26beae81\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`skill\` ADD CONSTRAINT \`FK_b2923d394f3636671ff9b3c3e81\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_b08dd29fb6a8acdf83c83d8988f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_c2f6bec0b39eaa3a6d90903ae99\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_49746602acc4e5e8721062b69ec\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_87bfea6d0b9a1ec602ee88e5f68\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_16507eb222e3c50be077fb4ace2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_8f274646f2bdf4e12990feeb040\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_a3ee022203211f678376cd919bb\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_8b12c913c39c72fe5980427c963\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_16dbef9d1b2b422abdce8ee3ae2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_33779b0395f72af0b50dc526d1d\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_131331557078611a68b4a5b2e7e\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_586513cceb16777fd14a17bfe10\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_e91cbff3d206f150ccc14d0c3a1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_5b0272d923a31c972bed1a1ac4d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_8c9920b5fb32c3d8453f64b705c\` FOREIGN KEY (\`parentId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_3797a20ef5553ae87af126bc2fe\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_94fe6b3a5aec5f85427df4f8cd7\` FOREIGN KEY (\`creatorId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_1e1f64696aa3a26d3e12c840e55\` FOREIGN KEY (\`organizationSprintId\`) REFERENCES \`organization_sprint\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_0cbe714983eb0aae5feeee8212b\` FOREIGN KEY (\`taskStatusId\`) REFERENCES \`task_status\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_2f4bdd2593fd6038aaa91fd1076\` FOREIGN KEY (\`taskSizeId\`) REFERENCES \`task_size\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task\` ADD CONSTRAINT \`FK_b8616deefe44d0622233e73fbf9\` FOREIGN KEY (\`taskPriorityId\`) REFERENCES \`task_priority\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_20b50abc5c97610a75d49ad3817\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_24114c4059e6b6991daba541b1d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_6deea7b3671e45973e191a1502c\` FOREIGN KEY (\`taskFromId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_0848fd2b8c23c0ab55146297cff\` FOREIGN KEY (\`taskToId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_1818655f27b8cf4f0d1dbfeb8db\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_7fd1b30d159b608cbf59009f681\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_db4237960ca989eb7a48cd433b1\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_52b039cff6a1adf6b7f9e49ee44\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_b7b0ea8ac2825fb981c1181d115\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_bed691e21fe01cf5aceee722952\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_d99fe5b50dbe5078e0d9a9b6a9d\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_4967ebdca0aefb9d43e56695e42\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_f6ec2207e50680a475d71c89793\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_596512cc6508a482cc23ae6ab78\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_ad6792b26526bd96ab18d634544\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_f4438327b3c2afb0832569b2a1e\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_efbaf00a743316b394cc31e4a20\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_9b9a828a49f4bd6383a4073fe23\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_a19e8975e5c296640d457dfc11f\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_0330b4a942b536d8d1f264abe32\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_379c8bd0ce203341148c1f99ee7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_9c845f353378371ee3aa60f6865\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_91988120385964f213aec8aa84c\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_959e77718a2e76ee56498c1106a\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tenant_setting\` ADD CONSTRAINT \`FK_affdab301e348b892175f30fa39\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tenant\` ADD CONSTRAINT \`FK_d154d06dac0d0e0a5d9a083e253\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_off_policy\` ADD CONSTRAINT \`FK_1c0ed84d54f8fbe4af10dfcda1c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_off_policy\` ADD CONSTRAINT \`FK_c2744cffeca55c3c9c52bb9789c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_4989834dd1c9c8ea3576ed99ce5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_981333982a6df8b815957dcbf27\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_c1f8ae47dc2f1882afc5045c739\` FOREIGN KEY (\`policyId\`) REFERENCES \`time_off_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_c009cdd795be674c20470623742\` FOREIGN KEY (\`documentId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_f2401d8fdff5d8970dfe30d3aed\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_fdb3f018c2bba4885bfa5757d16\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_a6f74ae99d549932391f0f44609\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_5a898f44fa31ef7916f0c38b016\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_4e382caaf07ab0923b2e06bf918\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_2743f8990fde12f9586287eb09f\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_235004f3dafac90692cd64d9158\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_0951aacffe3f8d0cff54cf2f341\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_5b594d02d98d5defcde323abe5b\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_fa1896dc735403799311968f7ec\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_fa9018cb248ea0f3b2b30ef143b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_aed2d5cc5680fba9d387c7f931d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_a89a849957e005bafb8e4220bc7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_e65393bb52aa8275b1392c73f72\` FOREIGN KEY (\`timesheetId\`) REFERENCES \`timesheet\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_54776f6f5fd3c13c3bc1fbfac5b\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_1ddf2da35e34378fd845d80a18b\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_d1e8f22c02c5e949453dde7f2d1\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_18dcdf754396f0cb0308dc91f4c\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_b8284109257b5137256b5b3e848\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_b407841271245501dd1a8c75513\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_7913305b850c7afc89b6ed96a30\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_c7f72cb68b22b8ab988158e4d26\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_82c5edbd179359212f16f0d386a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_9272701d3da8bd8507f316c9154\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_25b8df69c9b7f5752c6a6a6ef7f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_aca65a79fe0c1ec9e6a59022c54\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_8c8f821cb0fe0dd387491ea7d9e\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_6c1f81934a3f597b3b1a17f5623\` FOREIGN KEY (\`approvedById\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_611e1392c8cc9b101e3ea7ad80c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_7143f31467178a6164a42426c15\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_29c3c8cc3ea9db22e4a347f4b5a\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`user\` ADD CONSTRAINT \`FK_685bf353c85f23b6f848e4dcded\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`user\` ADD CONSTRAINT \`FK_c28e52f758e7bbc53828db92194\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`user\` ADD CONSTRAINT \`FK_5e028298e103e1694147ada69e5\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_62573a939f834f2de343f98288c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_c899e17322d11e1977832e8c656\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_a8c9aee14d47ec7b3f2ac429ebc\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_3f934c4772e7c7f2c66d7ea4e72\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_a1c4a97b928b547c3041d3ac1f6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_d5f4b64e6a80546fd6dd4ac3ed0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_a2f863689d1316810c41c1ea38e\` FOREIGN KEY (\`variantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_617306cb3613dd8d59301ae16fd\` FOREIGN KEY (\`warehouseProductId\`) REFERENCES \`warehouse_product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_9b2f00761a6b1b77cb6289e3fff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_f5735eafddabdb4b20f621a976a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_f502dc6d9802306f9d1584932b8\` FOREIGN KEY (\`logoId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_84594016a98da8b87e0f51cd931\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_bcb30c9893f4c8d0c4e556b4ed3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_2ba72a9dec732a10e8c05bcdec1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_ff979040ce93cbc60863d322ecd\` FOREIGN KEY (\`parentId\`) REFERENCES \`knowledge_base\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_06a9902fedc1f9dcdbaf14afb01\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_3547f82f867489542ceae58a49e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_66af194845635058239e794e1b9\` FOREIGN KEY (\`categoryId\`) REFERENCES \`knowledge_base\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_1551e821871d9230cc0dafbbe58\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_81558bb2bef673628d92540b4e4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_8eb7e413257d7a26104f4e326fd\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_2d5ecab1f06b327bad545536143\` FOREIGN KEY (\`articleId\`) REFERENCES \`knowledge_base_article\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`changelog\` ADD CONSTRAINT \`FK_744268ee0ec6073883267bc3b66\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`changelog\` ADD CONSTRAINT \`FK_c2037b621d2e8023898aee4ac74\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_candidate\` ADD CONSTRAINT \`FK_34e4625cc9b010079f1b5758b36\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_candidate\` ADD CONSTRAINT \`FK_7e0891bb331b08bd4abb6776b76\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`employee_job_preset\` ADD CONSTRAINT \`FK_7ae5b4d4bdec77971dab319f2e2\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_job_preset\` ADD CONSTRAINT \`FK_68e75e49f06409fd385b4f87746\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_employee_level\` ADD CONSTRAINT \`FK_b3565ff8073d4f66c46d27fe88e\` FOREIGN KEY (\`employeeLevelId\`) REFERENCES \`employee_level\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_employee_level\` ADD CONSTRAINT \`FK_f3caf4cc158fe8b8e06578e7922\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_employee\` ADD CONSTRAINT \`FK_e0ddfccfe9816681c410ebf2b9a\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_employee\` ADD CONSTRAINT \`FK_b1ffe2a63a48b486e18dc59d1b7\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`time_off_policy_employee\` ADD CONSTRAINT \`FK_c451f53f5a6cd97db94e1c9482d\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_off_policy_employee\` ADD CONSTRAINT \`FK_0f823750ac5a7d899cc5d8d0402\` FOREIGN KEY (\`timeOffPolicyId\`) REFERENCES \`time_off_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_off_request_employee\` ADD CONSTRAINT \`FK_cd312469204347b1210397770a1\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_off_request_employee\` ADD CONSTRAINT \`FK_0a8cf0aacf95ce66e73e75a95cf\` FOREIGN KEY (\`timeOffRequestId\`) REFERENCES \`time_off_request\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_tasks_task\` ADD CONSTRAINT \`FK_eae5eea1c6a3fcf4a2c95f1a5fe\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`employee_tasks_task\` ADD CONSTRAINT \`FK_6bbbe677c5fc5115916b4eccfb1\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_shares_employees\` ADD CONSTRAINT \`FK_8676224f55a965c53e4bb7cbf8f\` FOREIGN KEY (\`equipmentSharingId\`) REFERENCES \`equipment_sharing\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_shares_employees\` ADD CONSTRAINT \`FK_57f6461f1a710f0f4abdcb8d0e6\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_shares_teams\` ADD CONSTRAINT \`FK_f84171695b7aedfc454483bcf21\` FOREIGN KEY (\`equipmentSharingId\`) REFERENCES \`equipment_sharing\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`equipment_shares_teams\` ADD CONSTRAINT \`FK_7ccef49dd56c8c74daa8d12186b\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_equipment\` ADD CONSTRAINT \`FK_bb0062d51a75164fcb64041ee7d\` FOREIGN KEY (\`equipmentId\`) REFERENCES \`equipment\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_equipment\` ADD CONSTRAINT \`FK_0360b8197c2a38d6fe882cb1aff\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_event_type\` ADD CONSTRAINT \`FK_094af399a26d4a1d3ae17ea11e3\` FOREIGN KEY (\`eventTypeId\`) REFERENCES \`event_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_event_type\` ADD CONSTRAINT \`FK_34b8f471aac00eaec6f2830e5bb\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_organization_expense_category\` ADD CONSTRAINT \`FK_107a93f89c8f31f4386ae4b19d9\` FOREIGN KEY (\`expenseCategoryId\`) REFERENCES \`expense_category\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_expense_category\` ADD CONSTRAINT \`FK_727dbf5e1100023681e216d6a93\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_expense\` ADD CONSTRAINT \`FK_6f1108552ea7a70a4d958b338cd\` FOREIGN KEY (\`expenseId\`) REFERENCES \`expense\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_expense\` ADD CONSTRAINT \`FK_8dcfbd0d960672fefe681bcba9c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_income\` ADD CONSTRAINT \`FK_55c9568ebe1c4addc3deb6922e5\` FOREIGN KEY (\`incomeId\`) REFERENCES \`income\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_income\` ADD CONSTRAINT \`FK_00e2fd30761a36911648166044c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`integration_integration_type\` ADD CONSTRAINT \`FK_34c86921ee9b462bc5c7b61fad4\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`integration_integration_type\` ADD CONSTRAINT \`FK_8dd2062499a6c2a708ddd05650e\` FOREIGN KEY (\`integrationTypeId\`) REFERENCES \`integration_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_integration\` ADD CONSTRAINT \`FK_c9a85b16615bc5c3035802adb04\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_integration\` ADD CONSTRAINT \`FK_0f19ad9872190b7a67a9652d5e1\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`invite_organization_project\` ADD CONSTRAINT \`FK_020325728f0979a2822a8295653\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_project\` ADD CONSTRAINT \`FK_f2806968dd846cb49fcdac195a0\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_contact\` ADD CONSTRAINT \`FK_a0c92b6393c7a13266003d552ef\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_contact\` ADD CONSTRAINT \`FK_c5a147ce2a0ec69ccc61149262d\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_department\` ADD CONSTRAINT \`FK_0935b93b3498a0f98db1af71760\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_department\` ADD CONSTRAINT \`FK_fe2eea7a939442efde885303efd\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_team\` ADD CONSTRAINT \`FK_104140c94e838a058a34b30a09c\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`invite_organization_team\` ADD CONSTRAINT \`FK_1132ec0c3618e53fc8cf7ed6694\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_invoice\` ADD CONSTRAINT \`FK_5a07958d7c6253b311dbdc34ff8\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_invoice\` ADD CONSTRAINT \`FK_0728fc2cc26e8802cbf41aaf274\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_merchant\` ADD CONSTRAINT \`FK_e7d60a4e9906d056a8966e279fd\` FOREIGN KEY (\`merchantId\`) REFERENCES \`merchant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_merchant\` ADD CONSTRAINT \`FK_4af822b453c7d7d5f033e6ea16f\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`warehouse_merchant\` ADD CONSTRAINT \`FK_812f0cfb560ac6dda0d1345765b\` FOREIGN KEY (\`merchantId\`) REFERENCES \`merchant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`warehouse_merchant\` ADD CONSTRAINT \`FK_a6bfc0dc6e5234e8e7ef698a36a\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_organization_contact\` ADD CONSTRAINT \`FK_1fb664a63f20bea6a3f0b387713\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_contact\` ADD CONSTRAINT \`FK_8a06f5aded97d1b5e81005e1216\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_contact_employee\` ADD CONSTRAINT \`FK_beffeb7f338fa98354948c07894\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_contact_employee\` ADD CONSTRAINT \`FK_cd2bd8302bfb6093d0908c36dcb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_department\` ADD CONSTRAINT \`FK_c2c9cd2ea533d5442de455fb3e1\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_department\` ADD CONSTRAINT \`FK_0eb285a6b1ac7e3d0a542e50a4b\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_department_employee\` ADD CONSTRAINT \`FK_c34e79a3aa682bbd3f0e8cf4c46\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_department_employee\` ADD CONSTRAINT \`FK_0d4f83695591ae3c98a0544ac8d\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_department\` ADD CONSTRAINT \`FK_c58533f9ba63f42fef682e1ee7c\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_department\` ADD CONSTRAINT \`FK_ef6e8d34b95dcb2b21d5de08a61\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_employment_type\` ADD CONSTRAINT \`FK_41a87d3cfa58c851bbf03ad4e8d\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_employment_type\` ADD CONSTRAINT \`FK_904a731b2ae6bc1aa52c8302a98\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_employment_type_employee\` ADD CONSTRAINT \`FK_3bfdb894d67e6a29aa95780bb47\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_employment_type_employee\` ADD CONSTRAINT \`FK_3ed17d3e624435e9f2ad71e0583\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_employment_type\` ADD CONSTRAINT \`FK_b4b51067c538f78b8585ef2a175\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`candidate_employment_type\` ADD CONSTRAINT \`FK_8c5db3a96baffba025729ebe869\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_organization_position\` ADD CONSTRAINT \`FK_1f7e0230bc542d7037810203786\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_position\` ADD CONSTRAINT \`FK_c71c381e77b0543ed4023aeef79\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_organization_project\` ADD CONSTRAINT \`FK_b69fa5d1b1d02cdbe301ea6b108\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_project\` ADD CONSTRAINT \`FK_18be859b371e9159dfc2cecbe13\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_project_team\` ADD CONSTRAINT \`FK_7c31431ff2173c2c939a0aa036c\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_project_team\` ADD CONSTRAINT \`FK_599a5f7f6c190822dcfdbbb6eb0\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_team\` ADD CONSTRAINT \`FK_4b5e0ca086e6124eeddf84252fc\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_team\` ADD CONSTRAINT \`FK_2382356b63c832a137079210bd1\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`organization_team_tasks_task\` ADD CONSTRAINT \`FK_2a6fb43dc7e7aebcda95e32a107\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`organization_team_tasks_task\` ADD CONSTRAINT \`FK_d15fbe1e1d9c1f56651d8d3831e\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_vendor\` ADD CONSTRAINT \`FK_7dde3307daf6d6dec1513ecc560\` FOREIGN KEY (\`organizationVendorId\`) REFERENCES \`organization_vendor\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization_vendor\` ADD CONSTRAINT \`FK_f71369c1cb86ae9fd4d5452f9aa\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_organization\` ADD CONSTRAINT \`FK_7ca79ff010025397cf9f216bdeb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_organization\` ADD CONSTRAINT \`FK_f5e70849adc6f2f81fcbccae77c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_payment\` ADD CONSTRAINT \`FK_1fcb2a337ee905ab36c4aea3a3c\` FOREIGN KEY (\`paymentId\`) REFERENCES \`payment\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_payment\` ADD CONSTRAINT \`FK_e087c0540b5098d115b50d954cd\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_variant_options_product_option\` ADD CONSTRAINT \`FK_526f0131260eec308a3bd2b61b6\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_variant_options_product_option\` ADD CONSTRAINT \`FK_e96a71affe63c97f7fa2f076dac\` FOREIGN KEY (\`productOptionId\`) REFERENCES \`product_option\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_product\` ADD CONSTRAINT \`FK_e516b4a2a1a8d4beda7217eeac6\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_product\` ADD CONSTRAINT \`FK_f75a28915b38d926902c0f85b24\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`product_gallery_item\` ADD CONSTRAINT \`FK_f7187fa710c6a5d22f461926378\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`product_gallery_item\` ADD CONSTRAINT \`FK_825848065557eac3678b164cee2\` FOREIGN KEY (\`imageAssetId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_proposal\` ADD CONSTRAINT \`FK_3f55851a03524e567594d507744\` FOREIGN KEY (\`proposalId\`) REFERENCES \`proposal\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_proposal\` ADD CONSTRAINT \`FK_451853704de278eef61a37fa7a6\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_request_approval\` ADD CONSTRAINT \`FK_74938a30181630c480b36e27d76\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_request_approval\` ADD CONSTRAINT \`FK_6c6576bff4b497a4975337fa5e3\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`skill_employee\` ADD CONSTRAINT \`FK_e699b50ca468e75bbd36913dccb\` FOREIGN KEY (\`skillId\`) REFERENCES \`skill\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`skill_employee\` ADD CONSTRAINT \`FK_760034f54e598d519b5f0c4ecee\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`skill_organization\` ADD CONSTRAINT \`FK_61593ade5fed9445738ddbe39c4\` FOREIGN KEY (\`skillId\`) REFERENCES \`skill\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`skill_organization\` ADD CONSTRAINT \`FK_b65cfda00c52e1fc26cc96e52ca\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_task\` ADD CONSTRAINT \`FK_4b4e8f61e866248f2ddf8ce181a\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_task\` ADD CONSTRAINT \`FK_bf7c34187a346f499e4dbc4b08b\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`task_employee\` ADD CONSTRAINT \`FK_790858593698e54cba501eb6908\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_employee\` ADD CONSTRAINT \`FK_f38b1bd46f8831704348003bbff\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_team\` ADD CONSTRAINT \`FK_47689f911b0cbb16c94a56a9c50\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`task_team\` ADD CONSTRAINT \`FK_0ef34c9f9d6dc8d14f1fbb10e86\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_slot_time_logs\` ADD CONSTRAINT \`FK_63c61a88461ff5c115c3b6bcde5\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`time_slot_time_logs\` ADD CONSTRAINT \`FK_2fc2675c79cb3cbceb32bf2dc7a\` FOREIGN KEY (\`timeLogId\`) REFERENCES \`time_log\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_user\` ADD CONSTRAINT \`FK_6a58ed56a12604c076a8e0cfdaa\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_user\` ADD CONSTRAINT \`FK_e64a306f3215dbb99bbb26ca599\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE \`tag_warehouse\` ADD CONSTRAINT \`FK_08385e1e045b83d25978568743f\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`); await queryRunner.query(`ALTER TABLE \`tag_warehouse\` ADD CONSTRAINT \`FK_3557d514afd3794d40128e05423\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - } + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE \`accounting_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`mjml\` text NULL, \`hbs\` longtext NOT NULL, \`templateType\` varchar(255) NOT NULL, INDEX \`IDX_5cf7c007fc9c83bee748f08806\` (\`isActive\`), INDEX \`IDX_7ac2c1c487dd77fe38c2d571ea\` (\`isArchived\`), INDEX \`IDX_2ca6a49062a4ed884e413bf572\` (\`tenantId\`), INDEX \`IDX_e66511b175393255c6c4e7b007\` (\`organizationId\`), INDEX \`IDX_968c1c9a131a61a3720b3a72f6\` (\`name\`), INDEX \`IDX_a841eabc6b656c965d8846223e\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`appointment_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`appointmentId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`employeeAppointmentId\` varchar(255) NULL, INDEX \`IDX_379af16b0aeed6a4d8f15c53bc\` (\`isActive\`), INDEX \`IDX_2a6f8c4b8da6f85e2903daf5c3\` (\`isArchived\`), INDEX \`IDX_2c0494466d5a7e1165cea3dca9\` (\`tenantId\`), INDEX \`IDX_3c3a62226896345c4716bfe1d9\` (\`organizationId\`), INDEX \`IDX_0ddc50b7521b9a905d9ca8c8ba\` (\`employeeId\`), INDEX \`IDX_e9ca170a0fae05e44a9bd137d8\` (\`employeeAppointmentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`approval_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`approvalType\` varchar(255) NULL, INDEX \`IDX_338364927c68961167606e989c\` (\`isActive\`), INDEX \`IDX_f50ce5a39d610cfcd9da9652b1\` (\`isArchived\`), INDEX \`IDX_1462391059ebe137645098d727\` (\`tenantId\`), INDEX \`IDX_dfe3b357df3ce136917b1f0984\` (\`organizationId\`), INDEX \`IDX_45f32a5a12d42fba17fe62a279\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`availability_slot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startTime\` datetime NOT NULL, \`endTime\` datetime NOT NULL, \`allDay\` tinyint NOT NULL, \`type\` text NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_3e20b617c7d7a87b8bf53ddcbe\` (\`isActive\`), INDEX \`IDX_3aabb2cdf5b6e0df87cb94bdca\` (\`isArchived\`), INDEX \`IDX_f008a481cb4eed547704bb9d83\` (\`tenantId\`), INDEX \`IDX_d544bd3a63634a4438509ac958\` (\`organizationId\`), INDEX \`IDX_46ed3c2287423f5dc089100fee\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_criterion_rating\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`rating\` int NOT NULL, \`technologyId\` varchar(255) NULL, \`personalQualityId\` varchar(255) NULL, \`feedbackId\` varchar(255) NULL, INDEX \`IDX_0a417dafb1dd14eb92a69fa641\` (\`isActive\`), INDEX \`IDX_fcab96cef60fd8bccac610ccef\` (\`isArchived\`), INDEX \`IDX_9d5bd131452ef689df2b46551b\` (\`tenantId\`), INDEX \`IDX_b106406e94bb7317493efc2c98\` (\`organizationId\`), INDEX \`IDX_d1d16bc87d3afaf387f34cdceb\` (\`technologyId\`), INDEX \`IDX_ba4c376b2069aa82745d4e9682\` (\`personalQualityId\`), INDEX \`IDX_159f821dd214792f1d2ad9cff7\` (\`feedbackId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_document\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`documentUrl\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_bf8070715e42b3afe9730e7b30\` (\`isActive\`), INDEX \`IDX_3ed4bac12d0ca32eada4ea5a49\` (\`isArchived\`), INDEX \`IDX_4d9b7ab09f9f9517d488b5fed1\` (\`tenantId\`), INDEX \`IDX_d108a827199fda86a9ec216989\` (\`organizationId\`), INDEX \`IDX_3f9053719c9d11ebdea03e5a2d\` (\`candidateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_education\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`schoolName\` varchar(255) NOT NULL, \`degree\` varchar(255) NOT NULL, \`field\` varchar(255) NOT NULL, \`completionDate\` datetime NOT NULL, \`notes\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_336eb14606016757d2302efa4d\` (\`isActive\`), INDEX \`IDX_b443c78c3796f2e9aab05a2bb9\` (\`isArchived\`), INDEX \`IDX_00cdd9ed7571be8e2c8d09e7cd\` (\`tenantId\`), INDEX \`IDX_f660af89b2c69fea2334508cbb\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_experience\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`occupation\` varchar(255) NOT NULL, \`duration\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_dafa68d060cf401d5f62a57ad4\` (\`isActive\`), INDEX \`IDX_c24bce6dd33e56ef8e8dacef1a\` (\`isArchived\`), INDEX \`IDX_8dcf5fc8bc7f77a80b0fc648bf\` (\`tenantId\`), INDEX \`IDX_a50eb955f940ca93e044d175c6\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_feedback\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` varchar(255) NULL, \`rating\` decimal NULL, \`status\` enum ('APPLIED', 'REJECTED', 'HIRED') NULL, \`candidateId\` varchar(255) NULL, \`interviewId\` varchar(255) NULL, \`interviewerId\` varchar(255) NULL, INDEX \`IDX_c660aef2ca5aff9dbf45a9a4bb\` (\`isActive\`), INDEX \`IDX_05ed49a5ebdd5ec533f913b620\` (\`isArchived\`), INDEX \`IDX_6cb21fa0f65ff69679966c836f\` (\`tenantId\`), INDEX \`IDX_3a6928f8501fce33820721a8fe\` (\`organizationId\`), INDEX \`IDX_98c008fd8cf597e83dcdccfd16\` (\`candidateId\`), INDEX \`IDX_0862c274d336126b951bfe009a\` (\`interviewId\`), UNIQUE INDEX \`REL_44f3d80c3293e1de038c87f115\` (\`interviewerId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_interview\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`startTime\` datetime NULL, \`endTime\` datetime NULL, \`location\` varchar(255) NULL, \`note\` varchar(255) NULL, \`rating\` decimal NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_b9191cf49f8cd1f192cb74233c\` (\`isActive\`), INDEX \`IDX_7b49ce2928b327213f2de66b95\` (\`isArchived\`), INDEX \`IDX_59b765e6d13d83dba4852a43eb\` (\`tenantId\`), INDEX \`IDX_03be41e88b1fecfe4e24d6b04b\` (\`organizationId\`), INDEX \`IDX_91996439c4baafee8395d3df15\` (\`candidateId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_interviewer\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`interviewId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_b9132118c3a98c4c48e417c0c5\` (\`isActive\`), INDEX \`IDX_2043abff09f084fb8690009fb8\` (\`isArchived\`), INDEX \`IDX_f0ca69c78eea92c95d9044764a\` (\`tenantId\`), INDEX \`IDX_5f1e315db848990dfffa72817c\` (\`organizationId\`), INDEX \`IDX_ecb65075e94b47bbab11cfa5a1\` (\`interviewId\`), INDEX \`IDX_9e7b20eb3dfa082b83b198fdad\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_personal_quality\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`rating\` decimal NULL, \`interviewId\` varchar(255) NULL, INDEX \`IDX_afe01503d4337c9623c06f22df\` (\`isActive\`), INDEX \`IDX_ff6776d92db4ef71edbfba9903\` (\`isArchived\`), INDEX \`IDX_045de7c208adcd0c68c0a65174\` (\`tenantId\`), INDEX \`IDX_d321f4547ed467d07cce1e7d9a\` (\`organizationId\`), INDEX \`IDX_a0d171f45bdbcf2b990c0c37c3\` (\`interviewId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_skill\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`candidateId\` varchar(255) NULL, INDEX \`IDX_6907163d0bb8e9f0440b9bf2a7\` (\`isActive\`), INDEX \`IDX_a38fe0c3f2ff0a4e475f2a1347\` (\`isArchived\`), INDEX \`IDX_8a07f780c6fce2b82830ab0687\` (\`tenantId\`), INDEX \`IDX_d7986743e7f11720349a6c9557\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_source\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_2be9182096747fb18cb8afb1f0\` (\`isActive\`), INDEX \`IDX_509101ab1a46a5934ee278d447\` (\`isArchived\`), INDEX \`IDX_b2a1ba27a76dd819cd8294cce3\` (\`tenantId\`), INDEX \`IDX_e92027b5280828cadd7cd6ea71\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_technology\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`rating\` decimal NULL, \`interviewId\` varchar(255) NULL, INDEX \`IDX_199ca43300fa4e64239656a677\` (\`isActive\`), INDEX \`IDX_97aa0328b72e1bf919e61bccdc\` (\`isArchived\`), INDEX \`IDX_a6fecb615b07987b480defac64\` (\`tenantId\`), INDEX \`IDX_9d46b8c5382acd4d4514bc5c62\` (\`organizationId\`), INDEX \`IDX_063663c7e61e45d172d1b83265\` (\`interviewId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`rating\` decimal NULL, \`valueDate\` datetime NULL, \`appliedDate\` datetime NULL, \`hiredDate\` datetime NULL, \`status\` varchar(255) NULL DEFAULT 'APPLIED', \`rejectDate\` datetime NULL, \`candidateLevel\` varchar(500) NULL, \`reWeeklyLimit\` int NULL, \`billRateCurrency\` varchar(255) NULL, \`billRateValue\` int NULL, \`minimumBillingRate\` int NULL, \`payPeriod\` varchar(255) NULL, \`cvUrl\` varchar(255) NULL, \`contactId\` varchar(255) NULL, \`organizationPositionId\` varchar(255) NULL, \`sourceId\` varchar(255) NULL, \`userId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_2b8091376a529383e23ba3356a\` (\`isActive\`), INDEX \`IDX_af835b66fa10279103bd89e225\` (\`isArchived\`), INDEX \`IDX_77ac426e04553ff1654421bce4\` (\`tenantId\`), INDEX \`IDX_16fb27ffd1a99c6506c92ad57a\` (\`organizationId\`), INDEX \`IDX_b674793a804b7d69d74c8f6c5b\` (\`contactId\`), INDEX \`IDX_1e3e8228e7df634fa4cec6322c\` (\`organizationPositionId\`), INDEX \`IDX_4ea108fd8b089237964d5f98fb\` (\`sourceId\`), INDEX \`IDX_3930aa71e0fa24f09201811b1b\` (\`userId\`), INDEX \`IDX_8b900e8a39f76125e610ab30c0\` (\`employeeId\`), UNIQUE INDEX \`REL_b674793a804b7d69d74c8f6c5b\` (\`contactId\`), UNIQUE INDEX \`REL_4ea108fd8b089237964d5f98fb\` (\`sourceId\`), UNIQUE INDEX \`REL_3930aa71e0fa24f09201811b1b\` (\`userId\`), UNIQUE INDEX \`REL_8b900e8a39f76125e610ab30c0\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`contact\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`firstName\` varchar(255) NULL, \`lastName\` varchar(255) NULL, \`country\` varchar(255) NULL, \`city\` varchar(255) NULL, \`address\` varchar(255) NULL, \`address2\` varchar(255) NULL, \`postcode\` varchar(255) NULL, \`latitude\` decimal NULL, \`longitude\` decimal NULL, \`regionCode\` varchar(255) NULL, \`fax\` varchar(255) NULL, \`fiscalInformation\` varchar(255) NULL, \`website\` varchar(255) NULL, INDEX \`IDX_05831d37eabeb6150f99c69784\` (\`isActive\`), INDEX \`IDX_4164bd34bdcce8754641f0e567\` (\`isArchived\`), INDEX \`IDX_60468af1ce34043a900809c84f\` (\`tenantId\`), INDEX \`IDX_7719d73cd16a9f57ecc6ac24b3\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`country\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`isoCode\` varchar(255) NOT NULL, \`country\` varchar(255) NOT NULL, INDEX \`IDX_97ebcd8db30a408b5f907d6ff4\` (\`isActive\`), INDEX \`IDX_6cd9b7ea6818e862217035436c\` (\`isArchived\`), INDEX \`IDX_6eba1a52ee121d100c8a0a6510\` (\`isoCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`currency\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`isoCode\` varchar(255) NOT NULL, \`currency\` varchar(255) NOT NULL, INDEX \`IDX_03cc024ddc2f196dca7fead7cb\` (\`isActive\`), INDEX \`IDX_8203f1410475748bbbc6d3029d\` (\`isArchived\`), INDEX \`IDX_0b0fbda74f6c82c943e706a3cc\` (\`isoCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`custom_smtp\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`fromAddress\` varchar(255) NULL, \`host\` varchar(255) NOT NULL, \`port\` int NOT NULL, \`secure\` tinyint NOT NULL, \`username\` varchar(255) NOT NULL, \`password\` varchar(255) NOT NULL, \`isValidate\` tinyint NOT NULL DEFAULT 0, INDEX \`IDX_e2c7d28bb07adc915d74437c7b\` (\`isActive\`), INDEX \`IDX_f10372f9d038d0954d5b20635a\` (\`isArchived\`), INDEX \`IDX_2aa3fc8daa25beec4788d2be26\` (\`tenantId\`), INDEX \`IDX_15a1306132d66c63ef31f7288c\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`deal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`probability\` int NOT NULL, \`createdByUserId\` varchar(255) NOT NULL, \`stageId\` varchar(255) NOT NULL, \`clientId\` varchar(255) NULL, INDEX \`IDX_0d8c964237e5061627de82df80\` (\`isActive\`), INDEX \`IDX_443c561d45f6c57f3790a759ba\` (\`isArchived\`), INDEX \`IDX_46a3c00bfc3e36b4412d8bcdb0\` (\`tenantId\`), INDEX \`IDX_38fb85abdf9995efcf217f5955\` (\`organizationId\`), INDEX \`IDX_4b1ff44e6bae5065429dbab554\` (\`createdByUserId\`), INDEX \`IDX_9211f5b62988df6e95522be7da\` (\`stageId\`), UNIQUE INDEX \`REL_1ae3abc0ae1dcf6c13f49b62b5\` (\`clientId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`email_sent\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`content\` text NULL, \`email\` varchar(255) NOT NULL, \`userId\` varchar(255) NULL, \`emailTemplateId\` varchar(255) NOT NULL, \`status\` enum ('SENT', 'FAILED') NULL, INDEX \`IDX_d825bc6da1c52a3900a9373260\` (\`isActive\`), INDEX \`IDX_9a69f7077e0333d2c848895a1b\` (\`isArchived\`), INDEX \`IDX_0af511c44de7a16beb45cc3785\` (\`tenantId\`), INDEX \`IDX_525f4873c6edc3d94559f88900\` (\`organizationId\`), INDEX \`IDX_953df0eb0df3035baf140399f6\` (\`name\`), INDEX \`IDX_a954fda57cca81dc48446e73b8\` (\`email\`), INDEX \`IDX_1261c457b3035b77719556995b\` (\`userId\`), INDEX \`IDX_9033faf41b23c61ba201c48796\` (\`emailTemplateId\`), INDEX \`IDX_5956ce758c01ebf8a539e8d4f0\` (\`status\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`email_reset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`oldEmail\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`token\` varchar(255) NULL, \`expiredAt\` datetime NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_e3321e3575289b7ee1e8eb1042\` (\`isActive\`), INDEX \`IDX_13247a755d17e7905d5bb4cfda\` (\`isArchived\`), INDEX \`IDX_93799dfaeff51de06f1e02ac41\` (\`tenantId\`), INDEX \`IDX_03d16a2fd43d7c601743440212\` (\`email\`), INDEX \`IDX_4be518a169bbcbfe92025ac574\` (\`oldEmail\`), INDEX \`IDX_9e80c9ec749dfda6dbe2cd9704\` (\`code\`), INDEX \`IDX_4ac734f2a1a3c055dca04fba99\` (\`token\`), INDEX \`IDX_e37af4ab2ba0bf268bfd982634\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`email_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`mjml\` text NULL, \`hbs\` longtext NOT NULL, INDEX \`IDX_e4932e0a726b9b07d81d8b6905\` (\`isActive\`), INDEX \`IDX_29d60114e1968c0cd68a19e3c5\` (\`isArchived\`), INDEX \`IDX_753e005a45556b5909e11937aa\` (\`tenantId\`), INDEX \`IDX_c160fe6234675fac031aa3e7c5\` (\`organizationId\`), INDEX \`IDX_274708db64fcce5448f2c4541c\` (\`name\`), INDEX \`IDX_7e688e6613930ba721b841db43\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_appointment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`agenda\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`location\` varchar(255) NULL, \`startDateTime\` datetime NOT NULL, \`endDateTime\` datetime NOT NULL, \`bufferTimeStart\` tinyint NULL, \`bufferTimeEnd\` tinyint NULL, \`bufferTimeInMins\` int NULL, \`breakTimeInMins\` int NULL, \`breakStartTime\` datetime NULL, \`emails\` varchar(255) NULL, \`status\` varchar(255) NULL, INDEX \`IDX_d0219ada2359ede9e7b0d511ba\` (\`isActive\`), INDEX \`IDX_64c83df9d37d9ada96edb66557\` (\`isArchived\`), INDEX \`IDX_a35637bb659c59e18adb4f38f8\` (\`tenantId\`), INDEX \`IDX_86cf36c137712e779dd7e2301e\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_award\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`year\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_c07390f325c847be7df93d0d17\` (\`isActive\`), INDEX \`IDX_8fb47e8bfd26340ddaeabd24e5\` (\`isArchived\`), INDEX \`IDX_91e0f7efcd17d20b5029fb1342\` (\`tenantId\`), INDEX \`IDX_caf8363b0ed7d5f24ae866ba3b\` (\`organizationId\`), INDEX \`IDX_6912685bbb0e303eab392978d9\` (\`name\`), INDEX \`IDX_0c5266f3f488add404f92d56ec\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_upwork_job_search_criterion\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPresetId\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`occupationId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`keyword\` varchar(255) NULL, \`jobType\` text NULL, INDEX \`IDX_6bae61744663a416e73903d9af\` (\`isActive\`), INDEX \`IDX_0e130a25bb4abe1b27c8a0adf4\` (\`isArchived\`), INDEX \`IDX_afe6c40d3d9951388fa05f83f2\` (\`tenantId\`), INDEX \`IDX_630337302efe97cc93deeb2151\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`job_preset_upwork_job_search_criterion\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPresetId\` varchar(255) NOT NULL, \`occupationId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`keyword\` varchar(255) NULL, \`jobType\` text NULL, INDEX \`IDX_af850e1fa48af82d66e9bf81c7\` (\`isActive\`), INDEX \`IDX_4070b6f3480e9c4b2dcf3f7b56\` (\`isArchived\`), INDEX \`IDX_2323220b4decfd2f4d8307fd78\` (\`tenantId\`), INDEX \`IDX_d5ca48cfacfb516543d6507ca4\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`job_preset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_46226c3185e3ca3d7033831d7a\` (\`isActive\`), INDEX \`IDX_e210f70c3904cf84ab5113be8f\` (\`isArchived\`), INDEX \`IDX_7e53ea80aca15da11a8a5ec038\` (\`tenantId\`), INDEX \`IDX_a4b038417e3221c0791dd8c771\` (\`organizationId\`), INDEX \`IDX_f2c1b6770dd2a3abfa35f49411\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`job_search_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`jobSourceCategoryId\` varchar(255) NULL, \`jobSource\` enum ('upwork', 'web', 'linkedin') NOT NULL DEFAULT 'upwork', INDEX \`IDX_36333846c37e5f8812a5c9f7ff\` (\`isActive\`), INDEX \`IDX_015231c6e28cfb2b789ca4b76f\` (\`isArchived\`), INDEX \`IDX_35e120f2b6e5188391cf068d3b\` (\`tenantId\`), INDEX \`IDX_86381fb6d28978b101b3aec8ca\` (\`organizationId\`), INDEX \`IDX_3b335bbcbf7d5e00853acaa165\` (\`name\`), INDEX \`IDX_d0a798419c775b9157bf0269f4\` (\`jobSourceCategoryId\`), INDEX \`IDX_6ee5218c869b57197e4a209bed\` (\`jobSource\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`job_search_occupation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`jobSourceOccupationId\` varchar(255) NULL, \`jobSource\` enum ('upwork', 'web', 'linkedin') NOT NULL DEFAULT 'upwork', INDEX \`IDX_4b8450a24233df8b47ca472923\` (\`isActive\`), INDEX \`IDX_e4bc75a1cbb07d117a0acfcdba\` (\`isArchived\`), INDEX \`IDX_44e22d88b47daf2095491b7cac\` (\`tenantId\`), INDEX \`IDX_1a62a99e1016e4a2b461e886ec\` (\`organizationId\`), INDEX \`IDX_9f1288205ae91f91cf356cac2f\` (\`name\`), INDEX \`IDX_cb64573b18dd7b23f591f15502\` (\`jobSourceOccupationId\`), INDEX \`IDX_c8723c90a6f007f8d7e882a04f\` (\`jobSource\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_level\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`level\` varchar(255) NOT NULL, INDEX \`IDX_90bd442869709bae9d1b18e489\` (\`isActive\`), INDEX \`IDX_88a58d149404145ed7b3385387\` (\`isArchived\`), INDEX \`IDX_d3fc52d497bc44d6f493dbedc3\` (\`tenantId\`), INDEX \`IDX_c4668533292bf4526e61aedf74\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_phone\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`type\` varchar(255) NULL, \`phoneNumber\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_587d11ffbd87adb6dff367f3cd\` (\`isActive\`), INDEX \`IDX_aa98ea786d490db300d3dbbdb6\` (\`isArchived\`), INDEX \`IDX_d543336994b1f764c449e0b1d3\` (\`tenantId\`), INDEX \`IDX_0f9cefa604913e1ab322591546\` (\`organizationId\`), INDEX \`IDX_ba7b2ef5a9cd165a1e4e2ad0ef\` (\`phoneNumber\`), INDEX \`IDX_329ebd01a757d1a0c3c4d628e2\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_proposal_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`content\` text NULL, \`isDefault\` tinyint NOT NULL DEFAULT 0, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_2bb17670e2bea3980ff960bbcf\` (\`isActive\`), INDEX \`IDX_e396663e1a31114eac39087829\` (\`isArchived\`), INDEX \`IDX_f577c9bc6183c1d1eae1e154bb\` (\`tenantId\`), INDEX \`IDX_ee780fbd8f91de31c004929eec\` (\`organizationId\`), INDEX \`IDX_dc2ff85f7de16dea6453a833dd\` (\`name\`), FULLTEXT INDEX \`IDX_0111963c9cb4dd14565c0d9c84\` (\`content\`), INDEX \`IDX_a13f3564eae9db44ddc4308afc\` (\`isDefault\`), INDEX \`IDX_2be728a7f8b118712a4200990d\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_recurring_expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startDay\` int NOT NULL, \`startMonth\` int NOT NULL, \`startYear\` int NOT NULL, \`startDate\` datetime NOT NULL, \`endDay\` int NULL, \`endMonth\` int NULL, \`endYear\` int NULL, \`endDate\` datetime NULL, \`categoryName\` varchar(255) NOT NULL, \`value\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`parentRecurringExpenseId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_25f8915182128f377d84b60d26\` (\`isActive\`), INDEX \`IDX_3980b0fe1e757b092ea5323656\` (\`isArchived\`), INDEX \`IDX_5fde7be40b3c03bc0fdac0c2f6\` (\`tenantId\`), INDEX \`IDX_3ee5147bb1fde625fa33c0e956\` (\`organizationId\`), INDEX \`IDX_a4b5a2ea2afecf1ee254f1a704\` (\`categoryName\`), INDEX \`IDX_739f8cdce21cc72d400559ce00\` (\`currency\`), INDEX \`IDX_6e570174fda71e97616e9d2eea\` (\`parentRecurringExpenseId\`), INDEX \`IDX_0ac8526c48a3daa267c86225fb\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`month\` int NOT NULL, \`year\` int NOT NULL, \`settingType\` varchar(255) NOT NULL, \`value\` int NOT NULL, \`currency\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_48fae30026b4e166a3445fee6d\` (\`isActive\`), INDEX \`IDX_01237d04f882cf1ea794678e8d\` (\`isArchived\`), INDEX \`IDX_9516a627a131626d2a5738a05a\` (\`tenantId\`), INDEX \`IDX_56e96cd218a185ed59b5a8e786\` (\`organizationId\`), INDEX \`IDX_9537fae454ebebc98ee5adb3a2\` (\`settingType\`), INDEX \`IDX_710c71526edb89b2a7033abcdf\` (\`currency\`), INDEX \`IDX_95ea18af6ef8123503d332240c\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`valueDate\` datetime NULL, \`short_description\` varchar(200) NULL, \`description\` varchar(255) NULL, \`startedWorkOn\` datetime NULL, \`endWork\` datetime NULL, \`payPeriod\` varchar(255) NULL, \`billRateValue\` int NULL, \`minimumBillingRate\` int NULL, \`billRateCurrency\` varchar(255) NULL, \`reWeeklyLimit\` int NULL, \`offerDate\` datetime NULL, \`acceptDate\` datetime NULL, \`rejectDate\` datetime NULL, \`employeeLevel\` varchar(500) NULL, \`anonymousBonus\` tinyint NULL, \`averageIncome\` decimal NULL, \`averageBonus\` decimal NULL, \`totalWorkHours\` decimal NULL DEFAULT '0', \`averageExpenses\` decimal NULL, \`show_anonymous_bonus\` tinyint NULL, \`show_average_bonus\` tinyint NULL, \`show_average_expenses\` tinyint NULL, \`show_average_income\` tinyint NULL, \`show_billrate\` tinyint NULL, \`show_payperiod\` tinyint NULL, \`show_start_work_on\` tinyint NULL, \`isJobSearchActive\` tinyint NULL, \`linkedInUrl\` varchar(255) NULL, \`facebookUrl\` varchar(255) NULL, \`instagramUrl\` varchar(255) NULL, \`twitterUrl\` varchar(255) NULL, \`githubUrl\` varchar(255) NULL, \`gitlabUrl\` varchar(255) NULL, \`upworkUrl\` varchar(255) NULL, \`stackoverflowUrl\` varchar(255) NULL, \`isVerified\` tinyint NULL, \`isVetted\` tinyint NULL, \`totalJobs\` decimal NULL, \`jobSuccess\` decimal NULL, \`profile_link\` varchar(255) NULL, \`isTrackingEnabled\` tinyint NULL DEFAULT 0, \`isOnline\` tinyint NULL DEFAULT 0, \`isAway\` tinyint NULL DEFAULT 0, \`isTrackingTime\` tinyint NULL DEFAULT 0, \`allowScreenshotCapture\` tinyint NOT NULL DEFAULT 1, \`upworkId\` varchar(255) NULL, \`linkedInId\` varchar(255) NULL, \`userId\` varchar(255) NOT NULL, \`contactId\` varchar(255) NULL, \`organizationPositionId\` varchar(255) NULL, INDEX \`IDX_510cb87f5da169e57e694d1a5c\` (\`isActive\`), INDEX \`IDX_175b7be641928a31521224daa8\` (\`isArchived\`), INDEX \`IDX_4b3303a6b7eb92d237a4379734\` (\`tenantId\`), INDEX \`IDX_c6a48286f3aa8ae903bee0d1e7\` (\`organizationId\`), INDEX \`IDX_96dfbcaa2990df01fe5bb39ccc\` (\`profile_link\`), INDEX \`IDX_f4b0d329c4a3cf79ffe9d56504\` (\`userId\`), INDEX \`IDX_1c0c1370ecd98040259625e17e\` (\`contactId\`), INDEX \`IDX_5e719204dcafa8d6b2ecdeda13\` (\`organizationPositionId\`), UNIQUE INDEX \`REL_f4b0d329c4a3cf79ffe9d56504\` (\`userId\`), UNIQUE INDEX \`REL_1c0c1370ecd98040259625e17e\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`equipment_sharing_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, INDEX \`IDX_0f3ee47a5fb7192d5eb00c71ae\` (\`isActive\`), INDEX \`IDX_b0fc293cf47f31ba512fd29bf0\` (\`isArchived\`), INDEX \`IDX_5443ca8ed830626656d8cfecef\` (\`tenantId\`), INDEX \`IDX_5311a833ff255881454bd5b3b5\` (\`organizationId\`), INDEX \`IDX_04c9e514ed70897f6ad8cadc3c\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`equipment_sharing\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`shareRequestDay\` datetime NULL, \`shareStartDay\` datetime NULL, \`shareEndDay\` datetime NULL, \`status\` int NOT NULL, \`createdBy\` varchar(255) NULL, \`createdByName\` varchar(255) NULL, \`equipmentId\` varchar(255) NULL, \`equipmentSharingPolicyId\` varchar(255) NULL, INDEX \`IDX_70ff31cefa0f578f6fa82d2bcc\` (\`isActive\`), INDEX \`IDX_a734598f5637cf1501288331e3\` (\`isArchived\`), INDEX \`IDX_fa525e61fb3d8d9efec0f364a4\` (\`tenantId\`), INDEX \`IDX_ea9254be07ae4a8604f0aaab19\` (\`organizationId\`), INDEX \`IDX_acad51a6362806fc499e583e40\` (\`equipmentId\`), INDEX \`IDX_0ecfe0ce0cd2b197249d5f1c10\` (\`equipmentSharingPolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`equipment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`serialNumber\` varchar(255) NOT NULL, \`manufacturedYear\` decimal NULL, \`initialCost\` decimal NULL, \`currency\` varchar(255) NOT NULL, \`maxSharePeriod\` decimal NULL, \`autoApproveShare\` tinyint NOT NULL, \`imageId\` varchar(36) NULL, INDEX \`IDX_39e1b443404ea7fa42b3d36ccb\` (\`isActive\`), INDEX \`IDX_d8452bfe9f18ced4ce76c4b70b\` (\`isArchived\`), INDEX \`IDX_fb6808468066849ab7b7454d5f\` (\`tenantId\`), INDEX \`IDX_f98ce0d210aa9f91b729d44780\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`estimate_email\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`token\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`expireDate\` datetime NOT NULL, \`convertAcceptedEstimates\` tinyint NULL, INDEX \`IDX_1a4bd2a8034bb1309b4ea87882\` (\`isActive\`), INDEX \`IDX_f1fac79e17c475f00daa4db3d2\` (\`isArchived\`), INDEX \`IDX_391d3f83244fea73c619aecadd\` (\`tenantId\`), INDEX \`IDX_233c1d351d63441aeb039d1164\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`event_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` decimal NOT NULL, \`durationUnit\` varchar(255) NULL, \`title\` varchar(255) NULL, \`description\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, INDEX \`IDX_f14eee32875b112fab1139b332\` (\`isActive\`), INDEX \`IDX_613cfa5783e164cad10dc27e58\` (\`isArchived\`), INDEX \`IDX_92fc62260c0c7ff108622850bf\` (\`tenantId\`), INDEX \`IDX_fc8818d6fde74370ec703a0135\` (\`organizationId\`), INDEX \`IDX_4b02d8616129f39fca2b10e98b\` (\`duration\`), INDEX \`IDX_9d5980ff1064e2edb77509d312\` (\`durationUnit\`), INDEX \`IDX_43459c650957e478203c738574\` (\`title\`), INDEX \`IDX_5bde7aeb2c7fb3a421b175871e\` (\`description\`), INDEX \`IDX_24d905ec9e127ade23754a363d\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`expense_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_8376e41fd82aba147a433dc097\` (\`isActive\`), INDEX \`IDX_e9cef5d359dfa48ee5d0cd5fcc\` (\`isArchived\`), INDEX \`IDX_37504e920ee5ca46a4000b89da\` (\`tenantId\`), INDEX \`IDX_9c9bfe5baaf83f53533ff035fc\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`amount\` decimal NOT NULL, \`typeOfExpense\` varchar(255) NULL, \`notes\` varchar(255) NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`purpose\` varchar(255) NULL, \`taxType\` varchar(255) NULL, \`taxLabel\` varchar(255) NULL, \`rateValue\` decimal NULL, \`receipt\` varchar(255) NULL, \`splitExpense\` tinyint NULL, \`reference\` varchar(255) NULL, \`status\` enum ('INVOICED', 'UNINVOICED', 'PAID', 'NOT_BILLABLE') NULL, \`employeeId\` varchar(255) NULL, \`vendorId\` varchar(255) NULL, \`categoryId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_1aa0e5fd480214ae4851471e3c\` (\`isActive\`), INDEX \`IDX_d77aeb93f2439ebdf4babaab4c\` (\`isArchived\`), INDEX \`IDX_6d171c9d5f81095436b99da5e6\` (\`tenantId\`), INDEX \`IDX_c5fb146726ff128e600f23d0a1\` (\`organizationId\`), INDEX \`IDX_846a933af451a33b95b7b198c6\` (\`amount\`), INDEX \`IDX_b5bb8f62d401475fcc8c2ba35e\` (\`typeOfExpense\`), INDEX \`IDX_3826d6ca74a08a8498fa17d330\` (\`notes\`), INDEX \`IDX_89508d119b1a279c037d9da151\` (\`currency\`), INDEX \`IDX_cbfebdb1419f9b8036a8b0546e\` (\`purpose\`), INDEX \`IDX_dd8ab9312fb8d787982b9feebf\` (\`taxType\`), INDEX \`IDX_0006d3025b6c92fbd4089b9465\` (\`taxLabel\`), INDEX \`IDX_97ed0e2b80f2e7ec260fd81cd9\` (\`rateValue\`), INDEX \`IDX_5f57d077c28b378a6c885e81c5\` (\`receipt\`), INDEX \`IDX_5e7b197dbac69012dbdb4964f3\` (\`employeeId\`), INDEX \`IDX_eacb116ab0521ad9b96f2bb53b\` (\`vendorId\`), INDEX \`IDX_42eea5debc63f4d1bf89881c10\` (\`categoryId\`), INDEX \`IDX_9971c4171ae051e74b833984a3\` (\`projectId\`), INDEX \`IDX_047b8b5c0782d5a6d4c8bfc1a4\` (\`organizationContactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`import-history\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`file\` varchar(255) NOT NULL, \`path\` varchar(255) NOT NULL, \`size\` int NULL, \`status\` varchar(255) NOT NULL, \`importDate\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX \`IDX_e339340014a6c4e2f57be00b0c\` (\`isActive\`), INDEX \`IDX_d6a626bee6cddf4bc53a493bc3\` (\`isArchived\`), INDEX \`IDX_54868607115e2fee3b0b764eec\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`import-record\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`entityType\` varchar(255) NOT NULL, \`sourceId\` varchar(255) NOT NULL, \`destinationId\` varchar(255) NOT NULL, \`importDate\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX \`IDX_b90957ef81e74c43d6ae037560\` (\`isActive\`), INDEX \`IDX_339328a7247aa09d061c642ae1\` (\`isArchived\`), INDEX \`IDX_a43b235c35c2c4d3263ada770c\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`feature_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isEnabled\` tinyint NOT NULL DEFAULT 1, \`featureId\` varchar(255) NOT NULL, INDEX \`IDX_4ee685760ddb60ff71f763d8f6\` (\`isActive\`), INDEX \`IDX_e4c142f37091b47056012d34ba\` (\`isArchived\`), INDEX \`IDX_8f71803d96dcdbcc6b19bb28d3\` (\`tenantId\`), INDEX \`IDX_6a94e6b0a572f591288ac44a42\` (\`organizationId\`), INDEX \`IDX_6d413f9fdd5366b1b9add46483\` (\`featureId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`feature\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`isPaid\` tinyint NOT NULL DEFAULT 0, \`description\` varchar(255) NULL, \`image\` varchar(255) NULL, \`link\` varchar(255) NOT NULL, \`status\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`parentId\` varchar(255) NULL, INDEX \`IDX_5405b67f1df904831a358df7c4\` (\`isActive\`), INDEX \`IDX_a26cc341268d22bd55f06e3ef6\` (\`isArchived\`), INDEX \`IDX_4832be692a2dc63d67e8e93c75\` (\`name\`), INDEX \`IDX_c30465b5a6e0fae1c8ee7e3120\` (\`code\`), INDEX \`IDX_d4a28a8e70d450a412bf0cfb52\` (\`parentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal_general_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`maxObjectives\` int NOT NULL, \`maxKeyResults\` int NOT NULL, \`employeeCanCreateObjective\` tinyint NOT NULL, \`canOwnObjectives\` varchar(255) NOT NULL, \`canOwnKeyResult\` varchar(255) NOT NULL, \`krTypeKPI\` tinyint NOT NULL, \`krTypeTask\` tinyint NOT NULL, INDEX \`IDX_bdee8704ebeb79368ff6154fc7\` (\`isActive\`), INDEX \`IDX_4a44905db4ca1e40b62021fdfb\` (\`isArchived\`), INDEX \`IDX_d17a5159d888ac6320459eda39\` (\`tenantId\`), INDEX \`IDX_e35d0f7b794ca8850669d12c78\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal_kpi_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`operator\` varchar(255) NOT NULL, \`currentValue\` int NOT NULL, \`targetValue\` int NOT NULL, \`leadId\` varchar(36) NULL, INDEX \`IDX_b4f4701ddb0e973602445ed1c6\` (\`isActive\`), INDEX \`IDX_26311c417ba945c901c65d515d\` (\`isArchived\`), INDEX \`IDX_cc72d4e8e4284dcc8ffbf96caf\` (\`tenantId\`), INDEX \`IDX_df7ab026698c02859ff7540809\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal_kpi\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`operator\` varchar(255) NOT NULL, \`currentValue\` int NOT NULL, \`targetValue\` int NOT NULL, \`leadId\` varchar(255) NULL, INDEX \`IDX_cfc393bd9835d8259e73019226\` (\`isActive\`), INDEX \`IDX_a96c22c51607f878c8a98bc488\` (\`isArchived\`), INDEX \`IDX_43aa2985216560cd9fa93f501e\` (\`tenantId\`), INDEX \`IDX_e49e37fe88a2725a38a3b05849\` (\`organizationId\`), INDEX \`IDX_d4f093ca4eb7c40db68d9a789d\` (\`leadId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, \`category\` varchar(255) NOT NULL, INDEX \`IDX_cd91c5925942061527b1bc112c\` (\`isActive\`), INDEX \`IDX_056e869152a335f88c38c5b693\` (\`isArchived\`), INDEX \`IDX_774bf82989475befe301fe1bca\` (\`tenantId\`), INDEX \`IDX_5708fe06608c72fc77b65ae651\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal_time_frame\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`startDate\` datetime NOT NULL, \`endDate\` datetime NOT NULL, INDEX \`IDX_646565982726362cc2ca4fb807\` (\`isActive\`), INDEX \`IDX_ef4ec26ca3a7e0d8c9e1748be2\` (\`isArchived\`), INDEX \`IDX_b56723b53a76ca1c171890c479\` (\`tenantId\`), INDEX \`IDX_405bc5bba9ed71aefef84a29f1\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`goal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NOT NULL, \`deadline\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, \`progress\` int NOT NULL, \`ownerTeamId\` varchar(255) NULL, \`ownerEmployeeId\` varchar(255) NULL, \`leadId\` varchar(255) NULL, \`alignedKeyResultId\` varchar(255) NULL, INDEX \`IDX_72641ffde44e1a1627aa2d040f\` (\`isActive\`), INDEX \`IDX_4a2c00a44350a063d75be80ba9\` (\`isArchived\`), INDEX \`IDX_6b4758a5442713070c9a366d0e\` (\`tenantId\`), INDEX \`IDX_c6e8ae55a4db3584686cbf6afe\` (\`organizationId\`), INDEX \`IDX_ac161c1a0c0ff8e83554f097e5\` (\`ownerTeamId\`), INDEX \`IDX_35526ff1063ab5fa2b20e71bd6\` (\`ownerEmployeeId\`), INDEX \`IDX_af0a11734e70412b742ac339c8\` (\`leadId\`), INDEX \`IDX_4c8b4e887a994182fd6132e640\` (\`alignedKeyResultId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`image_asset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NULL, \`url\` varchar(255) NOT NULL, \`thumb\` varchar(255) NULL, \`width\` int NOT NULL DEFAULT '0', \`height\` int NOT NULL DEFAULT '0', \`size\` decimal NULL, \`isFeatured\` tinyint NOT NULL DEFAULT 0, \`externalProviderId\` varchar(255) NULL, \`storageProvider\` enum ('LOCAL', 'S3', 'WASABI', 'CLOUDINARY') NULL, INDEX \`IDX_9d44ce9eb8689e578b941a6a54\` (\`isActive\`), INDEX \`IDX_af1a212cb378bb0eed51c1b2bc\` (\`isArchived\`), INDEX \`IDX_01856a9a730b7e79d70aa661cb\` (\`tenantId\`), INDEX \`IDX_d3675304df9971cccf96d9a7c3\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`income\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`amount\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`notes\` varchar(255) NULL, \`isBonus\` tinyint NULL, \`reference\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`clientId\` varchar(255) NULL, INDEX \`IDX_904ab9ee6ac5e74bf3616c8ccb\` (\`isActive\`), INDEX \`IDX_aedb8b1d10c498309bed9edf53\` (\`isArchived\`), INDEX \`IDX_8608b275644cfc7a0f3f585081\` (\`tenantId\`), INDEX \`IDX_64409de4711cd14e2c43371cc0\` (\`organizationId\`), INDEX \`IDX_bd39a647a2843177723ddf733e\` (\`amount\`), INDEX \`IDX_86b5a121b3775a1b0b7fa75680\` (\`currency\`), INDEX \`IDX_20207d9f915066dfbc2210bcf1\` (\`notes\`), INDEX \`IDX_a05d52b7ffe89140f9cbcf114b\` (\`employeeId\`), INDEX \`IDX_29fbd3a17710a27e6f856072c0\` (\`clientId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_entity_setting_tied\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sync\` tinyint NOT NULL, \`integrationEntitySettingId\` varchar(255) NULL, INDEX \`IDX_6d43cc33c80221dbe4854b38e6\` (\`isActive\`), INDEX \`IDX_101cd83aa75949cfb5b8eec084\` (\`isArchived\`), INDEX \`IDX_b208a754c7a538cb3422f39f5b\` (\`tenantId\`), INDEX \`IDX_d5ac36aa3d5919908414154fca\` (\`organizationId\`), INDEX \`IDX_3fb863167095805e33f38a0fdc\` (\`integrationEntitySettingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_entity_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sync\` tinyint NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_e3d407c5532edaceaa4df34623\` (\`isActive\`), INDEX \`IDX_1c653ebceca3b9c8766131db91\` (\`isArchived\`), INDEX \`IDX_23e9cfcf1bfff07dcc3254378d\` (\`tenantId\`), INDEX \`IDX_c6c01e38eebd8b26b9214b9044\` (\`organizationId\`), INDEX \`IDX_f80ff4ebbf0b33a67dce598911\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_map\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`entity\` varchar(255) NOT NULL, \`sourceId\` varchar(255) NOT NULL, \`gauzyId\` varchar(255) NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_c79464c4ccf7e5195d69675c15\` (\`isActive\`), INDEX \`IDX_e63f4791631e7572ca213ac4a4\` (\`isArchived\`), INDEX \`IDX_eec3d6064578610ddc609dd360\` (\`tenantId\`), INDEX \`IDX_7022dafd72c1b92f7d50691441\` (\`organizationId\`), INDEX \`IDX_c327ea26bda3d349a1eceb5658\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`settingsName\` varchar(255) NOT NULL, \`settingsValue\` varchar(255) NOT NULL, \`integrationId\` varchar(255) NOT NULL, INDEX \`IDX_97c0d54aae21ccdbb5c3581642\` (\`isActive\`), INDEX \`IDX_f515574f1251562c52fe25b6a3\` (\`isArchived\`), INDEX \`IDX_954c6b05297814776d9cb66ca7\` (\`tenantId\`), INDEX \`IDX_369eaafb13afe9903a170077ed\` (\`organizationId\`), INDEX \`IDX_34daf030004ad37b88f1f3d863\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_tenant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`lastSyncedAt\` datetime NULL DEFAULT CURRENT_TIMESTAMP, \`integrationId\` varchar(255) NULL, INDEX \`IDX_c5ff5d3ab364b7da72bf3fbb46\` (\`isActive\`), INDEX \`IDX_5487f9197c106d774bae20991c\` (\`isArchived\`), INDEX \`IDX_24e37d03ef224f1a16a35069c2\` (\`tenantId\`), INDEX \`IDX_33ab224e7755a46fff5bc1e64e\` (\`organizationId\`), INDEX \`IDX_d0532ed8020981736b58748de6\` (\`lastSyncedAt\`), INDEX \`IDX_0d6ddc27d687ca879042c5f3ce\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_github_repository\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`repositoryId\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`fullName\` varchar(255) NOT NULL, \`owner\` varchar(255) NOT NULL, \`issuesCount\` int NULL, \`hasSyncEnabled\` tinyint NULL DEFAULT 1, \`private\` tinyint NULL DEFAULT 0, \`status\` varchar(255) NULL, \`integrationId\` varchar(255) NULL, INDEX \`IDX_5e97728cfda96f49cc7f95bbaf\` (\`isActive\`), INDEX \`IDX_ef65338e8597b9f56fd0fe3c94\` (\`isArchived\`), INDEX \`IDX_480158f21938444e4f62fb3185\` (\`tenantId\`), INDEX \`IDX_69d75a47af6bfcda545a865691\` (\`organizationId\`), INDEX \`IDX_ca0fa80f50baed7287a499dc2c\` (\`repositoryId\`), INDEX \`IDX_6eea42a69e130bbd14b7ea3659\` (\`name\`), INDEX \`IDX_a146e202c19f521bf5ec69bb26\` (\`fullName\`), INDEX \`IDX_9e8a77c1d330554fab9230100a\` (\`owner\`), INDEX \`IDX_04717f25bea7d9cef0d51cac50\` (\`issuesCount\`), INDEX \`IDX_34c48d11eb82ef42e89370bdc7\` (\`hasSyncEnabled\`), INDEX \`IDX_2eec784cadcb7847b64937fb58\` (\`private\`), INDEX \`IDX_59407d03d189560ac1a0a4b0eb\` (\`status\`), INDEX \`IDX_add7dbec156589dd0b27e2e0c4\` (\`integrationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_github_repository_issue\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`issueId\` int NOT NULL, \`issueNumber\` int NOT NULL, \`repositoryId\` varchar(255) NULL, INDEX \`IDX_d706210d377ece2a1bc3386388\` (\`isActive\`), INDEX \`IDX_c774c276d6b7ea05a7e12d3c81\` (\`isArchived\`), INDEX \`IDX_b3234be5b70c2362cdf67bb188\` (\`tenantId\`), INDEX \`IDX_6c8e119fc6a2a7d3413aa76d3b\` (\`organizationId\`), INDEX \`IDX_055f310a04a928343494a5255a\` (\`issueId\`), INDEX \`IDX_a8709a9c5cc142c6fbe92df274\` (\`issueNumber\`), INDEX \`IDX_5065401113abb6e9608225e567\` (\`repositoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`groupName\` varchar(255) NOT NULL, \`order\` int NOT NULL, INDEX \`IDX_34a49d941459e1031c766b941f\` (\`isActive\`), INDEX \`IDX_e7b65ef60492b1c34007736f99\` (\`isArchived\`), UNIQUE INDEX \`IDX_83443d669822bbbf2bd0ebdacd\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`provider\` varchar(255) NULL, \`redirectUrl\` varchar(255) NULL, \`imgSrc\` varchar(255) NULL, \`isComingSoon\` tinyint NOT NULL DEFAULT 0, \`isPaid\` tinyint NOT NULL DEFAULT 0, \`version\` varchar(255) NULL, \`docUrl\` varchar(255) NULL, \`isFreeTrial\` tinyint NOT NULL DEFAULT 0, \`freeTrialPeriod\` decimal NULL DEFAULT '0', \`order\` int NULL, INDEX \`IDX_24981cd300007cf88601c2d616\` (\`isActive\`), INDEX \`IDX_85d7b0f07f3e3707b4586670a9\` (\`isArchived\`), UNIQUE INDEX \`IDX_52d7fa32a7832b377fc2d7f619\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invite\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`token\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`expireDate\` datetime NULL, \`actionDate\` datetime NULL, \`code\` varchar(255) NULL, \`fullName\` varchar(255) NULL, \`invitedById\` varchar(255) NULL, \`roleId\` varchar(255) NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_bd44bcb10034bc0c5fe4427b3e\` (\`isActive\`), INDEX \`IDX_3cef860504647ccd52d39d7dc2\` (\`isArchived\`), INDEX \`IDX_7c2328f76efb850b8114797247\` (\`tenantId\`), INDEX \`IDX_68eef4ab86b67747f24f288a16\` (\`organizationId\`), INDEX \`IDX_5a182e8b3e225b14ddf6df7e6c\` (\`invitedById\`), INDEX \`IDX_900a3ed40499c79c1c289fec28\` (\`roleId\`), INDEX \`IDX_91bfeec7a9574f458e5b592472\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invoice_estimate_history\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`action\` varchar(255) NOT NULL, \`title\` varchar(255) NULL, \`userId\` varchar(255) NULL, \`invoiceId\` varchar(255) NOT NULL, INDEX \`IDX_483eb296a94d821ebedb375858\` (\`isActive\`), INDEX \`IDX_8106063f79cce8e67790d79092\` (\`isArchived\`), INDEX \`IDX_cc0ac824ba89deda98bb418e8c\` (\`tenantId\`), INDEX \`IDX_856f24297f120604f8ae294276\` (\`organizationId\`), INDEX \`IDX_da2893697d57368470952a76f6\` (\`userId\`), INDEX \`IDX_31ec3d5a6b0985cec544c64217\` (\`invoiceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invoice_item\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` varchar(255) NULL, \`price\` decimal NOT NULL, \`quantity\` decimal NOT NULL, \`totalValue\` decimal NOT NULL, \`applyTax\` tinyint NULL, \`applyDiscount\` tinyint NULL, \`expenseId\` varchar(255) NULL, \`invoiceId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`employeeId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`productId\` varchar(255) NULL, INDEX \`IDX_e2835fd8776ae5d56d892e087e\` (\`isActive\`), INDEX \`IDX_b7da14d2b61cf1dd5c65188b9c\` (\`isArchived\`), INDEX \`IDX_f78214cd9de76e80fe8a6305f5\` (\`tenantId\`), INDEX \`IDX_e89749c8e8258b2ec110c0776f\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invoice\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`invoiceDate\` datetime NULL, \`invoiceNumber\` bigint NULL, \`dueDate\` datetime NULL, \`currency\` varchar(255) NOT NULL, \`discountValue\` decimal NOT NULL, \`paid\` tinyint NULL, \`tax\` decimal NULL, \`tax2\` decimal NULL, \`terms\` varchar(255) NOT NULL, \`totalValue\` decimal NULL, \`status\` varchar(255) NOT NULL, \`isEstimate\` tinyint NULL, \`isAccepted\` tinyint NULL, \`discountType\` varchar(255) NULL, \`taxType\` varchar(255) NULL, \`tax2Type\` varchar(255) NULL, \`invoiceType\` varchar(255) NULL, \`sentTo\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`internalNote\` varchar(255) NULL, \`alreadyPaid\` decimal NULL, \`amountDue\` decimal NULL, \`hasRemainingAmountInvoiced\` tinyint NULL, \`token\` text NULL, \`fromOrganizationId\` varchar(255) NOT NULL, \`toContactId\` varchar(255) NULL, INDEX \`IDX_850ca385c1985c1808cd4ea241\` (\`isActive\`), INDEX \`IDX_eabacf7474d75e53d7b7046f3e\` (\`isArchived\`), INDEX \`IDX_7fb52a5f267f53b7d93af3d8c3\` (\`tenantId\`), INDEX \`IDX_058ef835f99e28fc6717cd7c80\` (\`organizationId\`), INDEX \`IDX_b5c33892e630b66c65d623baf8\` (\`fromOrganizationId\`), INDEX \`IDX_d9e965da0f63c94983d3a1006a\` (\`toContactId\`), UNIQUE INDEX \`IDX_d7bed97fb47876e03fd7d7c285\` (\`invoiceNumber\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`key_result_template\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`unit\` varchar(255) NULL, \`targetValue\` int NULL, \`initialValue\` int NULL, \`deadline\` varchar(255) NOT NULL, \`kpiId\` varchar(255) NULL, \`goalId\` varchar(255) NULL, INDEX \`IDX_f4e813d72dc732f16497ee2c52\` (\`isActive\`), INDEX \`IDX_aa0e9b0cfcba1926925b025512\` (\`isArchived\`), INDEX \`IDX_86c09eb673b0e66129dbdc7211\` (\`tenantId\`), INDEX \`IDX_fab6b6200b9ed6fd002c1ff62a\` (\`organizationId\`), INDEX \`IDX_46426ea45456e240a092b73204\` (\`goalId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`key_result_update\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`update\` int NOT NULL, \`progress\` int NOT NULL, \`owner\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`keyResultId\` varchar(255) NULL, INDEX \`IDX_12b8b54f416ec9f5ec002f0a83\` (\`isActive\`), INDEX \`IDX_94aad97b26aede6545a3226fb3\` (\`isArchived\`), INDEX \`IDX_cd9cbc0d5b6d62dbb63c3b3a65\` (\`tenantId\`), INDEX \`IDX_fd4b0cb7a44ed914acdda55e29\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`key_result\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NOT NULL, \`type\` varchar(255) NOT NULL, \`targetValue\` int NULL, \`initialValue\` int NULL, \`unit\` varchar(255) NULL, \`update\` int NOT NULL, \`progress\` int NOT NULL, \`deadline\` varchar(255) NOT NULL, \`hardDeadline\` datetime NULL, \`softDeadline\` datetime NULL, \`status\` varchar(255) NOT NULL, \`weight\` varchar(255) NULL, \`ownerId\` varchar(255) NOT NULL, \`leadId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`kpiId\` varchar(255) NULL, \`goalId\` varchar(255) NULL, INDEX \`IDX_9b62dd2dddcde032f46a981733\` (\`isActive\`), INDEX \`IDX_8889e2618366faefa575a8049b\` (\`isArchived\`), INDEX \`IDX_8ac2c6b487d03157adda874789\` (\`tenantId\`), INDEX \`IDX_d1f45ca98f17bd84a5e430feaf\` (\`organizationId\`), INDEX \`IDX_5880347716f9ec5056ec15112c\` (\`ownerId\`), INDEX \`IDX_c89adeff0de3aedb2e772a5bf4\` (\`leadId\`), INDEX \`IDX_38dc003f3484eff4b59918e9ae\` (\`projectId\`), INDEX \`IDX_d8547e21ccb8e37ac9f0d69c1a\` (\`taskId\`), INDEX \`IDX_4e1e975124c1d717814a4bb2ec\` (\`kpiId\`), INDEX \`IDX_3e1d08761a717c1dd71fe67249\` (\`goalId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`language\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NULL, \`is_system\` tinyint NULL DEFAULT 1, \`description\` varchar(255) NULL, \`color\` varchar(255) NOT NULL, INDEX \`IDX_3a7abee35dfa3c90ed491583eb\` (\`isActive\`), INDEX \`IDX_15fcb8179bc7b0642ca78da69e\` (\`isArchived\`), UNIQUE INDEX \`IDX_465b3173cdddf0ac2d3fe73a33\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`merchant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`phone\` varchar(255) NULL, \`description\` varchar(255) NULL, \`active\` tinyint NOT NULL DEFAULT 1, \`currency\` varchar(255) NOT NULL DEFAULT 'USD', \`contactId\` varchar(255) NULL, \`logoId\` varchar(255) NULL, INDEX \`IDX_a03be8a86e528e2720504a041f\` (\`isActive\`), INDEX \`IDX_0a0f972564e74c9c4905e3abcb\` (\`isArchived\`), INDEX \`IDX_533144d7ae94180235ea456625\` (\`tenantId\`), INDEX \`IDX_d306a524b507f72fa8550aeffe\` (\`organizationId\`), INDEX \`IDX_e03ddff05652be527e04abdc56\` (\`contactId\`), INDEX \`IDX_20acc3c3a6c900c6ef9fc68199\` (\`logoId\`), UNIQUE INDEX \`REL_e03ddff05652be527e04abdc56\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_award\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`year\` varchar(255) NOT NULL, INDEX \`IDX_4062b5d54aa740aaff9a6c5fbb\` (\`isActive\`), INDEX \`IDX_34c6749e2bc94b2e52e9572f32\` (\`isArchived\`), INDEX \`IDX_af6423760433da72002a7f369e\` (\`tenantId\`), INDEX \`IDX_2e0d21aab892b5993abaac09bc\` (\`organizationId\`), INDEX \`IDX_31626e7d39eb95b710d5a2d80f\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_contact\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`primaryEmail\` varchar(255) NULL, \`primaryPhone\` varchar(255) NULL, \`inviteStatus\` enum ('NOT_INVITED', 'INVITED', 'ACCEPTED') NULL, \`notes\` varchar(255) NULL, \`contactType\` enum ('CLIENT', 'CUSTOMER', 'LEAD') NOT NULL DEFAULT 'CLIENT', \`imageUrl\` varchar(500) NULL, \`budget\` int NULL, \`budgetType\` enum ('hours', 'cost') NULL DEFAULT 'cost', \`createdBy\` varchar(255) NULL, \`contactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_53627a383c9817dbf1164d7dc6\` (\`isActive\`), INDEX \`IDX_f91783c7a8565c648b65635efc\` (\`isArchived\`), INDEX \`IDX_e68c43e315ad3aaea4e99cf461\` (\`tenantId\`), INDEX \`IDX_6200736cb4d3617b004e5b647f\` (\`organizationId\`), INDEX \`IDX_de33f92e042365d196d959e774\` (\`name\`), INDEX \`IDX_a86d2e378b953cb39261f457d2\` (\`contactId\`), INDEX \`IDX_8cfcdc6bc8fb55e273d9ace5fd\` (\`imageId\`), UNIQUE INDEX \`REL_a86d2e378b953cb39261f457d2\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_department\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_6139cd4c620e81aefd4895d370\` (\`isActive\`), INDEX \`IDX_b65059949804b20048b1c86c3d\` (\`isArchived\`), INDEX \`IDX_b3644ff7cd65239e29d292a41d\` (\`tenantId\`), INDEX \`IDX_c61a562a2379d1c0077fe7de33\` (\`organizationId\`), INDEX \`IDX_91b652409dc1fb2f712590dd21\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_document\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`documentUrl\` varchar(255) NULL, \`documentId\` varchar(255) NULL, INDEX \`IDX_e5edb48261db95f46c3b4d34a5\` (\`isActive\`), INDEX \`IDX_72c6a8ad9de5c04b2b689fd229\` (\`isArchived\`), INDEX \`IDX_4bc83945c022a862a33629ff1e\` (\`tenantId\`), INDEX \`IDX_1057ec001a4c6b258658143047\` (\`organizationId\`), INDEX \`IDX_c129dee7d1cb84e01e69b5e2c6\` (\`documentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_employment_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_880f3cce5e03f42bec3da6e6dc\` (\`isActive\`), INDEX \`IDX_cc096d49e2399e89cdf32297da\` (\`isArchived\`), INDEX \`IDX_227b5bd9867287cbbeece8f6ba\` (\`tenantId\`), INDEX \`IDX_a583cfe32f492f5ba99b7bb205\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_language\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`name\` varchar(255) NOT NULL, \`level\` varchar(255) NOT NULL, INDEX \`IDX_b79e8d45a3ef5503579643f5de\` (\`isActive\`), INDEX \`IDX_6577ec9ca4cef331a507264d44\` (\`isArchived\`), INDEX \`IDX_225e476592214e32e117a85213\` (\`tenantId\`), INDEX \`IDX_4513931e2d530f78d7144c8c7c\` (\`organizationId\`), INDEX \`IDX_020516e74a57cb85d75381e841\` (\`languageCode\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_position\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_7317abf7a05a169783b6aa7932\` (\`isActive\`), INDEX \`IDX_ce8721ddf715f0efa4bd3d2c5f\` (\`isArchived\`), INDEX \`IDX_a8f497b1006ec967964abb0d49\` (\`tenantId\`), INDEX \`IDX_a0409e39f23ff6d418f2c03df5\` (\`organizationId\`), INDEX \`IDX_3f02c20145af9997253531349c\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_project\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`startDate\` datetime NULL, \`endDate\` datetime NULL, \`billing\` varchar(255) NULL, \`currency\` varchar(255) NULL, \`public\` tinyint NULL, \`owner\` varchar(255) NULL, \`taskListType\` varchar(255) NOT NULL DEFAULT 'GRID', \`code\` varchar(255) NULL, \`description\` varchar(255) NULL, \`color\` varchar(255) NULL, \`billable\` tinyint NULL, \`billingFlat\` tinyint NULL, \`openSource\` tinyint NULL, \`projectUrl\` varchar(255) NULL, \`openSourceProjectUrl\` varchar(255) NULL, \`budget\` int NULL, \`budgetType\` enum ('hours', 'cost') NULL DEFAULT 'cost', \`membersCount\` int NULL DEFAULT '0', \`imageUrl\` varchar(500) NULL, \`isTasksAutoSync\` tinyint NULL DEFAULT 1, \`isTasksAutoSyncOnLabel\` tinyint NULL DEFAULT 1, \`syncTag\` varchar(255) NULL, \`repositoryId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_18e22d4b569159bb91dec869aa\` (\`isActive\`), INDEX \`IDX_3590135ac2034d7aa88efa7e52\` (\`isArchived\`), INDEX \`IDX_7cf84e8b5775f349f81a1f3cc4\` (\`tenantId\`), INDEX \`IDX_9d8afc1e1e64d4b7d48dd2229d\` (\`organizationId\`), INDEX \`IDX_37215da8dee9503d759adb3538\` (\`name\`), INDEX \`IDX_c210effeb6314d325bc024d21e\` (\`currency\`), INDEX \`IDX_75855b44250686f84b7c4bc1f1\` (\`isTasksAutoSync\`), INDEX \`IDX_c5c4366237dc2bb176c1503426\` (\`isTasksAutoSyncOnLabel\`), INDEX \`IDX_3e128d30e9910ff920eee4ef37\` (\`syncTag\`), INDEX \`IDX_904ae0b765faef6ba2db8b1e69\` (\`repositoryId\`), INDEX \`IDX_bc1e32c13683dbb16ada1c6da1\` (\`organizationContactId\`), INDEX \`IDX_063324fdceb51f7086e401ed2c\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_recurring_expense\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startDay\` int NOT NULL, \`startMonth\` int NOT NULL, \`startYear\` int NOT NULL, \`startDate\` datetime NOT NULL, \`endDay\` int NULL, \`endMonth\` int NULL, \`endYear\` int NULL, \`endDate\` datetime NULL, \`categoryName\` varchar(255) NOT NULL, \`value\` decimal NOT NULL, \`currency\` varchar(255) NOT NULL, \`splitExpense\` tinyint NULL, \`parentRecurringExpenseId\` varchar(255) NULL, INDEX \`IDX_9ad08dbc039d08279dae2dd94e\` (\`isActive\`), INDEX \`IDX_f3ef2000abb9762b138cc5a1b3\` (\`isArchived\`), INDEX \`IDX_0b19a287858af40661bd3eb741\` (\`tenantId\`), INDEX \`IDX_8a12e7a0d47d3c6a6b35f7984e\` (\`organizationId\`), INDEX \`IDX_f1e5497ee6be7ba3f2ee90bf4b\` (\`categoryName\`), INDEX \`IDX_61387780d015923453f4b015b4\` (\`currency\`), INDEX \`IDX_637ac2c467df4bc3b71795a866\` (\`parentRecurringExpenseId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_sprint\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`projectId\` varchar(255) NOT NULL, \`goal\` varchar(255) NULL, \`length\` int NOT NULL DEFAULT '7', \`startDate\` datetime NULL, \`endDate\` datetime NULL, \`dayStart\` int NULL, INDEX \`IDX_5596b4fa7fb2ceb0955580becd\` (\`isActive\`), INDEX \`IDX_76e53f9609ca05477d50980743\` (\`isArchived\`), INDEX \`IDX_f57ad03c4e471bd8530494ea63\` (\`tenantId\`), INDEX \`IDX_8a1fe8afb3aa672bae5993fbe7\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_task_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isTasksPrivacyEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksMultipleAssigneesEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksManualTimeEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksGroupEstimationEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksEstimationInHoursEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksEstimationInStoryPointsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksProofOfCompletionEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksProofOfCompletionType\` varchar(255) NOT NULL DEFAULT 'PRIVATE', \`isTasksLinkedEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksCommentsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksHistoryEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksAcceptanceCriteriaEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksDraftsEnabled\` tinyint NOT NULL DEFAULT 1, \`isTasksNotifyLeftEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksNotifyLeftPeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoCloseEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksAutoClosePeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoArchiveEnabled\` tinyint NOT NULL DEFAULT 1, \`tasksAutoArchivePeriodDays\` int NOT NULL DEFAULT '7', \`isTasksAutoStatusEnabled\` tinyint NOT NULL DEFAULT 1, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_f0e2385b2d5f176f9ed3b6a9e3\` (\`isActive\`), INDEX \`IDX_b7be7e61daf2b5af3232c9c4d6\` (\`isArchived\`), INDEX \`IDX_582768159ef0c749e8552ea9bc\` (\`tenantId\`), INDEX \`IDX_5830901876e426adfc15fb7341\` (\`organizationId\`), INDEX \`IDX_19ab7adf33199bc6f913db277d\` (\`projectId\`), INDEX \`IDX_20a290f166c0810eafbf271717\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_team_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isTrackingEnabled\` tinyint NULL DEFAULT 1, \`activeTaskId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`roleId\` varchar(255) NULL, \`order\` int NULL, INDEX \`IDX_70fcc451944fbde73d223c2af3\` (\`isActive\`), INDEX \`IDX_752d7a0fe6597ee6bbc6502a12\` (\`isArchived\`), INDEX \`IDX_fe12e1b76bbb76209134d9bdc2\` (\`tenantId\`), INDEX \`IDX_d8eba1c0e500c60be1b69c1e77\` (\`organizationId\`), INDEX \`IDX_719aeb37fa7a1dd80d25336a0c\` (\`activeTaskId\`), INDEX \`IDX_8dc83cdd7c519d73afc0d8bdf0\` (\`organizationTeamId\`), INDEX \`IDX_a2a5601d799fbfc29c17b99243\` (\`employeeId\`), INDEX \`IDX_ce83034f38496f5fe3f1979697\` (\`roleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_team_join_request\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`fullName\` varchar(255) NULL, \`linkAddress\` varchar(255) NULL, \`position\` varchar(255) NULL, \`status\` varchar(255) NULL, \`code\` varchar(255) NULL, \`token\` varchar(255) NULL, \`expiredAt\` datetime NULL, \`userId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NOT NULL, INDEX \`IDX_29ece7e3bb764028387cdbc888\` (\`isActive\`), INDEX \`IDX_b027ee2cb18245356b8d963d2f\` (\`isArchived\`), INDEX \`IDX_d9529008c733cb90044b8c2ad6\` (\`tenantId\`), INDEX \`IDX_c15823bf3f63b1fe331d9de662\` (\`organizationId\`), INDEX \`IDX_5e73656ce0355347477c42ae19\` (\`userId\`), INDEX \`IDX_171b852be7c1f387eca93775aa\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_team\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`color\` varchar(255) NULL, \`emoji\` varchar(255) NULL, \`teamSize\` varchar(255) NULL, \`logo\` varchar(255) NULL, \`prefix\` varchar(255) NULL, \`public\` tinyint NULL DEFAULT 0, \`profile_link\` varchar(255) NULL, \`createdById\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_722d648e0b83267d4a66332ccb\` (\`isActive\`), INDEX \`IDX_38f1d96e8c2d59e4f0f84209ab\` (\`isArchived\`), INDEX \`IDX_176f5ed3c4534f3110d423d569\` (\`tenantId\`), INDEX \`IDX_eef1c19a0cb5321223cfe3286c\` (\`organizationId\`), INDEX \`IDX_103ae3eb65f4b091efc55cb532\` (\`name\`), INDEX \`IDX_e22ab0f1236b1a07785b641727\` (\`profile_link\`), INDEX \`IDX_da625f694eb1e23e585f301008\` (\`createdById\`), INDEX \`IDX_51e91be110fa0b8e70066f5727\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_vendor\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`email\` varchar(255) NULL, \`phone\` varchar(255) NULL, \`website\` varchar(255) NULL, INDEX \`IDX_04c6320f910056ecb11b147ac8\` (\`isActive\`), INDEX \`IDX_266972cd6ff9656eec8818e12d\` (\`isArchived\`), INDEX \`IDX_7e0bf6063e1728c9813d5da7ca\` (\`tenantId\`), INDEX \`IDX_56dd132aa3743cfa9b034d020e\` (\`organizationId\`), INDEX \`IDX_e56e80136b07ecd52545368611\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`isDefault\` tinyint NOT NULL DEFAULT 0, \`profile_link\` varchar(255) NULL, \`banner\` varchar(255) NULL, \`totalEmployees\` int NULL, \`short_description\` varchar(255) NULL, \`client_focus\` varchar(255) NULL, \`overview\` varchar(255) NULL, \`imageUrl\` varchar(500) NULL, \`currency\` varchar(255) NOT NULL, \`valueDate\` datetime NULL, \`defaultValueDateType\` enum ('TODAY', 'END_OF_MONTH', 'START_OF_MONTH') NULL DEFAULT 'TODAY', \`defaultAlignmentType\` varchar(255) NULL, \`timeZone\` varchar(255) NULL, \`regionCode\` varchar(255) NULL, \`brandColor\` varchar(255) NULL, \`dateFormat\` varchar(255) NULL, \`officialName\` varchar(255) NULL, \`startWeekOn\` varchar(255) NULL, \`taxId\` varchar(255) NULL, \`numberFormat\` varchar(255) NULL, \`minimumProjectSize\` varchar(255) NULL, \`bonusType\` varchar(255) NULL, \`bonusPercentage\` int NULL, \`invitesAllowed\` tinyint NULL DEFAULT 1, \`show_income\` tinyint NULL, \`show_profits\` tinyint NULL, \`show_bonuses_paid\` tinyint NULL, \`show_total_hours\` tinyint NULL, \`show_minimum_project_size\` tinyint NULL, \`show_projects_count\` tinyint NULL, \`show_clients_count\` tinyint NULL, \`show_clients\` tinyint NULL, \`show_employees_count\` tinyint NULL, \`inviteExpiryPeriod\` int NULL, \`fiscalStartDate\` datetime NULL, \`fiscalEndDate\` datetime NULL, \`registrationDate\` datetime NULL, \`futureDateAllowed\` tinyint NULL, \`allowManualTime\` tinyint NOT NULL DEFAULT 1, \`allowModifyTime\` tinyint NOT NULL DEFAULT 1, \`allowDeleteTime\` tinyint NOT NULL DEFAULT 1, \`allowTrackInactivity\` tinyint NOT NULL DEFAULT 1, \`inactivityTimeLimit\` int NOT NULL DEFAULT '10', \`activityProofDuration\` int NOT NULL DEFAULT '1', \`requireReason\` tinyint NOT NULL DEFAULT 0, \`requireDescription\` tinyint NOT NULL DEFAULT 0, \`requireProject\` tinyint NOT NULL DEFAULT 0, \`requireTask\` tinyint NOT NULL DEFAULT 0, \`requireClient\` tinyint NOT NULL DEFAULT 0, \`timeFormat\` int NOT NULL DEFAULT '12', \`separateInvoiceItemTaxAndDiscount\` tinyint NULL, \`website\` varchar(255) NULL, \`fiscalInformation\` varchar(255) NULL, \`currencyPosition\` varchar(255) NOT NULL DEFAULT 'LEFT', \`discountAfterTax\` tinyint NULL, \`defaultStartTime\` varchar(255) NULL, \`defaultEndTime\` varchar(255) NULL, \`defaultInvoiceEstimateTerms\` varchar(255) NULL, \`convertAcceptedEstimates\` tinyint NULL, \`daysUntilDue\` int NULL, \`isRemoveIdleTime\` tinyint NOT NULL DEFAULT 0, \`allowScreenshotCapture\` tinyint NOT NULL DEFAULT 1, \`upworkOrganizationId\` varchar(255) NULL, \`upworkOrganizationName\` varchar(255) NULL, \`randomScreenshot\` tinyint NULL DEFAULT 0, \`trackOnSleep\` tinyint NULL DEFAULT 0, \`screenshotFrequency\` decimal NOT NULL DEFAULT '10', \`enforced\` tinyint NULL DEFAULT 0, \`contactId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_6de52b8f3de32abee3df2628a3\` (\`isActive\`), INDEX \`IDX_b2091c1795f1d0d919b278ab23\` (\`isArchived\`), INDEX \`IDX_745a293c8b2c750bc421fa0633\` (\`tenantId\`), INDEX \`IDX_c21e615583a3ebbb0977452afb\` (\`name\`), INDEX \`IDX_03e5eecc2328eb545ff748cbdd\` (\`isDefault\`), INDEX \`IDX_40460ab803bf6e5a62b75a35c5\` (\`profile_link\`), INDEX \`IDX_6cc2b2052744e352834a4c9e78\` (\`banner\`), INDEX \`IDX_b03a8a28f6ebdb6df8f630216b\` (\`totalEmployees\`), INDEX \`IDX_f37d866c3326eca5f579cef35c\` (\`short_description\`), INDEX \`IDX_c75285bf286b17c7ca5537857b\` (\`client_focus\`), INDEX \`IDX_9ea70bf5c390b00e7bb96b86ed\` (\`overview\`), INDEX \`IDX_15458cef74076623c270500053\` (\`currency\`), INDEX \`IDX_2360aa7a4b5ab99e026584f305\` (\`defaultValueDateType\`), INDEX \`IDX_7965db2b12872551b586f76dd7\` (\`contactId\`), INDEX \`IDX_47b6a97e09895a06606a4a8042\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`password_reset\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`email\` varchar(255) NOT NULL, \`token\` varchar(255) NOT NULL, INDEX \`IDX_380c03025a41ad032191f1ef2d\` (\`isActive\`), INDEX \`IDX_e71a736d52820b568f6b0ca203\` (\`isArchived\`), INDEX \`IDX_1fa632f2d12a06ef8dcc00858f\` (\`tenantId\`), INDEX \`IDX_1c88db6e50f0704688d1f1978c\` (\`email\`), INDEX \`IDX_36e929b98372d961bb63bd4b4e\` (\`token\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`payment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`paymentDate\` datetime NULL, \`amount\` decimal NULL, \`note\` varchar(255) NULL, \`currency\` varchar(255) NOT NULL, \`paymentMethod\` enum ('BANK_TRANSFER', 'CASH', 'CHEQUE', 'CREDIT_CARD', 'DEBIT', 'ONLINE') NULL, \`overdue\` tinyint NULL, \`employeeId\` varchar(255) NULL, \`invoiceId\` varchar(255) NULL, \`recordedById\` varchar(255) NOT NULL, \`projectId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_16a49d62227bf23686b77b5a21\` (\`isActive\`), INDEX \`IDX_8c4018eab11e92c3b09583495f\` (\`isArchived\`), INDEX \`IDX_6959c37c3acf0832103a253570\` (\`tenantId\`), INDEX \`IDX_be7fcc9fb8cd5a74cb602ec6c9\` (\`organizationId\`), INDEX \`IDX_62ef561a3bb084a7d12dad8a2d\` (\`employeeId\`), INDEX \`IDX_87223c7f1d4c2ca51cf6992784\` (\`invoiceId\`), INDEX \`IDX_3f13c738eff604a85700746ec7\` (\`recordedById\`), INDEX \`IDX_8846e403ec45e1ad8c309f91a3\` (\`projectId\`), INDEX \`IDX_82753b9e315af84b20eaf84d77\` (\`organizationContactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`pipeline_stage\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` text NULL, \`index\` int NOT NULL, \`name\` varchar(255) NOT NULL, \`pipelineId\` varchar(255) NOT NULL, INDEX \`IDX_a6acee4ad726734b73f3886c14\` (\`isActive\`), INDEX \`IDX_074caa106ee22d5d675a696a98\` (\`isArchived\`), INDEX \`IDX_28965bf63ad4c0976892d0fd5e\` (\`tenantId\`), INDEX \`IDX_04d16bdd72668de12c3e41a85a\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`pipeline\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`description\` text NULL, \`name\` varchar(255) NOT NULL, INDEX \`IDX_f3027eabd451ec18b93fab7ed5\` (\`isActive\`), INDEX \`IDX_1adf9f97094bc93e176ede2482\` (\`isArchived\`), INDEX \`IDX_683274c59fb08b21249096e305\` (\`tenantId\`), INDEX \`IDX_873ade98fbd6ca71c8b4d1bbca\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_category_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_e690dd59b69e74a6bb5d94f32b\` (\`isActive\`), INDEX \`IDX_d32c5d5e4451acf44fd5b212ce\` (\`isArchived\`), INDEX \`IDX_27d71aa2e843f07fbf36329be3\` (\`tenantId\`), INDEX \`IDX_e46203bf1dbf3291d174f02cb3\` (\`organizationId\`), INDEX \`IDX_586294149d24cd835678878ef1\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`imageUrl\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_198fba43f049ea621407e7d188\` (\`isActive\`), INDEX \`IDX_06cd3959f09e0b12793a763515\` (\`isArchived\`), INDEX \`IDX_0a0cf25cd8232a154d1cce2641\` (\`tenantId\`), INDEX \`IDX_853302351eaa4daa39920c270a\` (\`organizationId\`), INDEX \`IDX_f38e86bd280ff9c9c7d9cb7839\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_option_group\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`productId\` varchar(255) NOT NULL, INDEX \`IDX_0fc743f2bc16502dbc5e85420c\` (\`isActive\`), INDEX \`IDX_76bda4c33c83614617278617ae\` (\`isArchived\`), INDEX \`IDX_462a7fd3ce68935cf973c6709f\` (\`tenantId\`), INDEX \`IDX_4a1430a01b71ecdfcd54b2b6c5\` (\`organizationId\`), INDEX \`IDX_a6e91739227bf4d442f23c52c7\` (\`productId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_option_group_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_75b7065234a6d32fbd03d8703f\` (\`isActive\`), INDEX \`IDX_e9e50109d3054fb81205c0a74e\` (\`isArchived\`), INDEX \`IDX_fd6b39f1fd1db026b5dcc3c795\` (\`tenantId\`), INDEX \`IDX_0e2fcc31743e20a45fc3cf0211\` (\`organizationId\`), INDEX \`IDX_c9ce1da98b6d93293daafee63a\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_option_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_f284f666950392c55afa0806c8\` (\`isActive\`), INDEX \`IDX_2f581c3477a5c7a66de5d7f264\` (\`isArchived\`), INDEX \`IDX_9869d7680f48487e584f5d2fca\` (\`tenantId\`), INDEX \`IDX_4dc2f466cfa3d0b7fef19d1273\` (\`organizationId\`), INDEX \`IDX_f43c46e12db0580af320db7738\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_option\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NULL, \`groupId\` varchar(255) NOT NULL, INDEX \`IDX_d81028785f188c253e0bd49a03\` (\`isActive\`), INDEX \`IDX_35d083f4ecfe72cce72ee88f58\` (\`isArchived\`), INDEX \`IDX_985d235aa5394937c4493262c7\` (\`tenantId\`), INDEX \`IDX_47ffb82a65c43f102b7e0efa41\` (\`organizationId\`), INDEX \`IDX_a6debf9198e2fbfa006aa10d71\` (\`groupId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_variant_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isSubscription\` tinyint NOT NULL DEFAULT 0, \`isPurchaseAutomatically\` tinyint NOT NULL DEFAULT 0, \`canBeSold\` tinyint NOT NULL DEFAULT 1, \`canBePurchased\` tinyint NOT NULL DEFAULT 1, \`canBeCharged\` tinyint NOT NULL DEFAULT 0, \`canBeRented\` tinyint NOT NULL DEFAULT 0, \`isEquipment\` tinyint NOT NULL DEFAULT 0, \`trackInventory\` tinyint NOT NULL DEFAULT 0, \`productVariantId\` varchar(36) NULL, INDEX \`IDX_ad107ba78e487cd8b13313593b\` (\`isActive\`), INDEX \`IDX_ae78776111e1906accfd61511d\` (\`isArchived\`), INDEX \`IDX_2efe48435d4ba480a4bb8b96fa\` (\`tenantId\`), INDEX \`IDX_bed9d45e15866d9b8e87e7a7bf\` (\`organizationId\`), UNIQUE INDEX \`REL_b0d86990fe7160a5f3e4011fb2\` (\`productVariantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_type_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_e9dca49bad996f1761db3b2f56\` (\`isActive\`), INDEX \`IDX_65874d6bab7fefcaeccd2252c1\` (\`isArchived\`), INDEX \`IDX_30aafca59cdb456bf5231f9e46\` (\`tenantId\`), INDEX \`IDX_2dd271bdeb602b8c3956287e33\` (\`organizationId\`), INDEX \`IDX_f4b767c43b4e9130c63382c9b2\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`icon\` varchar(255) NULL, INDEX \`IDX_90cc635a1065702ed3b79da6ec\` (\`isActive\`), INDEX \`IDX_49064ee0f3acd5882f4d893f3d\` (\`isArchived\`), INDEX \`IDX_f206c807fc7e41fc8a8b6679ae\` (\`tenantId\`), INDEX \`IDX_e4e4120b0c19d3a207ce38d758\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_variant_price\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`unitCost\` int NOT NULL DEFAULT '0', \`unitCostCurrency\` varchar(255) NOT NULL DEFAULT 'USD', \`retailPrice\` int NOT NULL DEFAULT '0', \`retailPriceCurrency\` varchar(255) NOT NULL DEFAULT 'USD', \`productVariantId\` varchar(36) NULL, INDEX \`IDX_562ef5984b6d4bed640bfcc6a2\` (\`isActive\`), INDEX \`IDX_24ac11e35221577e4ba4fdd229\` (\`isArchived\`), INDEX \`IDX_7052eaf00a5795afa5ebf35995\` (\`tenantId\`), INDEX \`IDX_0cfba32db58a952f58b1e35cf1\` (\`organizationId\`), UNIQUE INDEX \`REL_5842f603bd85d924127d63d73c\` (\`productVariantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_variant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`taxes\` int NOT NULL DEFAULT '0', \`notes\` varchar(255) NULL, \`quantity\` int NOT NULL DEFAULT '0', \`billingInvoicingPolicy\` varchar(255) NOT NULL DEFAULT 'Quantity ordered', \`internalReference\` varchar(255) NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`productId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, \`priceId\` varchar(36) NULL, \`settingId\` varchar(36) NULL, INDEX \`IDX_e0d896cadbc695a490f64bb7e7\` (\`isActive\`), INDEX \`IDX_e0005cbdabb760488f66f3fbba\` (\`isArchived\`), INDEX \`IDX_9121e00c4dc3500dc610cf8722\` (\`tenantId\`), INDEX \`IDX_6a289b10030ae86903406e3c9b\` (\`organizationId\`), INDEX \`IDX_6e420052844edf3a5506d863ce\` (\`productId\`), INDEX \`IDX_b83f23626741630a8629960715\` (\`imageId\`), UNIQUE INDEX \`REL_41b31a71dda350cfe5da07e0e4\` (\`priceId\`), UNIQUE INDEX \`REL_9f0fd369dfeb275415c649d110\` (\`settingId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`enabled\` tinyint NOT NULL DEFAULT 1, \`code\` varchar(255) NOT NULL, \`imageUrl\` varchar(255) NULL, \`featuredImageId\` varchar(255) NULL, \`productTypeId\` varchar(255) NULL, \`productCategoryId\` varchar(255) NULL, INDEX \`IDX_7bb2b2f7a4c8a4916d4339d7f4\` (\`isActive\`), INDEX \`IDX_6f58935aa2175d930e47e97c9f\` (\`isArchived\`), INDEX \`IDX_08293ca31a601d3cd0228120bc\` (\`tenantId\`), INDEX \`IDX_32a4bdd261ec81f4ca6b3abe26\` (\`organizationId\`), INDEX \`IDX_4627873dbc1af07d732e6eec7b\` (\`featuredImageId\`), INDEX \`IDX_374bfd0d1b0e1398d7206456d9\` (\`productTypeId\`), INDEX \`IDX_618194d24a7ea86a165d7ec628\` (\`productCategoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_translation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`languageCode\` varchar(255) NOT NULL, \`referenceId\` varchar(255) NOT NULL, INDEX \`IDX_1d9ca23c7e1c606061fec8bb74\` (\`isActive\`), INDEX \`IDX_96413a8061ff4ccdc418d4e16a\` (\`isArchived\`), INDEX \`IDX_7533fd275bfb3219ce9eb4004c\` (\`tenantId\`), INDEX \`IDX_e6abcacc3d3a4f9cf5ca97f2b2\` (\`organizationId\`), INDEX \`IDX_d24bc28e54f1dc296452a25591\` (\`referenceId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`proposal\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`jobPostUrl\` varchar(255) NULL, \`valueDate\` datetime NULL, \`jobPostContent\` varchar(255) NOT NULL, \`proposalContent\` varchar(255) NOT NULL, \`status\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, INDEX \`IDX_61a30a7d83666bf265fd86a72d\` (\`isActive\`), INDEX \`IDX_e2836e856f491dd4676e1ec8d3\` (\`isArchived\`), INDEX \`IDX_4177329f5e6ddbfb6416592713\` (\`tenantId\`), INDEX \`IDX_d59ec6899d435f430799795ad7\` (\`organizationId\`), INDEX \`IDX_cc28a54171231fbd9a127051f0\` (\`jobPostUrl\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`report_category\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`iconClass\` varchar(255) NULL, INDEX \`IDX_dd9fcd7916d0a22189ecea6a36\` (\`isActive\`), INDEX \`IDX_656f05f951faa13d7195853424\` (\`isArchived\`), INDEX \`IDX_fa278d337ba5e200d44ade6697\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`report_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`reportId\` varchar(255) NOT NULL, \`isEnabled\` tinyint NOT NULL DEFAULT 1, INDEX \`IDX_a6bde8f44e18f17b1ca603e150\` (\`isActive\`), INDEX \`IDX_40459267d68604655aa6df4251\` (\`isArchived\`), INDEX \`IDX_edf9bd011d7f08e3e18a5becb8\` (\`tenantId\`), INDEX \`IDX_5193788a3ebc1143bedb74cf72\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`report\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`slug\` varchar(255) NULL, \`description\` varchar(255) NULL, \`image\` varchar(255) NULL, \`iconClass\` varchar(255) NULL, \`showInMenu\` tinyint NOT NULL DEFAULT 0, \`categoryId\` varchar(255) NOT NULL, INDEX \`IDX_143ead1a6ac5f73125d8c4c3aa\` (\`isActive\`), INDEX \`IDX_1316fdd7b9a2926437a13271bf\` (\`isArchived\`), INDEX \`IDX_6f9ee54eb839117e83b937648d\` (\`name\`), INDEX \`IDX_ef16fed5f7e6951027502e6458\` (\`slug\`), INDEX \`IDX_230652e48daa99c50c000fc5d1\` (\`categoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`request_approval_employee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`status\` int NULL, \`requestApprovalId\` varchar(255) NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_2634ff04775e659c4792325f38\` (\`isActive\`), INDEX \`IDX_3d66190c19b9fe69a8bbb300df\` (\`isArchived\`), INDEX \`IDX_a5445b38b780b29b09369e36a9\` (\`tenantId\`), INDEX \`IDX_4071f027554eefff65ac8123e6\` (\`organizationId\`), INDEX \`IDX_563fec5539b89a57f40731f985\` (\`requestApprovalId\`), INDEX \`IDX_ce2113039f070b3f003aa0db61\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`request_approval_team\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`status\` int NULL, \`requestApprovalId\` varchar(255) NOT NULL, \`teamId\` varchar(255) NOT NULL, INDEX \`IDX_34b2e8f794e0336b9ac410d8bd\` (\`isActive\`), INDEX \`IDX_bdcb4ea389bdb794bae75b0170\` (\`isArchived\`), INDEX \`IDX_94b2a3d0f17c9549dea1493dc9\` (\`tenantId\`), INDEX \`IDX_77e1050669b32cfff482f96016\` (\`organizationId\`), INDEX \`IDX_6c75d8a8c609e88896b2653cc4\` (\`requestApprovalId\`), INDEX \`IDX_9ccdaee6c5c62cda8f7375e841\` (\`teamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`request_approval\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`status\` int NULL, \`createdBy\` varchar(255) NULL, \`createdByName\` varchar(255) NULL, \`min_count\` int NULL, \`requestId\` varchar(255) NULL, \`requestType\` varchar(255) NULL, \`approvalPolicyId\` varchar(255) NULL, INDEX \`IDX_db152600f88a9a4888df0b626e\` (\`isActive\`), INDEX \`IDX_c77295d7f5d6086c815de3c120\` (\`isArchived\`), INDEX \`IDX_9feaa23ed7bc47d51315e304bb\` (\`tenantId\`), INDEX \`IDX_8343741e7929043b2a7de89f73\` (\`organizationId\`), INDEX \`IDX_c63fafc733ff8ab37dede8ffec\` (\`name\`), INDEX \`IDX_26bb3420001d31337393ed05bc\` (\`approvalPolicyId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`role_permission\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`permission\` varchar(255) NOT NULL, \`enabled\` tinyint NULL DEFAULT 0, \`description\` varchar(255) NULL, \`roleId\` varchar(255) NOT NULL, INDEX \`IDX_78f93dbb42a97f6785bcf53efd\` (\`isActive\`), INDEX \`IDX_5c36df1a5c85016952e90d760f\` (\`isArchived\`), INDEX \`IDX_cbd053921056e77c0a8e03122a\` (\`tenantId\`), INDEX \`IDX_8307c5c44a4ad6210b767b17a9\` (\`permission\`), INDEX \`IDX_e3130a39c1e4a740d044e68573\` (\`roleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`role\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, INDEX \`IDX_c5f75cd3367769b6f22b298d29\` (\`isActive\`), INDEX \`IDX_09868c0733ba37a4753ff8931f\` (\`isArchived\`), INDEX \`IDX_1751a572e91385a09d41c62471\` (\`tenantId\`), INDEX \`IDX_ae4578dcaed5adff96595e6166\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`skill\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`color\` varchar(255) NOT NULL, INDEX \`IDX_f4cdbe61d68413f4d6a671f8c2\` (\`isActive\`), INDEX \`IDX_ca52119f9e4857399706d723e9\` (\`isArchived\`), INDEX \`IDX_8e502eac7ed1347c71c26beae8\` (\`tenantId\`), INDEX \`IDX_b2923d394f3636671ff9b3c3e8\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`color\` varchar(255) NOT NULL, \`textColor\` varchar(255) NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_1f22c73374bcca1ea84a4dca59\` (\`isActive\`), INDEX \`IDX_58876ee26a90170551027459bf\` (\`isArchived\`), INDEX \`IDX_b08dd29fb6a8acdf83c83d8988\` (\`tenantId\`), INDEX \`IDX_c2f6bec0b39eaa3a6d90903ae9\` (\`organizationId\`), INDEX \`IDX_49746602acc4e5e8721062b69e\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_estimation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`estimate\` int NOT NULL, \`employeeId\` varchar(255) NOT NULL, \`taskId\` varchar(255) NOT NULL, INDEX \`IDX_b1a7086c279309b20e8384d0d9\` (\`isActive\`), INDEX \`IDX_1f3ffda4fce02682e76308b476\` (\`isArchived\`), INDEX \`IDX_87bfea6d0b9a1ec602ee88e5f6\` (\`tenantId\`), INDEX \`IDX_16507eb222e3c50be077fb4ace\` (\`organizationId\`), INDEX \`IDX_8f274646f2bdf4e12990feeb04\` (\`employeeId\`), INDEX \`IDX_a3ee022203211f678376cd919b\` (\`taskId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`issue_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`imageId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_722ce5d7535524b96c6d03f7c4\` (\`isActive\`), INDEX \`IDX_1909e9bae7d8b2c920b3e4d859\` (\`isArchived\`), INDEX \`IDX_8b12c913c39c72fe5980427c96\` (\`tenantId\`), INDEX \`IDX_16dbef9d1b2b422abdce8ee3ae\` (\`organizationId\`), INDEX \`IDX_4af451ab46a94e94394c72d911\` (\`name\`), INDEX \`IDX_af2d743ed61571bcdc5d9a27a0\` (\`value\`), INDEX \`IDX_33779b0395f72af0b50dc526d1\` (\`imageId\`), INDEX \`IDX_131331557078611a68b4a5b2e7\` (\`projectId\`), INDEX \`IDX_586513cceb16777fd14a17bfe1\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`number\` bigint NULL, \`prefix\` varchar(255) NULL, \`title\` varchar(255) NOT NULL, \`description\` text NULL, \`status\` varchar(255) NULL, \`priority\` varchar(255) NULL, \`size\` varchar(255) NULL, \`issueType\` varchar(255) NULL, \`estimate\` int NULL, \`dueDate\` datetime NULL, \`public\` tinyint NULL DEFAULT 1, \`startDate\` datetime NULL, \`resolvedAt\` datetime NULL, \`version\` varchar(255) NULL, \`parentId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`creatorId\` varchar(255) NULL, \`organizationSprintId\` varchar(255) NULL, \`taskStatusId\` varchar(255) NULL, \`taskSizeId\` varchar(255) NULL, \`taskPriorityId\` varchar(255) NULL, INDEX \`IDX_3e16c81005c389a4db83c0e5e3\` (\`isActive\`), INDEX \`IDX_ca2f7edd5a5ce8f14b257c9d54\` (\`isArchived\`), INDEX \`IDX_e91cbff3d206f150ccc14d0c3a\` (\`tenantId\`), INDEX \`IDX_5b0272d923a31c972bed1a1ac4\` (\`organizationId\`), INDEX \`IDX_2fe7a278e6f08d2be55740a939\` (\`status\`), INDEX \`IDX_f092f3386f10f2e2ef5b0b6ad1\` (\`priority\`), INDEX \`IDX_7127880d6fae956ecc1c84ac31\` (\`size\`), INDEX \`IDX_ed5441fb13e82854a994da5a78\` (\`issueType\`), INDEX \`IDX_3797a20ef5553ae87af126bc2f\` (\`projectId\`), INDEX \`IDX_94fe6b3a5aec5f85427df4f8cd\` (\`creatorId\`), INDEX \`IDX_1e1f64696aa3a26d3e12c840e5\` (\`organizationSprintId\`), INDEX \`IDX_0cbe714983eb0aae5feeee8212\` (\`taskStatusId\`), INDEX \`IDX_2f4bdd2593fd6038aaa91fd107\` (\`taskSizeId\`), INDEX \`IDX_b8616deefe44d0622233e73fbf\` (\`taskPriorityId\`), UNIQUE INDEX \`taskNumber\` (\`projectId\`, \`number\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_linked_issues\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`action\` int NOT NULL, \`taskFromId\` varchar(255) NOT NULL, \`taskToId\` varchar(255) NOT NULL, INDEX \`IDX_d49853e18e5bc772f5435b01a5\` (\`isActive\`), INDEX \`IDX_88021c0cd9508757d3d90333f8\` (\`isArchived\`), INDEX \`IDX_20b50abc5c97610a75d49ad381\` (\`tenantId\`), INDEX \`IDX_24114c4059e6b6991daba541b1\` (\`organizationId\`), INDEX \`IDX_6deea7b3671e45973e191a1502\` (\`taskFromId\`), INDEX \`IDX_0848fd2b8c23c0ab55146297cf\` (\`taskToId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_priority\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_8ddcc5eeaf96314f53ca486821\` (\`isActive\`), INDEX \`IDX_e6adb82db368af15f2b8cdd4e8\` (\`isArchived\`), INDEX \`IDX_1818655f27b8cf4f0d1dbfeb8d\` (\`tenantId\`), INDEX \`IDX_7fd1b30d159b608cbf59009f68\` (\`organizationId\`), INDEX \`IDX_7d656b4cba8f11e639dbc5aab3\` (\`name\`), INDEX \`IDX_46daede7b19176b6ad959d70da\` (\`value\`), INDEX \`IDX_db4237960ca989eb7a48cd433b\` (\`projectId\`), INDEX \`IDX_52b039cff6a1adf6b7f9e49ee4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_related_issue_type\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_5a341f51d8f5ec12db24ab033f\` (\`isActive\`), INDEX \`IDX_8177dd93be8044b37d3bb9285d\` (\`isArchived\`), INDEX \`IDX_b7b0ea8ac2825fb981c1181d11\` (\`tenantId\`), INDEX \`IDX_bed691e21fe01cf5aceee72295\` (\`organizationId\`), INDEX \`IDX_9423f99da972c150f85dbc11c1\` (\`name\`), INDEX \`IDX_61a7cb4452d9e23f91231b7fd6\` (\`value\`), INDEX \`IDX_d99fe5b50dbe5078e0d9a9b6a9\` (\`projectId\`), INDEX \`IDX_4967ebdca0aefb9d43e56695e4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_size\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_d65afcfe2d64e49d43931579a3\` (\`isActive\`), INDEX \`IDX_8f26ffc61abaef417b0f807695\` (\`isArchived\`), INDEX \`IDX_f6ec2207e50680a475d71c8979\` (\`tenantId\`), INDEX \`IDX_596512cc6508a482cc23ae6ab7\` (\`organizationId\`), INDEX \`IDX_90c54f57b29cc8b67edc2738ae\` (\`name\`), INDEX \`IDX_1a7b137d009616a2ff1aa6834f\` (\`value\`), INDEX \`IDX_ad6792b26526bd96ab18d63454\` (\`projectId\`), INDEX \`IDX_f4438327b3c2afb0832569b2a1\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_status\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`order\` int NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`isCollapsed\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_25d9737ee153411871b4d20c67\` (\`isActive\`), INDEX \`IDX_79c525a8c2209e90186bfcbea9\` (\`isArchived\`), INDEX \`IDX_efbaf00a743316b394cc31e4a2\` (\`tenantId\`), INDEX \`IDX_9b9a828a49f4bd6383a4073fe2\` (\`organizationId\`), INDEX \`IDX_b0c955f276679dd2b2735c3936\` (\`name\`), INDEX \`IDX_68eaba689ed6d3e27ec93d3e88\` (\`value\`), INDEX \`IDX_a19e8975e5c296640d457dfc11\` (\`projectId\`), INDEX \`IDX_0330b4a942b536d8d1f264abe3\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_version\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`color\` varchar(255) NULL, \`isSystem\` tinyint NOT NULL DEFAULT 0, \`projectId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_7e509a66367ecaf8e3bc96f263\` (\`isActive\`), INDEX \`IDX_313b0e55871c1c9b6c22341536\` (\`isArchived\`), INDEX \`IDX_379c8bd0ce203341148c1f99ee\` (\`tenantId\`), INDEX \`IDX_9c845f353378371ee3aa60f686\` (\`organizationId\`), INDEX \`IDX_3396dda57286ca17ab61fd3704\` (\`name\`), INDEX \`IDX_e9fd8df772ad2d955a65f4c68a\` (\`value\`), INDEX \`IDX_91988120385964f213aec8aa84\` (\`projectId\`), INDEX \`IDX_959e77718a2e76ee56498c1106\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tenant_setting\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`value\` varchar(255) NULL, INDEX \`IDX_1d9975b98d82f385ae14b4d7c6\` (\`isActive\`), INDEX \`IDX_a7500f9b1b7917bf10882c820e\` (\`isArchived\`), INDEX \`IDX_affdab301e348b892175f30fa3\` (\`tenantId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tenant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`name\` varchar(255) NOT NULL, \`logo\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_b8eb9f3e420aa846f30e291960\` (\`isActive\`), INDEX \`IDX_eeedffab85b3534a1068d9270f\` (\`isArchived\`), INDEX \`IDX_56211336b5ff35fd944f225917\` (\`name\`), INDEX \`IDX_d154d06dac0d0e0a5d9a083e25\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_off_policy\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`requiresApproval\` tinyint NOT NULL, \`paid\` tinyint NOT NULL, INDEX \`IDX_cf9377d3bcb7cb996f72268941\` (\`isActive\`), INDEX \`IDX_22d919e53cf5f6d836b18d407a\` (\`isArchived\`), INDEX \`IDX_1c0ed84d54f8fbe4af10dfcda1\` (\`tenantId\`), INDEX \`IDX_c2744cffeca55c3c9c52bb9789\` (\`organizationId\`), INDEX \`IDX_7d7f69c79df4a6f152b0e362b1\` (\`name\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_off_request\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`documentUrl\` varchar(255) NULL, \`description\` varchar(255) NULL, \`start\` datetime NOT NULL, \`end\` datetime NOT NULL, \`requestDate\` datetime NOT NULL, \`status\` varchar(255) NOT NULL, \`isHoliday\` tinyint NULL DEFAULT 0, \`policyId\` varchar(255) NOT NULL, \`documentId\` varchar(255) NULL, INDEX \`IDX_45e4bc4476681f4db2097cc2d5\` (\`isActive\`), INDEX \`IDX_5ddef92c4694e6d650d9e557b3\` (\`isArchived\`), INDEX \`IDX_4989834dd1c9c8ea3576ed99ce\` (\`tenantId\`), INDEX \`IDX_981333982a6df8b815957dcbf2\` (\`organizationId\`), INDEX \`IDX_c1f8ae47dc2f1882afc5045c73\` (\`policyId\`), INDEX \`IDX_c009cdd795be674c2047062374\` (\`documentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`activity\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`title\` varchar(255) NULL, \`description\` longtext NULL, \`metaData\` json NULL, \`date\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`time\` time(6) NOT NULL DEFAULT '0', \`duration\` int NOT NULL DEFAULT '0', \`type\` varchar(255) NULL, \`source\` varchar(255) NOT NULL DEFAULT 'BROWSER', \`recordedAt\` datetime NULL, \`employeeId\` varchar(255) NOT NULL, \`projectId\` varchar(255) NULL, \`timeSlotId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, INDEX \`IDX_ae6ac57aafef59f561d4db3dd7\` (\`isActive\`), INDEX \`IDX_d2d6db7f03da5632687e5d140e\` (\`isArchived\`), INDEX \`IDX_f2401d8fdff5d8970dfe30d3ae\` (\`tenantId\`), INDEX \`IDX_fdb3f018c2bba4885bfa5757d1\` (\`organizationId\`), INDEX \`IDX_a28a1682ea80f10d1ecc7babaa\` (\`title\`), INDEX \`IDX_302b60a4970ffe94d5223f1c23\` (\`date\`), INDEX \`IDX_b5525385e85f7429e233d4a0fa\` (\`time\`), INDEX \`IDX_f27285af15ef48363745ab2d79\` (\`type\`), INDEX \`IDX_0e36a2c95e2f1df7f1b3059d24\` (\`source\`), INDEX \`IDX_ffd736f18ba71b3221e4f835a9\` (\`recordedAt\`), INDEX \`IDX_a6f74ae99d549932391f0f4460\` (\`employeeId\`), INDEX \`IDX_5a898f44fa31ef7916f0c38b01\` (\`projectId\`), INDEX \`IDX_4e382caaf07ab0923b2e06bf91\` (\`timeSlotId\`), INDEX \`IDX_2743f8990fde12f9586287eb09\` (\`taskId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`screenshot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`file\` varchar(255) NOT NULL, \`thumb\` varchar(255) NULL, \`recordedAt\` datetime NULL, \`storageProvider\` enum ('LOCAL', 'S3', 'WASABI', 'CLOUDINARY') NULL, \`isWorkRelated\` tinyint NULL, \`description\` varchar(255) NULL, \`apps\` json NULL, \`timeSlotId\` varchar(255) NULL, \`userId\` varchar(255) NULL, INDEX \`IDX_742688858e0484d66f04e4d4c4\` (\`isActive\`), INDEX \`IDX_892e285e1da2b3e61e51e50628\` (\`isArchived\`), INDEX \`IDX_235004f3dafac90692cd64d915\` (\`tenantId\`), INDEX \`IDX_0951aacffe3f8d0cff54cf2f34\` (\`organizationId\`), INDEX \`IDX_3d7feb5fe793e4811cdb79f983\` (\`recordedAt\`), INDEX \`IDX_2b374e5cdee1145ebb2a832f20\` (\`storageProvider\`), INDEX \`IDX_1b0867d86ead2332f3d4edba7d\` (\`isWorkRelated\`), INDEX \`IDX_eea7986acfb827bf5d0622c41f\` (\`description\`), INDEX \`IDX_5b594d02d98d5defcde323abe5\` (\`timeSlotId\`), INDEX \`IDX_fa1896dc735403799311968f7e\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_log\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`startedAt\` datetime NULL, \`stoppedAt\` datetime NULL, \`editedAt\` datetime NULL, \`logType\` varchar(255) NOT NULL DEFAULT 'TRACKED', \`source\` varchar(255) NOT NULL DEFAULT 'BROWSER', \`description\` longtext NULL, \`reason\` varchar(255) NULL, \`isBillable\` tinyint NOT NULL DEFAULT 0, \`isRunning\` tinyint NULL, \`version\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`timesheetId\` varchar(255) NULL, \`projectId\` varchar(255) NULL, \`taskId\` varchar(255) NULL, \`organizationContactId\` varchar(255) NULL, \`organizationTeamId\` varchar(255) NULL, INDEX \`IDX_a1910a76044b971609b75ea165\` (\`isActive\`), INDEX \`IDX_91a64228fbbe1516730a0cab5d\` (\`isArchived\`), INDEX \`IDX_fa9018cb248ea0f3b2b30ef143\` (\`tenantId\`), INDEX \`IDX_aed2d5cc5680fba9d387c7f931\` (\`organizationId\`), INDEX \`IDX_189b79acd611870aba62b3594e\` (\`startedAt\`), INDEX \`IDX_a1f8fcd70164d915fe7dd4a1ec\` (\`stoppedAt\`), INDEX \`IDX_154e9120e2acb632d8bd9b91ff\` (\`editedAt\`), INDEX \`IDX_e80fb588b1086ce2a4f2244814\` (\`logType\`), INDEX \`IDX_402290e7045e0c10ef97d9f982\` (\`source\`), INDEX \`IDX_722b9cb3a991c964d86396b6bc\` (\`isBillable\`), INDEX \`IDX_f447474d185cd70b3015853874\` (\`isRunning\`), INDEX \`IDX_79001d281ecb766005b3d331c1\` (\`version\`), INDEX \`IDX_a89a849957e005bafb8e4220bc\` (\`employeeId\`), INDEX \`IDX_e65393bb52aa8275b1392c73f7\` (\`timesheetId\`), INDEX \`IDX_54776f6f5fd3c13c3bc1fbfac5\` (\`projectId\`), INDEX \`IDX_1ddf2da35e34378fd845d80a18\` (\`taskId\`), INDEX \`IDX_d1e8f22c02c5e949453dde7f2d\` (\`organizationContactId\`), INDEX \`IDX_18dcdf754396f0cb0308dc91f4\` (\`organizationTeamId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_slot\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` int NOT NULL DEFAULT '0', \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`overall\` int NOT NULL DEFAULT '0', \`startedAt\` datetime NOT NULL, \`employeeId\` varchar(255) NOT NULL, INDEX \`IDX_645a6bc3f1141d4a111a3166d8\` (\`isActive\`), INDEX \`IDX_81060c5dbe69efa1f3b6e1a2e5\` (\`isArchived\`), INDEX \`IDX_b8284109257b5137256b5b3e84\` (\`tenantId\`), INDEX \`IDX_b407841271245501dd1a8c7551\` (\`organizationId\`), INDEX \`IDX_0c707825a7c2ecc4e186b07ebf\` (\`duration\`), INDEX \`IDX_f44e721669d5c6bed32cd6a3bf\` (\`overall\`), INDEX \`IDX_c6e7d1075bfd97eea6643b1479\` (\`startedAt\`), INDEX \`IDX_7913305b850c7afc89b6ed96a3\` (\`employeeId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_slot_minute\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`datetime\` datetime NOT NULL, \`timeSlotId\` varchar(255) NOT NULL, INDEX \`IDX_8260fdc7862ca27d8cf10e6290\` (\`isActive\`), INDEX \`IDX_a3eeb9629f550c367bb752855e\` (\`isArchived\`), INDEX \`IDX_c7f72cb68b22b8ab988158e4d2\` (\`tenantId\`), INDEX \`IDX_82c5edbd179359212f16f0d386\` (\`organizationId\`), INDEX \`IDX_9272701d3da8bd8507f316c915\` (\`timeSlotId\`), UNIQUE INDEX \`IDX_0ac1d2777eefcee82db52ca366\` (\`timeSlotId\`, \`datetime\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`timesheet\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`duration\` int NOT NULL DEFAULT '0', \`keyboard\` int NOT NULL DEFAULT '0', \`mouse\` int NOT NULL DEFAULT '0', \`overall\` int NOT NULL DEFAULT '0', \`startedAt\` datetime NULL, \`stoppedAt\` datetime NULL, \`approvedAt\` datetime NULL, \`submittedAt\` datetime NULL, \`lockedAt\` datetime NULL, \`editedAt\` datetime NULL, \`isBilled\` tinyint NOT NULL DEFAULT 0, \`status\` varchar(255) NOT NULL DEFAULT 'PENDING', \`employeeId\` varchar(255) NOT NULL, \`approvedById\` varchar(255) NULL, INDEX \`IDX_42205a9e6af108364e5cc62dd4\` (\`isActive\`), INDEX \`IDX_f2d4cd3a7e839bfc7cb6b993ff\` (\`isArchived\`), INDEX \`IDX_25b8df69c9b7f5752c6a6a6ef7\` (\`tenantId\`), INDEX \`IDX_aca65a79fe0c1ec9e6a59022c5\` (\`organizationId\`), INDEX \`IDX_930e2b28de9ecb1ea689d5a97a\` (\`startedAt\`), INDEX \`IDX_f6558fbb3158ab90da1c41d943\` (\`stoppedAt\`), INDEX \`IDX_6a79eb7534066b11f59243ede1\` (\`approvedAt\`), INDEX \`IDX_3f8fc4b5718fcaa913f9438e27\` (\`submittedAt\`), INDEX \`IDX_3502c60f98a7cda58dea75bcb5\` (\`lockedAt\`), INDEX \`IDX_ea81b5247ecdf5d82cf71fa096\` (\`editedAt\`), INDEX \`IDX_c828facbb4250117f83416d9f7\` (\`isBilled\`), INDEX \`IDX_23fdffa8369387d87101090684\` (\`status\`), INDEX \`IDX_8c8f821cb0fe0dd387491ea7d9\` (\`employeeId\`), INDEX \`IDX_6c1f81934a3f597b3b1a17f562\` (\`approvedById\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`user_organization\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`isDefault\` tinyint NOT NULL DEFAULT 1, \`userId\` varchar(255) NOT NULL, INDEX \`IDX_ca24fc59aac015d9660955f5f6\` (\`isActive\`), INDEX \`IDX_c764336019c69cc4927f317cb0\` (\`isArchived\`), INDEX \`IDX_611e1392c8cc9b101e3ea7ad80\` (\`tenantId\`), INDEX \`IDX_7143f31467178a6164a42426c1\` (\`organizationId\`), INDEX \`IDX_1f97ff07fb198bd0a7786b2abd\` (\`isDefault\`), INDEX \`IDX_29c3c8cc3ea9db22e4a347f4b5\` (\`userId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`user\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`thirdPartyId\` varchar(255) NULL, \`firstName\` varchar(255) NULL, \`lastName\` varchar(255) NULL, \`email\` varchar(255) NULL, \`phoneNumber\` varchar(255) NULL, \`username\` varchar(255) NULL, \`timeZone\` varchar(255) NULL, \`hash\` varchar(255) NULL, \`refreshToken\` varchar(255) NULL, \`imageUrl\` varchar(500) NULL, \`preferredLanguage\` varchar(255) NULL DEFAULT 'en', \`preferredComponentLayout\` enum ('CARDS_GRID', 'TABLE') NULL DEFAULT 'TABLE', \`code\` varchar(255) NULL, \`codeExpireAt\` datetime NULL, \`emailVerifiedAt\` datetime NULL, \`emailToken\` varchar(255) NULL, \`roleId\` varchar(255) NULL, \`imageId\` varchar(255) NULL, INDEX \`IDX_fde2ce12ab12b02ae583dd76c7\` (\`isActive\`), INDEX \`IDX_557cb712d32a9ad9ffbb4cd50d\` (\`isArchived\`), INDEX \`IDX_685bf353c85f23b6f848e4dcde\` (\`tenantId\`), INDEX \`IDX_19de43e9f1842360ce646253d7\` (\`thirdPartyId\`), INDEX \`IDX_58e4dbff0e1a32a9bdc861bb29\` (\`firstName\`), INDEX \`IDX_f0e1b4ecdca13b177e2e3a0613\` (\`lastName\`), INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` (\`email\`), INDEX \`IDX_f2578043e491921209f5dadd08\` (\`phoneNumber\`), INDEX \`IDX_78a916df40e02a9deb1c4b75ed\` (\`username\`), INDEX \`IDX_c28e52f758e7bbc53828db9219\` (\`roleId\`), INDEX \`IDX_5e028298e103e1694147ada69e\` (\`imageId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`warehouse_product\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`quantity\` decimal NULL DEFAULT '0', \`warehouseId\` varchar(255) NOT NULL, \`productId\` varchar(255) NOT NULL, INDEX \`IDX_7a584a02d15a022e9c4f06ea72\` (\`isActive\`), INDEX \`IDX_3370818c940a51996d80bb4d16\` (\`isArchived\`), INDEX \`IDX_62573a939f834f2de343f98288\` (\`tenantId\`), INDEX \`IDX_c899e17322d11e1977832e8c65\` (\`organizationId\`), INDEX \`IDX_a8c9aee14d47ec7b3f2ac429eb\` (\`warehouseId\`), INDEX \`IDX_3f934c4772e7c7f2c66d7ea4e7\` (\`productId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`warehouse_product_variant\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`quantity\` decimal NULL DEFAULT '0', \`variantId\` varchar(255) NOT NULL, \`warehouseProductId\` varchar(255) NOT NULL, INDEX \`IDX_5f32a52e9bd19bf323b02efcd1\` (\`isActive\`), INDEX \`IDX_40aa52eaed1ce133f5fee76bca\` (\`isArchived\`), INDEX \`IDX_a1c4a97b928b547c3041d3ac1f\` (\`tenantId\`), INDEX \`IDX_d5f4b64e6a80546fd6dd4ac3ed\` (\`organizationId\`), INDEX \`IDX_a2f863689d1316810c41c1ea38\` (\`variantId\`), INDEX \`IDX_617306cb3613dd8d59301ae16f\` (\`warehouseProductId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`warehouse\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`code\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`active\` tinyint NOT NULL DEFAULT 1, \`logoId\` varchar(255) NULL, \`contactId\` varchar(255) NULL, INDEX \`IDX_ee85901ae866ffe2061d5b35c8\` (\`isActive\`), INDEX \`IDX_835691d3dd62d0b705302cbb2d\` (\`isArchived\`), INDEX \`IDX_9b2f00761a6b1b77cb6289e3ff\` (\`tenantId\`), INDEX \`IDX_f5735eafddabdb4b20f621a976\` (\`organizationId\`), INDEX \`IDX_f502dc6d9802306f9d1584932b\` (\`logoId\`), INDEX \`IDX_84594016a98da8b87e0f51cd93\` (\`contactId\`), UNIQUE INDEX \`REL_84594016a98da8b87e0f51cd93\` (\`contactId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`knowledge_base\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`flag\` varchar(255) NOT NULL, \`icon\` varchar(255) NOT NULL, \`privacy\` varchar(255) NOT NULL, \`language\` varchar(255) NOT NULL, \`color\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`data\` varchar(255) NULL, \`index\` int NULL, \`parentId\` varchar(255) NULL, INDEX \`IDX_9b22423b8cb20087c16613ecba\` (\`isActive\`), INDEX \`IDX_0765098c5a6f93f51a55bda026\` (\`isArchived\`), INDEX \`IDX_bcb30c9893f4c8d0c4e556b4ed\` (\`tenantId\`), INDEX \`IDX_2ba72a9dec732a10e8c05bcdec\` (\`organizationId\`), INDEX \`IDX_ff979040ce93cbc60863d322ec\` (\`parentId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`knowledge_base_article\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`name\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, \`data\` varchar(255) NULL, \`draft\` tinyint NOT NULL, \`privacy\` tinyint NOT NULL, \`index\` int NOT NULL, \`categoryId\` varchar(255) NOT NULL, INDEX \`IDX_1544c43e36e1ccf7d578c70607\` (\`isActive\`), INDEX \`IDX_e9720156c57ff1ad841e95ace7\` (\`isArchived\`), INDEX \`IDX_06a9902fedc1f9dcdbaf14afb0\` (\`tenantId\`), INDEX \`IDX_3547f82f867489542ceae58a49\` (\`organizationId\`), INDEX \`IDX_66af194845635058239e794e1b\` (\`categoryId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`knowledge_base_author\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`employeeId\` varchar(255) NOT NULL, \`articleId\` varchar(255) NOT NULL, INDEX \`IDX_b9623984c84eb7be4c0eb076c2\` (\`isActive\`), INDEX \`IDX_a9130ad7824fb843f06103971e\` (\`isArchived\`), INDEX \`IDX_1551e821871d9230cc0dafbbe5\` (\`tenantId\`), INDEX \`IDX_81558bb2bef673628d92540b4e\` (\`organizationId\`), INDEX \`IDX_8eb7e413257d7a26104f4e326f\` (\`employeeId\`), INDEX \`IDX_2d5ecab1f06b327bad54553614\` (\`articleId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`changelog\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`deletedAt\` datetime(6) NULL, \`isActive\` tinyint NULL DEFAULT 1, \`isArchived\` tinyint NULL DEFAULT 0, \`tenantId\` varchar(255) NULL, \`organizationId\` varchar(255) NULL, \`icon\` varchar(255) NULL, \`title\` varchar(255) NULL, \`date\` datetime NOT NULL, \`content\` varchar(255) NOT NULL, \`isFeature\` tinyint NULL, \`learnMoreUrl\` varchar(255) NULL, \`imageUrl\` varchar(255) NULL, INDEX \`IDX_cc89233c87fcf64b01df07e038\` (\`isActive\`), INDEX \`IDX_cbc2b8338d45e774afd8682ffe\` (\`isArchived\`), INDEX \`IDX_744268ee0ec6073883267bc3b6\` (\`tenantId\`), INDEX \`IDX_c2037b621d2e8023898aee4ac7\` (\`organizationId\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_candidate\` (\`candidateId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_34e4625cc9b010079f1b5758b3\` (\`candidateId\`), INDEX \`IDX_7e0891bb331b08bd4abb6776b7\` (\`tagId\`), PRIMARY KEY (\`candidateId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_job_preset\` (\`jobPresetId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_7ae5b4d4bdec77971dab319f2e\` (\`jobPresetId\`), INDEX \`IDX_68e75e49f06409fd385b4f8774\` (\`employeeId\`), PRIMARY KEY (\`jobPresetId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_employee_level\` (\`employeeLevelId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_b3565ff8073d4f66c46d27fe88\` (\`employeeLevelId\`), INDEX \`IDX_f3caf4cc158fe8b8e06578e792\` (\`tagId\`), PRIMARY KEY (\`employeeLevelId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_project_employee\` (\`employeeId\` varchar(36) NOT NULL, \`organizationProjectId\` varchar(36) NOT NULL, INDEX \`IDX_6b5b0c3d994f59d9c800922257\` (\`employeeId\`), INDEX \`IDX_2ba868f42c2301075b7c141359\` (\`organizationProjectId\`), PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_employee\` (\`employeeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e0ddfccfe9816681c410ebf2b9\` (\`employeeId\`), INDEX \`IDX_b1ffe2a63a48b486e18dc59d1b\` (\`tagId\`), PRIMARY KEY (\`employeeId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_off_policy_employee\` (\`employeeId\` varchar(36) NOT NULL, \`timeOffPolicyId\` varchar(36) NOT NULL, INDEX \`IDX_c451f53f5a6cd97db94e1c9482\` (\`employeeId\`), INDEX \`IDX_0f823750ac5a7d899cc5d8d040\` (\`timeOffPolicyId\`), PRIMARY KEY (\`employeeId\`, \`timeOffPolicyId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_off_request_employee\` (\`employeeId\` varchar(36) NOT NULL, \`timeOffRequestId\` varchar(36) NOT NULL, INDEX \`IDX_cd312469204347b1210397770a\` (\`employeeId\`), INDEX \`IDX_0a8cf0aacf95ce66e73e75a95c\` (\`timeOffRequestId\`), PRIMARY KEY (\`employeeId\`, \`timeOffRequestId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`employee_tasks_task\` (\`employeeId\` varchar(36) NOT NULL, \`taskId\` varchar(36) NOT NULL, INDEX \`IDX_eae5eea1c6a3fcf4a2c95f1a5f\` (\`employeeId\`), INDEX \`IDX_6bbbe677c5fc5115916b4eccfb\` (\`taskId\`), PRIMARY KEY (\`employeeId\`, \`taskId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`equipment_shares_employees\` (\`equipmentSharingId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_8676224f55a965c53e4bb7cbf8\` (\`equipmentSharingId\`), INDEX \`IDX_57f6461f1a710f0f4abdcb8d0e\` (\`employeeId\`), PRIMARY KEY (\`equipmentSharingId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`equipment_shares_teams\` (\`equipmentSharingId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_f84171695b7aedfc454483bcf2\` (\`equipmentSharingId\`), INDEX \`IDX_7ccef49dd56c8c74daa8d12186\` (\`organizationTeamId\`), PRIMARY KEY (\`equipmentSharingId\`, \`organizationTeamId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_equipment\` (\`equipmentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_bb0062d51a75164fcb64041ee7\` (\`equipmentId\`), INDEX \`IDX_0360b8197c2a38d6fe882cb1af\` (\`tagId\`), PRIMARY KEY (\`equipmentId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_event_type\` (\`eventTypeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_094af399a26d4a1d3ae17ea11e\` (\`eventTypeId\`), INDEX \`IDX_34b8f471aac00eaec6f2830e5b\` (\`tagId\`), PRIMARY KEY (\`eventTypeId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_expense_category\` (\`expenseCategoryId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_107a93f89c8f31f4386ae4b19d\` (\`expenseCategoryId\`), INDEX \`IDX_727dbf5e1100023681e216d6a9\` (\`tagId\`), PRIMARY KEY (\`expenseCategoryId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_expense\` (\`expenseId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_6f1108552ea7a70a4d958b338c\` (\`expenseId\`), INDEX \`IDX_8dcfbd0d960672fefe681bcba9\` (\`tagId\`), PRIMARY KEY (\`expenseId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_income\` (\`incomeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_55c9568ebe1c4addc3deb6922e\` (\`incomeId\`), INDEX \`IDX_00e2fd30761a36911648166044\` (\`tagId\`), PRIMARY KEY (\`incomeId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`integration_integration_type\` (\`integrationId\` varchar(36) NOT NULL, \`integrationTypeId\` varchar(36) NOT NULL, INDEX \`IDX_34c86921ee9b462bc5c7b61fad\` (\`integrationId\`), INDEX \`IDX_8dd2062499a6c2a708ddd05650\` (\`integrationTypeId\`), PRIMARY KEY (\`integrationId\`, \`integrationTypeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_integration\` (\`integrationId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_c9a85b16615bc5c3035802adb0\` (\`integrationId\`), INDEX \`IDX_0f19ad9872190b7a67a9652d5e\` (\`tagId\`), PRIMARY KEY (\`integrationId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invite_organization_project\` (\`inviteId\` varchar(36) NOT NULL, \`organizationProjectId\` varchar(36) NOT NULL, INDEX \`IDX_020325728f0979a2822a829565\` (\`inviteId\`), INDEX \`IDX_f2806968dd846cb49fcdac195a\` (\`organizationProjectId\`), PRIMARY KEY (\`inviteId\`, \`organizationProjectId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invite_organization_contact\` (\`inviteId\` varchar(36) NOT NULL, \`organizationContactId\` varchar(36) NOT NULL, INDEX \`IDX_a0c92b6393c7a13266003d552e\` (\`inviteId\`), INDEX \`IDX_c5a147ce2a0ec69ccc61149262\` (\`organizationContactId\`), PRIMARY KEY (\`inviteId\`, \`organizationContactId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invite_organization_department\` (\`inviteId\` varchar(36) NOT NULL, \`organizationDepartmentId\` varchar(36) NOT NULL, INDEX \`IDX_0935b93b3498a0f98db1af7176\` (\`inviteId\`), INDEX \`IDX_fe2eea7a939442efde885303ef\` (\`organizationDepartmentId\`), PRIMARY KEY (\`inviteId\`, \`organizationDepartmentId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`invite_organization_team\` (\`inviteId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_104140c94e838a058a34b30a09\` (\`inviteId\`), INDEX \`IDX_1132ec0c3618e53fc8cf7ed669\` (\`organizationTeamId\`), PRIMARY KEY (\`inviteId\`, \`organizationTeamId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_invoice\` (\`invoiceId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_5a07958d7c6253b311dbdc34ff\` (\`invoiceId\`), INDEX \`IDX_0728fc2cc26e8802cbf41aaf27\` (\`tagId\`), PRIMARY KEY (\`invoiceId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_merchant\` (\`merchantId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e7d60a4e9906d056a8966e279f\` (\`merchantId\`), INDEX \`IDX_4af822b453c7d7d5f033e6ea16\` (\`tagId\`), PRIMARY KEY (\`merchantId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`warehouse_merchant\` (\`merchantId\` varchar(36) NOT NULL, \`warehouseId\` varchar(36) NOT NULL, INDEX \`IDX_812f0cfb560ac6dda0d1345765\` (\`merchantId\`), INDEX \`IDX_a6bfc0dc6e5234e8e7ef698a36\` (\`warehouseId\`), PRIMARY KEY (\`merchantId\`, \`warehouseId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_contact\` (\`organizationContactId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1fb664a63f20bea6a3f0b38771\` (\`organizationContactId\`), INDEX \`IDX_8a06f5aded97d1b5e81005e121\` (\`tagId\`), PRIMARY KEY (\`organizationContactId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_contact_employee\` (\`organizationContactId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_beffeb7f338fa98354948c0789\` (\`organizationContactId\`), INDEX \`IDX_cd2bd8302bfb6093d0908c36dc\` (\`employeeId\`), PRIMARY KEY (\`organizationContactId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_department\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_c2c9cd2ea533d5442de455fb3e\` (\`organizationDepartmentId\`), INDEX \`IDX_0eb285a6b1ac7e3d0a542e50a4\` (\`tagId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_department_employee\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_c34e79a3aa682bbd3f0e8cf4c4\` (\`organizationDepartmentId\`), INDEX \`IDX_0d4f83695591ae3c98a0544ac8\` (\`employeeId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_department\` (\`organizationDepartmentId\` varchar(36) NOT NULL, \`candidateId\` varchar(36) NOT NULL, INDEX \`IDX_c58533f9ba63f42fef682e1ee7\` (\`organizationDepartmentId\`), INDEX \`IDX_ef6e8d34b95dcb2b21d5de08a6\` (\`candidateId\`), PRIMARY KEY (\`organizationDepartmentId\`, \`candidateId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_employment_type\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_41a87d3cfa58c851bbf03ad4e8\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_904a731b2ae6bc1aa52c8302a9\` (\`tagId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_employment_type_employee\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_3bfdb894d67e6a29aa95780bb4\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_3ed17d3e624435e9f2ad71e058\` (\`employeeId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`candidate_employment_type\` (\`organizationEmploymentTypeId\` varchar(36) NOT NULL, \`candidateId\` varchar(36) NOT NULL, INDEX \`IDX_b4b51067c538f78b8585ef2a17\` (\`organizationEmploymentTypeId\`), INDEX \`IDX_8c5db3a96baffba025729ebe86\` (\`candidateId\`), PRIMARY KEY (\`organizationEmploymentTypeId\`, \`candidateId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_position\` (\`organizationPositionId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1f7e0230bc542d703781020378\` (\`organizationPositionId\`), INDEX \`IDX_c71c381e77b0543ed4023aeef7\` (\`tagId\`), PRIMARY KEY (\`organizationPositionId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_project\` (\`organizationProjectId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_b69fa5d1b1d02cdbe301ea6b10\` (\`organizationProjectId\`), INDEX \`IDX_18be859b371e9159dfc2cecbe1\` (\`tagId\`), PRIMARY KEY (\`organizationProjectId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_project_team\` (\`organizationProjectId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_7c31431ff2173c2c939a0aa036\` (\`organizationProjectId\`), INDEX \`IDX_599a5f7f6c190822dcfdbbb6eb\` (\`organizationTeamId\`), PRIMARY KEY (\`organizationProjectId\`, \`organizationTeamId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_team\` (\`organizationTeamId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_4b5e0ca086e6124eeddf84252f\` (\`organizationTeamId\`), INDEX \`IDX_2382356b63c832a137079210bd\` (\`tagId\`), PRIMARY KEY (\`organizationTeamId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`organization_team_tasks_task\` (\`organizationTeamId\` varchar(36) NOT NULL, \`taskId\` varchar(36) NOT NULL, INDEX \`IDX_2a6fb43dc7e7aebcda95e32a10\` (\`organizationTeamId\`), INDEX \`IDX_d15fbe1e1d9c1f56651d8d3831\` (\`taskId\`), PRIMARY KEY (\`organizationTeamId\`, \`taskId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization_vendor\` (\`organizationVendorId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_7dde3307daf6d6dec1513ecc56\` (\`organizationVendorId\`), INDEX \`IDX_f71369c1cb86ae9fd4d5452f9a\` (\`tagId\`), PRIMARY KEY (\`organizationVendorId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_organization\` (\`organizationId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_7ca79ff010025397cf9f216bde\` (\`organizationId\`), INDEX \`IDX_f5e70849adc6f2f81fcbccae77\` (\`tagId\`), PRIMARY KEY (\`organizationId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_payment\` (\`paymentId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_1fcb2a337ee905ab36c4aea3a3\` (\`paymentId\`), INDEX \`IDX_e087c0540b5098d115b50d954c\` (\`tagId\`), PRIMARY KEY (\`paymentId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_variant_options_product_option\` (\`productVariantId\` varchar(36) NOT NULL, \`productOptionId\` varchar(36) NOT NULL, INDEX \`IDX_526f0131260eec308a3bd2b61b\` (\`productVariantId\`), INDEX \`IDX_e96a71affe63c97f7fa2f076da\` (\`productOptionId\`), PRIMARY KEY (\`productVariantId\`, \`productOptionId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_product\` (\`productId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_e516b4a2a1a8d4beda7217eeac\` (\`productId\`), INDEX \`IDX_f75a28915b38d926902c0f85b2\` (\`tagId\`), PRIMARY KEY (\`productId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`product_gallery_item\` (\`productId\` varchar(36) NOT NULL, \`imageAssetId\` varchar(36) NOT NULL, INDEX \`IDX_f7187fa710c6a5d22f46192637\` (\`productId\`), INDEX \`IDX_825848065557eac3678b164cee\` (\`imageAssetId\`), PRIMARY KEY (\`productId\`, \`imageAssetId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_proposal\` (\`proposalId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_3f55851a03524e567594d50774\` (\`proposalId\`), INDEX \`IDX_451853704de278eef61a37fa7a\` (\`tagId\`), PRIMARY KEY (\`proposalId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_request_approval\` (\`requestApprovalId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_74938a30181630c480b36e27d7\` (\`requestApprovalId\`), INDEX \`IDX_6c6576bff4b497a4975337fa5e\` (\`tagId\`), PRIMARY KEY (\`requestApprovalId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`skill_employee\` (\`skillId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_e699b50ca468e75bbd36913dcc\` (\`skillId\`), INDEX \`IDX_760034f54e598d519b5f0c4ece\` (\`employeeId\`), PRIMARY KEY (\`skillId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`skill_organization\` (\`skillId\` varchar(36) NOT NULL, \`organizationId\` varchar(36) NOT NULL, INDEX \`IDX_61593ade5fed9445738ddbe39c\` (\`skillId\`), INDEX \`IDX_b65cfda00c52e1fc26cc96e52c\` (\`organizationId\`), PRIMARY KEY (\`skillId\`, \`organizationId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_task\` (\`taskId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_4b4e8f61e866248f2ddf8ce181\` (\`taskId\`), INDEX \`IDX_bf7c34187a346f499e4dbc4b08\` (\`tagId\`), PRIMARY KEY (\`taskId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_employee\` (\`taskId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_790858593698e54cba501eb690\` (\`taskId\`), INDEX \`IDX_f38b1bd46f8831704348003bbf\` (\`employeeId\`), PRIMARY KEY (\`taskId\`, \`employeeId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`task_team\` (\`taskId\` varchar(36) NOT NULL, \`organizationTeamId\` varchar(36) NOT NULL, INDEX \`IDX_47689f911b0cbb16c94a56a9c5\` (\`taskId\`), INDEX \`IDX_0ef34c9f9d6dc8d14f1fbb10e8\` (\`organizationTeamId\`), PRIMARY KEY (\`taskId\`, \`organizationTeamId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`time_slot_time_logs\` (\`timeSlotId\` varchar(36) NOT NULL, \`timeLogId\` varchar(36) NOT NULL, INDEX \`IDX_63c61a88461ff5c115c3b6bcde\` (\`timeSlotId\`), INDEX \`IDX_2fc2675c79cb3cbceb32bf2dc7\` (\`timeLogId\`), PRIMARY KEY (\`timeSlotId\`, \`timeLogId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_user\` (\`userId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_6a58ed56a12604c076a8e0cfda\` (\`userId\`), INDEX \`IDX_e64a306f3215dbb99bbb26ca59\` (\`tagId\`), PRIMARY KEY (\`userId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `CREATE TABLE \`tag_warehouse\` (\`warehouseId\` varchar(36) NOT NULL, \`tagId\` varchar(36) NOT NULL, INDEX \`IDX_08385e1e045b83d25978568743\` (\`warehouseId\`), INDEX \`IDX_3557d514afd3794d40128e0542\` (\`tagId\`), PRIMARY KEY (\`warehouseId\`, \`tagId\`)) ENGINE=InnoDB` + ); + await queryRunner.query( + `ALTER TABLE \`accounting_template\` ADD CONSTRAINT \`FK_2ca6a49062a4ed884e413bf572e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`accounting_template\` ADD CONSTRAINT \`FK_e66511b175393255c6c4e7b007f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_2c0494466d5a7e1165cea3dca98\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_3c3a62226896345c4716bfe1d96\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_0ddc50b7521b9a905d9ca8c8ba3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` ADD CONSTRAINT \`FK_e9ca170a0fae05e44a9bd137d8b\` FOREIGN KEY (\`employeeAppointmentId\`) REFERENCES \`employee_appointment\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`approval_policy\` ADD CONSTRAINT \`FK_1462391059ebe137645098d7276\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`approval_policy\` ADD CONSTRAINT \`FK_dfe3b357df3ce136917b1f09843\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_f008a481cb4eed547704bb9d839\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_d544bd3a63634a4438509ac958d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` ADD CONSTRAINT \`FK_46ed3c2287423f5dc089100feeb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_9d5bd131452ef689df2b46551b4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_b106406e94bb7317493efc2c989\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_d1d16bc87d3afaf387f34cdceb7\` FOREIGN KEY (\`technologyId\`) REFERENCES \`candidate_technology\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_ba4c376b2069aa82745d4e96822\` FOREIGN KEY (\`personalQualityId\`) REFERENCES \`candidate_personal_quality\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` ADD CONSTRAINT \`FK_159f821dd214792f1d2ad9cff7c\` FOREIGN KEY (\`feedbackId\`) REFERENCES \`candidate_feedback\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_4d9b7ab09f9f9517d488b5fed1e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_d108a827199fda86a9ec216989a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` ADD CONSTRAINT \`FK_3f9053719c9d11ebdea03e5a2d4\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_00cdd9ed7571be8e2c8d09e7cd4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_f660af89b2c69fea2334508cbbd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` ADD CONSTRAINT \`FK_59b61ba52a58851cfc85b1e6c66\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_8dcf5fc8bc7f77a80b0fc648bfc\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_a50eb955f940ca93e044d175c62\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` ADD CONSTRAINT \`FK_cf75465b3663652a28cf1841ce2\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_6cb21fa0f65ff69679966c836f2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_3a6928f8501fce33820721a8fe8\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_98c008fd8cf597e83dcdccfd161\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_0862c274d336126b951bfe009a7\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` ADD CONSTRAINT \`FK_44f3d80c3293e1de038c87f115d\` FOREIGN KEY (\`interviewerId\`) REFERENCES \`candidate_interviewer\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_59b765e6d13d83dba4852a43eb5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_03be41e88b1fecfe4e24d6b04b2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` ADD CONSTRAINT \`FK_91996439c4baafee8395d3df153\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_f0ca69c78eea92c95d9044764a2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_5f1e315db848990dfffa72817ca\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_ecb65075e94b47bbab11cfa5a1e\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` ADD CONSTRAINT \`FK_9e7b20eb3dfa082b83b198fdad4\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_045de7c208adcd0c68c0a651748\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_d321f4547ed467d07cce1e7d9a5\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` ADD CONSTRAINT \`FK_a0d171f45bdbcf2b990c0c37c32\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_8a07f780c6fce2b82830ab06877\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_d7986743e7f11720349a6c95572\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_skill\` ADD CONSTRAINT \`FK_492548e6c176f5655adfae9f5ea\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_source\` ADD CONSTRAINT \`FK_b2a1ba27a76dd819cd8294cce38\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_source\` ADD CONSTRAINT \`FK_e92027b5280828cadd7cd6ea719\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_a6fecb615b07987b480defac647\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_9d46b8c5382acd4d4514bc5c62e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` ADD CONSTRAINT \`FK_063663c7e61e45d172d1b832656\` FOREIGN KEY (\`interviewId\`) REFERENCES \`candidate_interview\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_77ac426e04553ff1654421bce4d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_16fb27ffd1a99c6506c92ad57a7\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_b674793a804b7d69d74c8f6c5ba\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_1e3e8228e7df634fa4cec6322c7\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_4ea108fd8b089237964d5f98fba\` FOREIGN KEY (\`sourceId\`) REFERENCES \`candidate_source\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_3930aa71e0fa24f09201811b1bb\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`candidate\` ADD CONSTRAINT \`FK_8b900e8a39f76125e610ab30c0e\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`contact\` ADD CONSTRAINT \`FK_60468af1ce34043a900809c84f2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`contact\` ADD CONSTRAINT \`FK_7719d73cd16a9f57ecc6ac24b3d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`custom_smtp\` ADD CONSTRAINT \`FK_2aa3fc8daa25beec4788d2be26c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`custom_smtp\` ADD CONSTRAINT \`FK_15a1306132d66c63ef31f7288c1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_46a3c00bfc3e36b4412d8bcdb08\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_38fb85abdf9995efcf217f59554\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_4b1ff44e6bae5065429dbab554b\` FOREIGN KEY (\`createdByUserId\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_9211f5b62988df6e95522be7daa\` FOREIGN KEY (\`stageId\`) REFERENCES \`pipeline_stage\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`deal\` ADD CONSTRAINT \`FK_1ae3abc0ae1dcf6c13f49b62b56\` FOREIGN KEY (\`clientId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_0af511c44de7a16beb45cc37852\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_525f4873c6edc3d94559f88900c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_1261c457b3035b77719556995bf\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_sent\` ADD CONSTRAINT \`FK_9033faf41b23c61ba201c487969\` FOREIGN KEY (\`emailTemplateId\`) REFERENCES \`email_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_reset\` ADD CONSTRAINT \`FK_93799dfaeff51de06f1e02ac414\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_reset\` ADD CONSTRAINT \`FK_e37af4ab2ba0bf268bfd9826345\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_template\` ADD CONSTRAINT \`FK_753e005a45556b5909e11937aaf\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`email_template\` ADD CONSTRAINT \`FK_c160fe6234675fac031aa3e7c50\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_a35637bb659c59e18adb4f38f87\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_86cf36c137712e779dd7e2301e6\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` ADD CONSTRAINT \`FK_2f58132c57108540887dc3e88eb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_91e0f7efcd17d20b5029fb1342d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_caf8363b0ed7d5f24ae866ba3bb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_award\` ADD CONSTRAINT \`FK_0c5266f3f488add404f92d56ec7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_afe6c40d3d9951388fa05f83f28\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_630337302efe97cc93deeb21516\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_2dc73e07ac7040f273cea3c999d\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_c872e6e3ab28e813c2324d1f4fb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_b6bcd5ceb60e4bb493344a6b4f2\` FOREIGN KEY (\`occupationId\`) REFERENCES \`job_search_occupation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d2b148ddd67e520fb8061f4c133\` FOREIGN KEY (\`categoryId\`) REFERENCES \`job_search_category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_2323220b4decfd2f4d8307fd78f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d5ca48cfacfb516543d6507ca4a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_9a687ce1a10a3abda460922cf84\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_d45b36b85ffbd5189f7e70f29f5\` FOREIGN KEY (\`occupationId\`) REFERENCES \`job_search_occupation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` ADD CONSTRAINT \`FK_b909a3df761d7e489aca80f138a\` FOREIGN KEY (\`categoryId\`) REFERENCES \`job_search_category\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset\` ADD CONSTRAINT \`FK_7e53ea80aca15da11a8a5ec0380\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset\` ADD CONSTRAINT \`FK_a4b038417e3221c0791dd8c7714\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_category\` ADD CONSTRAINT \`FK_35e120f2b6e5188391cf068d3ba\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_category\` ADD CONSTRAINT \`FK_86381fb6d28978b101b3aec8ca4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_occupation\` ADD CONSTRAINT \`FK_44e22d88b47daf2095491b7cac3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_occupation\` ADD CONSTRAINT \`FK_1a62a99e1016e4a2b461e886ecd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_level\` ADD CONSTRAINT \`FK_d3fc52d497bc44d6f493dbedc3a\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_level\` ADD CONSTRAINT \`FK_c4668533292bf4526e61aedf74a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_d543336994b1f764c449e0b1d3c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_0f9cefa604913e1ab3225915469\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_phone\` ADD CONSTRAINT \`FK_329ebd01a757d1a0c3c4d628e29\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_f577c9bc6183c1d1eae1e154bbc\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_ee780fbd8f91de31c004929eecb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` ADD CONSTRAINT \`FK_2be728a7f8b118712a4200990d4\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_5fde7be40b3c03bc0fdac0c2f66\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_3ee5147bb1fde625fa33c0e956b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` ADD CONSTRAINT \`FK_0ac8526c48a3daa267c86225fb5\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_9516a627a131626d2a5738a05a8\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_56e96cd218a185ed59b5a8e7869\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_setting\` ADD CONSTRAINT \`FK_95ea18af6ef8123503d332240c2\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_4b3303a6b7eb92d237a4379734e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_c6a48286f3aa8ae903bee0d1e72\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_f4b0d329c4a3cf79ffe9d565047\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_1c0c1370ecd98040259625e17e2\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee\` ADD CONSTRAINT \`FK_5e719204dcafa8d6b2ecdeda130\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing_policy\` ADD CONSTRAINT \`FK_5443ca8ed830626656d8cfecef7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing_policy\` ADD CONSTRAINT \`FK_5311a833ff255881454bd5b3b58\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_fa525e61fb3d8d9efec0f364a4b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_ea9254be07ae4a8604f0aaab196\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_acad51a6362806fc499e583e402\` FOREIGN KEY (\`equipmentId\`) REFERENCES \`equipment\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` ADD CONSTRAINT \`FK_0ecfe0ce0cd2b197249d5f1c105\` FOREIGN KEY (\`equipmentSharingPolicyId\`) REFERENCES \`equipment_sharing_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_fb6808468066849ab7b7454d5f3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_f98ce0d210aa9f91b729d447806\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment\` ADD CONSTRAINT \`FK_0ab80a66282582ae8b0282508e7\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`estimate_email\` ADD CONSTRAINT \`FK_391d3f83244fea73c619aecadd9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`estimate_email\` ADD CONSTRAINT \`FK_233c1d351d63441aeb039d1164f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_92fc62260c0c7ff108622850bff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_fc8818d6fde74370ec703a01352\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`event_type\` ADD CONSTRAINT \`FK_24d905ec9e127ade23754a363dd\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense_category\` ADD CONSTRAINT \`FK_37504e920ee5ca46a4000b89da5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense_category\` ADD CONSTRAINT \`FK_9c9bfe5baaf83f53533ff035fc0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_6d171c9d5f81095436b99da5e62\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_c5fb146726ff128e600f23d0a1b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_5e7b197dbac69012dbdb4964f37\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_eacb116ab0521ad9b96f2bb53ba\` FOREIGN KEY (\`vendorId\`) REFERENCES \`organization_vendor\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_42eea5debc63f4d1bf89881c10a\` FOREIGN KEY (\`categoryId\`) REFERENCES \`expense_category\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_9971c4171ae051e74b833984a30\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`expense\` ADD CONSTRAINT \`FK_047b8b5c0782d5a6d4c8bfc1a4e\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`import-history\` ADD CONSTRAINT \`FK_54868607115e2fee3b0b764eec2\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`import-record\` ADD CONSTRAINT \`FK_a43b235c35c2c4d3263ada770c6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_8f71803d96dcdbcc6b19bb28d38\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_6a94e6b0a572f591288ac44a421\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` ADD CONSTRAINT \`FK_6d413f9fdd5366b1b9add464836\` FOREIGN KEY (\`featureId\`) REFERENCES \`feature\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`feature\` ADD CONSTRAINT \`FK_d4a28a8e70d450a412bf0cfb52a\` FOREIGN KEY (\`parentId\`) REFERENCES \`feature\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_general_setting\` ADD CONSTRAINT \`FK_d17a5159d888ac6320459eda392\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_general_setting\` ADD CONSTRAINT \`FK_e35d0f7b794ca8850669d12c78c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_cc72d4e8e4284dcc8ffbf96caf4\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_df7ab026698c02859ff75408093\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` ADD CONSTRAINT \`FK_f69e740b066c6469d1c68a4a28b\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_43aa2985216560cd9fa93f501e5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_e49e37fe88a2725a38a3b058493\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi\` ADD CONSTRAINT \`FK_d4f093ca4eb7c40db68d9a789d0\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_template\` ADD CONSTRAINT \`FK_774bf82989475befe301fe1bca5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_template\` ADD CONSTRAINT \`FK_5708fe06608c72fc77b65ae6519\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal_time_frame\` ADD CONSTRAINT \`FK_b56723b53a76ca1c171890c479b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal_time_frame\` ADD CONSTRAINT \`FK_405bc5bba9ed71aefef84a29f10\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_6b4758a5442713070c9a366d0e5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_c6e8ae55a4db3584686cbf6afe1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_ac161c1a0c0ff8e83554f097e5e\` FOREIGN KEY (\`ownerTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_35526ff1063ab5fa2b20e71bd66\` FOREIGN KEY (\`ownerEmployeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_af0a11734e70412b742ac339c88\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`goal\` ADD CONSTRAINT \`FK_4c8b4e887a994182fd6132e6400\` FOREIGN KEY (\`alignedKeyResultId\`) REFERENCES \`key_result\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`image_asset\` ADD CONSTRAINT \`FK_01856a9a730b7e79d70aa661cb0\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`image_asset\` ADD CONSTRAINT \`FK_d3675304df9971cccf96d9a7c34\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`income\` ADD CONSTRAINT \`FK_8608b275644cfc7a0f3f5850814\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`income\` ADD CONSTRAINT \`FK_64409de4711cd14e2c43371cc02\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`income\` ADD CONSTRAINT \`FK_a05d52b7ffe89140f9cbcf114b3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`income\` ADD CONSTRAINT \`FK_29fbd3a17710a27e6f856072c01\` FOREIGN KEY (\`clientId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_b208a754c7a538cb3422f39f5b9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_d5ac36aa3d5919908414154fca0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` ADD CONSTRAINT \`FK_3fb863167095805e33f38a0fdcc\` FOREIGN KEY (\`integrationEntitySettingId\`) REFERENCES \`integration_entity_setting\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_23e9cfcf1bfff07dcc3254378df\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_c6c01e38eebd8b26b9214b90441\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` ADD CONSTRAINT \`FK_f80ff4ebbf0b33a67dce5989117\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_eec3d6064578610ddc609dd360e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_7022dafd72c1b92f7d506914411\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_map\` ADD CONSTRAINT \`FK_c327ea26bda3d349a1eceb5658e\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_954c6b05297814776d9cb66ca77\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_369eaafb13afe9903a170077edb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` ADD CONSTRAINT \`FK_34daf030004ad37b88f1f3d863c\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_24e37d03ef224f1a16a35069c2c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_33ab224e7755a46fff5bc1e64e5\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` ADD CONSTRAINT \`FK_0d6ddc27d687ca879042c5f3ce3\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_480158f21938444e4f62fb31857\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_69d75a47af6bfcda545a865691b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` ADD CONSTRAINT \`FK_add7dbec156589dd0b27e2e0c49\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration_tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_b3234be5b70c2362cdf67bb1889\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_6c8e119fc6a2a7d3413aa76d3bd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` ADD CONSTRAINT \`FK_5065401113abb6e9608225e5678\` FOREIGN KEY (\`repositoryId\`) REFERENCES \`organization_github_repository\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_7c2328f76efb850b81147972476\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_68eef4ab86b67747f24f288a16c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_5a182e8b3e225b14ddf6df7e6c3\` FOREIGN KEY (\`invitedById\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_900a3ed40499c79c1c289fec284\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invite\` ADD CONSTRAINT \`FK_91bfeec7a9574f458e5b592472d\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_cc0ac824ba89deda98bb418e8ca\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_856f24297f120604f8ae2942769\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_da2893697d57368470952a76f65\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` ADD CONSTRAINT \`FK_31ec3d5a6b0985cec544c642178\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_f78214cd9de76e80fe8a6305f52\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_e89749c8e8258b2ec110c0776ff\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_897c33b49a04cf3db7acd336afc\` FOREIGN KEY (\`expenseId\`) REFERENCES \`expense\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_553d5aac210d22fdca5c8d48ead\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_62d486728b272e3b4d23a6b5db6\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_d4d92abde074b3da8054d7cfbc7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_16f1d0e74b4d33e59c0eabdaac7\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_item\` ADD CONSTRAINT \`FK_e558df60d7d9a3e412ef0bbb844\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_7fb52a5f267f53b7d93af3d8c3c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_058ef835f99e28fc6717cd7c80f\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_b5c33892e630b66c65d623baf8e\` FOREIGN KEY (\`fromOrganizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invoice\` ADD CONSTRAINT \`FK_d9e965da0f63c94983d3a1006ac\` FOREIGN KEY (\`toContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_86c09eb673b0e66129dbdc72111\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_fab6b6200b9ed6fd002c1ff62ab\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_4bc62c3d2ffdd6f9c7f8b3dcd1c\` FOREIGN KEY (\`kpiId\`) REFERENCES \`goal_kpi_template\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` ADD CONSTRAINT \`FK_46426ea45456e240a092b732047\` FOREIGN KEY (\`goalId\`) REFERENCES \`goal_template\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_cd9cbc0d5b6d62dbb63c3b3a65b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_fd4b0cb7a44ed914acdda55e29c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` ADD CONSTRAINT \`FK_7497a70a581e5f56f792015dd37\` FOREIGN KEY (\`keyResultId\`) REFERENCES \`key_result\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_8ac2c6b487d03157adda874789f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_d1f45ca98f17bd84a5e430feaf4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_5880347716f9ec5056ec15112cc\` FOREIGN KEY (\`ownerId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_c89adeff0de3aedb2e772a5bf4c\` FOREIGN KEY (\`leadId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_38dc003f3484eff4b59918e9ae3\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_d8547e21ccb8e37ac9f0d69c1af\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_4e1e975124c1d717814a4bb2ec8\` FOREIGN KEY (\`kpiId\`) REFERENCES \`goal_kpi\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`key_result\` ADD CONSTRAINT \`FK_3e1d08761a717c1dd71fe67249b\` FOREIGN KEY (\`goalId\`) REFERENCES \`goal\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_533144d7ae94180235ea456625b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_d306a524b507f72fa8550aeffe4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_e03ddff05652be527e04abdc56f\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`merchant\` ADD CONSTRAINT \`FK_20acc3c3a6c900c6ef9fc681996\` FOREIGN KEY (\`logoId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_award\` ADD CONSTRAINT \`FK_af6423760433da72002a7f369eb\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_award\` ADD CONSTRAINT \`FK_2e0d21aab892b5993abaac09bcd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_e68c43e315ad3aaea4e99cf461d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_6200736cb4d3617b004e5b647ff\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_a86d2e378b953cb39261f457d26\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` ADD CONSTRAINT \`FK_8cfcdc6bc8fb55e273d9ace5fd5\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department\` ADD CONSTRAINT \`FK_b3644ff7cd65239e29d292a41d1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department\` ADD CONSTRAINT \`FK_c61a562a2379d1c0077fe7de332\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_4bc83945c022a862a33629ff1e1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_1057ec001a4c6b258658143047a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` ADD CONSTRAINT \`FK_c129dee7d1cb84e01e69b5e2c66\` FOREIGN KEY (\`documentId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type\` ADD CONSTRAINT \`FK_227b5bd9867287cbbeece8f6ba9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type\` ADD CONSTRAINT \`FK_a583cfe32f492f5ba99b7bb2050\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_225e476592214e32e117a85213c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_4513931e2d530f78d7144c8c7cd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` ADD CONSTRAINT \`FK_020516e74a57cb85d75381e841a\` FOREIGN KEY (\`languageCode\`) REFERENCES \`language\`(\`code\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_position\` ADD CONSTRAINT \`FK_a8f497b1006ec967964abb0d497\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_position\` ADD CONSTRAINT \`FK_a0409e39f23ff6d418f2c03df58\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_7cf84e8b5775f349f81a1f3cc44\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_9d8afc1e1e64d4b7d48dd2229d7\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_904ae0b765faef6ba2db8b1e698\` FOREIGN KEY (\`repositoryId\`) REFERENCES \`organization_github_repository\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_bc1e32c13683dbb16ada1c6da14\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` ADD CONSTRAINT \`FK_063324fdceb51f7086e401ed2c9\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_recurring_expense\` ADD CONSTRAINT \`FK_0b19a287858af40661bd3eb7411\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_recurring_expense\` ADD CONSTRAINT \`FK_8a12e7a0d47d3c6a6b35f7984e3\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_f57ad03c4e471bd8530494ea63d\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_8a1fe8afb3aa672bae5993fbe7d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` ADD CONSTRAINT \`FK_a140b7e30ff3455551a0fd599fb\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_582768159ef0c749e8552ea9bcd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_5830901876e426adfc15fb7341b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_19ab7adf33199bc6f913db277d7\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` ADD CONSTRAINT \`FK_20a290f166c0810eafbf2717171\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_fe12e1b76bbb76209134d9bdc2e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_d8eba1c0e500c60be1b69c1e777\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_719aeb37fa7a1dd80d25336a0cf\` FOREIGN KEY (\`activeTaskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_8dc83cdd7c519d73afc0d8bdf09\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_a2a5601d799fbfc29c17b99243f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` ADD CONSTRAINT \`FK_ce83034f38496f5fe3f19796977\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_d9529008c733cb90044b8c2ad6b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_c15823bf3f63b1fe331d9de6625\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_5e73656ce0355347477c42ae19b\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` ADD CONSTRAINT \`FK_171b852be7c1f387eca93775aad\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_176f5ed3c4534f3110d423d5690\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_eef1c19a0cb5321223cfe3286c4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_da625f694eb1e23e585f3010082\` FOREIGN KEY (\`createdById\`) REFERENCES \`user\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` ADD CONSTRAINT \`FK_51e91be110fa0b8e70066f5727f\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_vendor\` ADD CONSTRAINT \`FK_7e0bf6063e1728c9813d5da7caa\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_vendor\` ADD CONSTRAINT \`FK_56dd132aa3743cfa9b034d020eb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_745a293c8b2c750bc421fa06332\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_7965db2b12872551b586f76dd79\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization\` ADD CONSTRAINT \`FK_47b6a97e09895a06606a4a80421\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`password_reset\` ADD CONSTRAINT \`FK_1fa632f2d12a06ef8dcc00858ff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_6959c37c3acf0832103a2535703\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_be7fcc9fb8cd5a74cb602ec6c9b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_62ef561a3bb084a7d12dad8a2d9\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_87223c7f1d4c2ca51cf69927844\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_3f13c738eff604a85700746ec7d\` FOREIGN KEY (\`recordedById\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_8846e403ec45e1ad8c309f91a37\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`payment\` ADD CONSTRAINT \`FK_82753b9e315af84b20eaf84d778\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_28965bf63ad4c0976892d0fd5e8\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_04d16bdd72668de12c3e41a85a6\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`pipeline_stage\` ADD CONSTRAINT \`FK_73ec3158bf224b485fd715cb3a6\` FOREIGN KEY (\`pipelineId\`) REFERENCES \`pipeline\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`pipeline\` ADD CONSTRAINT \`FK_683274c59fb08b21249096e305c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`pipeline\` ADD CONSTRAINT \`FK_873ade98fbd6ca71c8b4d1bbcac\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_27d71aa2e843f07fbf36329be3f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_e46203bf1dbf3291d174f02cb34\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` ADD CONSTRAINT \`FK_586294149d24cd835678878ef12\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_category\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_0a0cf25cd8232a154d1cce2641c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_853302351eaa4daa39920c270a9\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_category\` ADD CONSTRAINT \`FK_f38e86bd280ff9c9c7d9cb78393\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_462a7fd3ce68935cf973c6709f9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_4a1430a01b71ecdfcd54b2b6c5c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` ADD CONSTRAINT \`FK_a6e91739227bf4d442f23c52c75\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_fd6b39f1fd1db026b5dcc3c7953\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_0e2fcc31743e20a45fc3cf0211d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` ADD CONSTRAINT \`FK_c9ce1da98b6d93293daafee63aa\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_option_group\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_9869d7680f48487e584f5d2fca7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_4dc2f466cfa3d0b7fef19d12731\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` ADD CONSTRAINT \`FK_f43c46e12db0580af320db77381\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_option\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_985d235aa5394937c4493262c7f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_47ffb82a65c43f102b7e0efa41a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_option\` ADD CONSTRAINT \`FK_a6debf9198e2fbfa006aa10d710\` FOREIGN KEY (\`groupId\`) REFERENCES \`product_option_group\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_2efe48435d4ba480a4bb8b96fa6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_bed9d45e15866d9b8e87e7a7bfe\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` ADD CONSTRAINT \`FK_b0d86990fe7160a5f3e4011fb23\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_30aafca59cdb456bf5231f9e463\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_2dd271bdeb602b8c3956287e33c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` ADD CONSTRAINT \`FK_f4b767c43b4e9130c63382c9b28\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_type\` ADD CONSTRAINT \`FK_f206c807fc7e41fc8a8b6679ae0\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_type\` ADD CONSTRAINT \`FK_e4e4120b0c19d3a207ce38d7581\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_7052eaf00a5795afa5ebf359950\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_0cfba32db58a952f58b1e35cf1c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` ADD CONSTRAINT \`FK_5842f603bd85d924127d63d73cd\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_9121e00c4dc3500dc610cf8722e\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_6a289b10030ae86903406e3c9bd\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_41b31a71dda350cfe5da07e0e4f\` FOREIGN KEY (\`priceId\`) REFERENCES \`product_variant_price\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_9f0fd369dfeb275415c649d110b\` FOREIGN KEY (\`settingId\`) REFERENCES \`product_variant_setting\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_6e420052844edf3a5506d863ce6\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant\` ADD CONSTRAINT \`FK_b83f23626741630a86299607156\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product\` ADD CONSTRAINT \`FK_08293ca31a601d3cd0228120bc9\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product\` ADD CONSTRAINT \`FK_32a4bdd261ec81f4ca6b3abe262\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product\` ADD CONSTRAINT \`FK_4627873dbc1af07d732e6eec7be\` FOREIGN KEY (\`featuredImageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product\` ADD CONSTRAINT \`FK_374bfd0d1b0e1398d7206456d98\` FOREIGN KEY (\`productTypeId\`) REFERENCES \`product_type\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product\` ADD CONSTRAINT \`FK_618194d24a7ea86a165d7ec628e\` FOREIGN KEY (\`productCategoryId\`) REFERENCES \`product_category\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_7533fd275bfb3219ce9eb4004c7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_e6abcacc3d3a4f9cf5ca97f2b28\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_translation\` ADD CONSTRAINT \`FK_d24bc28e54f1dc296452a255917\` FOREIGN KEY (\`referenceId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_4177329f5e6ddbfb64165927134\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_d59ec6899d435f430799795ad7b\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_f399488a0f3ea10bb511e3f5aa3\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`proposal\` ADD CONSTRAINT \`FK_61c45ab51852e4b0e539756d40f\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_edf9bd011d7f08e3e18a5becb8b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_5193788a3ebc1143bedb74cf725\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`report_organization\` ADD CONSTRAINT \`FK_a085d6f9bcfd19f8bae1dbfe135\` FOREIGN KEY (\`reportId\`) REFERENCES \`report\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`report\` ADD CONSTRAINT \`FK_230652e48daa99c50c000fc5d10\` FOREIGN KEY (\`categoryId\`) REFERENCES \`report_category\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_a5445b38b780b29b09369e36a9b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_4071f027554eefff65ac8123e6e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_563fec5539b89a57f40731f9858\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` ADD CONSTRAINT \`FK_ce2113039f070b3f003aa0db611\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_94b2a3d0f17c9549dea1493dc96\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_77e1050669b32cfff482f960169\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_6c75d8a8c609e88896b2653cc41\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` ADD CONSTRAINT \`FK_9ccdaee6c5c62cda8f7375e8417\` FOREIGN KEY (\`teamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_9feaa23ed7bc47d51315e304bb5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_8343741e7929043b2a7de89f739\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval\` ADD CONSTRAINT \`FK_26bb3420001d31337393ed05bc3\` FOREIGN KEY (\`approvalPolicyId\`) REFERENCES \`approval_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`role_permission\` ADD CONSTRAINT \`FK_cbd053921056e77c0a8e03122af\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`role_permission\` ADD CONSTRAINT \`FK_e3130a39c1e4a740d044e685730\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`role\` ADD CONSTRAINT \`FK_1751a572e91385a09d41c624714\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`skill\` ADD CONSTRAINT \`FK_8e502eac7ed1347c71c26beae81\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`skill\` ADD CONSTRAINT \`FK_b2923d394f3636671ff9b3c3e81\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_b08dd29fb6a8acdf83c83d8988f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_c2f6bec0b39eaa3a6d90903ae99\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag\` ADD CONSTRAINT \`FK_49746602acc4e5e8721062b69ec\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_87bfea6d0b9a1ec602ee88e5f68\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_16507eb222e3c50be077fb4ace2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_8f274646f2bdf4e12990feeb040\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_estimation\` ADD CONSTRAINT \`FK_a3ee022203211f678376cd919bb\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_8b12c913c39c72fe5980427c963\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_16dbef9d1b2b422abdce8ee3ae2\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_33779b0395f72af0b50dc526d1d\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_131331557078611a68b4a5b2e7e\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`issue_type\` ADD CONSTRAINT \`FK_586513cceb16777fd14a17bfe10\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_e91cbff3d206f150ccc14d0c3a1\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_5b0272d923a31c972bed1a1ac4d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_8c9920b5fb32c3d8453f64b705c\` FOREIGN KEY (\`parentId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_3797a20ef5553ae87af126bc2fe\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_94fe6b3a5aec5f85427df4f8cd7\` FOREIGN KEY (\`creatorId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_1e1f64696aa3a26d3e12c840e55\` FOREIGN KEY (\`organizationSprintId\`) REFERENCES \`organization_sprint\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_0cbe714983eb0aae5feeee8212b\` FOREIGN KEY (\`taskStatusId\`) REFERENCES \`task_status\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_2f4bdd2593fd6038aaa91fd1076\` FOREIGN KEY (\`taskSizeId\`) REFERENCES \`task_size\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task\` ADD CONSTRAINT \`FK_b8616deefe44d0622233e73fbf9\` FOREIGN KEY (\`taskPriorityId\`) REFERENCES \`task_priority\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_20b50abc5c97610a75d49ad3817\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_24114c4059e6b6991daba541b1d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_6deea7b3671e45973e191a1502c\` FOREIGN KEY (\`taskFromId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` ADD CONSTRAINT \`FK_0848fd2b8c23c0ab55146297cff\` FOREIGN KEY (\`taskToId\`) REFERENCES \`task\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_1818655f27b8cf4f0d1dbfeb8db\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_7fd1b30d159b608cbf59009f681\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_db4237960ca989eb7a48cd433b1\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_priority\` ADD CONSTRAINT \`FK_52b039cff6a1adf6b7f9e49ee44\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_b7b0ea8ac2825fb981c1181d115\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_bed691e21fe01cf5aceee722952\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_d99fe5b50dbe5078e0d9a9b6a9d\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` ADD CONSTRAINT \`FK_4967ebdca0aefb9d43e56695e42\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_f6ec2207e50680a475d71c89793\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_596512cc6508a482cc23ae6ab78\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_ad6792b26526bd96ab18d634544\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_size\` ADD CONSTRAINT \`FK_f4438327b3c2afb0832569b2a1e\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_efbaf00a743316b394cc31e4a20\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_9b9a828a49f4bd6383a4073fe23\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_a19e8975e5c296640d457dfc11f\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_status\` ADD CONSTRAINT \`FK_0330b4a942b536d8d1f264abe32\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_379c8bd0ce203341148c1f99ee7\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_9c845f353378371ee3aa60f6865\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_91988120385964f213aec8aa84c\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_version\` ADD CONSTRAINT \`FK_959e77718a2e76ee56498c1106a\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tenant_setting\` ADD CONSTRAINT \`FK_affdab301e348b892175f30fa39\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tenant\` ADD CONSTRAINT \`FK_d154d06dac0d0e0a5d9a083e253\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy\` ADD CONSTRAINT \`FK_1c0ed84d54f8fbe4af10dfcda1c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy\` ADD CONSTRAINT \`FK_c2744cffeca55c3c9c52bb9789c\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_4989834dd1c9c8ea3576ed99ce5\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_981333982a6df8b815957dcbf27\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_c1f8ae47dc2f1882afc5045c739\` FOREIGN KEY (\`policyId\`) REFERENCES \`time_off_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request\` ADD CONSTRAINT \`FK_c009cdd795be674c20470623742\` FOREIGN KEY (\`documentId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_f2401d8fdff5d8970dfe30d3aed\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_fdb3f018c2bba4885bfa5757d16\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_a6f74ae99d549932391f0f44609\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_5a898f44fa31ef7916f0c38b016\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_4e382caaf07ab0923b2e06bf918\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`activity\` ADD CONSTRAINT \`FK_2743f8990fde12f9586287eb09f\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_235004f3dafac90692cd64d9158\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_0951aacffe3f8d0cff54cf2f341\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_5b594d02d98d5defcde323abe5b\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`screenshot\` ADD CONSTRAINT \`FK_fa1896dc735403799311968f7ec\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_fa9018cb248ea0f3b2b30ef143b\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_aed2d5cc5680fba9d387c7f931d\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_a89a849957e005bafb8e4220bc7\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_e65393bb52aa8275b1392c73f72\` FOREIGN KEY (\`timesheetId\`) REFERENCES \`timesheet\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_54776f6f5fd3c13c3bc1fbfac5b\` FOREIGN KEY (\`projectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_1ddf2da35e34378fd845d80a18b\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_d1e8f22c02c5e949453dde7f2d1\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_log\` ADD CONSTRAINT \`FK_18dcdf754396f0cb0308dc91f4c\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_b8284109257b5137256b5b3e848\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_b407841271245501dd1a8c75513\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot\` ADD CONSTRAINT \`FK_7913305b850c7afc89b6ed96a30\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_c7f72cb68b22b8ab988158e4d26\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_82c5edbd179359212f16f0d386a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_minute\` ADD CONSTRAINT \`FK_9272701d3da8bd8507f316c9154\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_25b8df69c9b7f5752c6a6a6ef7f\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_aca65a79fe0c1ec9e6a59022c54\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_8c8f821cb0fe0dd387491ea7d9e\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`timesheet\` ADD CONSTRAINT \`FK_6c1f81934a3f597b3b1a17f5623\` FOREIGN KEY (\`approvedById\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_611e1392c8cc9b101e3ea7ad80c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_7143f31467178a6164a42426c15\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`user_organization\` ADD CONSTRAINT \`FK_29c3c8cc3ea9db22e4a347f4b5a\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_685bf353c85f23b6f848e4dcded\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_c28e52f758e7bbc53828db92194\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`user\` ADD CONSTRAINT \`FK_5e028298e103e1694147ada69e5\` FOREIGN KEY (\`imageId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_62573a939f834f2de343f98288c\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_c899e17322d11e1977832e8c656\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_a8c9aee14d47ec7b3f2ac429ebc\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` ADD CONSTRAINT \`FK_3f934c4772e7c7f2c66d7ea4e72\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_a1c4a97b928b547c3041d3ac1f6\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_d5f4b64e6a80546fd6dd4ac3ed0\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_a2f863689d1316810c41c1ea38e\` FOREIGN KEY (\`variantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` ADD CONSTRAINT \`FK_617306cb3613dd8d59301ae16fd\` FOREIGN KEY (\`warehouseProductId\`) REFERENCES \`warehouse_product\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_9b2f00761a6b1b77cb6289e3fff\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_f5735eafddabdb4b20f621a976a\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_f502dc6d9802306f9d1584932b8\` FOREIGN KEY (\`logoId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse\` ADD CONSTRAINT \`FK_84594016a98da8b87e0f51cd931\` FOREIGN KEY (\`contactId\`) REFERENCES \`contact\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_bcb30c9893f4c8d0c4e556b4ed3\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_2ba72a9dec732a10e8c05bcdec1\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base\` ADD CONSTRAINT \`FK_ff979040ce93cbc60863d322ecd\` FOREIGN KEY (\`parentId\`) REFERENCES \`knowledge_base\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_06a9902fedc1f9dcdbaf14afb01\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_3547f82f867489542ceae58a49e\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` ADD CONSTRAINT \`FK_66af194845635058239e794e1b9\` FOREIGN KEY (\`categoryId\`) REFERENCES \`knowledge_base\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_1551e821871d9230cc0dafbbe58\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_81558bb2bef673628d92540b4e4\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_8eb7e413257d7a26104f4e326fd\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` ADD CONSTRAINT \`FK_2d5ecab1f06b327bad545536143\` FOREIGN KEY (\`articleId\`) REFERENCES \`knowledge_base_article\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`changelog\` ADD CONSTRAINT \`FK_744268ee0ec6073883267bc3b66\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`changelog\` ADD CONSTRAINT \`FK_c2037b621d2e8023898aee4ac74\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_candidate\` ADD CONSTRAINT \`FK_34e4625cc9b010079f1b5758b36\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_candidate\` ADD CONSTRAINT \`FK_7e0891bb331b08bd4abb6776b76\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`employee_job_preset\` ADD CONSTRAINT \`FK_7ae5b4d4bdec77971dab319f2e2\` FOREIGN KEY (\`jobPresetId\`) REFERENCES \`job_preset\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_job_preset\` ADD CONSTRAINT \`FK_68e75e49f06409fd385b4f87746\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee_level\` ADD CONSTRAINT \`FK_b3565ff8073d4f66c46d27fe88e\` FOREIGN KEY (\`employeeLevelId\`) REFERENCES \`employee_level\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee_level\` ADD CONSTRAINT \`FK_f3caf4cc158fe8b8e06578e7922\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee\` ADD CONSTRAINT \`FK_e0ddfccfe9816681c410ebf2b9a\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee\` ADD CONSTRAINT \`FK_b1ffe2a63a48b486e18dc59d1b7\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy_employee\` ADD CONSTRAINT \`FK_c451f53f5a6cd97db94e1c9482d\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy_employee\` ADD CONSTRAINT \`FK_0f823750ac5a7d899cc5d8d0402\` FOREIGN KEY (\`timeOffPolicyId\`) REFERENCES \`time_off_policy\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request_employee\` ADD CONSTRAINT \`FK_cd312469204347b1210397770a1\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request_employee\` ADD CONSTRAINT \`FK_0a8cf0aacf95ce66e73e75a95cf\` FOREIGN KEY (\`timeOffRequestId\`) REFERENCES \`time_off_request\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_tasks_task\` ADD CONSTRAINT \`FK_eae5eea1c6a3fcf4a2c95f1a5fe\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`employee_tasks_task\` ADD CONSTRAINT \`FK_6bbbe677c5fc5115916b4eccfb1\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_employees\` ADD CONSTRAINT \`FK_8676224f55a965c53e4bb7cbf8f\` FOREIGN KEY (\`equipmentSharingId\`) REFERENCES \`equipment_sharing\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_employees\` ADD CONSTRAINT \`FK_57f6461f1a710f0f4abdcb8d0e6\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_teams\` ADD CONSTRAINT \`FK_f84171695b7aedfc454483bcf21\` FOREIGN KEY (\`equipmentSharingId\`) REFERENCES \`equipment_sharing\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_teams\` ADD CONSTRAINT \`FK_7ccef49dd56c8c74daa8d12186b\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_equipment\` ADD CONSTRAINT \`FK_bb0062d51a75164fcb64041ee7d\` FOREIGN KEY (\`equipmentId\`) REFERENCES \`equipment\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_equipment\` ADD CONSTRAINT \`FK_0360b8197c2a38d6fe882cb1aff\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_event_type\` ADD CONSTRAINT \`FK_094af399a26d4a1d3ae17ea11e3\` FOREIGN KEY (\`eventTypeId\`) REFERENCES \`event_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_event_type\` ADD CONSTRAINT \`FK_34b8f471aac00eaec6f2830e5bb\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_expense_category\` ADD CONSTRAINT \`FK_107a93f89c8f31f4386ae4b19d9\` FOREIGN KEY (\`expenseCategoryId\`) REFERENCES \`expense_category\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_expense_category\` ADD CONSTRAINT \`FK_727dbf5e1100023681e216d6a93\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_expense\` ADD CONSTRAINT \`FK_6f1108552ea7a70a4d958b338cd\` FOREIGN KEY (\`expenseId\`) REFERENCES \`expense\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_expense\` ADD CONSTRAINT \`FK_8dcfbd0d960672fefe681bcba9c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_income\` ADD CONSTRAINT \`FK_55c9568ebe1c4addc3deb6922e5\` FOREIGN KEY (\`incomeId\`) REFERENCES \`income\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_income\` ADD CONSTRAINT \`FK_00e2fd30761a36911648166044c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`integration_integration_type\` ADD CONSTRAINT \`FK_34c86921ee9b462bc5c7b61fad4\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`integration_integration_type\` ADD CONSTRAINT \`FK_8dd2062499a6c2a708ddd05650e\` FOREIGN KEY (\`integrationTypeId\`) REFERENCES \`integration_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_integration\` ADD CONSTRAINT \`FK_c9a85b16615bc5c3035802adb04\` FOREIGN KEY (\`integrationId\`) REFERENCES \`integration\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_integration\` ADD CONSTRAINT \`FK_0f19ad9872190b7a67a9652d5e1\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_project\` ADD CONSTRAINT \`FK_020325728f0979a2822a8295653\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_project\` ADD CONSTRAINT \`FK_f2806968dd846cb49fcdac195a0\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_contact\` ADD CONSTRAINT \`FK_a0c92b6393c7a13266003d552ef\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_contact\` ADD CONSTRAINT \`FK_c5a147ce2a0ec69ccc61149262d\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_department\` ADD CONSTRAINT \`FK_0935b93b3498a0f98db1af71760\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_department\` ADD CONSTRAINT \`FK_fe2eea7a939442efde885303efd\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_team\` ADD CONSTRAINT \`FK_104140c94e838a058a34b30a09c\` FOREIGN KEY (\`inviteId\`) REFERENCES \`invite\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_team\` ADD CONSTRAINT \`FK_1132ec0c3618e53fc8cf7ed6694\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_invoice\` ADD CONSTRAINT \`FK_5a07958d7c6253b311dbdc34ff8\` FOREIGN KEY (\`invoiceId\`) REFERENCES \`invoice\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_invoice\` ADD CONSTRAINT \`FK_0728fc2cc26e8802cbf41aaf274\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_merchant\` ADD CONSTRAINT \`FK_e7d60a4e9906d056a8966e279fd\` FOREIGN KEY (\`merchantId\`) REFERENCES \`merchant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_merchant\` ADD CONSTRAINT \`FK_4af822b453c7d7d5f033e6ea16f\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_merchant\` ADD CONSTRAINT \`FK_812f0cfb560ac6dda0d1345765b\` FOREIGN KEY (\`merchantId\`) REFERENCES \`merchant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_merchant\` ADD CONSTRAINT \`FK_a6bfc0dc6e5234e8e7ef698a36a\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_contact\` ADD CONSTRAINT \`FK_1fb664a63f20bea6a3f0b387713\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_contact\` ADD CONSTRAINT \`FK_8a06f5aded97d1b5e81005e1216\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact_employee\` ADD CONSTRAINT \`FK_beffeb7f338fa98354948c07894\` FOREIGN KEY (\`organizationContactId\`) REFERENCES \`organization_contact\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact_employee\` ADD CONSTRAINT \`FK_cd2bd8302bfb6093d0908c36dcb\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_department\` ADD CONSTRAINT \`FK_c2c9cd2ea533d5442de455fb3e1\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_department\` ADD CONSTRAINT \`FK_0eb285a6b1ac7e3d0a542e50a4b\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department_employee\` ADD CONSTRAINT \`FK_c34e79a3aa682bbd3f0e8cf4c46\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department_employee\` ADD CONSTRAINT \`FK_0d4f83695591ae3c98a0544ac8d\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_department\` ADD CONSTRAINT \`FK_c58533f9ba63f42fef682e1ee7c\` FOREIGN KEY (\`organizationDepartmentId\`) REFERENCES \`organization_department\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_department\` ADD CONSTRAINT \`FK_ef6e8d34b95dcb2b21d5de08a61\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_employment_type\` ADD CONSTRAINT \`FK_41a87d3cfa58c851bbf03ad4e8d\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_employment_type\` ADD CONSTRAINT \`FK_904a731b2ae6bc1aa52c8302a98\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type_employee\` ADD CONSTRAINT \`FK_3bfdb894d67e6a29aa95780bb47\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type_employee\` ADD CONSTRAINT \`FK_3ed17d3e624435e9f2ad71e0583\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_employment_type\` ADD CONSTRAINT \`FK_b4b51067c538f78b8585ef2a175\` FOREIGN KEY (\`organizationEmploymentTypeId\`) REFERENCES \`organization_employment_type\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_employment_type\` ADD CONSTRAINT \`FK_8c5db3a96baffba025729ebe869\` FOREIGN KEY (\`candidateId\`) REFERENCES \`candidate\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_position\` ADD CONSTRAINT \`FK_1f7e0230bc542d7037810203786\` FOREIGN KEY (\`organizationPositionId\`) REFERENCES \`organization_position\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_position\` ADD CONSTRAINT \`FK_c71c381e77b0543ed4023aeef79\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_project\` ADD CONSTRAINT \`FK_b69fa5d1b1d02cdbe301ea6b108\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_project\` ADD CONSTRAINT \`FK_18be859b371e9159dfc2cecbe13\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_team\` ADD CONSTRAINT \`FK_7c31431ff2173c2c939a0aa036c\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_team\` ADD CONSTRAINT \`FK_599a5f7f6c190822dcfdbbb6eb0\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_team\` ADD CONSTRAINT \`FK_4b5e0ca086e6124eeddf84252fc\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_team\` ADD CONSTRAINT \`FK_2382356b63c832a137079210bd1\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_tasks_task\` ADD CONSTRAINT \`FK_2a6fb43dc7e7aebcda95e32a107\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_tasks_task\` ADD CONSTRAINT \`FK_d15fbe1e1d9c1f56651d8d3831e\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_vendor\` ADD CONSTRAINT \`FK_7dde3307daf6d6dec1513ecc560\` FOREIGN KEY (\`organizationVendorId\`) REFERENCES \`organization_vendor\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_vendor\` ADD CONSTRAINT \`FK_f71369c1cb86ae9fd4d5452f9aa\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization\` ADD CONSTRAINT \`FK_7ca79ff010025397cf9f216bdeb\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization\` ADD CONSTRAINT \`FK_f5e70849adc6f2f81fcbccae77c\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_payment\` ADD CONSTRAINT \`FK_1fcb2a337ee905ab36c4aea3a3c\` FOREIGN KEY (\`paymentId\`) REFERENCES \`payment\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_payment\` ADD CONSTRAINT \`FK_e087c0540b5098d115b50d954cd\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_options_product_option\` ADD CONSTRAINT \`FK_526f0131260eec308a3bd2b61b6\` FOREIGN KEY (\`productVariantId\`) REFERENCES \`product_variant\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_options_product_option\` ADD CONSTRAINT \`FK_e96a71affe63c97f7fa2f076dac\` FOREIGN KEY (\`productOptionId\`) REFERENCES \`product_option\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_product\` ADD CONSTRAINT \`FK_e516b4a2a1a8d4beda7217eeac6\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_product\` ADD CONSTRAINT \`FK_f75a28915b38d926902c0f85b24\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`product_gallery_item\` ADD CONSTRAINT \`FK_f7187fa710c6a5d22f461926378\` FOREIGN KEY (\`productId\`) REFERENCES \`product\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`product_gallery_item\` ADD CONSTRAINT \`FK_825848065557eac3678b164cee2\` FOREIGN KEY (\`imageAssetId\`) REFERENCES \`image_asset\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_proposal\` ADD CONSTRAINT \`FK_3f55851a03524e567594d507744\` FOREIGN KEY (\`proposalId\`) REFERENCES \`proposal\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_proposal\` ADD CONSTRAINT \`FK_451853704de278eef61a37fa7a6\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_request_approval\` ADD CONSTRAINT \`FK_74938a30181630c480b36e27d76\` FOREIGN KEY (\`requestApprovalId\`) REFERENCES \`request_approval\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_request_approval\` ADD CONSTRAINT \`FK_6c6576bff4b497a4975337fa5e3\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`skill_employee\` ADD CONSTRAINT \`FK_e699b50ca468e75bbd36913dccb\` FOREIGN KEY (\`skillId\`) REFERENCES \`skill\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`skill_employee\` ADD CONSTRAINT \`FK_760034f54e598d519b5f0c4ecee\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`skill_organization\` ADD CONSTRAINT \`FK_61593ade5fed9445738ddbe39c4\` FOREIGN KEY (\`skillId\`) REFERENCES \`skill\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`skill_organization\` ADD CONSTRAINT \`FK_b65cfda00c52e1fc26cc96e52ca\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_task\` ADD CONSTRAINT \`FK_4b4e8f61e866248f2ddf8ce181a\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_task\` ADD CONSTRAINT \`FK_bf7c34187a346f499e4dbc4b08b\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`task_employee\` ADD CONSTRAINT \`FK_790858593698e54cba501eb6908\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_employee\` ADD CONSTRAINT \`FK_f38b1bd46f8831704348003bbff\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_team\` ADD CONSTRAINT \`FK_47689f911b0cbb16c94a56a9c50\` FOREIGN KEY (\`taskId\`) REFERENCES \`task\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`task_team\` ADD CONSTRAINT \`FK_0ef34c9f9d6dc8d14f1fbb10e86\` FOREIGN KEY (\`organizationTeamId\`) REFERENCES \`organization_team\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_time_logs\` ADD CONSTRAINT \`FK_63c61a88461ff5c115c3b6bcde5\` FOREIGN KEY (\`timeSlotId\`) REFERENCES \`time_slot\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_time_logs\` ADD CONSTRAINT \`FK_2fc2675c79cb3cbceb32bf2dc7a\` FOREIGN KEY (\`timeLogId\`) REFERENCES \`time_log\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_user\` ADD CONSTRAINT \`FK_6a58ed56a12604c076a8e0cfdaa\` FOREIGN KEY (\`userId\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_user\` ADD CONSTRAINT \`FK_e64a306f3215dbb99bbb26ca599\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`tag_warehouse\` ADD CONSTRAINT \`FK_08385e1e045b83d25978568743f\` FOREIGN KEY (\`warehouseId\`) REFERENCES \`warehouse\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`tag_warehouse\` ADD CONSTRAINT \`FK_3557d514afd3794d40128e05423\` FOREIGN KEY (\`tagId\`) REFERENCES \`tag\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`tag_warehouse\` DROP FOREIGN KEY \`FK_3557d514afd3794d40128e05423\``); await queryRunner.query(`ALTER TABLE \`tag_warehouse\` DROP FOREIGN KEY \`FK_08385e1e045b83d25978568743f\``); await queryRunner.query(`ALTER TABLE \`tag_user\` DROP FOREIGN KEY \`FK_e64a306f3215dbb99bbb26ca599\``); await queryRunner.query(`ALTER TABLE \`tag_user\` DROP FOREIGN KEY \`FK_6a58ed56a12604c076a8e0cfdaa\``); await queryRunner.query(`ALTER TABLE \`time_slot_time_logs\` DROP FOREIGN KEY \`FK_2fc2675c79cb3cbceb32bf2dc7a\``); await queryRunner.query(`ALTER TABLE \`time_slot_time_logs\` DROP FOREIGN KEY \`FK_63c61a88461ff5c115c3b6bcde5\``); await queryRunner.query(`ALTER TABLE \`task_team\` DROP FOREIGN KEY \`FK_0ef34c9f9d6dc8d14f1fbb10e86\``); await queryRunner.query(`ALTER TABLE \`task_team\` DROP FOREIGN KEY \`FK_47689f911b0cbb16c94a56a9c50\``); await queryRunner.query(`ALTER TABLE \`task_employee\` DROP FOREIGN KEY \`FK_f38b1bd46f8831704348003bbff\``); await queryRunner.query(`ALTER TABLE \`task_employee\` DROP FOREIGN KEY \`FK_790858593698e54cba501eb6908\``); await queryRunner.query(`ALTER TABLE \`tag_task\` DROP FOREIGN KEY \`FK_bf7c34187a346f499e4dbc4b08b\``); await queryRunner.query(`ALTER TABLE \`tag_task\` DROP FOREIGN KEY \`FK_4b4e8f61e866248f2ddf8ce181a\``); await queryRunner.query(`ALTER TABLE \`skill_organization\` DROP FOREIGN KEY \`FK_b65cfda00c52e1fc26cc96e52ca\``); await queryRunner.query(`ALTER TABLE \`skill_organization\` DROP FOREIGN KEY \`FK_61593ade5fed9445738ddbe39c4\``); await queryRunner.query(`ALTER TABLE \`skill_employee\` DROP FOREIGN KEY \`FK_760034f54e598d519b5f0c4ecee\``); await queryRunner.query(`ALTER TABLE \`skill_employee\` DROP FOREIGN KEY \`FK_e699b50ca468e75bbd36913dccb\``); await queryRunner.query(`ALTER TABLE \`tag_request_approval\` DROP FOREIGN KEY \`FK_6c6576bff4b497a4975337fa5e3\``); await queryRunner.query(`ALTER TABLE \`tag_request_approval\` DROP FOREIGN KEY \`FK_74938a30181630c480b36e27d76\``); await queryRunner.query(`ALTER TABLE \`tag_proposal\` DROP FOREIGN KEY \`FK_451853704de278eef61a37fa7a6\``); await queryRunner.query(`ALTER TABLE \`tag_proposal\` DROP FOREIGN KEY \`FK_3f55851a03524e567594d507744\``); await queryRunner.query(`ALTER TABLE \`product_gallery_item\` DROP FOREIGN KEY \`FK_825848065557eac3678b164cee2\``); await queryRunner.query(`ALTER TABLE \`product_gallery_item\` DROP FOREIGN KEY \`FK_f7187fa710c6a5d22f461926378\``); await queryRunner.query(`ALTER TABLE \`tag_product\` DROP FOREIGN KEY \`FK_f75a28915b38d926902c0f85b24\``); await queryRunner.query(`ALTER TABLE \`tag_product\` DROP FOREIGN KEY \`FK_e516b4a2a1a8d4beda7217eeac6\``); await queryRunner.query(`ALTER TABLE \`product_variant_options_product_option\` DROP FOREIGN KEY \`FK_e96a71affe63c97f7fa2f076dac\``); await queryRunner.query(`ALTER TABLE \`product_variant_options_product_option\` DROP FOREIGN KEY \`FK_526f0131260eec308a3bd2b61b6\``); await queryRunner.query(`ALTER TABLE \`tag_payment\` DROP FOREIGN KEY \`FK_e087c0540b5098d115b50d954cd\``); await queryRunner.query(`ALTER TABLE \`tag_payment\` DROP FOREIGN KEY \`FK_1fcb2a337ee905ab36c4aea3a3c\``); await queryRunner.query(`ALTER TABLE \`tag_organization\` DROP FOREIGN KEY \`FK_f5e70849adc6f2f81fcbccae77c\``); await queryRunner.query(`ALTER TABLE \`tag_organization\` DROP FOREIGN KEY \`FK_7ca79ff010025397cf9f216bdeb\``); await queryRunner.query(`ALTER TABLE \`tag_organization_vendor\` DROP FOREIGN KEY \`FK_f71369c1cb86ae9fd4d5452f9aa\``); await queryRunner.query(`ALTER TABLE \`tag_organization_vendor\` DROP FOREIGN KEY \`FK_7dde3307daf6d6dec1513ecc560\``); await queryRunner.query(`ALTER TABLE \`organization_team_tasks_task\` DROP FOREIGN KEY \`FK_d15fbe1e1d9c1f56651d8d3831e\``); await queryRunner.query(`ALTER TABLE \`organization_team_tasks_task\` DROP FOREIGN KEY \`FK_2a6fb43dc7e7aebcda95e32a107\``); await queryRunner.query(`ALTER TABLE \`tag_organization_team\` DROP FOREIGN KEY \`FK_2382356b63c832a137079210bd1\``); await queryRunner.query(`ALTER TABLE \`tag_organization_team\` DROP FOREIGN KEY \`FK_4b5e0ca086e6124eeddf84252fc\``); await queryRunner.query(`ALTER TABLE \`organization_project_team\` DROP FOREIGN KEY \`FK_599a5f7f6c190822dcfdbbb6eb0\``); await queryRunner.query(`ALTER TABLE \`organization_project_team\` DROP FOREIGN KEY \`FK_7c31431ff2173c2c939a0aa036c\``); await queryRunner.query(`ALTER TABLE \`tag_organization_project\` DROP FOREIGN KEY \`FK_18be859b371e9159dfc2cecbe13\``); await queryRunner.query(`ALTER TABLE \`tag_organization_project\` DROP FOREIGN KEY \`FK_b69fa5d1b1d02cdbe301ea6b108\``); await queryRunner.query(`ALTER TABLE \`tag_organization_position\` DROP FOREIGN KEY \`FK_c71c381e77b0543ed4023aeef79\``); await queryRunner.query(`ALTER TABLE \`tag_organization_position\` DROP FOREIGN KEY \`FK_1f7e0230bc542d7037810203786\``); await queryRunner.query(`ALTER TABLE \`candidate_employment_type\` DROP FOREIGN KEY \`FK_8c5db3a96baffba025729ebe869\``); await queryRunner.query(`ALTER TABLE \`candidate_employment_type\` DROP FOREIGN KEY \`FK_b4b51067c538f78b8585ef2a175\``); await queryRunner.query(`ALTER TABLE \`organization_employment_type_employee\` DROP FOREIGN KEY \`FK_3ed17d3e624435e9f2ad71e0583\``); await queryRunner.query(`ALTER TABLE \`organization_employment_type_employee\` DROP FOREIGN KEY \`FK_3bfdb894d67e6a29aa95780bb47\``); await queryRunner.query(`ALTER TABLE \`tag_organization_employment_type\` DROP FOREIGN KEY \`FK_904a731b2ae6bc1aa52c8302a98\``); await queryRunner.query(`ALTER TABLE \`tag_organization_employment_type\` DROP FOREIGN KEY \`FK_41a87d3cfa58c851bbf03ad4e8d\``); await queryRunner.query(`ALTER TABLE \`candidate_department\` DROP FOREIGN KEY \`FK_ef6e8d34b95dcb2b21d5de08a61\``); await queryRunner.query(`ALTER TABLE \`candidate_department\` DROP FOREIGN KEY \`FK_c58533f9ba63f42fef682e1ee7c\``); await queryRunner.query(`ALTER TABLE \`organization_department_employee\` DROP FOREIGN KEY \`FK_0d4f83695591ae3c98a0544ac8d\``); await queryRunner.query(`ALTER TABLE \`organization_department_employee\` DROP FOREIGN KEY \`FK_c34e79a3aa682bbd3f0e8cf4c46\``); await queryRunner.query(`ALTER TABLE \`tag_organization_department\` DROP FOREIGN KEY \`FK_0eb285a6b1ac7e3d0a542e50a4b\``); await queryRunner.query(`ALTER TABLE \`tag_organization_department\` DROP FOREIGN KEY \`FK_c2c9cd2ea533d5442de455fb3e1\``); await queryRunner.query(`ALTER TABLE \`organization_contact_employee\` DROP FOREIGN KEY \`FK_cd2bd8302bfb6093d0908c36dcb\``); await queryRunner.query(`ALTER TABLE \`organization_contact_employee\` DROP FOREIGN KEY \`FK_beffeb7f338fa98354948c07894\``); await queryRunner.query(`ALTER TABLE \`tag_organization_contact\` DROP FOREIGN KEY \`FK_8a06f5aded97d1b5e81005e1216\``); await queryRunner.query(`ALTER TABLE \`tag_organization_contact\` DROP FOREIGN KEY \`FK_1fb664a63f20bea6a3f0b387713\``); await queryRunner.query(`ALTER TABLE \`warehouse_merchant\` DROP FOREIGN KEY \`FK_a6bfc0dc6e5234e8e7ef698a36a\``); await queryRunner.query(`ALTER TABLE \`warehouse_merchant\` DROP FOREIGN KEY \`FK_812f0cfb560ac6dda0d1345765b\``); await queryRunner.query(`ALTER TABLE \`tag_merchant\` DROP FOREIGN KEY \`FK_4af822b453c7d7d5f033e6ea16f\``); await queryRunner.query(`ALTER TABLE \`tag_merchant\` DROP FOREIGN KEY \`FK_e7d60a4e9906d056a8966e279fd\``); await queryRunner.query(`ALTER TABLE \`tag_invoice\` DROP FOREIGN KEY \`FK_0728fc2cc26e8802cbf41aaf274\``); await queryRunner.query(`ALTER TABLE \`tag_invoice\` DROP FOREIGN KEY \`FK_5a07958d7c6253b311dbdc34ff8\``); await queryRunner.query(`ALTER TABLE \`invite_organization_team\` DROP FOREIGN KEY \`FK_1132ec0c3618e53fc8cf7ed6694\``); await queryRunner.query(`ALTER TABLE \`invite_organization_team\` DROP FOREIGN KEY \`FK_104140c94e838a058a34b30a09c\``); await queryRunner.query(`ALTER TABLE \`invite_organization_department\` DROP FOREIGN KEY \`FK_fe2eea7a939442efde885303efd\``); await queryRunner.query(`ALTER TABLE \`invite_organization_department\` DROP FOREIGN KEY \`FK_0935b93b3498a0f98db1af71760\``); await queryRunner.query(`ALTER TABLE \`invite_organization_contact\` DROP FOREIGN KEY \`FK_c5a147ce2a0ec69ccc61149262d\``); await queryRunner.query(`ALTER TABLE \`invite_organization_contact\` DROP FOREIGN KEY \`FK_a0c92b6393c7a13266003d552ef\``); await queryRunner.query(`ALTER TABLE \`invite_organization_project\` DROP FOREIGN KEY \`FK_f2806968dd846cb49fcdac195a0\``); await queryRunner.query(`ALTER TABLE \`invite_organization_project\` DROP FOREIGN KEY \`FK_020325728f0979a2822a8295653\``); await queryRunner.query(`ALTER TABLE \`tag_integration\` DROP FOREIGN KEY \`FK_0f19ad9872190b7a67a9652d5e1\``); await queryRunner.query(`ALTER TABLE \`tag_integration\` DROP FOREIGN KEY \`FK_c9a85b16615bc5c3035802adb04\``); await queryRunner.query(`ALTER TABLE \`integration_integration_type\` DROP FOREIGN KEY \`FK_8dd2062499a6c2a708ddd05650e\``); await queryRunner.query(`ALTER TABLE \`integration_integration_type\` DROP FOREIGN KEY \`FK_34c86921ee9b462bc5c7b61fad4\``); await queryRunner.query(`ALTER TABLE \`tag_income\` DROP FOREIGN KEY \`FK_00e2fd30761a36911648166044c\``); await queryRunner.query(`ALTER TABLE \`tag_income\` DROP FOREIGN KEY \`FK_55c9568ebe1c4addc3deb6922e5\``); await queryRunner.query(`ALTER TABLE \`tag_expense\` DROP FOREIGN KEY \`FK_8dcfbd0d960672fefe681bcba9c\``); await queryRunner.query(`ALTER TABLE \`tag_expense\` DROP FOREIGN KEY \`FK_6f1108552ea7a70a4d958b338cd\``); await queryRunner.query(`ALTER TABLE \`tag_organization_expense_category\` DROP FOREIGN KEY \`FK_727dbf5e1100023681e216d6a93\``); await queryRunner.query(`ALTER TABLE \`tag_organization_expense_category\` DROP FOREIGN KEY \`FK_107a93f89c8f31f4386ae4b19d9\``); await queryRunner.query(`ALTER TABLE \`tag_event_type\` DROP FOREIGN KEY \`FK_34b8f471aac00eaec6f2830e5bb\``); await queryRunner.query(`ALTER TABLE \`tag_event_type\` DROP FOREIGN KEY \`FK_094af399a26d4a1d3ae17ea11e3\``); await queryRunner.query(`ALTER TABLE \`tag_equipment\` DROP FOREIGN KEY \`FK_0360b8197c2a38d6fe882cb1aff\``); await queryRunner.query(`ALTER TABLE \`tag_equipment\` DROP FOREIGN KEY \`FK_bb0062d51a75164fcb64041ee7d\``); await queryRunner.query(`ALTER TABLE \`equipment_shares_teams\` DROP FOREIGN KEY \`FK_7ccef49dd56c8c74daa8d12186b\``); await queryRunner.query(`ALTER TABLE \`equipment_shares_teams\` DROP FOREIGN KEY \`FK_f84171695b7aedfc454483bcf21\``); await queryRunner.query(`ALTER TABLE \`equipment_shares_employees\` DROP FOREIGN KEY \`FK_57f6461f1a710f0f4abdcb8d0e6\``); await queryRunner.query(`ALTER TABLE \`equipment_shares_employees\` DROP FOREIGN KEY \`FK_8676224f55a965c53e4bb7cbf8f\``); await queryRunner.query(`ALTER TABLE \`employee_tasks_task\` DROP FOREIGN KEY \`FK_6bbbe677c5fc5115916b4eccfb1\``); await queryRunner.query(`ALTER TABLE \`employee_tasks_task\` DROP FOREIGN KEY \`FK_eae5eea1c6a3fcf4a2c95f1a5fe\``); await queryRunner.query(`ALTER TABLE \`time_off_request_employee\` DROP FOREIGN KEY \`FK_0a8cf0aacf95ce66e73e75a95cf\``); await queryRunner.query(`ALTER TABLE \`time_off_request_employee\` DROP FOREIGN KEY \`FK_cd312469204347b1210397770a1\``); await queryRunner.query(`ALTER TABLE \`time_off_policy_employee\` DROP FOREIGN KEY \`FK_0f823750ac5a7d899cc5d8d0402\``); await queryRunner.query(`ALTER TABLE \`time_off_policy_employee\` DROP FOREIGN KEY \`FK_c451f53f5a6cd97db94e1c9482d\``); await queryRunner.query(`ALTER TABLE \`tag_employee\` DROP FOREIGN KEY \`FK_b1ffe2a63a48b486e18dc59d1b7\``); await queryRunner.query(`ALTER TABLE \`tag_employee\` DROP FOREIGN KEY \`FK_e0ddfccfe9816681c410ebf2b9a\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\``); await queryRunner.query(`ALTER TABLE \`tag_employee_level\` DROP FOREIGN KEY \`FK_f3caf4cc158fe8b8e06578e7922\``); await queryRunner.query(`ALTER TABLE \`tag_employee_level\` DROP FOREIGN KEY \`FK_b3565ff8073d4f66c46d27fe88e\``); await queryRunner.query(`ALTER TABLE \`employee_job_preset\` DROP FOREIGN KEY \`FK_68e75e49f06409fd385b4f87746\``); await queryRunner.query(`ALTER TABLE \`employee_job_preset\` DROP FOREIGN KEY \`FK_7ae5b4d4bdec77971dab319f2e2\``); await queryRunner.query(`ALTER TABLE \`tag_candidate\` DROP FOREIGN KEY \`FK_7e0891bb331b08bd4abb6776b76\``); await queryRunner.query(`ALTER TABLE \`tag_candidate\` DROP FOREIGN KEY \`FK_34e4625cc9b010079f1b5758b36\``); await queryRunner.query(`ALTER TABLE \`changelog\` DROP FOREIGN KEY \`FK_c2037b621d2e8023898aee4ac74\``); await queryRunner.query(`ALTER TABLE \`changelog\` DROP FOREIGN KEY \`FK_744268ee0ec6073883267bc3b66\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_2d5ecab1f06b327bad545536143\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_8eb7e413257d7a26104f4e326fd\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_81558bb2bef673628d92540b4e4\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_1551e821871d9230cc0dafbbe58\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_66af194845635058239e794e1b9\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_3547f82f867489542ceae58a49e\``); await queryRunner.query(`ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_06a9902fedc1f9dcdbaf14afb01\``); await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_ff979040ce93cbc60863d322ecd\``); await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_2ba72a9dec732a10e8c05bcdec1\``); await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_bcb30c9893f4c8d0c4e556b4ed3\``); await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_84594016a98da8b87e0f51cd931\``); await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_f502dc6d9802306f9d1584932b8\``); await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_f5735eafddabdb4b20f621a976a\``); await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_9b2f00761a6b1b77cb6289e3fff\``); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_617306cb3613dd8d59301ae16fd\``); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_a2f863689d1316810c41c1ea38e\``); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_d5f4b64e6a80546fd6dd4ac3ed0\``); await queryRunner.query(`ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_a1c4a97b928b547c3041d3ac1f6\``); await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_3f934c4772e7c7f2c66d7ea4e72\``); await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_a8c9aee14d47ec7b3f2ac429ebc\``); await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_c899e17322d11e1977832e8c656\``); await queryRunner.query(`ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_62573a939f834f2de343f98288c\``); await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_5e028298e103e1694147ada69e5\``); await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_c28e52f758e7bbc53828db92194\``); await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_685bf353c85f23b6f848e4dcded\``); await queryRunner.query(`ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_29c3c8cc3ea9db22e4a347f4b5a\``); await queryRunner.query(`ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_7143f31467178a6164a42426c15\``); await queryRunner.query(`ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_611e1392c8cc9b101e3ea7ad80c\``); await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_6c1f81934a3f597b3b1a17f5623\``); await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_8c8f821cb0fe0dd387491ea7d9e\``); await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_aca65a79fe0c1ec9e6a59022c54\``); await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_25b8df69c9b7f5752c6a6a6ef7f\``); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_9272701d3da8bd8507f316c9154\``); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_82c5edbd179359212f16f0d386a\``); await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_c7f72cb68b22b8ab988158e4d26\``); await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_7913305b850c7afc89b6ed96a30\``); await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_b407841271245501dd1a8c75513\``); await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_b8284109257b5137256b5b3e848\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_18dcdf754396f0cb0308dc91f4c\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_d1e8f22c02c5e949453dde7f2d1\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_1ddf2da35e34378fd845d80a18b\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_54776f6f5fd3c13c3bc1fbfac5b\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_e65393bb52aa8275b1392c73f72\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_a89a849957e005bafb8e4220bc7\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_aed2d5cc5680fba9d387c7f931d\``); await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_fa9018cb248ea0f3b2b30ef143b\``); await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_fa1896dc735403799311968f7ec\``); await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_5b594d02d98d5defcde323abe5b\``); await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_0951aacffe3f8d0cff54cf2f341\``); await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_235004f3dafac90692cd64d9158\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_2743f8990fde12f9586287eb09f\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_4e382caaf07ab0923b2e06bf918\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_5a898f44fa31ef7916f0c38b016\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_a6f74ae99d549932391f0f44609\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_fdb3f018c2bba4885bfa5757d16\``); await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_f2401d8fdff5d8970dfe30d3aed\``); await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_c009cdd795be674c20470623742\``); await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_c1f8ae47dc2f1882afc5045c739\``); await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_981333982a6df8b815957dcbf27\``); await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_4989834dd1c9c8ea3576ed99ce5\``); await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP FOREIGN KEY \`FK_c2744cffeca55c3c9c52bb9789c\``); await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP FOREIGN KEY \`FK_1c0ed84d54f8fbe4af10dfcda1c\``); await queryRunner.query(`ALTER TABLE \`tenant\` DROP FOREIGN KEY \`FK_d154d06dac0d0e0a5d9a083e253\``); await queryRunner.query(`ALTER TABLE \`tenant_setting\` DROP FOREIGN KEY \`FK_affdab301e348b892175f30fa39\``); await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_959e77718a2e76ee56498c1106a\``); await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_91988120385964f213aec8aa84c\``); await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_9c845f353378371ee3aa60f6865\``); await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_379c8bd0ce203341148c1f99ee7\``); await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_0330b4a942b536d8d1f264abe32\``); await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_a19e8975e5c296640d457dfc11f\``); await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_9b9a828a49f4bd6383a4073fe23\``); await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_efbaf00a743316b394cc31e4a20\``); await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_f4438327b3c2afb0832569b2a1e\``); await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_ad6792b26526bd96ab18d634544\``); await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_596512cc6508a482cc23ae6ab78\``); await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_f6ec2207e50680a475d71c89793\``); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_4967ebdca0aefb9d43e56695e42\``); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_d99fe5b50dbe5078e0d9a9b6a9d\``); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_bed691e21fe01cf5aceee722952\``); await queryRunner.query(`ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_b7b0ea8ac2825fb981c1181d115\``); await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_52b039cff6a1adf6b7f9e49ee44\``); await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_db4237960ca989eb7a48cd433b1\``); await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_7fd1b30d159b608cbf59009f681\``); await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_1818655f27b8cf4f0d1dbfeb8db\``); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_0848fd2b8c23c0ab55146297cff\``); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_6deea7b3671e45973e191a1502c\``); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_24114c4059e6b6991daba541b1d\``); await queryRunner.query(`ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_20b50abc5c97610a75d49ad3817\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_b8616deefe44d0622233e73fbf9\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_2f4bdd2593fd6038aaa91fd1076\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_0cbe714983eb0aae5feeee8212b\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_1e1f64696aa3a26d3e12c840e55\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_94fe6b3a5aec5f85427df4f8cd7\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_3797a20ef5553ae87af126bc2fe\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_8c9920b5fb32c3d8453f64b705c\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_5b0272d923a31c972bed1a1ac4d\``); await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_e91cbff3d206f150ccc14d0c3a1\``); await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_586513cceb16777fd14a17bfe10\``); await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_131331557078611a68b4a5b2e7e\``); await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_33779b0395f72af0b50dc526d1d\``); await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_16dbef9d1b2b422abdce8ee3ae2\``); await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_8b12c913c39c72fe5980427c963\``); await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_a3ee022203211f678376cd919bb\``); await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_8f274646f2bdf4e12990feeb040\``); await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_16507eb222e3c50be077fb4ace2\``); await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_87bfea6d0b9a1ec602ee88e5f68\``); await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_49746602acc4e5e8721062b69ec\``); await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_c2f6bec0b39eaa3a6d90903ae99\``); await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_b08dd29fb6a8acdf83c83d8988f\``); await queryRunner.query(`ALTER TABLE \`skill\` DROP FOREIGN KEY \`FK_b2923d394f3636671ff9b3c3e81\``); await queryRunner.query(`ALTER TABLE \`skill\` DROP FOREIGN KEY \`FK_8e502eac7ed1347c71c26beae81\``); await queryRunner.query(`ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_1751a572e91385a09d41c624714\``); await queryRunner.query(`ALTER TABLE \`role_permission\` DROP FOREIGN KEY \`FK_e3130a39c1e4a740d044e685730\``); await queryRunner.query(`ALTER TABLE \`role_permission\` DROP FOREIGN KEY \`FK_cbd053921056e77c0a8e03122af\``); await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_26bb3420001d31337393ed05bc3\``); await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_8343741e7929043b2a7de89f739\``); await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_9feaa23ed7bc47d51315e304bb5\``); await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_9ccdaee6c5c62cda8f7375e8417\``); await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_6c75d8a8c609e88896b2653cc41\``); await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_77e1050669b32cfff482f960169\``); await queryRunner.query(`ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_94b2a3d0f17c9549dea1493dc96\``); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_ce2113039f070b3f003aa0db611\``); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_563fec5539b89a57f40731f9858\``); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_4071f027554eefff65ac8123e6e\``); await queryRunner.query(`ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_a5445b38b780b29b09369e36a9b\``); await queryRunner.query(`ALTER TABLE \`report\` DROP FOREIGN KEY \`FK_230652e48daa99c50c000fc5d10\``); await queryRunner.query(`ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_a085d6f9bcfd19f8bae1dbfe135\``); await queryRunner.query(`ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_5193788a3ebc1143bedb74cf725\``); await queryRunner.query(`ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_edf9bd011d7f08e3e18a5becb8b\``); await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_61c45ab51852e4b0e539756d40f\``); await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_f399488a0f3ea10bb511e3f5aa3\``); await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_d59ec6899d435f430799795ad7b\``); await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_4177329f5e6ddbfb64165927134\``); await queryRunner.query(`ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_d24bc28e54f1dc296452a255917\``); await queryRunner.query(`ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_e6abcacc3d3a4f9cf5ca97f2b28\``); await queryRunner.query(`ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_7533fd275bfb3219ce9eb4004c7\``); await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_618194d24a7ea86a165d7ec628e\``); await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_374bfd0d1b0e1398d7206456d98\``); await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_4627873dbc1af07d732e6eec7be\``); await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_32a4bdd261ec81f4ca6b3abe262\``); await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_08293ca31a601d3cd0228120bc9\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_b83f23626741630a86299607156\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_6e420052844edf3a5506d863ce6\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_9f0fd369dfeb275415c649d110b\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_41b31a71dda350cfe5da07e0e4f\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_6a289b10030ae86903406e3c9bd\``); await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_9121e00c4dc3500dc610cf8722e\``); await queryRunner.query(`ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_5842f603bd85d924127d63d73cd\``); await queryRunner.query(`ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_0cfba32db58a952f58b1e35cf1c\``); await queryRunner.query(`ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_7052eaf00a5795afa5ebf359950\``); await queryRunner.query(`ALTER TABLE \`product_type\` DROP FOREIGN KEY \`FK_e4e4120b0c19d3a207ce38d7581\``); await queryRunner.query(`ALTER TABLE \`product_type\` DROP FOREIGN KEY \`FK_f206c807fc7e41fc8a8b6679ae0\``); await queryRunner.query(`ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_f4b767c43b4e9130c63382c9b28\``); await queryRunner.query(`ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_2dd271bdeb602b8c3956287e33c\``); await queryRunner.query(`ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_30aafca59cdb456bf5231f9e463\``); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_b0d86990fe7160a5f3e4011fb23\``); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_bed9d45e15866d9b8e87e7a7bfe\``); await queryRunner.query(`ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_2efe48435d4ba480a4bb8b96fa6\``); await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_a6debf9198e2fbfa006aa10d710\``); await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_47ffb82a65c43f102b7e0efa41a\``); await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_985d235aa5394937c4493262c7f\``); await queryRunner.query(`ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_f43c46e12db0580af320db77381\``); await queryRunner.query(`ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_4dc2f466cfa3d0b7fef19d12731\``); await queryRunner.query(`ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_9869d7680f48487e584f5d2fca7\``); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_c9ce1da98b6d93293daafee63aa\``); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_0e2fcc31743e20a45fc3cf0211d\``); await queryRunner.query(`ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_fd6b39f1fd1db026b5dcc3c7953\``); await queryRunner.query(`ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_a6e91739227bf4d442f23c52c75\``); await queryRunner.query(`ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_4a1430a01b71ecdfcd54b2b6c5c\``); await queryRunner.query(`ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_462a7fd3ce68935cf973c6709f9\``); await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_f38e86bd280ff9c9c7d9cb78393\``); await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_853302351eaa4daa39920c270a9\``); await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0a0cf25cd8232a154d1cce2641c\``); await queryRunner.query(`ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_586294149d24cd835678878ef12\``); await queryRunner.query(`ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_e46203bf1dbf3291d174f02cb34\``); await queryRunner.query(`ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_27d71aa2e843f07fbf36329be3f\``); await queryRunner.query(`ALTER TABLE \`pipeline\` DROP FOREIGN KEY \`FK_873ade98fbd6ca71c8b4d1bbcac\``); await queryRunner.query(`ALTER TABLE \`pipeline\` DROP FOREIGN KEY \`FK_683274c59fb08b21249096e305c\``); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_73ec3158bf224b485fd715cb3a6\``); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_04d16bdd72668de12c3e41a85a6\``); await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_28965bf63ad4c0976892d0fd5e8\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_82753b9e315af84b20eaf84d778\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_8846e403ec45e1ad8c309f91a37\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_3f13c738eff604a85700746ec7d\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_87223c7f1d4c2ca51cf69927844\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_62ef561a3bb084a7d12dad8a2d9\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_be7fcc9fb8cd5a74cb602ec6c9b\``); await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_6959c37c3acf0832103a2535703\``); await queryRunner.query(`ALTER TABLE \`password_reset\` DROP FOREIGN KEY \`FK_1fa632f2d12a06ef8dcc00858ff\``); await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_47b6a97e09895a06606a4a80421\``); await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7965db2b12872551b586f76dd79\``); await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_745a293c8b2c750bc421fa06332\``); await queryRunner.query(`ALTER TABLE \`organization_vendor\` DROP FOREIGN KEY \`FK_56dd132aa3743cfa9b034d020eb\``); await queryRunner.query(`ALTER TABLE \`organization_vendor\` DROP FOREIGN KEY \`FK_7e0bf6063e1728c9813d5da7caa\``); await queryRunner.query(`ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_51e91be110fa0b8e70066f5727f\``); await queryRunner.query(`ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_da625f694eb1e23e585f3010082\``); await queryRunner.query(`ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_eef1c19a0cb5321223cfe3286c4\``); await queryRunner.query(`ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_176f5ed3c4534f3110d423d5690\``); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_171b852be7c1f387eca93775aad\``); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_5e73656ce0355347477c42ae19b\``); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_c15823bf3f63b1fe331d9de6625\``); await queryRunner.query(`ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_d9529008c733cb90044b8c2ad6b\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_ce83034f38496f5fe3f19796977\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_a2a5601d799fbfc29c17b99243f\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_8dc83cdd7c519d73afc0d8bdf09\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_719aeb37fa7a1dd80d25336a0cf\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_d8eba1c0e500c60be1b69c1e777\``); await queryRunner.query(`ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_fe12e1b76bbb76209134d9bdc2e\``); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_20a290f166c0810eafbf2717171\``); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_19ab7adf33199bc6f913db277d7\``); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_5830901876e426adfc15fb7341b\``); await queryRunner.query(`ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_582768159ef0c749e8552ea9bcd\``); await queryRunner.query(`ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_a140b7e30ff3455551a0fd599fb\``); await queryRunner.query(`ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_8a1fe8afb3aa672bae5993fbe7d\``); await queryRunner.query(`ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_f57ad03c4e471bd8530494ea63d\``); await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` DROP FOREIGN KEY \`FK_8a12e7a0d47d3c6a6b35f7984e3\``); await queryRunner.query(`ALTER TABLE \`organization_recurring_expense\` DROP FOREIGN KEY \`FK_0b19a287858af40661bd3eb7411\``); await queryRunner.query(`ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_063324fdceb51f7086e401ed2c9\``); await queryRunner.query(`ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_bc1e32c13683dbb16ada1c6da14\``); await queryRunner.query(`ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_904ae0b765faef6ba2db8b1e698\``); await queryRunner.query(`ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_9d8afc1e1e64d4b7d48dd2229d7\``); await queryRunner.query(`ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_7cf84e8b5775f349f81a1f3cc44\``); await queryRunner.query(`ALTER TABLE \`organization_position\` DROP FOREIGN KEY \`FK_a0409e39f23ff6d418f2c03df58\``); await queryRunner.query(`ALTER TABLE \`organization_position\` DROP FOREIGN KEY \`FK_a8f497b1006ec967964abb0d497\``); await queryRunner.query(`ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_020516e74a57cb85d75381e841a\``); await queryRunner.query(`ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_4513931e2d530f78d7144c8c7cd\``); await queryRunner.query(`ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_225e476592214e32e117a85213c\``); await queryRunner.query(`ALTER TABLE \`organization_employment_type\` DROP FOREIGN KEY \`FK_a583cfe32f492f5ba99b7bb2050\``); await queryRunner.query(`ALTER TABLE \`organization_employment_type\` DROP FOREIGN KEY \`FK_227b5bd9867287cbbeece8f6ba9\``); await queryRunner.query(`ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_c129dee7d1cb84e01e69b5e2c66\``); await queryRunner.query(`ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_1057ec001a4c6b258658143047a\``); await queryRunner.query(`ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_4bc83945c022a862a33629ff1e1\``); await queryRunner.query(`ALTER TABLE \`organization_department\` DROP FOREIGN KEY \`FK_c61a562a2379d1c0077fe7de332\``); await queryRunner.query(`ALTER TABLE \`organization_department\` DROP FOREIGN KEY \`FK_b3644ff7cd65239e29d292a41d1\``); await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_8cfcdc6bc8fb55e273d9ace5fd5\``); await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_a86d2e378b953cb39261f457d26\``); await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_6200736cb4d3617b004e5b647ff\``); await queryRunner.query(`ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_e68c43e315ad3aaea4e99cf461d\``); await queryRunner.query(`ALTER TABLE \`organization_award\` DROP FOREIGN KEY \`FK_2e0d21aab892b5993abaac09bcd\``); await queryRunner.query(`ALTER TABLE \`organization_award\` DROP FOREIGN KEY \`FK_af6423760433da72002a7f369eb\``); await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_20acc3c3a6c900c6ef9fc681996\``); await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_e03ddff05652be527e04abdc56f\``); await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_d306a524b507f72fa8550aeffe4\``); await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_533144d7ae94180235ea456625b\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_3e1d08761a717c1dd71fe67249b\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_4e1e975124c1d717814a4bb2ec8\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_d8547e21ccb8e37ac9f0d69c1af\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_38dc003f3484eff4b59918e9ae3\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_c89adeff0de3aedb2e772a5bf4c\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_5880347716f9ec5056ec15112cc\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_d1f45ca98f17bd84a5e430feaf4\``); await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_8ac2c6b487d03157adda874789f\``); await queryRunner.query(`ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_7497a70a581e5f56f792015dd37\``); await queryRunner.query(`ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_fd4b0cb7a44ed914acdda55e29c\``); await queryRunner.query(`ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_cd9cbc0d5b6d62dbb63c3b3a65b\``); await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_46426ea45456e240a092b732047\``); await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_4bc62c3d2ffdd6f9c7f8b3dcd1c\``); await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_fab6b6200b9ed6fd002c1ff62ab\``); await queryRunner.query(`ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_86c09eb673b0e66129dbdc72111\``); await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_d9e965da0f63c94983d3a1006ac\``); await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_b5c33892e630b66c65d623baf8e\``); await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_058ef835f99e28fc6717cd7c80f\``); await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_7fb52a5f267f53b7d93af3d8c3c\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_e558df60d7d9a3e412ef0bbb844\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_16f1d0e74b4d33e59c0eabdaac7\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_d4d92abde074b3da8054d7cfbc7\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_62d486728b272e3b4d23a6b5db6\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_553d5aac210d22fdca5c8d48ead\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_897c33b49a04cf3db7acd336afc\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_e89749c8e8258b2ec110c0776ff\``); await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_f78214cd9de76e80fe8a6305f52\``); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_31ec3d5a6b0985cec544c642178\``); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_da2893697d57368470952a76f65\``); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_856f24297f120604f8ae2942769\``); await queryRunner.query(`ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_cc0ac824ba89deda98bb418e8ca\``); await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_91bfeec7a9574f458e5b592472d\``); await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_900a3ed40499c79c1c289fec284\``); await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_5a182e8b3e225b14ddf6df7e6c3\``); await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_68eef4ab86b67747f24f288a16c\``); await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_7c2328f76efb850b81147972476\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_5065401113abb6e9608225e5678\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_6c8e119fc6a2a7d3413aa76d3bd\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_b3234be5b70c2362cdf67bb1889\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_add7dbec156589dd0b27e2e0c49\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_69d75a47af6bfcda545a865691b\``); await queryRunner.query(`ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_480158f21938444e4f62fb31857\``); await queryRunner.query(`ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_0d6ddc27d687ca879042c5f3ce3\``); await queryRunner.query(`ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_33ab224e7755a46fff5bc1e64e5\``); await queryRunner.query(`ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_24e37d03ef224f1a16a35069c2c\``); await queryRunner.query(`ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_34daf030004ad37b88f1f3d863c\``); await queryRunner.query(`ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_369eaafb13afe9903a170077edb\``); await queryRunner.query(`ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_954c6b05297814776d9cb66ca77\``); await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_c327ea26bda3d349a1eceb5658e\``); await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_7022dafd72c1b92f7d506914411\``); await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_eec3d6064578610ddc609dd360e\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_f80ff4ebbf0b33a67dce5989117\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_c6c01e38eebd8b26b9214b90441\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_23e9cfcf1bfff07dcc3254378df\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_3fb863167095805e33f38a0fdcc\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_d5ac36aa3d5919908414154fca0\``); await queryRunner.query(`ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_b208a754c7a538cb3422f39f5b9\``); await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_29fbd3a17710a27e6f856072c01\``); await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_a05d52b7ffe89140f9cbcf114b3\``); await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_64409de4711cd14e2c43371cc02\``); await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_8608b275644cfc7a0f3f5850814\``); await queryRunner.query(`ALTER TABLE \`image_asset\` DROP FOREIGN KEY \`FK_d3675304df9971cccf96d9a7c34\``); await queryRunner.query(`ALTER TABLE \`image_asset\` DROP FOREIGN KEY \`FK_01856a9a730b7e79d70aa661cb0\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_4c8b4e887a994182fd6132e6400\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_af0a11734e70412b742ac339c88\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_35526ff1063ab5fa2b20e71bd66\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_ac161c1a0c0ff8e83554f097e5e\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_c6e8ae55a4db3584686cbf6afe1\``); await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_6b4758a5442713070c9a366d0e5\``); await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP FOREIGN KEY \`FK_405bc5bba9ed71aefef84a29f10\``); await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP FOREIGN KEY \`FK_b56723b53a76ca1c171890c479b\``); await queryRunner.query(`ALTER TABLE \`goal_template\` DROP FOREIGN KEY \`FK_5708fe06608c72fc77b65ae6519\``); await queryRunner.query(`ALTER TABLE \`goal_template\` DROP FOREIGN KEY \`FK_774bf82989475befe301fe1bca5\``); await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_d4f093ca4eb7c40db68d9a789d0\``); await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_e49e37fe88a2725a38a3b058493\``); await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_43aa2985216560cd9fa93f501e5\``); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_f69e740b066c6469d1c68a4a28b\``); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_df7ab026698c02859ff75408093\``); await queryRunner.query(`ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_cc72d4e8e4284dcc8ffbf96caf4\``); await queryRunner.query(`ALTER TABLE \`goal_general_setting\` DROP FOREIGN KEY \`FK_e35d0f7b794ca8850669d12c78c\``); await queryRunner.query(`ALTER TABLE \`goal_general_setting\` DROP FOREIGN KEY \`FK_d17a5159d888ac6320459eda392\``); await queryRunner.query(`ALTER TABLE \`feature\` DROP FOREIGN KEY \`FK_d4a28a8e70d450a412bf0cfb52a\``); await queryRunner.query(`ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_6d413f9fdd5366b1b9add464836\``); await queryRunner.query(`ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_6a94e6b0a572f591288ac44a421\``); await queryRunner.query(`ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_8f71803d96dcdbcc6b19bb28d38\``); await queryRunner.query(`ALTER TABLE \`import-record\` DROP FOREIGN KEY \`FK_a43b235c35c2c4d3263ada770c6\``); await queryRunner.query(`ALTER TABLE \`import-history\` DROP FOREIGN KEY \`FK_54868607115e2fee3b0b764eec2\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_047b8b5c0782d5a6d4c8bfc1a4e\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_9971c4171ae051e74b833984a30\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_42eea5debc63f4d1bf89881c10a\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_eacb116ab0521ad9b96f2bb53ba\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_5e7b197dbac69012dbdb4964f37\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_c5fb146726ff128e600f23d0a1b\``); await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_6d171c9d5f81095436b99da5e62\``); await queryRunner.query(`ALTER TABLE \`expense_category\` DROP FOREIGN KEY \`FK_9c9bfe5baaf83f53533ff035fc0\``); await queryRunner.query(`ALTER TABLE \`expense_category\` DROP FOREIGN KEY \`FK_37504e920ee5ca46a4000b89da5\``); await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_24d905ec9e127ade23754a363dd\``); await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_fc8818d6fde74370ec703a01352\``); await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_92fc62260c0c7ff108622850bff\``); await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP FOREIGN KEY \`FK_233c1d351d63441aeb039d1164f\``); await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP FOREIGN KEY \`FK_391d3f83244fea73c619aecadd9\``); await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_0ab80a66282582ae8b0282508e7\``); await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_f98ce0d210aa9f91b729d447806\``); await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_fb6808468066849ab7b7454d5f3\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_0ecfe0ce0cd2b197249d5f1c105\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_acad51a6362806fc499e583e402\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_ea9254be07ae4a8604f0aaab196\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_fa525e61fb3d8d9efec0f364a4b\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` DROP FOREIGN KEY \`FK_5311a833ff255881454bd5b3b58\``); await queryRunner.query(`ALTER TABLE \`equipment_sharing_policy\` DROP FOREIGN KEY \`FK_5443ca8ed830626656d8cfecef7\``); await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_5e719204dcafa8d6b2ecdeda130\``); await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_1c0c1370ecd98040259625e17e2\``); await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_f4b0d329c4a3cf79ffe9d565047\``); await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_c6a48286f3aa8ae903bee0d1e72\``); await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_4b3303a6b7eb92d237a4379734e\``); await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_95ea18af6ef8123503d332240c2\``); await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_56e96cd218a185ed59b5a8e7869\``); await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_9516a627a131626d2a5738a05a8\``); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_0ac8526c48a3daa267c86225fb5\``); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_3ee5147bb1fde625fa33c0e956b\``); await queryRunner.query(`ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_5fde7be40b3c03bc0fdac0c2f66\``); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_2be728a7f8b118712a4200990d4\``); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_ee780fbd8f91de31c004929eecb\``); await queryRunner.query(`ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_f577c9bc6183c1d1eae1e154bbc\``); await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_329ebd01a757d1a0c3c4d628e29\``); await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_0f9cefa604913e1ab3225915469\``); await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_d543336994b1f764c449e0b1d3c\``); await queryRunner.query(`ALTER TABLE \`employee_level\` DROP FOREIGN KEY \`FK_c4668533292bf4526e61aedf74a\``); await queryRunner.query(`ALTER TABLE \`employee_level\` DROP FOREIGN KEY \`FK_d3fc52d497bc44d6f493dbedc3a\``); await queryRunner.query(`ALTER TABLE \`job_search_occupation\` DROP FOREIGN KEY \`FK_1a62a99e1016e4a2b461e886ecd\``); await queryRunner.query(`ALTER TABLE \`job_search_occupation\` DROP FOREIGN KEY \`FK_44e22d88b47daf2095491b7cac3\``); await queryRunner.query(`ALTER TABLE \`job_search_category\` DROP FOREIGN KEY \`FK_86381fb6d28978b101b3aec8ca4\``); await queryRunner.query(`ALTER TABLE \`job_search_category\` DROP FOREIGN KEY \`FK_35e120f2b6e5188391cf068d3ba\``); await queryRunner.query(`ALTER TABLE \`job_preset\` DROP FOREIGN KEY \`FK_a4b038417e3221c0791dd8c7714\``); await queryRunner.query(`ALTER TABLE \`job_preset\` DROP FOREIGN KEY \`FK_7e53ea80aca15da11a8a5ec0380\``); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_b909a3df761d7e489aca80f138a\``); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d45b36b85ffbd5189f7e70f29f5\``); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_9a687ce1a10a3abda460922cf84\``); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d5ca48cfacfb516543d6507ca4a\``); await queryRunner.query(`ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_2323220b4decfd2f4d8307fd78f\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d2b148ddd67e520fb8061f4c133\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_b6bcd5ceb60e4bb493344a6b4f2\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_c872e6e3ab28e813c2324d1f4fb\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_2dc73e07ac7040f273cea3c999d\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_630337302efe97cc93deeb21516\``); await queryRunner.query(`ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_afe6c40d3d9951388fa05f83f28\``); await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_0c5266f3f488add404f92d56ec7\``); await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_caf8363b0ed7d5f24ae866ba3bb\``); await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_91e0f7efcd17d20b5029fb1342d\``); await queryRunner.query(`ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_2f58132c57108540887dc3e88eb\``); await queryRunner.query(`ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_86cf36c137712e779dd7e2301e6\``); await queryRunner.query(`ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_a35637bb659c59e18adb4f38f87\``); await queryRunner.query(`ALTER TABLE \`email_template\` DROP FOREIGN KEY \`FK_c160fe6234675fac031aa3e7c50\``); await queryRunner.query(`ALTER TABLE \`email_template\` DROP FOREIGN KEY \`FK_753e005a45556b5909e11937aaf\``); await queryRunner.query(`ALTER TABLE \`email_reset\` DROP FOREIGN KEY \`FK_e37af4ab2ba0bf268bfd9826345\``); await queryRunner.query(`ALTER TABLE \`email_reset\` DROP FOREIGN KEY \`FK_93799dfaeff51de06f1e02ac414\``); await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_9033faf41b23c61ba201c487969\``); await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_1261c457b3035b77719556995bf\``); await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_525f4873c6edc3d94559f88900c\``); await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_0af511c44de7a16beb45cc37852\``); await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_1ae3abc0ae1dcf6c13f49b62b56\``); await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_9211f5b62988df6e95522be7daa\``); await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_4b1ff44e6bae5065429dbab554b\``); await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_38fb85abdf9995efcf217f59554\``); await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_46a3c00bfc3e36b4412d8bcdb08\``); await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP FOREIGN KEY \`FK_15a1306132d66c63ef31f7288c1\``); await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP FOREIGN KEY \`FK_2aa3fc8daa25beec4788d2be26c\``); await queryRunner.query(`ALTER TABLE \`contact\` DROP FOREIGN KEY \`FK_7719d73cd16a9f57ecc6ac24b3d\``); await queryRunner.query(`ALTER TABLE \`contact\` DROP FOREIGN KEY \`FK_60468af1ce34043a900809c84f2\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_8b900e8a39f76125e610ab30c0e\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_3930aa71e0fa24f09201811b1bb\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_4ea108fd8b089237964d5f98fba\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_1e3e8228e7df634fa4cec6322c7\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_b674793a804b7d69d74c8f6c5ba\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_16fb27ffd1a99c6506c92ad57a7\``); await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_77ac426e04553ff1654421bce4d\``); await queryRunner.query(`ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_063663c7e61e45d172d1b832656\``); await queryRunner.query(`ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_9d46b8c5382acd4d4514bc5c62e\``); await queryRunner.query(`ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_a6fecb615b07987b480defac647\``); await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP FOREIGN KEY \`FK_e92027b5280828cadd7cd6ea719\``); await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP FOREIGN KEY \`FK_b2a1ba27a76dd819cd8294cce38\``); await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_492548e6c176f5655adfae9f5ea\``); await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_d7986743e7f11720349a6c95572\``); await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_8a07f780c6fce2b82830ab06877\``); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_a0d171f45bdbcf2b990c0c37c32\``); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_d321f4547ed467d07cce1e7d9a5\``); await queryRunner.query(`ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_045de7c208adcd0c68c0a651748\``); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_9e7b20eb3dfa082b83b198fdad4\``); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_ecb65075e94b47bbab11cfa5a1e\``); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_5f1e315db848990dfffa72817ca\``); await queryRunner.query(`ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_f0ca69c78eea92c95d9044764a2\``); await queryRunner.query(`ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_91996439c4baafee8395d3df153\``); await queryRunner.query(`ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_03be41e88b1fecfe4e24d6b04b2\``); await queryRunner.query(`ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_59b765e6d13d83dba4852a43eb5\``); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_44f3d80c3293e1de038c87f115d\``); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_0862c274d336126b951bfe009a7\``); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_98c008fd8cf597e83dcdccfd161\``); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_3a6928f8501fce33820721a8fe8\``); await queryRunner.query(`ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_6cb21fa0f65ff69679966c836f2\``); await queryRunner.query(`ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_cf75465b3663652a28cf1841ce2\``); await queryRunner.query(`ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_a50eb955f940ca93e044d175c62\``); await queryRunner.query(`ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_8dcf5fc8bc7f77a80b0fc648bfc\``); await queryRunner.query(`ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_59b61ba52a58851cfc85b1e6c66\``); await queryRunner.query(`ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_f660af89b2c69fea2334508cbbd\``); await queryRunner.query(`ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_00cdd9ed7571be8e2c8d09e7cd4\``); await queryRunner.query(`ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_3f9053719c9d11ebdea03e5a2d4\``); await queryRunner.query(`ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_d108a827199fda86a9ec216989a\``); await queryRunner.query(`ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_4d9b7ab09f9f9517d488b5fed1e\``); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_159f821dd214792f1d2ad9cff7c\``); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_ba4c376b2069aa82745d4e96822\``); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_d1d16bc87d3afaf387f34cdceb7\``); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_b106406e94bb7317493efc2c989\``); await queryRunner.query(`ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_9d5bd131452ef689df2b46551b4\``); await queryRunner.query(`ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_46ed3c2287423f5dc089100feeb\``); await queryRunner.query(`ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_d544bd3a63634a4438509ac958d\``); await queryRunner.query(`ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_f008a481cb4eed547704bb9d839\``); await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP FOREIGN KEY \`FK_dfe3b357df3ce136917b1f09843\``); await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP FOREIGN KEY \`FK_1462391059ebe137645098d7276\``); await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_e9ca170a0fae05e44a9bd137d8b\``); await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_0ddc50b7521b9a905d9ca8c8ba3\``); await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_3c3a62226896345c4716bfe1d96\``); await queryRunner.query(`ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_2c0494466d5a7e1165cea3dca98\``); await queryRunner.query(`ALTER TABLE \`accounting_template\` DROP FOREIGN KEY \`FK_e66511b175393255c6c4e7b007f\``); await queryRunner.query(`ALTER TABLE \`accounting_template\` DROP FOREIGN KEY \`FK_2ca6a49062a4ed884e413bf572e\``); await queryRunner.query(`DROP INDEX \`IDX_3557d514afd3794d40128e0542\` ON \`tag_warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_08385e1e045b83d25978568743\` ON \`tag_warehouse\``); await queryRunner.query(`DROP TABLE \`tag_warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_e64a306f3215dbb99bbb26ca59\` ON \`tag_user\``); await queryRunner.query(`DROP INDEX \`IDX_6a58ed56a12604c076a8e0cfda\` ON \`tag_user\``); await queryRunner.query(`DROP TABLE \`tag_user\``); await queryRunner.query(`DROP INDEX \`IDX_2fc2675c79cb3cbceb32bf2dc7\` ON \`time_slot_time_logs\``); await queryRunner.query(`DROP INDEX \`IDX_63c61a88461ff5c115c3b6bcde\` ON \`time_slot_time_logs\``); await queryRunner.query(`DROP TABLE \`time_slot_time_logs\``); await queryRunner.query(`DROP INDEX \`IDX_0ef34c9f9d6dc8d14f1fbb10e8\` ON \`task_team\``); await queryRunner.query(`DROP INDEX \`IDX_47689f911b0cbb16c94a56a9c5\` ON \`task_team\``); await queryRunner.query(`DROP TABLE \`task_team\``); await queryRunner.query(`DROP INDEX \`IDX_f38b1bd46f8831704348003bbf\` ON \`task_employee\``); await queryRunner.query(`DROP INDEX \`IDX_790858593698e54cba501eb690\` ON \`task_employee\``); await queryRunner.query(`DROP TABLE \`task_employee\``); await queryRunner.query(`DROP INDEX \`IDX_bf7c34187a346f499e4dbc4b08\` ON \`tag_task\``); await queryRunner.query(`DROP INDEX \`IDX_4b4e8f61e866248f2ddf8ce181\` ON \`tag_task\``); await queryRunner.query(`DROP TABLE \`tag_task\``); await queryRunner.query(`DROP INDEX \`IDX_b65cfda00c52e1fc26cc96e52c\` ON \`skill_organization\``); await queryRunner.query(`DROP INDEX \`IDX_61593ade5fed9445738ddbe39c\` ON \`skill_organization\``); await queryRunner.query(`DROP TABLE \`skill_organization\``); await queryRunner.query(`DROP INDEX \`IDX_760034f54e598d519b5f0c4ece\` ON \`skill_employee\``); await queryRunner.query(`DROP INDEX \`IDX_e699b50ca468e75bbd36913dcc\` ON \`skill_employee\``); await queryRunner.query(`DROP TABLE \`skill_employee\``); await queryRunner.query(`DROP INDEX \`IDX_6c6576bff4b497a4975337fa5e\` ON \`tag_request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_74938a30181630c480b36e27d7\` ON \`tag_request_approval\``); await queryRunner.query(`DROP TABLE \`tag_request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_451853704de278eef61a37fa7a\` ON \`tag_proposal\``); await queryRunner.query(`DROP INDEX \`IDX_3f55851a03524e567594d50774\` ON \`tag_proposal\``); await queryRunner.query(`DROP TABLE \`tag_proposal\``); await queryRunner.query(`DROP INDEX \`IDX_825848065557eac3678b164cee\` ON \`product_gallery_item\``); await queryRunner.query(`DROP INDEX \`IDX_f7187fa710c6a5d22f46192637\` ON \`product_gallery_item\``); await queryRunner.query(`DROP TABLE \`product_gallery_item\``); await queryRunner.query(`DROP INDEX \`IDX_f75a28915b38d926902c0f85b2\` ON \`tag_product\``); await queryRunner.query(`DROP INDEX \`IDX_e516b4a2a1a8d4beda7217eeac\` ON \`tag_product\``); await queryRunner.query(`DROP TABLE \`tag_product\``); await queryRunner.query(`DROP INDEX \`IDX_e96a71affe63c97f7fa2f076da\` ON \`product_variant_options_product_option\``); await queryRunner.query(`DROP INDEX \`IDX_526f0131260eec308a3bd2b61b\` ON \`product_variant_options_product_option\``); await queryRunner.query(`DROP TABLE \`product_variant_options_product_option\``); await queryRunner.query(`DROP INDEX \`IDX_e087c0540b5098d115b50d954c\` ON \`tag_payment\``); await queryRunner.query(`DROP INDEX \`IDX_1fcb2a337ee905ab36c4aea3a3\` ON \`tag_payment\``); await queryRunner.query(`DROP TABLE \`tag_payment\``); await queryRunner.query(`DROP INDEX \`IDX_f5e70849adc6f2f81fcbccae77\` ON \`tag_organization\``); await queryRunner.query(`DROP INDEX \`IDX_7ca79ff010025397cf9f216bde\` ON \`tag_organization\``); await queryRunner.query(`DROP TABLE \`tag_organization\``); await queryRunner.query(`DROP INDEX \`IDX_f71369c1cb86ae9fd4d5452f9a\` ON \`tag_organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_7dde3307daf6d6dec1513ecc56\` ON \`tag_organization_vendor\``); await queryRunner.query(`DROP TABLE \`tag_organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_d15fbe1e1d9c1f56651d8d3831\` ON \`organization_team_tasks_task\``); await queryRunner.query(`DROP INDEX \`IDX_2a6fb43dc7e7aebcda95e32a10\` ON \`organization_team_tasks_task\``); await queryRunner.query(`DROP TABLE \`organization_team_tasks_task\``); await queryRunner.query(`DROP INDEX \`IDX_2382356b63c832a137079210bd\` ON \`tag_organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_4b5e0ca086e6124eeddf84252f\` ON \`tag_organization_team\``); await queryRunner.query(`DROP TABLE \`tag_organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_599a5f7f6c190822dcfdbbb6eb\` ON \`organization_project_team\``); await queryRunner.query(`DROP INDEX \`IDX_7c31431ff2173c2c939a0aa036\` ON \`organization_project_team\``); await queryRunner.query(`DROP TABLE \`organization_project_team\``); await queryRunner.query(`DROP INDEX \`IDX_18be859b371e9159dfc2cecbe1\` ON \`tag_organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_b69fa5d1b1d02cdbe301ea6b10\` ON \`tag_organization_project\``); await queryRunner.query(`DROP TABLE \`tag_organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_c71c381e77b0543ed4023aeef7\` ON \`tag_organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_1f7e0230bc542d703781020378\` ON \`tag_organization_position\``); await queryRunner.query(`DROP TABLE \`tag_organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_8c5db3a96baffba025729ebe86\` ON \`candidate_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_b4b51067c538f78b8585ef2a17\` ON \`candidate_employment_type\``); await queryRunner.query(`DROP TABLE \`candidate_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_3ed17d3e624435e9f2ad71e058\` ON \`organization_employment_type_employee\``); await queryRunner.query(`DROP INDEX \`IDX_3bfdb894d67e6a29aa95780bb4\` ON \`organization_employment_type_employee\``); await queryRunner.query(`DROP TABLE \`organization_employment_type_employee\``); await queryRunner.query(`DROP INDEX \`IDX_904a731b2ae6bc1aa52c8302a9\` ON \`tag_organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_41a87d3cfa58c851bbf03ad4e8\` ON \`tag_organization_employment_type\``); await queryRunner.query(`DROP TABLE \`tag_organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_ef6e8d34b95dcb2b21d5de08a6\` ON \`candidate_department\``); await queryRunner.query(`DROP INDEX \`IDX_c58533f9ba63f42fef682e1ee7\` ON \`candidate_department\``); await queryRunner.query(`DROP TABLE \`candidate_department\``); await queryRunner.query(`DROP INDEX \`IDX_0d4f83695591ae3c98a0544ac8\` ON \`organization_department_employee\``); await queryRunner.query(`DROP INDEX \`IDX_c34e79a3aa682bbd3f0e8cf4c4\` ON \`organization_department_employee\``); await queryRunner.query(`DROP TABLE \`organization_department_employee\``); await queryRunner.query(`DROP INDEX \`IDX_0eb285a6b1ac7e3d0a542e50a4\` ON \`tag_organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_c2c9cd2ea533d5442de455fb3e\` ON \`tag_organization_department\``); await queryRunner.query(`DROP TABLE \`tag_organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_cd2bd8302bfb6093d0908c36dc\` ON \`organization_contact_employee\``); await queryRunner.query(`DROP INDEX \`IDX_beffeb7f338fa98354948c0789\` ON \`organization_contact_employee\``); await queryRunner.query(`DROP TABLE \`organization_contact_employee\``); await queryRunner.query(`DROP INDEX \`IDX_8a06f5aded97d1b5e81005e121\` ON \`tag_organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_1fb664a63f20bea6a3f0b38771\` ON \`tag_organization_contact\``); await queryRunner.query(`DROP TABLE \`tag_organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_a6bfc0dc6e5234e8e7ef698a36\` ON \`warehouse_merchant\``); await queryRunner.query(`DROP INDEX \`IDX_812f0cfb560ac6dda0d1345765\` ON \`warehouse_merchant\``); await queryRunner.query(`DROP TABLE \`warehouse_merchant\``); await queryRunner.query(`DROP INDEX \`IDX_4af822b453c7d7d5f033e6ea16\` ON \`tag_merchant\``); await queryRunner.query(`DROP INDEX \`IDX_e7d60a4e9906d056a8966e279f\` ON \`tag_merchant\``); await queryRunner.query(`DROP TABLE \`tag_merchant\``); await queryRunner.query(`DROP INDEX \`IDX_0728fc2cc26e8802cbf41aaf27\` ON \`tag_invoice\``); await queryRunner.query(`DROP INDEX \`IDX_5a07958d7c6253b311dbdc34ff\` ON \`tag_invoice\``); await queryRunner.query(`DROP TABLE \`tag_invoice\``); await queryRunner.query(`DROP INDEX \`IDX_1132ec0c3618e53fc8cf7ed669\` ON \`invite_organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_104140c94e838a058a34b30a09\` ON \`invite_organization_team\``); await queryRunner.query(`DROP TABLE \`invite_organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_fe2eea7a939442efde885303ef\` ON \`invite_organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_0935b93b3498a0f98db1af7176\` ON \`invite_organization_department\``); await queryRunner.query(`DROP TABLE \`invite_organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_c5a147ce2a0ec69ccc61149262\` ON \`invite_organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_a0c92b6393c7a13266003d552e\` ON \`invite_organization_contact\``); await queryRunner.query(`DROP TABLE \`invite_organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_f2806968dd846cb49fcdac195a\` ON \`invite_organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_020325728f0979a2822a829565\` ON \`invite_organization_project\``); await queryRunner.query(`DROP TABLE \`invite_organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_0f19ad9872190b7a67a9652d5e\` ON \`tag_integration\``); await queryRunner.query(`DROP INDEX \`IDX_c9a85b16615bc5c3035802adb0\` ON \`tag_integration\``); await queryRunner.query(`DROP TABLE \`tag_integration\``); await queryRunner.query(`DROP INDEX \`IDX_8dd2062499a6c2a708ddd05650\` ON \`integration_integration_type\``); await queryRunner.query(`DROP INDEX \`IDX_34c86921ee9b462bc5c7b61fad\` ON \`integration_integration_type\``); await queryRunner.query(`DROP TABLE \`integration_integration_type\``); await queryRunner.query(`DROP INDEX \`IDX_00e2fd30761a36911648166044\` ON \`tag_income\``); await queryRunner.query(`DROP INDEX \`IDX_55c9568ebe1c4addc3deb6922e\` ON \`tag_income\``); await queryRunner.query(`DROP TABLE \`tag_income\``); await queryRunner.query(`DROP INDEX \`IDX_8dcfbd0d960672fefe681bcba9\` ON \`tag_expense\``); await queryRunner.query(`DROP INDEX \`IDX_6f1108552ea7a70a4d958b338c\` ON \`tag_expense\``); await queryRunner.query(`DROP TABLE \`tag_expense\``); await queryRunner.query(`DROP INDEX \`IDX_727dbf5e1100023681e216d6a9\` ON \`tag_organization_expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_107a93f89c8f31f4386ae4b19d\` ON \`tag_organization_expense_category\``); await queryRunner.query(`DROP TABLE \`tag_organization_expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_34b8f471aac00eaec6f2830e5b\` ON \`tag_event_type\``); await queryRunner.query(`DROP INDEX \`IDX_094af399a26d4a1d3ae17ea11e\` ON \`tag_event_type\``); await queryRunner.query(`DROP TABLE \`tag_event_type\``); await queryRunner.query(`DROP INDEX \`IDX_0360b8197c2a38d6fe882cb1af\` ON \`tag_equipment\``); await queryRunner.query(`DROP INDEX \`IDX_bb0062d51a75164fcb64041ee7\` ON \`tag_equipment\``); await queryRunner.query(`DROP TABLE \`tag_equipment\``); await queryRunner.query(`DROP INDEX \`IDX_7ccef49dd56c8c74daa8d12186\` ON \`equipment_shares_teams\``); await queryRunner.query(`DROP INDEX \`IDX_f84171695b7aedfc454483bcf2\` ON \`equipment_shares_teams\``); await queryRunner.query(`DROP TABLE \`equipment_shares_teams\``); await queryRunner.query(`DROP INDEX \`IDX_57f6461f1a710f0f4abdcb8d0e\` ON \`equipment_shares_employees\``); await queryRunner.query(`DROP INDEX \`IDX_8676224f55a965c53e4bb7cbf8\` ON \`equipment_shares_employees\``); await queryRunner.query(`DROP TABLE \`equipment_shares_employees\``); await queryRunner.query(`DROP INDEX \`IDX_6bbbe677c5fc5115916b4eccfb\` ON \`employee_tasks_task\``); await queryRunner.query(`DROP INDEX \`IDX_eae5eea1c6a3fcf4a2c95f1a5f\` ON \`employee_tasks_task\``); await queryRunner.query(`DROP TABLE \`employee_tasks_task\``); await queryRunner.query(`DROP INDEX \`IDX_0a8cf0aacf95ce66e73e75a95c\` ON \`time_off_request_employee\``); await queryRunner.query(`DROP INDEX \`IDX_cd312469204347b1210397770a\` ON \`time_off_request_employee\``); await queryRunner.query(`DROP TABLE \`time_off_request_employee\``); await queryRunner.query(`DROP INDEX \`IDX_0f823750ac5a7d899cc5d8d040\` ON \`time_off_policy_employee\``); await queryRunner.query(`DROP INDEX \`IDX_c451f53f5a6cd97db94e1c9482\` ON \`time_off_policy_employee\``); await queryRunner.query(`DROP TABLE \`time_off_policy_employee\``); await queryRunner.query(`DROP INDEX \`IDX_b1ffe2a63a48b486e18dc59d1b\` ON \`tag_employee\``); await queryRunner.query(`DROP INDEX \`IDX_e0ddfccfe9816681c410ebf2b9\` ON \`tag_employee\``); await queryRunner.query(`DROP TABLE \`tag_employee\``); await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); await queryRunner.query(`DROP TABLE \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_f3caf4cc158fe8b8e06578e792\` ON \`tag_employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_b3565ff8073d4f66c46d27fe88\` ON \`tag_employee_level\``); await queryRunner.query(`DROP TABLE \`tag_employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_68e75e49f06409fd385b4f8774\` ON \`employee_job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_7ae5b4d4bdec77971dab319f2e\` ON \`employee_job_preset\``); await queryRunner.query(`DROP TABLE \`employee_job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_7e0891bb331b08bd4abb6776b7\` ON \`tag_candidate\``); await queryRunner.query(`DROP INDEX \`IDX_34e4625cc9b010079f1b5758b3\` ON \`tag_candidate\``); await queryRunner.query(`DROP TABLE \`tag_candidate\``); await queryRunner.query(`DROP INDEX \`IDX_c2037b621d2e8023898aee4ac7\` ON \`changelog\``); await queryRunner.query(`DROP INDEX \`IDX_744268ee0ec6073883267bc3b6\` ON \`changelog\``); await queryRunner.query(`DROP INDEX \`IDX_cbc2b8338d45e774afd8682ffe\` ON \`changelog\``); await queryRunner.query(`DROP INDEX \`IDX_cc89233c87fcf64b01df07e038\` ON \`changelog\``); await queryRunner.query(`DROP TABLE \`changelog\``); await queryRunner.query(`DROP INDEX \`IDX_2d5ecab1f06b327bad54553614\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_8eb7e413257d7a26104f4e326f\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_81558bb2bef673628d92540b4e\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_1551e821871d9230cc0dafbbe5\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_a9130ad7824fb843f06103971e\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_b9623984c84eb7be4c0eb076c2\` ON \`knowledge_base_author\``); await queryRunner.query(`DROP TABLE \`knowledge_base_author\``); await queryRunner.query(`DROP INDEX \`IDX_66af194845635058239e794e1b\` ON \`knowledge_base_article\``); await queryRunner.query(`DROP INDEX \`IDX_3547f82f867489542ceae58a49\` ON \`knowledge_base_article\``); await queryRunner.query(`DROP INDEX \`IDX_06a9902fedc1f9dcdbaf14afb0\` ON \`knowledge_base_article\``); await queryRunner.query(`DROP INDEX \`IDX_e9720156c57ff1ad841e95ace7\` ON \`knowledge_base_article\``); await queryRunner.query(`DROP INDEX \`IDX_1544c43e36e1ccf7d578c70607\` ON \`knowledge_base_article\``); await queryRunner.query(`DROP TABLE \`knowledge_base_article\``); await queryRunner.query(`DROP INDEX \`IDX_ff979040ce93cbc60863d322ec\` ON \`knowledge_base\``); await queryRunner.query(`DROP INDEX \`IDX_2ba72a9dec732a10e8c05bcdec\` ON \`knowledge_base\``); await queryRunner.query(`DROP INDEX \`IDX_bcb30c9893f4c8d0c4e556b4ed\` ON \`knowledge_base\``); await queryRunner.query(`DROP INDEX \`IDX_0765098c5a6f93f51a55bda026\` ON \`knowledge_base\``); await queryRunner.query(`DROP INDEX \`IDX_9b22423b8cb20087c16613ecba\` ON \`knowledge_base\``); await queryRunner.query(`DROP TABLE \`knowledge_base\``); await queryRunner.query(`DROP INDEX \`REL_84594016a98da8b87e0f51cd93\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_84594016a98da8b87e0f51cd93\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_f502dc6d9802306f9d1584932b\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_f5735eafddabdb4b20f621a976\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_9b2f00761a6b1b77cb6289e3ff\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_835691d3dd62d0b705302cbb2d\` ON \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_ee85901ae866ffe2061d5b35c8\` ON \`warehouse\``); await queryRunner.query(`DROP TABLE \`warehouse\``); await queryRunner.query(`DROP INDEX \`IDX_617306cb3613dd8d59301ae16f\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_a2f863689d1316810c41c1ea38\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_d5f4b64e6a80546fd6dd4ac3ed\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_a1c4a97b928b547c3041d3ac1f\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_40aa52eaed1ce133f5fee76bca\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_5f32a52e9bd19bf323b02efcd1\` ON \`warehouse_product_variant\``); await queryRunner.query(`DROP TABLE \`warehouse_product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_3f934c4772e7c7f2c66d7ea4e7\` ON \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_a8c9aee14d47ec7b3f2ac429eb\` ON \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_c899e17322d11e1977832e8c65\` ON \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_62573a939f834f2de343f98288\` ON \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_3370818c940a51996d80bb4d16\` ON \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_7a584a02d15a022e9c4f06ea72\` ON \`warehouse_product\``); await queryRunner.query(`DROP TABLE \`warehouse_product\``); await queryRunner.query(`DROP INDEX \`IDX_5e028298e103e1694147ada69e\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_c28e52f758e7bbc53828db9219\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_78a916df40e02a9deb1c4b75ed\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_f2578043e491921209f5dadd08\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_f0e1b4ecdca13b177e2e3a0613\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_58e4dbff0e1a32a9bdc861bb29\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_19de43e9f1842360ce646253d7\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_685bf353c85f23b6f848e4dcde\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_557cb712d32a9ad9ffbb4cd50d\` ON \`user\``); await queryRunner.query(`DROP INDEX \`IDX_fde2ce12ab12b02ae583dd76c7\` ON \`user\``); await queryRunner.query(`DROP TABLE \`user\``); await queryRunner.query(`DROP INDEX \`IDX_29c3c8cc3ea9db22e4a347f4b5\` ON \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_1f97ff07fb198bd0a7786b2abd\` ON \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_7143f31467178a6164a42426c1\` ON \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_611e1392c8cc9b101e3ea7ad80\` ON \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_c764336019c69cc4927f317cb0\` ON \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_ca24fc59aac015d9660955f5f6\` ON \`user_organization\``); await queryRunner.query(`DROP TABLE \`user_organization\``); await queryRunner.query(`DROP INDEX \`IDX_6c1f81934a3f597b3b1a17f562\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_8c8f821cb0fe0dd387491ea7d9\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_23fdffa8369387d87101090684\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_c828facbb4250117f83416d9f7\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_ea81b5247ecdf5d82cf71fa096\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_3502c60f98a7cda58dea75bcb5\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_3f8fc4b5718fcaa913f9438e27\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_6a79eb7534066b11f59243ede1\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_f6558fbb3158ab90da1c41d943\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_930e2b28de9ecb1ea689d5a97a\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_aca65a79fe0c1ec9e6a59022c5\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_25b8df69c9b7f5752c6a6a6ef7\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_f2d4cd3a7e839bfc7cb6b993ff\` ON \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_42205a9e6af108364e5cc62dd4\` ON \`timesheet\``); await queryRunner.query(`DROP TABLE \`timesheet\``); await queryRunner.query(`DROP INDEX \`IDX_0ac1d2777eefcee82db52ca366\` ON \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_9272701d3da8bd8507f316c915\` ON \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_82c5edbd179359212f16f0d386\` ON \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_c7f72cb68b22b8ab988158e4d2\` ON \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_a3eeb9629f550c367bb752855e\` ON \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_8260fdc7862ca27d8cf10e6290\` ON \`time_slot_minute\``); await queryRunner.query(`DROP TABLE \`time_slot_minute\``); await queryRunner.query(`DROP INDEX \`IDX_7913305b850c7afc89b6ed96a3\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_c6e7d1075bfd97eea6643b1479\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_f44e721669d5c6bed32cd6a3bf\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_0c707825a7c2ecc4e186b07ebf\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_b407841271245501dd1a8c7551\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_b8284109257b5137256b5b3e84\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_81060c5dbe69efa1f3b6e1a2e5\` ON \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_645a6bc3f1141d4a111a3166d8\` ON \`time_slot\``); await queryRunner.query(`DROP TABLE \`time_slot\``); await queryRunner.query(`DROP INDEX \`IDX_18dcdf754396f0cb0308dc91f4\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_d1e8f22c02c5e949453dde7f2d\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_1ddf2da35e34378fd845d80a18\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_54776f6f5fd3c13c3bc1fbfac5\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_e65393bb52aa8275b1392c73f7\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_a89a849957e005bafb8e4220bc\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_79001d281ecb766005b3d331c1\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_f447474d185cd70b3015853874\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_722b9cb3a991c964d86396b6bc\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_402290e7045e0c10ef97d9f982\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_e80fb588b1086ce2a4f2244814\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_154e9120e2acb632d8bd9b91ff\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_a1f8fcd70164d915fe7dd4a1ec\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_189b79acd611870aba62b3594e\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_aed2d5cc5680fba9d387c7f931\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_fa9018cb248ea0f3b2b30ef143\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_91a64228fbbe1516730a0cab5d\` ON \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_a1910a76044b971609b75ea165\` ON \`time_log\``); await queryRunner.query(`DROP TABLE \`time_log\``); await queryRunner.query(`DROP INDEX \`IDX_fa1896dc735403799311968f7e\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_5b594d02d98d5defcde323abe5\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_eea7986acfb827bf5d0622c41f\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_1b0867d86ead2332f3d4edba7d\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_2b374e5cdee1145ebb2a832f20\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_3d7feb5fe793e4811cdb79f983\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_0951aacffe3f8d0cff54cf2f34\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_235004f3dafac90692cd64d915\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_892e285e1da2b3e61e51e50628\` ON \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_742688858e0484d66f04e4d4c4\` ON \`screenshot\``); await queryRunner.query(`DROP TABLE \`screenshot\``); await queryRunner.query(`DROP INDEX \`IDX_2743f8990fde12f9586287eb09\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_4e382caaf07ab0923b2e06bf91\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_5a898f44fa31ef7916f0c38b01\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_a6f74ae99d549932391f0f4460\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_ffd736f18ba71b3221e4f835a9\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_0e36a2c95e2f1df7f1b3059d24\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_f27285af15ef48363745ab2d79\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_b5525385e85f7429e233d4a0fa\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_302b60a4970ffe94d5223f1c23\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_a28a1682ea80f10d1ecc7babaa\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_fdb3f018c2bba4885bfa5757d1\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_f2401d8fdff5d8970dfe30d3ae\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_d2d6db7f03da5632687e5d140e\` ON \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_ae6ac57aafef59f561d4db3dd7\` ON \`activity\``); await queryRunner.query(`DROP TABLE \`activity\``); await queryRunner.query(`DROP INDEX \`IDX_c009cdd795be674c2047062374\` ON \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_c1f8ae47dc2f1882afc5045c73\` ON \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_981333982a6df8b815957dcbf2\` ON \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_4989834dd1c9c8ea3576ed99ce\` ON \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_5ddef92c4694e6d650d9e557b3\` ON \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_45e4bc4476681f4db2097cc2d5\` ON \`time_off_request\``); await queryRunner.query(`DROP TABLE \`time_off_request\``); await queryRunner.query(`DROP INDEX \`IDX_7d7f69c79df4a6f152b0e362b1\` ON \`time_off_policy\``); await queryRunner.query(`DROP INDEX \`IDX_c2744cffeca55c3c9c52bb9789\` ON \`time_off_policy\``); await queryRunner.query(`DROP INDEX \`IDX_1c0ed84d54f8fbe4af10dfcda1\` ON \`time_off_policy\``); await queryRunner.query(`DROP INDEX \`IDX_22d919e53cf5f6d836b18d407a\` ON \`time_off_policy\``); await queryRunner.query(`DROP INDEX \`IDX_cf9377d3bcb7cb996f72268941\` ON \`time_off_policy\``); await queryRunner.query(`DROP TABLE \`time_off_policy\``); await queryRunner.query(`DROP INDEX \`IDX_d154d06dac0d0e0a5d9a083e25\` ON \`tenant\``); await queryRunner.query(`DROP INDEX \`IDX_56211336b5ff35fd944f225917\` ON \`tenant\``); await queryRunner.query(`DROP INDEX \`IDX_eeedffab85b3534a1068d9270f\` ON \`tenant\``); await queryRunner.query(`DROP INDEX \`IDX_b8eb9f3e420aa846f30e291960\` ON \`tenant\``); await queryRunner.query(`DROP TABLE \`tenant\``); await queryRunner.query(`DROP INDEX \`IDX_affdab301e348b892175f30fa3\` ON \`tenant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_a7500f9b1b7917bf10882c820e\` ON \`tenant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_1d9975b98d82f385ae14b4d7c6\` ON \`tenant_setting\``); await queryRunner.query(`DROP TABLE \`tenant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_959e77718a2e76ee56498c1106\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_91988120385964f213aec8aa84\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_e9fd8df772ad2d955a65f4c68a\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_3396dda57286ca17ab61fd3704\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_9c845f353378371ee3aa60f686\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_379c8bd0ce203341148c1f99ee\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_313b0e55871c1c9b6c22341536\` ON \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_7e509a66367ecaf8e3bc96f263\` ON \`task_version\``); await queryRunner.query(`DROP TABLE \`task_version\``); await queryRunner.query(`DROP INDEX \`IDX_0330b4a942b536d8d1f264abe3\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_a19e8975e5c296640d457dfc11\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_68eaba689ed6d3e27ec93d3e88\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_b0c955f276679dd2b2735c3936\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_9b9a828a49f4bd6383a4073fe2\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_efbaf00a743316b394cc31e4a2\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_79c525a8c2209e90186bfcbea9\` ON \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_25d9737ee153411871b4d20c67\` ON \`task_status\``); await queryRunner.query(`DROP TABLE \`task_status\``); await queryRunner.query(`DROP INDEX \`IDX_f4438327b3c2afb0832569b2a1\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_ad6792b26526bd96ab18d63454\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_1a7b137d009616a2ff1aa6834f\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_90c54f57b29cc8b67edc2738ae\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_596512cc6508a482cc23ae6ab7\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_f6ec2207e50680a475d71c8979\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_8f26ffc61abaef417b0f807695\` ON \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_d65afcfe2d64e49d43931579a3\` ON \`task_size\``); await queryRunner.query(`DROP TABLE \`task_size\``); await queryRunner.query(`DROP INDEX \`IDX_4967ebdca0aefb9d43e56695e4\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_d99fe5b50dbe5078e0d9a9b6a9\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_61a7cb4452d9e23f91231b7fd6\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_9423f99da972c150f85dbc11c1\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_bed691e21fe01cf5aceee72295\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_b7b0ea8ac2825fb981c1181d11\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_8177dd93be8044b37d3bb9285d\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_5a341f51d8f5ec12db24ab033f\` ON \`task_related_issue_type\``); await queryRunner.query(`DROP TABLE \`task_related_issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_52b039cff6a1adf6b7f9e49ee4\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_db4237960ca989eb7a48cd433b\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_46daede7b19176b6ad959d70da\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_7d656b4cba8f11e639dbc5aab3\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_7fd1b30d159b608cbf59009f68\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_1818655f27b8cf4f0d1dbfeb8d\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_e6adb82db368af15f2b8cdd4e8\` ON \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_8ddcc5eeaf96314f53ca486821\` ON \`task_priority\``); await queryRunner.query(`DROP TABLE \`task_priority\``); await queryRunner.query(`DROP INDEX \`IDX_0848fd2b8c23c0ab55146297cf\` ON \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`IDX_6deea7b3671e45973e191a1502\` ON \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`IDX_24114c4059e6b6991daba541b1\` ON \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`IDX_20b50abc5c97610a75d49ad381\` ON \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`IDX_88021c0cd9508757d3d90333f8\` ON \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`IDX_d49853e18e5bc772f5435b01a5\` ON \`task_linked_issues\``); await queryRunner.query(`DROP TABLE \`task_linked_issues\``); await queryRunner.query(`DROP INDEX \`taskNumber\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_b8616deefe44d0622233e73fbf\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_2f4bdd2593fd6038aaa91fd107\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_0cbe714983eb0aae5feeee8212\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_1e1f64696aa3a26d3e12c840e5\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_94fe6b3a5aec5f85427df4f8cd\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_3797a20ef5553ae87af126bc2f\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_ed5441fb13e82854a994da5a78\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_7127880d6fae956ecc1c84ac31\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_f092f3386f10f2e2ef5b0b6ad1\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_2fe7a278e6f08d2be55740a939\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_5b0272d923a31c972bed1a1ac4\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_e91cbff3d206f150ccc14d0c3a\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_ca2f7edd5a5ce8f14b257c9d54\` ON \`task\``); await queryRunner.query(`DROP INDEX \`IDX_3e16c81005c389a4db83c0e5e3\` ON \`task\``); await queryRunner.query(`DROP TABLE \`task\``); await queryRunner.query(`DROP INDEX \`IDX_586513cceb16777fd14a17bfe1\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_131331557078611a68b4a5b2e7\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_33779b0395f72af0b50dc526d1\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_af2d743ed61571bcdc5d9a27a0\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_4af451ab46a94e94394c72d911\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_16dbef9d1b2b422abdce8ee3ae\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_8b12c913c39c72fe5980427c96\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_1909e9bae7d8b2c920b3e4d859\` ON \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_722ce5d7535524b96c6d03f7c4\` ON \`issue_type\``); await queryRunner.query(`DROP TABLE \`issue_type\``); await queryRunner.query(`DROP INDEX \`IDX_a3ee022203211f678376cd919b\` ON \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_8f274646f2bdf4e12990feeb04\` ON \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_16507eb222e3c50be077fb4ace\` ON \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_87bfea6d0b9a1ec602ee88e5f6\` ON \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_1f3ffda4fce02682e76308b476\` ON \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_b1a7086c279309b20e8384d0d9\` ON \`task_estimation\``); await queryRunner.query(`DROP TABLE \`task_estimation\``); await queryRunner.query(`DROP INDEX \`IDX_49746602acc4e5e8721062b69e\` ON \`tag\``); await queryRunner.query(`DROP INDEX \`IDX_c2f6bec0b39eaa3a6d90903ae9\` ON \`tag\``); await queryRunner.query(`DROP INDEX \`IDX_b08dd29fb6a8acdf83c83d8988\` ON \`tag\``); await queryRunner.query(`DROP INDEX \`IDX_58876ee26a90170551027459bf\` ON \`tag\``); await queryRunner.query(`DROP INDEX \`IDX_1f22c73374bcca1ea84a4dca59\` ON \`tag\``); await queryRunner.query(`DROP TABLE \`tag\``); await queryRunner.query(`DROP INDEX \`IDX_b2923d394f3636671ff9b3c3e8\` ON \`skill\``); await queryRunner.query(`DROP INDEX \`IDX_8e502eac7ed1347c71c26beae8\` ON \`skill\``); await queryRunner.query(`DROP INDEX \`IDX_ca52119f9e4857399706d723e9\` ON \`skill\``); await queryRunner.query(`DROP INDEX \`IDX_f4cdbe61d68413f4d6a671f8c2\` ON \`skill\``); await queryRunner.query(`DROP TABLE \`skill\``); await queryRunner.query(`DROP INDEX \`IDX_ae4578dcaed5adff96595e6166\` ON \`role\``); await queryRunner.query(`DROP INDEX \`IDX_1751a572e91385a09d41c62471\` ON \`role\``); await queryRunner.query(`DROP INDEX \`IDX_09868c0733ba37a4753ff8931f\` ON \`role\``); await queryRunner.query(`DROP INDEX \`IDX_c5f75cd3367769b6f22b298d29\` ON \`role\``); await queryRunner.query(`DROP TABLE \`role\``); await queryRunner.query(`DROP INDEX \`IDX_e3130a39c1e4a740d044e68573\` ON \`role_permission\``); await queryRunner.query(`DROP INDEX \`IDX_8307c5c44a4ad6210b767b17a9\` ON \`role_permission\``); await queryRunner.query(`DROP INDEX \`IDX_cbd053921056e77c0a8e03122a\` ON \`role_permission\``); await queryRunner.query(`DROP INDEX \`IDX_5c36df1a5c85016952e90d760f\` ON \`role_permission\``); await queryRunner.query(`DROP INDEX \`IDX_78f93dbb42a97f6785bcf53efd\` ON \`role_permission\``); await queryRunner.query(`DROP TABLE \`role_permission\``); await queryRunner.query(`DROP INDEX \`IDX_26bb3420001d31337393ed05bc\` ON \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_c63fafc733ff8ab37dede8ffec\` ON \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_8343741e7929043b2a7de89f73\` ON \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_9feaa23ed7bc47d51315e304bb\` ON \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_c77295d7f5d6086c815de3c120\` ON \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_db152600f88a9a4888df0b626e\` ON \`request_approval\``); await queryRunner.query(`DROP TABLE \`request_approval\``); await queryRunner.query(`DROP INDEX \`IDX_9ccdaee6c5c62cda8f7375e841\` ON \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_6c75d8a8c609e88896b2653cc4\` ON \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_77e1050669b32cfff482f96016\` ON \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_94b2a3d0f17c9549dea1493dc9\` ON \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_bdcb4ea389bdb794bae75b0170\` ON \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_34b2e8f794e0336b9ac410d8bd\` ON \`request_approval_team\``); await queryRunner.query(`DROP TABLE \`request_approval_team\``); await queryRunner.query(`DROP INDEX \`IDX_ce2113039f070b3f003aa0db61\` ON \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_563fec5539b89a57f40731f985\` ON \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_4071f027554eefff65ac8123e6\` ON \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_a5445b38b780b29b09369e36a9\` ON \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_3d66190c19b9fe69a8bbb300df\` ON \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_2634ff04775e659c4792325f38\` ON \`request_approval_employee\``); await queryRunner.query(`DROP TABLE \`request_approval_employee\``); await queryRunner.query(`DROP INDEX \`IDX_230652e48daa99c50c000fc5d1\` ON \`report\``); await queryRunner.query(`DROP INDEX \`IDX_ef16fed5f7e6951027502e6458\` ON \`report\``); await queryRunner.query(`DROP INDEX \`IDX_6f9ee54eb839117e83b937648d\` ON \`report\``); await queryRunner.query(`DROP INDEX \`IDX_1316fdd7b9a2926437a13271bf\` ON \`report\``); await queryRunner.query(`DROP INDEX \`IDX_143ead1a6ac5f73125d8c4c3aa\` ON \`report\``); await queryRunner.query(`DROP TABLE \`report\``); await queryRunner.query(`DROP INDEX \`IDX_5193788a3ebc1143bedb74cf72\` ON \`report_organization\``); await queryRunner.query(`DROP INDEX \`IDX_edf9bd011d7f08e3e18a5becb8\` ON \`report_organization\``); await queryRunner.query(`DROP INDEX \`IDX_40459267d68604655aa6df4251\` ON \`report_organization\``); await queryRunner.query(`DROP INDEX \`IDX_a6bde8f44e18f17b1ca603e150\` ON \`report_organization\``); await queryRunner.query(`DROP TABLE \`report_organization\``); await queryRunner.query(`DROP INDEX \`IDX_fa278d337ba5e200d44ade6697\` ON \`report_category\``); await queryRunner.query(`DROP INDEX \`IDX_656f05f951faa13d7195853424\` ON \`report_category\``); await queryRunner.query(`DROP INDEX \`IDX_dd9fcd7916d0a22189ecea6a36\` ON \`report_category\``); await queryRunner.query(`DROP TABLE \`report_category\``); await queryRunner.query(`DROP INDEX \`IDX_cc28a54171231fbd9a127051f0\` ON \`proposal\``); await queryRunner.query(`DROP INDEX \`IDX_d59ec6899d435f430799795ad7\` ON \`proposal\``); await queryRunner.query(`DROP INDEX \`IDX_4177329f5e6ddbfb6416592713\` ON \`proposal\``); await queryRunner.query(`DROP INDEX \`IDX_e2836e856f491dd4676e1ec8d3\` ON \`proposal\``); await queryRunner.query(`DROP INDEX \`IDX_61a30a7d83666bf265fd86a72d\` ON \`proposal\``); await queryRunner.query(`DROP TABLE \`proposal\``); await queryRunner.query(`DROP INDEX \`IDX_d24bc28e54f1dc296452a25591\` ON \`product_translation\``); await queryRunner.query(`DROP INDEX \`IDX_e6abcacc3d3a4f9cf5ca97f2b2\` ON \`product_translation\``); await queryRunner.query(`DROP INDEX \`IDX_7533fd275bfb3219ce9eb4004c\` ON \`product_translation\``); await queryRunner.query(`DROP INDEX \`IDX_96413a8061ff4ccdc418d4e16a\` ON \`product_translation\``); await queryRunner.query(`DROP INDEX \`IDX_1d9ca23c7e1c606061fec8bb74\` ON \`product_translation\``); await queryRunner.query(`DROP TABLE \`product_translation\``); await queryRunner.query(`DROP INDEX \`IDX_618194d24a7ea86a165d7ec628\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_374bfd0d1b0e1398d7206456d9\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_4627873dbc1af07d732e6eec7b\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_32a4bdd261ec81f4ca6b3abe26\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_08293ca31a601d3cd0228120bc\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_6f58935aa2175d930e47e97c9f\` ON \`product\``); await queryRunner.query(`DROP INDEX \`IDX_7bb2b2f7a4c8a4916d4339d7f4\` ON \`product\``); await queryRunner.query(`DROP TABLE \`product\``); await queryRunner.query(`DROP INDEX \`REL_9f0fd369dfeb275415c649d110\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`REL_41b31a71dda350cfe5da07e0e4\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_b83f23626741630a8629960715\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_6e420052844edf3a5506d863ce\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_6a289b10030ae86903406e3c9b\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_9121e00c4dc3500dc610cf8722\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_e0005cbdabb760488f66f3fbba\` ON \`product_variant\``); await queryRunner.query(`DROP INDEX \`IDX_e0d896cadbc695a490f64bb7e7\` ON \`product_variant\``); await queryRunner.query(`DROP TABLE \`product_variant\``); await queryRunner.query(`DROP INDEX \`REL_5842f603bd85d924127d63d73c\` ON \`product_variant_price\``); await queryRunner.query(`DROP INDEX \`IDX_0cfba32db58a952f58b1e35cf1\` ON \`product_variant_price\``); await queryRunner.query(`DROP INDEX \`IDX_7052eaf00a5795afa5ebf35995\` ON \`product_variant_price\``); await queryRunner.query(`DROP INDEX \`IDX_24ac11e35221577e4ba4fdd229\` ON \`product_variant_price\``); await queryRunner.query(`DROP INDEX \`IDX_562ef5984b6d4bed640bfcc6a2\` ON \`product_variant_price\``); await queryRunner.query(`DROP TABLE \`product_variant_price\``); await queryRunner.query(`DROP INDEX \`IDX_e4e4120b0c19d3a207ce38d758\` ON \`product_type\``); await queryRunner.query(`DROP INDEX \`IDX_f206c807fc7e41fc8a8b6679ae\` ON \`product_type\``); await queryRunner.query(`DROP INDEX \`IDX_49064ee0f3acd5882f4d893f3d\` ON \`product_type\``); await queryRunner.query(`DROP INDEX \`IDX_90cc635a1065702ed3b79da6ec\` ON \`product_type\``); await queryRunner.query(`DROP TABLE \`product_type\``); await queryRunner.query(`DROP INDEX \`IDX_f4b767c43b4e9130c63382c9b2\` ON \`product_type_translation\``); await queryRunner.query(`DROP INDEX \`IDX_2dd271bdeb602b8c3956287e33\` ON \`product_type_translation\``); await queryRunner.query(`DROP INDEX \`IDX_30aafca59cdb456bf5231f9e46\` ON \`product_type_translation\``); await queryRunner.query(`DROP INDEX \`IDX_65874d6bab7fefcaeccd2252c1\` ON \`product_type_translation\``); await queryRunner.query(`DROP INDEX \`IDX_e9dca49bad996f1761db3b2f56\` ON \`product_type_translation\``); await queryRunner.query(`DROP TABLE \`product_type_translation\``); await queryRunner.query(`DROP INDEX \`REL_b0d86990fe7160a5f3e4011fb2\` ON \`product_variant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_bed9d45e15866d9b8e87e7a7bf\` ON \`product_variant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_2efe48435d4ba480a4bb8b96fa\` ON \`product_variant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_ae78776111e1906accfd61511d\` ON \`product_variant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_ad107ba78e487cd8b13313593b\` ON \`product_variant_setting\``); await queryRunner.query(`DROP TABLE \`product_variant_setting\``); await queryRunner.query(`DROP INDEX \`IDX_a6debf9198e2fbfa006aa10d71\` ON \`product_option\``); await queryRunner.query(`DROP INDEX \`IDX_47ffb82a65c43f102b7e0efa41\` ON \`product_option\``); await queryRunner.query(`DROP INDEX \`IDX_985d235aa5394937c4493262c7\` ON \`product_option\``); await queryRunner.query(`DROP INDEX \`IDX_35d083f4ecfe72cce72ee88f58\` ON \`product_option\``); await queryRunner.query(`DROP INDEX \`IDX_d81028785f188c253e0bd49a03\` ON \`product_option\``); await queryRunner.query(`DROP TABLE \`product_option\``); await queryRunner.query(`DROP INDEX \`IDX_f43c46e12db0580af320db7738\` ON \`product_option_translation\``); await queryRunner.query(`DROP INDEX \`IDX_4dc2f466cfa3d0b7fef19d1273\` ON \`product_option_translation\``); await queryRunner.query(`DROP INDEX \`IDX_9869d7680f48487e584f5d2fca\` ON \`product_option_translation\``); await queryRunner.query(`DROP INDEX \`IDX_2f581c3477a5c7a66de5d7f264\` ON \`product_option_translation\``); await queryRunner.query(`DROP INDEX \`IDX_f284f666950392c55afa0806c8\` ON \`product_option_translation\``); await queryRunner.query(`DROP TABLE \`product_option_translation\``); await queryRunner.query(`DROP INDEX \`IDX_c9ce1da98b6d93293daafee63a\` ON \`product_option_group_translation\``); await queryRunner.query(`DROP INDEX \`IDX_0e2fcc31743e20a45fc3cf0211\` ON \`product_option_group_translation\``); await queryRunner.query(`DROP INDEX \`IDX_fd6b39f1fd1db026b5dcc3c795\` ON \`product_option_group_translation\``); await queryRunner.query(`DROP INDEX \`IDX_e9e50109d3054fb81205c0a74e\` ON \`product_option_group_translation\``); await queryRunner.query(`DROP INDEX \`IDX_75b7065234a6d32fbd03d8703f\` ON \`product_option_group_translation\``); await queryRunner.query(`DROP TABLE \`product_option_group_translation\``); await queryRunner.query(`DROP INDEX \`IDX_a6e91739227bf4d442f23c52c7\` ON \`product_option_group\``); await queryRunner.query(`DROP INDEX \`IDX_4a1430a01b71ecdfcd54b2b6c5\` ON \`product_option_group\``); await queryRunner.query(`DROP INDEX \`IDX_462a7fd3ce68935cf973c6709f\` ON \`product_option_group\``); await queryRunner.query(`DROP INDEX \`IDX_76bda4c33c83614617278617ae\` ON \`product_option_group\``); await queryRunner.query(`DROP INDEX \`IDX_0fc743f2bc16502dbc5e85420c\` ON \`product_option_group\``); await queryRunner.query(`DROP TABLE \`product_option_group\``); await queryRunner.query(`DROP INDEX \`IDX_f38e86bd280ff9c9c7d9cb7839\` ON \`product_category\``); await queryRunner.query(`DROP INDEX \`IDX_853302351eaa4daa39920c270a\` ON \`product_category\``); await queryRunner.query(`DROP INDEX \`IDX_0a0cf25cd8232a154d1cce2641\` ON \`product_category\``); await queryRunner.query(`DROP INDEX \`IDX_06cd3959f09e0b12793a763515\` ON \`product_category\``); await queryRunner.query(`DROP INDEX \`IDX_198fba43f049ea621407e7d188\` ON \`product_category\``); await queryRunner.query(`DROP TABLE \`product_category\``); await queryRunner.query(`DROP INDEX \`IDX_586294149d24cd835678878ef1\` ON \`product_category_translation\``); await queryRunner.query(`DROP INDEX \`IDX_e46203bf1dbf3291d174f02cb3\` ON \`product_category_translation\``); await queryRunner.query(`DROP INDEX \`IDX_27d71aa2e843f07fbf36329be3\` ON \`product_category_translation\``); await queryRunner.query(`DROP INDEX \`IDX_d32c5d5e4451acf44fd5b212ce\` ON \`product_category_translation\``); await queryRunner.query(`DROP INDEX \`IDX_e690dd59b69e74a6bb5d94f32b\` ON \`product_category_translation\``); await queryRunner.query(`DROP TABLE \`product_category_translation\``); await queryRunner.query(`DROP INDEX \`IDX_873ade98fbd6ca71c8b4d1bbca\` ON \`pipeline\``); await queryRunner.query(`DROP INDEX \`IDX_683274c59fb08b21249096e305\` ON \`pipeline\``); await queryRunner.query(`DROP INDEX \`IDX_1adf9f97094bc93e176ede2482\` ON \`pipeline\``); await queryRunner.query(`DROP INDEX \`IDX_f3027eabd451ec18b93fab7ed5\` ON \`pipeline\``); await queryRunner.query(`DROP TABLE \`pipeline\``); await queryRunner.query(`DROP INDEX \`IDX_04d16bdd72668de12c3e41a85a\` ON \`pipeline_stage\``); await queryRunner.query(`DROP INDEX \`IDX_28965bf63ad4c0976892d0fd5e\` ON \`pipeline_stage\``); await queryRunner.query(`DROP INDEX \`IDX_074caa106ee22d5d675a696a98\` ON \`pipeline_stage\``); await queryRunner.query(`DROP INDEX \`IDX_a6acee4ad726734b73f3886c14\` ON \`pipeline_stage\``); await queryRunner.query(`DROP TABLE \`pipeline_stage\``); await queryRunner.query(`DROP INDEX \`IDX_82753b9e315af84b20eaf84d77\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_8846e403ec45e1ad8c309f91a3\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_3f13c738eff604a85700746ec7\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_87223c7f1d4c2ca51cf6992784\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_62ef561a3bb084a7d12dad8a2d\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_be7fcc9fb8cd5a74cb602ec6c9\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_6959c37c3acf0832103a253570\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_8c4018eab11e92c3b09583495f\` ON \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_16a49d62227bf23686b77b5a21\` ON \`payment\``); await queryRunner.query(`DROP TABLE \`payment\``); await queryRunner.query(`DROP INDEX \`IDX_36e929b98372d961bb63bd4b4e\` ON \`password_reset\``); await queryRunner.query(`DROP INDEX \`IDX_1c88db6e50f0704688d1f1978c\` ON \`password_reset\``); await queryRunner.query(`DROP INDEX \`IDX_1fa632f2d12a06ef8dcc00858f\` ON \`password_reset\``); await queryRunner.query(`DROP INDEX \`IDX_e71a736d52820b568f6b0ca203\` ON \`password_reset\``); await queryRunner.query(`DROP INDEX \`IDX_380c03025a41ad032191f1ef2d\` ON \`password_reset\``); await queryRunner.query(`DROP TABLE \`password_reset\``); await queryRunner.query(`DROP INDEX \`IDX_47b6a97e09895a06606a4a8042\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_7965db2b12872551b586f76dd7\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_2360aa7a4b5ab99e026584f305\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_15458cef74076623c270500053\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_9ea70bf5c390b00e7bb96b86ed\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_c75285bf286b17c7ca5537857b\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_f37d866c3326eca5f579cef35c\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_b03a8a28f6ebdb6df8f630216b\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_6cc2b2052744e352834a4c9e78\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_40460ab803bf6e5a62b75a35c5\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_03e5eecc2328eb545ff748cbdd\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_c21e615583a3ebbb0977452afb\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_745a293c8b2c750bc421fa0633\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_b2091c1795f1d0d919b278ab23\` ON \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_6de52b8f3de32abee3df2628a3\` ON \`organization\``); await queryRunner.query(`DROP TABLE \`organization\``); await queryRunner.query(`DROP INDEX \`IDX_e56e80136b07ecd52545368611\` ON \`organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_56dd132aa3743cfa9b034d020e\` ON \`organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_7e0bf6063e1728c9813d5da7ca\` ON \`organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_266972cd6ff9656eec8818e12d\` ON \`organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_04c6320f910056ecb11b147ac8\` ON \`organization_vendor\``); await queryRunner.query(`DROP TABLE \`organization_vendor\``); await queryRunner.query(`DROP INDEX \`IDX_51e91be110fa0b8e70066f5727\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_da625f694eb1e23e585f301008\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_e22ab0f1236b1a07785b641727\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_103ae3eb65f4b091efc55cb532\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_eef1c19a0cb5321223cfe3286c\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_176f5ed3c4534f3110d423d569\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_38f1d96e8c2d59e4f0f84209ab\` ON \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_722d648e0b83267d4a66332ccb\` ON \`organization_team\``); await queryRunner.query(`DROP TABLE \`organization_team\``); await queryRunner.query(`DROP INDEX \`IDX_171b852be7c1f387eca93775aa\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_5e73656ce0355347477c42ae19\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_c15823bf3f63b1fe331d9de662\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_d9529008c733cb90044b8c2ad6\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_b027ee2cb18245356b8d963d2f\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_29ece7e3bb764028387cdbc888\` ON \`organization_team_join_request\``); await queryRunner.query(`DROP TABLE \`organization_team_join_request\``); await queryRunner.query(`DROP INDEX \`IDX_ce83034f38496f5fe3f1979697\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_a2a5601d799fbfc29c17b99243\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_8dc83cdd7c519d73afc0d8bdf0\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_719aeb37fa7a1dd80d25336a0c\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_d8eba1c0e500c60be1b69c1e77\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_fe12e1b76bbb76209134d9bdc2\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_752d7a0fe6597ee6bbc6502a12\` ON \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_70fcc451944fbde73d223c2af3\` ON \`organization_team_employee\``); await queryRunner.query(`DROP TABLE \`organization_team_employee\``); await queryRunner.query(`DROP INDEX \`IDX_20a290f166c0810eafbf271717\` ON \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_19ab7adf33199bc6f913db277d\` ON \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_5830901876e426adfc15fb7341\` ON \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_582768159ef0c749e8552ea9bc\` ON \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_b7be7e61daf2b5af3232c9c4d6\` ON \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_f0e2385b2d5f176f9ed3b6a9e3\` ON \`organization_task_setting\``); await queryRunner.query(`DROP TABLE \`organization_task_setting\``); await queryRunner.query(`DROP INDEX \`IDX_8a1fe8afb3aa672bae5993fbe7\` ON \`organization_sprint\``); await queryRunner.query(`DROP INDEX \`IDX_f57ad03c4e471bd8530494ea63\` ON \`organization_sprint\``); await queryRunner.query(`DROP INDEX \`IDX_76e53f9609ca05477d50980743\` ON \`organization_sprint\``); await queryRunner.query(`DROP INDEX \`IDX_5596b4fa7fb2ceb0955580becd\` ON \`organization_sprint\``); await queryRunner.query(`DROP TABLE \`organization_sprint\``); await queryRunner.query(`DROP INDEX \`IDX_637ac2c467df4bc3b71795a866\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_61387780d015923453f4b015b4\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_f1e5497ee6be7ba3f2ee90bf4b\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_8a12e7a0d47d3c6a6b35f7984e\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_0b19a287858af40661bd3eb741\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_f3ef2000abb9762b138cc5a1b3\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_9ad08dbc039d08279dae2dd94e\` ON \`organization_recurring_expense\``); await queryRunner.query(`DROP TABLE \`organization_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_063324fdceb51f7086e401ed2c\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_bc1e32c13683dbb16ada1c6da1\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_904ae0b765faef6ba2db8b1e69\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_3e128d30e9910ff920eee4ef37\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_c5c4366237dc2bb176c1503426\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_75855b44250686f84b7c4bc1f1\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_c210effeb6314d325bc024d21e\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_37215da8dee9503d759adb3538\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_9d8afc1e1e64d4b7d48dd2229d\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_7cf84e8b5775f349f81a1f3cc4\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_3590135ac2034d7aa88efa7e52\` ON \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_18e22d4b569159bb91dec869aa\` ON \`organization_project\``); await queryRunner.query(`DROP TABLE \`organization_project\``); await queryRunner.query(`DROP INDEX \`IDX_3f02c20145af9997253531349c\` ON \`organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_a0409e39f23ff6d418f2c03df5\` ON \`organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_a8f497b1006ec967964abb0d49\` ON \`organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_ce8721ddf715f0efa4bd3d2c5f\` ON \`organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_7317abf7a05a169783b6aa7932\` ON \`organization_position\``); await queryRunner.query(`DROP TABLE \`organization_position\``); await queryRunner.query(`DROP INDEX \`IDX_020516e74a57cb85d75381e841\` ON \`organization_language\``); await queryRunner.query(`DROP INDEX \`IDX_4513931e2d530f78d7144c8c7c\` ON \`organization_language\``); await queryRunner.query(`DROP INDEX \`IDX_225e476592214e32e117a85213\` ON \`organization_language\``); await queryRunner.query(`DROP INDEX \`IDX_6577ec9ca4cef331a507264d44\` ON \`organization_language\``); await queryRunner.query(`DROP INDEX \`IDX_b79e8d45a3ef5503579643f5de\` ON \`organization_language\``); await queryRunner.query(`DROP TABLE \`organization_language\``); await queryRunner.query(`DROP INDEX \`IDX_a583cfe32f492f5ba99b7bb205\` ON \`organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_227b5bd9867287cbbeece8f6ba\` ON \`organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_cc096d49e2399e89cdf32297da\` ON \`organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_880f3cce5e03f42bec3da6e6dc\` ON \`organization_employment_type\``); await queryRunner.query(`DROP TABLE \`organization_employment_type\``); await queryRunner.query(`DROP INDEX \`IDX_c129dee7d1cb84e01e69b5e2c6\` ON \`organization_document\``); await queryRunner.query(`DROP INDEX \`IDX_1057ec001a4c6b258658143047\` ON \`organization_document\``); await queryRunner.query(`DROP INDEX \`IDX_4bc83945c022a862a33629ff1e\` ON \`organization_document\``); await queryRunner.query(`DROP INDEX \`IDX_72c6a8ad9de5c04b2b689fd229\` ON \`organization_document\``); await queryRunner.query(`DROP INDEX \`IDX_e5edb48261db95f46c3b4d34a5\` ON \`organization_document\``); await queryRunner.query(`DROP TABLE \`organization_document\``); await queryRunner.query(`DROP INDEX \`IDX_91b652409dc1fb2f712590dd21\` ON \`organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_c61a562a2379d1c0077fe7de33\` ON \`organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_b3644ff7cd65239e29d292a41d\` ON \`organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_b65059949804b20048b1c86c3d\` ON \`organization_department\``); await queryRunner.query(`DROP INDEX \`IDX_6139cd4c620e81aefd4895d370\` ON \`organization_department\``); await queryRunner.query(`DROP TABLE \`organization_department\``); await queryRunner.query(`DROP INDEX \`REL_a86d2e378b953cb39261f457d2\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_8cfcdc6bc8fb55e273d9ace5fd\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_a86d2e378b953cb39261f457d2\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_de33f92e042365d196d959e774\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_6200736cb4d3617b004e5b647f\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_e68c43e315ad3aaea4e99cf461\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_f91783c7a8565c648b65635efc\` ON \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_53627a383c9817dbf1164d7dc6\` ON \`organization_contact\``); await queryRunner.query(`DROP TABLE \`organization_contact\``); await queryRunner.query(`DROP INDEX \`IDX_31626e7d39eb95b710d5a2d80f\` ON \`organization_award\``); await queryRunner.query(`DROP INDEX \`IDX_2e0d21aab892b5993abaac09bc\` ON \`organization_award\``); await queryRunner.query(`DROP INDEX \`IDX_af6423760433da72002a7f369e\` ON \`organization_award\``); await queryRunner.query(`DROP INDEX \`IDX_34c6749e2bc94b2e52e9572f32\` ON \`organization_award\``); await queryRunner.query(`DROP INDEX \`IDX_4062b5d54aa740aaff9a6c5fbb\` ON \`organization_award\``); await queryRunner.query(`DROP TABLE \`organization_award\``); await queryRunner.query(`DROP INDEX \`REL_e03ddff05652be527e04abdc56\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_20acc3c3a6c900c6ef9fc68199\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_e03ddff05652be527e04abdc56\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_d306a524b507f72fa8550aeffe\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_533144d7ae94180235ea456625\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_0a0f972564e74c9c4905e3abcb\` ON \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_a03be8a86e528e2720504a041f\` ON \`merchant\``); await queryRunner.query(`DROP TABLE \`merchant\``); await queryRunner.query(`DROP INDEX \`IDX_465b3173cdddf0ac2d3fe73a33\` ON \`language\``); await queryRunner.query(`DROP INDEX \`IDX_15fcb8179bc7b0642ca78da69e\` ON \`language\``); await queryRunner.query(`DROP INDEX \`IDX_3a7abee35dfa3c90ed491583eb\` ON \`language\``); await queryRunner.query(`DROP TABLE \`language\``); await queryRunner.query(`DROP INDEX \`IDX_3e1d08761a717c1dd71fe67249\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_4e1e975124c1d717814a4bb2ec\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_d8547e21ccb8e37ac9f0d69c1a\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_38dc003f3484eff4b59918e9ae\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_c89adeff0de3aedb2e772a5bf4\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_5880347716f9ec5056ec15112c\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_d1f45ca98f17bd84a5e430feaf\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_8ac2c6b487d03157adda874789\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_8889e2618366faefa575a8049b\` ON \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_9b62dd2dddcde032f46a981733\` ON \`key_result\``); await queryRunner.query(`DROP TABLE \`key_result\``); await queryRunner.query(`DROP INDEX \`IDX_fd4b0cb7a44ed914acdda55e29\` ON \`key_result_update\``); await queryRunner.query(`DROP INDEX \`IDX_cd9cbc0d5b6d62dbb63c3b3a65\` ON \`key_result_update\``); await queryRunner.query(`DROP INDEX \`IDX_94aad97b26aede6545a3226fb3\` ON \`key_result_update\``); await queryRunner.query(`DROP INDEX \`IDX_12b8b54f416ec9f5ec002f0a83\` ON \`key_result_update\``); await queryRunner.query(`DROP TABLE \`key_result_update\``); await queryRunner.query(`DROP INDEX \`IDX_46426ea45456e240a092b73204\` ON \`key_result_template\``); await queryRunner.query(`DROP INDEX \`IDX_fab6b6200b9ed6fd002c1ff62a\` ON \`key_result_template\``); await queryRunner.query(`DROP INDEX \`IDX_86c09eb673b0e66129dbdc7211\` ON \`key_result_template\``); await queryRunner.query(`DROP INDEX \`IDX_aa0e9b0cfcba1926925b025512\` ON \`key_result_template\``); await queryRunner.query(`DROP INDEX \`IDX_f4e813d72dc732f16497ee2c52\` ON \`key_result_template\``); await queryRunner.query(`DROP TABLE \`key_result_template\``); await queryRunner.query(`DROP INDEX \`IDX_d7bed97fb47876e03fd7d7c285\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_d9e965da0f63c94983d3a1006a\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_b5c33892e630b66c65d623baf8\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_058ef835f99e28fc6717cd7c80\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_7fb52a5f267f53b7d93af3d8c3\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_eabacf7474d75e53d7b7046f3e\` ON \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_850ca385c1985c1808cd4ea241\` ON \`invoice\``); await queryRunner.query(`DROP TABLE \`invoice\``); await queryRunner.query(`DROP INDEX \`IDX_e89749c8e8258b2ec110c0776f\` ON \`invoice_item\``); await queryRunner.query(`DROP INDEX \`IDX_f78214cd9de76e80fe8a6305f5\` ON \`invoice_item\``); await queryRunner.query(`DROP INDEX \`IDX_b7da14d2b61cf1dd5c65188b9c\` ON \`invoice_item\``); await queryRunner.query(`DROP INDEX \`IDX_e2835fd8776ae5d56d892e087e\` ON \`invoice_item\``); await queryRunner.query(`DROP TABLE \`invoice_item\``); await queryRunner.query(`DROP INDEX \`IDX_31ec3d5a6b0985cec544c64217\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_da2893697d57368470952a76f6\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_856f24297f120604f8ae294276\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_cc0ac824ba89deda98bb418e8c\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_8106063f79cce8e67790d79092\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_483eb296a94d821ebedb375858\` ON \`invoice_estimate_history\``); await queryRunner.query(`DROP TABLE \`invoice_estimate_history\``); await queryRunner.query(`DROP INDEX \`IDX_91bfeec7a9574f458e5b592472\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_900a3ed40499c79c1c289fec28\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_5a182e8b3e225b14ddf6df7e6c\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_68eef4ab86b67747f24f288a16\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_7c2328f76efb850b8114797247\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_3cef860504647ccd52d39d7dc2\` ON \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_bd44bcb10034bc0c5fe4427b3e\` ON \`invite\``); await queryRunner.query(`DROP TABLE \`invite\``); await queryRunner.query(`DROP INDEX \`IDX_52d7fa32a7832b377fc2d7f619\` ON \`integration\``); await queryRunner.query(`DROP INDEX \`IDX_85d7b0f07f3e3707b4586670a9\` ON \`integration\``); await queryRunner.query(`DROP INDEX \`IDX_24981cd300007cf88601c2d616\` ON \`integration\``); await queryRunner.query(`DROP TABLE \`integration\``); await queryRunner.query(`DROP INDEX \`IDX_83443d669822bbbf2bd0ebdacd\` ON \`integration_type\``); await queryRunner.query(`DROP INDEX \`IDX_e7b65ef60492b1c34007736f99\` ON \`integration_type\``); await queryRunner.query(`DROP INDEX \`IDX_34a49d941459e1031c766b941f\` ON \`integration_type\``); await queryRunner.query(`DROP TABLE \`integration_type\``); await queryRunner.query(`DROP INDEX \`IDX_5065401113abb6e9608225e567\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_a8709a9c5cc142c6fbe92df274\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_055f310a04a928343494a5255a\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_6c8e119fc6a2a7d3413aa76d3b\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_b3234be5b70c2362cdf67bb188\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_c774c276d6b7ea05a7e12d3c81\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_d706210d377ece2a1bc3386388\` ON \`organization_github_repository_issue\``); await queryRunner.query(`DROP TABLE \`organization_github_repository_issue\``); await queryRunner.query(`DROP INDEX \`IDX_add7dbec156589dd0b27e2e0c4\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_59407d03d189560ac1a0a4b0eb\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_2eec784cadcb7847b64937fb58\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_34c48d11eb82ef42e89370bdc7\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_04717f25bea7d9cef0d51cac50\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_9e8a77c1d330554fab9230100a\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_a146e202c19f521bf5ec69bb26\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_6eea42a69e130bbd14b7ea3659\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_ca0fa80f50baed7287a499dc2c\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_69d75a47af6bfcda545a865691\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_480158f21938444e4f62fb3185\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_ef65338e8597b9f56fd0fe3c94\` ON \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_5e97728cfda96f49cc7f95bbaf\` ON \`organization_github_repository\``); await queryRunner.query(`DROP TABLE \`organization_github_repository\``); await queryRunner.query(`DROP INDEX \`IDX_0d6ddc27d687ca879042c5f3ce\` ON \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_d0532ed8020981736b58748de6\` ON \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_33ab224e7755a46fff5bc1e64e\` ON \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_24e37d03ef224f1a16a35069c2\` ON \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_5487f9197c106d774bae20991c\` ON \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_c5ff5d3ab364b7da72bf3fbb46\` ON \`integration_tenant\``); await queryRunner.query(`DROP TABLE \`integration_tenant\``); await queryRunner.query(`DROP INDEX \`IDX_34daf030004ad37b88f1f3d863\` ON \`integration_setting\``); await queryRunner.query(`DROP INDEX \`IDX_369eaafb13afe9903a170077ed\` ON \`integration_setting\``); await queryRunner.query(`DROP INDEX \`IDX_954c6b05297814776d9cb66ca7\` ON \`integration_setting\``); await queryRunner.query(`DROP INDEX \`IDX_f515574f1251562c52fe25b6a3\` ON \`integration_setting\``); await queryRunner.query(`DROP INDEX \`IDX_97c0d54aae21ccdbb5c3581642\` ON \`integration_setting\``); await queryRunner.query(`DROP TABLE \`integration_setting\``); await queryRunner.query(`DROP INDEX \`IDX_c327ea26bda3d349a1eceb5658\` ON \`integration_map\``); await queryRunner.query(`DROP INDEX \`IDX_7022dafd72c1b92f7d50691441\` ON \`integration_map\``); await queryRunner.query(`DROP INDEX \`IDX_eec3d6064578610ddc609dd360\` ON \`integration_map\``); await queryRunner.query(`DROP INDEX \`IDX_e63f4791631e7572ca213ac4a4\` ON \`integration_map\``); await queryRunner.query(`DROP INDEX \`IDX_c79464c4ccf7e5195d69675c15\` ON \`integration_map\``); await queryRunner.query(`DROP TABLE \`integration_map\``); await queryRunner.query(`DROP INDEX \`IDX_f80ff4ebbf0b33a67dce598911\` ON \`integration_entity_setting\``); await queryRunner.query(`DROP INDEX \`IDX_c6c01e38eebd8b26b9214b9044\` ON \`integration_entity_setting\``); await queryRunner.query(`DROP INDEX \`IDX_23e9cfcf1bfff07dcc3254378d\` ON \`integration_entity_setting\``); await queryRunner.query(`DROP INDEX \`IDX_1c653ebceca3b9c8766131db91\` ON \`integration_entity_setting\``); await queryRunner.query(`DROP INDEX \`IDX_e3d407c5532edaceaa4df34623\` ON \`integration_entity_setting\``); await queryRunner.query(`DROP TABLE \`integration_entity_setting\``); await queryRunner.query(`DROP INDEX \`IDX_3fb863167095805e33f38a0fdc\` ON \`integration_entity_setting_tied\``); await queryRunner.query(`DROP INDEX \`IDX_d5ac36aa3d5919908414154fca\` ON \`integration_entity_setting_tied\``); await queryRunner.query(`DROP INDEX \`IDX_b208a754c7a538cb3422f39f5b\` ON \`integration_entity_setting_tied\``); await queryRunner.query(`DROP INDEX \`IDX_101cd83aa75949cfb5b8eec084\` ON \`integration_entity_setting_tied\``); await queryRunner.query(`DROP INDEX \`IDX_6d43cc33c80221dbe4854b38e6\` ON \`integration_entity_setting_tied\``); await queryRunner.query(`DROP TABLE \`integration_entity_setting_tied\``); await queryRunner.query(`DROP INDEX \`IDX_29fbd3a17710a27e6f856072c0\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_a05d52b7ffe89140f9cbcf114b\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_20207d9f915066dfbc2210bcf1\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_86b5a121b3775a1b0b7fa75680\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_bd39a647a2843177723ddf733e\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_64409de4711cd14e2c43371cc0\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_8608b275644cfc7a0f3f585081\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_aedb8b1d10c498309bed9edf53\` ON \`income\``); await queryRunner.query(`DROP INDEX \`IDX_904ab9ee6ac5e74bf3616c8ccb\` ON \`income\``); await queryRunner.query(`DROP TABLE \`income\``); await queryRunner.query(`DROP INDEX \`IDX_d3675304df9971cccf96d9a7c3\` ON \`image_asset\``); await queryRunner.query(`DROP INDEX \`IDX_01856a9a730b7e79d70aa661cb\` ON \`image_asset\``); await queryRunner.query(`DROP INDEX \`IDX_af1a212cb378bb0eed51c1b2bc\` ON \`image_asset\``); await queryRunner.query(`DROP INDEX \`IDX_9d44ce9eb8689e578b941a6a54\` ON \`image_asset\``); await queryRunner.query(`DROP TABLE \`image_asset\``); await queryRunner.query(`DROP INDEX \`IDX_4c8b4e887a994182fd6132e640\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_af0a11734e70412b742ac339c8\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_35526ff1063ab5fa2b20e71bd6\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_ac161c1a0c0ff8e83554f097e5\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_c6e8ae55a4db3584686cbf6afe\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_6b4758a5442713070c9a366d0e\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_4a2c00a44350a063d75be80ba9\` ON \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_72641ffde44e1a1627aa2d040f\` ON \`goal\``); await queryRunner.query(`DROP TABLE \`goal\``); await queryRunner.query(`DROP INDEX \`IDX_405bc5bba9ed71aefef84a29f1\` ON \`goal_time_frame\``); await queryRunner.query(`DROP INDEX \`IDX_b56723b53a76ca1c171890c479\` ON \`goal_time_frame\``); await queryRunner.query(`DROP INDEX \`IDX_ef4ec26ca3a7e0d8c9e1748be2\` ON \`goal_time_frame\``); await queryRunner.query(`DROP INDEX \`IDX_646565982726362cc2ca4fb807\` ON \`goal_time_frame\``); await queryRunner.query(`DROP TABLE \`goal_time_frame\``); await queryRunner.query(`DROP INDEX \`IDX_5708fe06608c72fc77b65ae651\` ON \`goal_template\``); await queryRunner.query(`DROP INDEX \`IDX_774bf82989475befe301fe1bca\` ON \`goal_template\``); await queryRunner.query(`DROP INDEX \`IDX_056e869152a335f88c38c5b693\` ON \`goal_template\``); await queryRunner.query(`DROP INDEX \`IDX_cd91c5925942061527b1bc112c\` ON \`goal_template\``); await queryRunner.query(`DROP TABLE \`goal_template\``); await queryRunner.query(`DROP INDEX \`IDX_d4f093ca4eb7c40db68d9a789d\` ON \`goal_kpi\``); await queryRunner.query(`DROP INDEX \`IDX_e49e37fe88a2725a38a3b05849\` ON \`goal_kpi\``); await queryRunner.query(`DROP INDEX \`IDX_43aa2985216560cd9fa93f501e\` ON \`goal_kpi\``); await queryRunner.query(`DROP INDEX \`IDX_a96c22c51607f878c8a98bc488\` ON \`goal_kpi\``); await queryRunner.query(`DROP INDEX \`IDX_cfc393bd9835d8259e73019226\` ON \`goal_kpi\``); await queryRunner.query(`DROP TABLE \`goal_kpi\``); await queryRunner.query(`DROP INDEX \`IDX_df7ab026698c02859ff7540809\` ON \`goal_kpi_template\``); await queryRunner.query(`DROP INDEX \`IDX_cc72d4e8e4284dcc8ffbf96caf\` ON \`goal_kpi_template\``); await queryRunner.query(`DROP INDEX \`IDX_26311c417ba945c901c65d515d\` ON \`goal_kpi_template\``); await queryRunner.query(`DROP INDEX \`IDX_b4f4701ddb0e973602445ed1c6\` ON \`goal_kpi_template\``); await queryRunner.query(`DROP TABLE \`goal_kpi_template\``); await queryRunner.query(`DROP INDEX \`IDX_e35d0f7b794ca8850669d12c78\` ON \`goal_general_setting\``); await queryRunner.query(`DROP INDEX \`IDX_d17a5159d888ac6320459eda39\` ON \`goal_general_setting\``); await queryRunner.query(`DROP INDEX \`IDX_4a44905db4ca1e40b62021fdfb\` ON \`goal_general_setting\``); await queryRunner.query(`DROP INDEX \`IDX_bdee8704ebeb79368ff6154fc7\` ON \`goal_general_setting\``); await queryRunner.query(`DROP TABLE \`goal_general_setting\``); await queryRunner.query(`DROP INDEX \`IDX_d4a28a8e70d450a412bf0cfb52\` ON \`feature\``); await queryRunner.query(`DROP INDEX \`IDX_c30465b5a6e0fae1c8ee7e3120\` ON \`feature\``); await queryRunner.query(`DROP INDEX \`IDX_4832be692a2dc63d67e8e93c75\` ON \`feature\``); await queryRunner.query(`DROP INDEX \`IDX_a26cc341268d22bd55f06e3ef6\` ON \`feature\``); await queryRunner.query(`DROP INDEX \`IDX_5405b67f1df904831a358df7c4\` ON \`feature\``); await queryRunner.query(`DROP TABLE \`feature\``); await queryRunner.query(`DROP INDEX \`IDX_6d413f9fdd5366b1b9add46483\` ON \`feature_organization\``); await queryRunner.query(`DROP INDEX \`IDX_6a94e6b0a572f591288ac44a42\` ON \`feature_organization\``); await queryRunner.query(`DROP INDEX \`IDX_8f71803d96dcdbcc6b19bb28d3\` ON \`feature_organization\``); await queryRunner.query(`DROP INDEX \`IDX_e4c142f37091b47056012d34ba\` ON \`feature_organization\``); await queryRunner.query(`DROP INDEX \`IDX_4ee685760ddb60ff71f763d8f6\` ON \`feature_organization\``); await queryRunner.query(`DROP TABLE \`feature_organization\``); await queryRunner.query(`DROP INDEX \`IDX_a43b235c35c2c4d3263ada770c\` ON \`import-record\``); await queryRunner.query(`DROP INDEX \`IDX_339328a7247aa09d061c642ae1\` ON \`import-record\``); await queryRunner.query(`DROP INDEX \`IDX_b90957ef81e74c43d6ae037560\` ON \`import-record\``); await queryRunner.query(`DROP TABLE \`import-record\``); await queryRunner.query(`DROP INDEX \`IDX_54868607115e2fee3b0b764eec\` ON \`import-history\``); await queryRunner.query(`DROP INDEX \`IDX_d6a626bee6cddf4bc53a493bc3\` ON \`import-history\``); await queryRunner.query(`DROP INDEX \`IDX_e339340014a6c4e2f57be00b0c\` ON \`import-history\``); await queryRunner.query(`DROP TABLE \`import-history\``); await queryRunner.query(`DROP INDEX \`IDX_047b8b5c0782d5a6d4c8bfc1a4\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_9971c4171ae051e74b833984a3\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_42eea5debc63f4d1bf89881c10\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_eacb116ab0521ad9b96f2bb53b\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_5e7b197dbac69012dbdb4964f3\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_5f57d077c28b378a6c885e81c5\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_97ed0e2b80f2e7ec260fd81cd9\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_0006d3025b6c92fbd4089b9465\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_dd8ab9312fb8d787982b9feebf\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_cbfebdb1419f9b8036a8b0546e\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_89508d119b1a279c037d9da151\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_3826d6ca74a08a8498fa17d330\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_b5bb8f62d401475fcc8c2ba35e\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_846a933af451a33b95b7b198c6\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_c5fb146726ff128e600f23d0a1\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_6d171c9d5f81095436b99da5e6\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_d77aeb93f2439ebdf4babaab4c\` ON \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_1aa0e5fd480214ae4851471e3c\` ON \`expense\``); await queryRunner.query(`DROP TABLE \`expense\``); await queryRunner.query(`DROP INDEX \`IDX_9c9bfe5baaf83f53533ff035fc\` ON \`expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_37504e920ee5ca46a4000b89da\` ON \`expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_e9cef5d359dfa48ee5d0cd5fcc\` ON \`expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_8376e41fd82aba147a433dc097\` ON \`expense_category\``); await queryRunner.query(`DROP TABLE \`expense_category\``); await queryRunner.query(`DROP INDEX \`IDX_24d905ec9e127ade23754a363d\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_5bde7aeb2c7fb3a421b175871e\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_43459c650957e478203c738574\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_9d5980ff1064e2edb77509d312\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_4b02d8616129f39fca2b10e98b\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_fc8818d6fde74370ec703a0135\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_92fc62260c0c7ff108622850bf\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_613cfa5783e164cad10dc27e58\` ON \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_f14eee32875b112fab1139b332\` ON \`event_type\``); await queryRunner.query(`DROP TABLE \`event_type\``); await queryRunner.query(`DROP INDEX \`IDX_233c1d351d63441aeb039d1164\` ON \`estimate_email\``); await queryRunner.query(`DROP INDEX \`IDX_391d3f83244fea73c619aecadd\` ON \`estimate_email\``); await queryRunner.query(`DROP INDEX \`IDX_f1fac79e17c475f00daa4db3d2\` ON \`estimate_email\``); await queryRunner.query(`DROP INDEX \`IDX_1a4bd2a8034bb1309b4ea87882\` ON \`estimate_email\``); await queryRunner.query(`DROP TABLE \`estimate_email\``); await queryRunner.query(`DROP INDEX \`IDX_f98ce0d210aa9f91b729d44780\` ON \`equipment\``); await queryRunner.query(`DROP INDEX \`IDX_fb6808468066849ab7b7454d5f\` ON \`equipment\``); await queryRunner.query(`DROP INDEX \`IDX_d8452bfe9f18ced4ce76c4b70b\` ON \`equipment\``); await queryRunner.query(`DROP INDEX \`IDX_39e1b443404ea7fa42b3d36ccb\` ON \`equipment\``); await queryRunner.query(`DROP TABLE \`equipment\``); await queryRunner.query(`DROP INDEX \`IDX_0ecfe0ce0cd2b197249d5f1c10\` ON \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_acad51a6362806fc499e583e40\` ON \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_ea9254be07ae4a8604f0aaab19\` ON \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_fa525e61fb3d8d9efec0f364a4\` ON \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_a734598f5637cf1501288331e3\` ON \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_70ff31cefa0f578f6fa82d2bcc\` ON \`equipment_sharing\``); await queryRunner.query(`DROP TABLE \`equipment_sharing\``); await queryRunner.query(`DROP INDEX \`IDX_04c9e514ed70897f6ad8cadc3c\` ON \`equipment_sharing_policy\``); await queryRunner.query(`DROP INDEX \`IDX_5311a833ff255881454bd5b3b5\` ON \`equipment_sharing_policy\``); await queryRunner.query(`DROP INDEX \`IDX_5443ca8ed830626656d8cfecef\` ON \`equipment_sharing_policy\``); await queryRunner.query(`DROP INDEX \`IDX_b0fc293cf47f31ba512fd29bf0\` ON \`equipment_sharing_policy\``); await queryRunner.query(`DROP INDEX \`IDX_0f3ee47a5fb7192d5eb00c71ae\` ON \`equipment_sharing_policy\``); await queryRunner.query(`DROP TABLE \`equipment_sharing_policy\``); await queryRunner.query(`DROP INDEX \`REL_1c0c1370ecd98040259625e17e\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`REL_f4b0d329c4a3cf79ffe9d56504\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_5e719204dcafa8d6b2ecdeda13\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_1c0c1370ecd98040259625e17e\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_f4b0d329c4a3cf79ffe9d56504\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_96dfbcaa2990df01fe5bb39ccc\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_c6a48286f3aa8ae903bee0d1e7\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_4b3303a6b7eb92d237a4379734\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_175b7be641928a31521224daa8\` ON \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_510cb87f5da169e57e694d1a5c\` ON \`employee\``); await queryRunner.query(`DROP TABLE \`employee\``); await queryRunner.query(`DROP INDEX \`IDX_95ea18af6ef8123503d332240c\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_710c71526edb89b2a7033abcdf\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_9537fae454ebebc98ee5adb3a2\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_56e96cd218a185ed59b5a8e786\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_9516a627a131626d2a5738a05a\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_01237d04f882cf1ea794678e8d\` ON \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_48fae30026b4e166a3445fee6d\` ON \`employee_setting\``); await queryRunner.query(`DROP TABLE \`employee_setting\``); await queryRunner.query(`DROP INDEX \`IDX_0ac8526c48a3daa267c86225fb\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_6e570174fda71e97616e9d2eea\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_739f8cdce21cc72d400559ce00\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_a4b5a2ea2afecf1ee254f1a704\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_3ee5147bb1fde625fa33c0e956\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_5fde7be40b3c03bc0fdac0c2f6\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_3980b0fe1e757b092ea5323656\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_25f8915182128f377d84b60d26\` ON \`employee_recurring_expense\``); await queryRunner.query(`DROP TABLE \`employee_recurring_expense\``); await queryRunner.query(`DROP INDEX \`IDX_2be728a7f8b118712a4200990d\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_a13f3564eae9db44ddc4308afc\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_0111963c9cb4dd14565c0d9c84\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_dc2ff85f7de16dea6453a833dd\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_ee780fbd8f91de31c004929eec\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_f577c9bc6183c1d1eae1e154bb\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_e396663e1a31114eac39087829\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_2bb17670e2bea3980ff960bbcf\` ON \`employee_proposal_template\``); await queryRunner.query(`DROP TABLE \`employee_proposal_template\``); await queryRunner.query(`DROP INDEX \`IDX_329ebd01a757d1a0c3c4d628e2\` ON \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_ba7b2ef5a9cd165a1e4e2ad0ef\` ON \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_0f9cefa604913e1ab322591546\` ON \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_d543336994b1f764c449e0b1d3\` ON \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_aa98ea786d490db300d3dbbdb6\` ON \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_587d11ffbd87adb6dff367f3cd\` ON \`employee_phone\``); await queryRunner.query(`DROP TABLE \`employee_phone\``); await queryRunner.query(`DROP INDEX \`IDX_c4668533292bf4526e61aedf74\` ON \`employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_d3fc52d497bc44d6f493dbedc3\` ON \`employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_88a58d149404145ed7b3385387\` ON \`employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_90bd442869709bae9d1b18e489\` ON \`employee_level\``); await queryRunner.query(`DROP TABLE \`employee_level\``); await queryRunner.query(`DROP INDEX \`IDX_c8723c90a6f007f8d7e882a04f\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_cb64573b18dd7b23f591f15502\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_9f1288205ae91f91cf356cac2f\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_1a62a99e1016e4a2b461e886ec\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_44e22d88b47daf2095491b7cac\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_e4bc75a1cbb07d117a0acfcdba\` ON \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_4b8450a24233df8b47ca472923\` ON \`job_search_occupation\``); await queryRunner.query(`DROP TABLE \`job_search_occupation\``); await queryRunner.query(`DROP INDEX \`IDX_6ee5218c869b57197e4a209bed\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_d0a798419c775b9157bf0269f4\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_3b335bbcbf7d5e00853acaa165\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_86381fb6d28978b101b3aec8ca\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_35e120f2b6e5188391cf068d3b\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_015231c6e28cfb2b789ca4b76f\` ON \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_36333846c37e5f8812a5c9f7ff\` ON \`job_search_category\``); await queryRunner.query(`DROP TABLE \`job_search_category\``); await queryRunner.query(`DROP INDEX \`IDX_f2c1b6770dd2a3abfa35f49411\` ON \`job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_a4b038417e3221c0791dd8c771\` ON \`job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_7e53ea80aca15da11a8a5ec038\` ON \`job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_e210f70c3904cf84ab5113be8f\` ON \`job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_46226c3185e3ca3d7033831d7a\` ON \`job_preset\``); await queryRunner.query(`DROP TABLE \`job_preset\``); await queryRunner.query(`DROP INDEX \`IDX_d5ca48cfacfb516543d6507ca4\` ON \`job_preset_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_2323220b4decfd2f4d8307fd78\` ON \`job_preset_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_4070b6f3480e9c4b2dcf3f7b56\` ON \`job_preset_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_af850e1fa48af82d66e9bf81c7\` ON \`job_preset_upwork_job_search_criterion\``); await queryRunner.query(`DROP TABLE \`job_preset_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_630337302efe97cc93deeb2151\` ON \`employee_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_afe6c40d3d9951388fa05f83f2\` ON \`employee_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_0e130a25bb4abe1b27c8a0adf4\` ON \`employee_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_6bae61744663a416e73903d9af\` ON \`employee_upwork_job_search_criterion\``); await queryRunner.query(`DROP TABLE \`employee_upwork_job_search_criterion\``); await queryRunner.query(`DROP INDEX \`IDX_0c5266f3f488add404f92d56ec\` ON \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_6912685bbb0e303eab392978d9\` ON \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_caf8363b0ed7d5f24ae866ba3b\` ON \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_91e0f7efcd17d20b5029fb1342\` ON \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_8fb47e8bfd26340ddaeabd24e5\` ON \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_c07390f325c847be7df93d0d17\` ON \`employee_award\``); await queryRunner.query(`DROP TABLE \`employee_award\``); await queryRunner.query(`DROP INDEX \`IDX_86cf36c137712e779dd7e2301e\` ON \`employee_appointment\``); await queryRunner.query(`DROP INDEX \`IDX_a35637bb659c59e18adb4f38f8\` ON \`employee_appointment\``); await queryRunner.query(`DROP INDEX \`IDX_64c83df9d37d9ada96edb66557\` ON \`employee_appointment\``); await queryRunner.query(`DROP INDEX \`IDX_d0219ada2359ede9e7b0d511ba\` ON \`employee_appointment\``); await queryRunner.query(`DROP TABLE \`employee_appointment\``); await queryRunner.query(`DROP INDEX \`IDX_7e688e6613930ba721b841db43\` ON \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_274708db64fcce5448f2c4541c\` ON \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_c160fe6234675fac031aa3e7c5\` ON \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_753e005a45556b5909e11937aa\` ON \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_29d60114e1968c0cd68a19e3c5\` ON \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_e4932e0a726b9b07d81d8b6905\` ON \`email_template\``); await queryRunner.query(`DROP TABLE \`email_template\``); await queryRunner.query(`DROP INDEX \`IDX_e37af4ab2ba0bf268bfd982634\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_4ac734f2a1a3c055dca04fba99\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_9e80c9ec749dfda6dbe2cd9704\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_4be518a169bbcbfe92025ac574\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_03d16a2fd43d7c601743440212\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_93799dfaeff51de06f1e02ac41\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_13247a755d17e7905d5bb4cfda\` ON \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_e3321e3575289b7ee1e8eb1042\` ON \`email_reset\``); await queryRunner.query(`DROP TABLE \`email_reset\``); await queryRunner.query(`DROP INDEX \`IDX_5956ce758c01ebf8a539e8d4f0\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_9033faf41b23c61ba201c48796\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_1261c457b3035b77719556995b\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_a954fda57cca81dc48446e73b8\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_953df0eb0df3035baf140399f6\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_525f4873c6edc3d94559f88900\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_0af511c44de7a16beb45cc3785\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_9a69f7077e0333d2c848895a1b\` ON \`email_sent\``); await queryRunner.query(`DROP INDEX \`IDX_d825bc6da1c52a3900a9373260\` ON \`email_sent\``); await queryRunner.query(`DROP TABLE \`email_sent\``); await queryRunner.query(`DROP INDEX \`REL_1ae3abc0ae1dcf6c13f49b62b5\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_9211f5b62988df6e95522be7da\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_4b1ff44e6bae5065429dbab554\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_38fb85abdf9995efcf217f5955\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_46a3c00bfc3e36b4412d8bcdb0\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_443c561d45f6c57f3790a759ba\` ON \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_0d8c964237e5061627de82df80\` ON \`deal\``); await queryRunner.query(`DROP TABLE \`deal\``); await queryRunner.query(`DROP INDEX \`IDX_15a1306132d66c63ef31f7288c\` ON \`custom_smtp\``); await queryRunner.query(`DROP INDEX \`IDX_2aa3fc8daa25beec4788d2be26\` ON \`custom_smtp\``); await queryRunner.query(`DROP INDEX \`IDX_f10372f9d038d0954d5b20635a\` ON \`custom_smtp\``); await queryRunner.query(`DROP INDEX \`IDX_e2c7d28bb07adc915d74437c7b\` ON \`custom_smtp\``); await queryRunner.query(`DROP TABLE \`custom_smtp\``); await queryRunner.query(`DROP INDEX \`IDX_0b0fbda74f6c82c943e706a3cc\` ON \`currency\``); await queryRunner.query(`DROP INDEX \`IDX_8203f1410475748bbbc6d3029d\` ON \`currency\``); await queryRunner.query(`DROP INDEX \`IDX_03cc024ddc2f196dca7fead7cb\` ON \`currency\``); await queryRunner.query(`DROP TABLE \`currency\``); await queryRunner.query(`DROP INDEX \`IDX_6eba1a52ee121d100c8a0a6510\` ON \`country\``); await queryRunner.query(`DROP INDEX \`IDX_6cd9b7ea6818e862217035436c\` ON \`country\``); await queryRunner.query(`DROP INDEX \`IDX_97ebcd8db30a408b5f907d6ff4\` ON \`country\``); await queryRunner.query(`DROP TABLE \`country\``); await queryRunner.query(`DROP INDEX \`IDX_7719d73cd16a9f57ecc6ac24b3\` ON \`contact\``); await queryRunner.query(`DROP INDEX \`IDX_60468af1ce34043a900809c84f\` ON \`contact\``); await queryRunner.query(`DROP INDEX \`IDX_4164bd34bdcce8754641f0e567\` ON \`contact\``); await queryRunner.query(`DROP INDEX \`IDX_05831d37eabeb6150f99c69784\` ON \`contact\``); await queryRunner.query(`DROP TABLE \`contact\``); await queryRunner.query(`DROP INDEX \`REL_8b900e8a39f76125e610ab30c0\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`REL_3930aa71e0fa24f09201811b1b\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`REL_4ea108fd8b089237964d5f98fb\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`REL_b674793a804b7d69d74c8f6c5b\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_8b900e8a39f76125e610ab30c0\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_3930aa71e0fa24f09201811b1b\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_4ea108fd8b089237964d5f98fb\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_1e3e8228e7df634fa4cec6322c\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_b674793a804b7d69d74c8f6c5b\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_16fb27ffd1a99c6506c92ad57a\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_77ac426e04553ff1654421bce4\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_af835b66fa10279103bd89e225\` ON \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_2b8091376a529383e23ba3356a\` ON \`candidate\``); await queryRunner.query(`DROP TABLE \`candidate\``); await queryRunner.query(`DROP INDEX \`IDX_063663c7e61e45d172d1b83265\` ON \`candidate_technology\``); await queryRunner.query(`DROP INDEX \`IDX_9d46b8c5382acd4d4514bc5c62\` ON \`candidate_technology\``); await queryRunner.query(`DROP INDEX \`IDX_a6fecb615b07987b480defac64\` ON \`candidate_technology\``); await queryRunner.query(`DROP INDEX \`IDX_97aa0328b72e1bf919e61bccdc\` ON \`candidate_technology\``); await queryRunner.query(`DROP INDEX \`IDX_199ca43300fa4e64239656a677\` ON \`candidate_technology\``); await queryRunner.query(`DROP TABLE \`candidate_technology\``); await queryRunner.query(`DROP INDEX \`IDX_e92027b5280828cadd7cd6ea71\` ON \`candidate_source\``); await queryRunner.query(`DROP INDEX \`IDX_b2a1ba27a76dd819cd8294cce3\` ON \`candidate_source\``); await queryRunner.query(`DROP INDEX \`IDX_509101ab1a46a5934ee278d447\` ON \`candidate_source\``); await queryRunner.query(`DROP INDEX \`IDX_2be9182096747fb18cb8afb1f0\` ON \`candidate_source\``); await queryRunner.query(`DROP TABLE \`candidate_source\``); await queryRunner.query(`DROP INDEX \`IDX_d7986743e7f11720349a6c9557\` ON \`candidate_skill\``); await queryRunner.query(`DROP INDEX \`IDX_8a07f780c6fce2b82830ab0687\` ON \`candidate_skill\``); await queryRunner.query(`DROP INDEX \`IDX_a38fe0c3f2ff0a4e475f2a1347\` ON \`candidate_skill\``); await queryRunner.query(`DROP INDEX \`IDX_6907163d0bb8e9f0440b9bf2a7\` ON \`candidate_skill\``); await queryRunner.query(`DROP TABLE \`candidate_skill\``); await queryRunner.query(`DROP INDEX \`IDX_a0d171f45bdbcf2b990c0c37c3\` ON \`candidate_personal_quality\``); await queryRunner.query(`DROP INDEX \`IDX_d321f4547ed467d07cce1e7d9a\` ON \`candidate_personal_quality\``); await queryRunner.query(`DROP INDEX \`IDX_045de7c208adcd0c68c0a65174\` ON \`candidate_personal_quality\``); await queryRunner.query(`DROP INDEX \`IDX_ff6776d92db4ef71edbfba9903\` ON \`candidate_personal_quality\``); await queryRunner.query(`DROP INDEX \`IDX_afe01503d4337c9623c06f22df\` ON \`candidate_personal_quality\``); await queryRunner.query(`DROP TABLE \`candidate_personal_quality\``); await queryRunner.query(`DROP INDEX \`IDX_9e7b20eb3dfa082b83b198fdad\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_ecb65075e94b47bbab11cfa5a1\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_5f1e315db848990dfffa72817c\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_f0ca69c78eea92c95d9044764a\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_2043abff09f084fb8690009fb8\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_b9132118c3a98c4c48e417c0c5\` ON \`candidate_interviewer\``); await queryRunner.query(`DROP TABLE \`candidate_interviewer\``); await queryRunner.query(`DROP INDEX \`IDX_91996439c4baafee8395d3df15\` ON \`candidate_interview\``); await queryRunner.query(`DROP INDEX \`IDX_03be41e88b1fecfe4e24d6b04b\` ON \`candidate_interview\``); await queryRunner.query(`DROP INDEX \`IDX_59b765e6d13d83dba4852a43eb\` ON \`candidate_interview\``); await queryRunner.query(`DROP INDEX \`IDX_7b49ce2928b327213f2de66b95\` ON \`candidate_interview\``); await queryRunner.query(`DROP INDEX \`IDX_b9191cf49f8cd1f192cb74233c\` ON \`candidate_interview\``); await queryRunner.query(`DROP TABLE \`candidate_interview\``); await queryRunner.query(`DROP INDEX \`REL_44f3d80c3293e1de038c87f115\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_0862c274d336126b951bfe009a\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_98c008fd8cf597e83dcdccfd16\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_3a6928f8501fce33820721a8fe\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_6cb21fa0f65ff69679966c836f\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_05ed49a5ebdd5ec533f913b620\` ON \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_c660aef2ca5aff9dbf45a9a4bb\` ON \`candidate_feedback\``); await queryRunner.query(`DROP TABLE \`candidate_feedback\``); await queryRunner.query(`DROP INDEX \`IDX_a50eb955f940ca93e044d175c6\` ON \`candidate_experience\``); await queryRunner.query(`DROP INDEX \`IDX_8dcf5fc8bc7f77a80b0fc648bf\` ON \`candidate_experience\``); await queryRunner.query(`DROP INDEX \`IDX_c24bce6dd33e56ef8e8dacef1a\` ON \`candidate_experience\``); await queryRunner.query(`DROP INDEX \`IDX_dafa68d060cf401d5f62a57ad4\` ON \`candidate_experience\``); await queryRunner.query(`DROP TABLE \`candidate_experience\``); await queryRunner.query(`DROP INDEX \`IDX_f660af89b2c69fea2334508cbb\` ON \`candidate_education\``); await queryRunner.query(`DROP INDEX \`IDX_00cdd9ed7571be8e2c8d09e7cd\` ON \`candidate_education\``); await queryRunner.query(`DROP INDEX \`IDX_b443c78c3796f2e9aab05a2bb9\` ON \`candidate_education\``); await queryRunner.query(`DROP INDEX \`IDX_336eb14606016757d2302efa4d\` ON \`candidate_education\``); await queryRunner.query(`DROP TABLE \`candidate_education\``); await queryRunner.query(`DROP INDEX \`IDX_3f9053719c9d11ebdea03e5a2d\` ON \`candidate_document\``); await queryRunner.query(`DROP INDEX \`IDX_d108a827199fda86a9ec216989\` ON \`candidate_document\``); await queryRunner.query(`DROP INDEX \`IDX_4d9b7ab09f9f9517d488b5fed1\` ON \`candidate_document\``); await queryRunner.query(`DROP INDEX \`IDX_3ed4bac12d0ca32eada4ea5a49\` ON \`candidate_document\``); await queryRunner.query(`DROP INDEX \`IDX_bf8070715e42b3afe9730e7b30\` ON \`candidate_document\``); await queryRunner.query(`DROP TABLE \`candidate_document\``); await queryRunner.query(`DROP INDEX \`IDX_159f821dd214792f1d2ad9cff7\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_ba4c376b2069aa82745d4e9682\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_d1d16bc87d3afaf387f34cdceb\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_b106406e94bb7317493efc2c98\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_9d5bd131452ef689df2b46551b\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_fcab96cef60fd8bccac610ccef\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_0a417dafb1dd14eb92a69fa641\` ON \`candidate_criterion_rating\``); await queryRunner.query(`DROP TABLE \`candidate_criterion_rating\``); await queryRunner.query(`DROP INDEX \`IDX_46ed3c2287423f5dc089100fee\` ON \`availability_slot\``); await queryRunner.query(`DROP INDEX \`IDX_d544bd3a63634a4438509ac958\` ON \`availability_slot\``); await queryRunner.query(`DROP INDEX \`IDX_f008a481cb4eed547704bb9d83\` ON \`availability_slot\``); await queryRunner.query(`DROP INDEX \`IDX_3aabb2cdf5b6e0df87cb94bdca\` ON \`availability_slot\``); await queryRunner.query(`DROP INDEX \`IDX_3e20b617c7d7a87b8bf53ddcbe\` ON \`availability_slot\``); await queryRunner.query(`DROP TABLE \`availability_slot\``); await queryRunner.query(`DROP INDEX \`IDX_45f32a5a12d42fba17fe62a279\` ON \`approval_policy\``); await queryRunner.query(`DROP INDEX \`IDX_dfe3b357df3ce136917b1f0984\` ON \`approval_policy\``); await queryRunner.query(`DROP INDEX \`IDX_1462391059ebe137645098d727\` ON \`approval_policy\``); await queryRunner.query(`DROP INDEX \`IDX_f50ce5a39d610cfcd9da9652b1\` ON \`approval_policy\``); await queryRunner.query(`DROP INDEX \`IDX_338364927c68961167606e989c\` ON \`approval_policy\``); await queryRunner.query(`DROP TABLE \`approval_policy\``); await queryRunner.query(`DROP INDEX \`IDX_e9ca170a0fae05e44a9bd137d8\` ON \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_0ddc50b7521b9a905d9ca8c8ba\` ON \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_3c3a62226896345c4716bfe1d9\` ON \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_2c0494466d5a7e1165cea3dca9\` ON \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_2a6f8c4b8da6f85e2903daf5c3\` ON \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_379af16b0aeed6a4d8f15c53bc\` ON \`appointment_employee\``); await queryRunner.query(`DROP TABLE \`appointment_employee\``); await queryRunner.query(`DROP INDEX \`IDX_a841eabc6b656c965d8846223e\` ON \`accounting_template\``); await queryRunner.query(`DROP INDEX \`IDX_968c1c9a131a61a3720b3a72f6\` ON \`accounting_template\``); await queryRunner.query(`DROP INDEX \`IDX_e66511b175393255c6c4e7b007\` ON \`accounting_template\``); await queryRunner.query(`DROP INDEX \`IDX_2ca6a49062a4ed884e413bf572\` ON \`accounting_template\``); await queryRunner.query(`DROP INDEX \`IDX_7ac2c1c487dd77fe38c2d571ea\` ON \`accounting_template\``); await queryRunner.query(`DROP INDEX \`IDX_5cf7c007fc9c83bee748f08806\` ON \`accounting_template\``); await queryRunner.query(`DROP TABLE \`accounting_template\``); - } + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`tag_warehouse\` DROP FOREIGN KEY \`FK_3557d514afd3794d40128e05423\``); + await queryRunner.query(`ALTER TABLE \`tag_warehouse\` DROP FOREIGN KEY \`FK_08385e1e045b83d25978568743f\``); + await queryRunner.query(`ALTER TABLE \`tag_user\` DROP FOREIGN KEY \`FK_e64a306f3215dbb99bbb26ca599\``); + await queryRunner.query(`ALTER TABLE \`tag_user\` DROP FOREIGN KEY \`FK_6a58ed56a12604c076a8e0cfdaa\``); + await queryRunner.query( + `ALTER TABLE \`time_slot_time_logs\` DROP FOREIGN KEY \`FK_2fc2675c79cb3cbceb32bf2dc7a\`` + ); + await queryRunner.query( + `ALTER TABLE \`time_slot_time_logs\` DROP FOREIGN KEY \`FK_63c61a88461ff5c115c3b6bcde5\`` + ); + await queryRunner.query(`ALTER TABLE \`task_team\` DROP FOREIGN KEY \`FK_0ef34c9f9d6dc8d14f1fbb10e86\``); + await queryRunner.query(`ALTER TABLE \`task_team\` DROP FOREIGN KEY \`FK_47689f911b0cbb16c94a56a9c50\``); + await queryRunner.query(`ALTER TABLE \`task_employee\` DROP FOREIGN KEY \`FK_f38b1bd46f8831704348003bbff\``); + await queryRunner.query(`ALTER TABLE \`task_employee\` DROP FOREIGN KEY \`FK_790858593698e54cba501eb6908\``); + await queryRunner.query(`ALTER TABLE \`tag_task\` DROP FOREIGN KEY \`FK_bf7c34187a346f499e4dbc4b08b\``); + await queryRunner.query(`ALTER TABLE \`tag_task\` DROP FOREIGN KEY \`FK_4b4e8f61e866248f2ddf8ce181a\``); + await queryRunner.query( + `ALTER TABLE \`skill_organization\` DROP FOREIGN KEY \`FK_b65cfda00c52e1fc26cc96e52ca\`` + ); + await queryRunner.query( + `ALTER TABLE \`skill_organization\` DROP FOREIGN KEY \`FK_61593ade5fed9445738ddbe39c4\`` + ); + await queryRunner.query(`ALTER TABLE \`skill_employee\` DROP FOREIGN KEY \`FK_760034f54e598d519b5f0c4ecee\``); + await queryRunner.query(`ALTER TABLE \`skill_employee\` DROP FOREIGN KEY \`FK_e699b50ca468e75bbd36913dccb\``); + await queryRunner.query( + `ALTER TABLE \`tag_request_approval\` DROP FOREIGN KEY \`FK_6c6576bff4b497a4975337fa5e3\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_request_approval\` DROP FOREIGN KEY \`FK_74938a30181630c480b36e27d76\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_proposal\` DROP FOREIGN KEY \`FK_451853704de278eef61a37fa7a6\``); + await queryRunner.query(`ALTER TABLE \`tag_proposal\` DROP FOREIGN KEY \`FK_3f55851a03524e567594d507744\``); + await queryRunner.query( + `ALTER TABLE \`product_gallery_item\` DROP FOREIGN KEY \`FK_825848065557eac3678b164cee2\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_gallery_item\` DROP FOREIGN KEY \`FK_f7187fa710c6a5d22f461926378\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_product\` DROP FOREIGN KEY \`FK_f75a28915b38d926902c0f85b24\``); + await queryRunner.query(`ALTER TABLE \`tag_product\` DROP FOREIGN KEY \`FK_e516b4a2a1a8d4beda7217eeac6\``); + await queryRunner.query( + `ALTER TABLE \`product_variant_options_product_option\` DROP FOREIGN KEY \`FK_e96a71affe63c97f7fa2f076dac\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_options_product_option\` DROP FOREIGN KEY \`FK_526f0131260eec308a3bd2b61b6\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_payment\` DROP FOREIGN KEY \`FK_e087c0540b5098d115b50d954cd\``); + await queryRunner.query(`ALTER TABLE \`tag_payment\` DROP FOREIGN KEY \`FK_1fcb2a337ee905ab36c4aea3a3c\``); + await queryRunner.query(`ALTER TABLE \`tag_organization\` DROP FOREIGN KEY \`FK_f5e70849adc6f2f81fcbccae77c\``); + await queryRunner.query(`ALTER TABLE \`tag_organization\` DROP FOREIGN KEY \`FK_7ca79ff010025397cf9f216bdeb\``); + await queryRunner.query( + `ALTER TABLE \`tag_organization_vendor\` DROP FOREIGN KEY \`FK_f71369c1cb86ae9fd4d5452f9aa\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_vendor\` DROP FOREIGN KEY \`FK_7dde3307daf6d6dec1513ecc560\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_tasks_task\` DROP FOREIGN KEY \`FK_d15fbe1e1d9c1f56651d8d3831e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_tasks_task\` DROP FOREIGN KEY \`FK_2a6fb43dc7e7aebcda95e32a107\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_team\` DROP FOREIGN KEY \`FK_2382356b63c832a137079210bd1\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_team\` DROP FOREIGN KEY \`FK_4b5e0ca086e6124eeddf84252fc\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_team\` DROP FOREIGN KEY \`FK_599a5f7f6c190822dcfdbbb6eb0\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_team\` DROP FOREIGN KEY \`FK_7c31431ff2173c2c939a0aa036c\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_project\` DROP FOREIGN KEY \`FK_18be859b371e9159dfc2cecbe13\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_project\` DROP FOREIGN KEY \`FK_b69fa5d1b1d02cdbe301ea6b108\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_position\` DROP FOREIGN KEY \`FK_c71c381e77b0543ed4023aeef79\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_position\` DROP FOREIGN KEY \`FK_1f7e0230bc542d7037810203786\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_employment_type\` DROP FOREIGN KEY \`FK_8c5db3a96baffba025729ebe869\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_employment_type\` DROP FOREIGN KEY \`FK_b4b51067c538f78b8585ef2a175\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type_employee\` DROP FOREIGN KEY \`FK_3ed17d3e624435e9f2ad71e0583\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type_employee\` DROP FOREIGN KEY \`FK_3bfdb894d67e6a29aa95780bb47\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_employment_type\` DROP FOREIGN KEY \`FK_904a731b2ae6bc1aa52c8302a98\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_employment_type\` DROP FOREIGN KEY \`FK_41a87d3cfa58c851bbf03ad4e8d\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_department\` DROP FOREIGN KEY \`FK_ef6e8d34b95dcb2b21d5de08a61\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_department\` DROP FOREIGN KEY \`FK_c58533f9ba63f42fef682e1ee7c\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department_employee\` DROP FOREIGN KEY \`FK_0d4f83695591ae3c98a0544ac8d\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department_employee\` DROP FOREIGN KEY \`FK_c34e79a3aa682bbd3f0e8cf4c46\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_department\` DROP FOREIGN KEY \`FK_0eb285a6b1ac7e3d0a542e50a4b\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_department\` DROP FOREIGN KEY \`FK_c2c9cd2ea533d5442de455fb3e1\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact_employee\` DROP FOREIGN KEY \`FK_cd2bd8302bfb6093d0908c36dcb\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact_employee\` DROP FOREIGN KEY \`FK_beffeb7f338fa98354948c07894\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_contact\` DROP FOREIGN KEY \`FK_8a06f5aded97d1b5e81005e1216\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_contact\` DROP FOREIGN KEY \`FK_1fb664a63f20bea6a3f0b387713\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_merchant\` DROP FOREIGN KEY \`FK_a6bfc0dc6e5234e8e7ef698a36a\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_merchant\` DROP FOREIGN KEY \`FK_812f0cfb560ac6dda0d1345765b\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_merchant\` DROP FOREIGN KEY \`FK_4af822b453c7d7d5f033e6ea16f\``); + await queryRunner.query(`ALTER TABLE \`tag_merchant\` DROP FOREIGN KEY \`FK_e7d60a4e9906d056a8966e279fd\``); + await queryRunner.query(`ALTER TABLE \`tag_invoice\` DROP FOREIGN KEY \`FK_0728fc2cc26e8802cbf41aaf274\``); + await queryRunner.query(`ALTER TABLE \`tag_invoice\` DROP FOREIGN KEY \`FK_5a07958d7c6253b311dbdc34ff8\``); + await queryRunner.query( + `ALTER TABLE \`invite_organization_team\` DROP FOREIGN KEY \`FK_1132ec0c3618e53fc8cf7ed6694\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_team\` DROP FOREIGN KEY \`FK_104140c94e838a058a34b30a09c\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_department\` DROP FOREIGN KEY \`FK_fe2eea7a939442efde885303efd\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_department\` DROP FOREIGN KEY \`FK_0935b93b3498a0f98db1af71760\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_contact\` DROP FOREIGN KEY \`FK_c5a147ce2a0ec69ccc61149262d\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_contact\` DROP FOREIGN KEY \`FK_a0c92b6393c7a13266003d552ef\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_project\` DROP FOREIGN KEY \`FK_f2806968dd846cb49fcdac195a0\`` + ); + await queryRunner.query( + `ALTER TABLE \`invite_organization_project\` DROP FOREIGN KEY \`FK_020325728f0979a2822a8295653\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_integration\` DROP FOREIGN KEY \`FK_0f19ad9872190b7a67a9652d5e1\``); + await queryRunner.query(`ALTER TABLE \`tag_integration\` DROP FOREIGN KEY \`FK_c9a85b16615bc5c3035802adb04\``); + await queryRunner.query( + `ALTER TABLE \`integration_integration_type\` DROP FOREIGN KEY \`FK_8dd2062499a6c2a708ddd05650e\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_integration_type\` DROP FOREIGN KEY \`FK_34c86921ee9b462bc5c7b61fad4\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_income\` DROP FOREIGN KEY \`FK_00e2fd30761a36911648166044c\``); + await queryRunner.query(`ALTER TABLE \`tag_income\` DROP FOREIGN KEY \`FK_55c9568ebe1c4addc3deb6922e5\``); + await queryRunner.query(`ALTER TABLE \`tag_expense\` DROP FOREIGN KEY \`FK_8dcfbd0d960672fefe681bcba9c\``); + await queryRunner.query(`ALTER TABLE \`tag_expense\` DROP FOREIGN KEY \`FK_6f1108552ea7a70a4d958b338cd\``); + await queryRunner.query( + `ALTER TABLE \`tag_organization_expense_category\` DROP FOREIGN KEY \`FK_727dbf5e1100023681e216d6a93\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_organization_expense_category\` DROP FOREIGN KEY \`FK_107a93f89c8f31f4386ae4b19d9\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_event_type\` DROP FOREIGN KEY \`FK_34b8f471aac00eaec6f2830e5bb\``); + await queryRunner.query(`ALTER TABLE \`tag_event_type\` DROP FOREIGN KEY \`FK_094af399a26d4a1d3ae17ea11e3\``); + await queryRunner.query(`ALTER TABLE \`tag_equipment\` DROP FOREIGN KEY \`FK_0360b8197c2a38d6fe882cb1aff\``); + await queryRunner.query(`ALTER TABLE \`tag_equipment\` DROP FOREIGN KEY \`FK_bb0062d51a75164fcb64041ee7d\``); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_teams\` DROP FOREIGN KEY \`FK_7ccef49dd56c8c74daa8d12186b\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_teams\` DROP FOREIGN KEY \`FK_f84171695b7aedfc454483bcf21\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_employees\` DROP FOREIGN KEY \`FK_57f6461f1a710f0f4abdcb8d0e6\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_shares_employees\` DROP FOREIGN KEY \`FK_8676224f55a965c53e4bb7cbf8f\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_tasks_task\` DROP FOREIGN KEY \`FK_6bbbe677c5fc5115916b4eccfb1\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_tasks_task\` DROP FOREIGN KEY \`FK_eae5eea1c6a3fcf4a2c95f1a5fe\`` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request_employee\` DROP FOREIGN KEY \`FK_0a8cf0aacf95ce66e73e75a95cf\`` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_request_employee\` DROP FOREIGN KEY \`FK_cd312469204347b1210397770a1\`` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy_employee\` DROP FOREIGN KEY \`FK_0f823750ac5a7d899cc5d8d0402\`` + ); + await queryRunner.query( + `ALTER TABLE \`time_off_policy_employee\` DROP FOREIGN KEY \`FK_c451f53f5a6cd97db94e1c9482d\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_employee\` DROP FOREIGN KEY \`FK_b1ffe2a63a48b486e18dc59d1b7\``); + await queryRunner.query(`ALTER TABLE \`tag_employee\` DROP FOREIGN KEY \`FK_e0ddfccfe9816681c410ebf2b9a\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee_level\` DROP FOREIGN KEY \`FK_f3caf4cc158fe8b8e06578e7922\`` + ); + await queryRunner.query( + `ALTER TABLE \`tag_employee_level\` DROP FOREIGN KEY \`FK_b3565ff8073d4f66c46d27fe88e\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_job_preset\` DROP FOREIGN KEY \`FK_68e75e49f06409fd385b4f87746\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_job_preset\` DROP FOREIGN KEY \`FK_7ae5b4d4bdec77971dab319f2e2\`` + ); + await queryRunner.query(`ALTER TABLE \`tag_candidate\` DROP FOREIGN KEY \`FK_7e0891bb331b08bd4abb6776b76\``); + await queryRunner.query(`ALTER TABLE \`tag_candidate\` DROP FOREIGN KEY \`FK_34e4625cc9b010079f1b5758b36\``); + await queryRunner.query(`ALTER TABLE \`changelog\` DROP FOREIGN KEY \`FK_c2037b621d2e8023898aee4ac74\``); + await queryRunner.query(`ALTER TABLE \`changelog\` DROP FOREIGN KEY \`FK_744268ee0ec6073883267bc3b66\``); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_2d5ecab1f06b327bad545536143\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_8eb7e413257d7a26104f4e326fd\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_81558bb2bef673628d92540b4e4\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_author\` DROP FOREIGN KEY \`FK_1551e821871d9230cc0dafbbe58\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_66af194845635058239e794e1b9\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_3547f82f867489542ceae58a49e\`` + ); + await queryRunner.query( + `ALTER TABLE \`knowledge_base_article\` DROP FOREIGN KEY \`FK_06a9902fedc1f9dcdbaf14afb01\`` + ); + await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_ff979040ce93cbc60863d322ecd\``); + await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_2ba72a9dec732a10e8c05bcdec1\``); + await queryRunner.query(`ALTER TABLE \`knowledge_base\` DROP FOREIGN KEY \`FK_bcb30c9893f4c8d0c4e556b4ed3\``); + await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_84594016a98da8b87e0f51cd931\``); + await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_f502dc6d9802306f9d1584932b8\``); + await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_f5735eafddabdb4b20f621a976a\``); + await queryRunner.query(`ALTER TABLE \`warehouse\` DROP FOREIGN KEY \`FK_9b2f00761a6b1b77cb6289e3fff\``); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_617306cb3613dd8d59301ae16fd\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_a2f863689d1316810c41c1ea38e\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_d5f4b64e6a80546fd6dd4ac3ed0\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product_variant\` DROP FOREIGN KEY \`FK_a1c4a97b928b547c3041d3ac1f6\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_3f934c4772e7c7f2c66d7ea4e72\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_a8c9aee14d47ec7b3f2ac429ebc\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_c899e17322d11e1977832e8c656\`` + ); + await queryRunner.query( + `ALTER TABLE \`warehouse_product\` DROP FOREIGN KEY \`FK_62573a939f834f2de343f98288c\`` + ); + await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_5e028298e103e1694147ada69e5\``); + await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_c28e52f758e7bbc53828db92194\``); + await queryRunner.query(`ALTER TABLE \`user\` DROP FOREIGN KEY \`FK_685bf353c85f23b6f848e4dcded\``); + await queryRunner.query( + `ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_29c3c8cc3ea9db22e4a347f4b5a\`` + ); + await queryRunner.query( + `ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_7143f31467178a6164a42426c15\`` + ); + await queryRunner.query( + `ALTER TABLE \`user_organization\` DROP FOREIGN KEY \`FK_611e1392c8cc9b101e3ea7ad80c\`` + ); + await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_6c1f81934a3f597b3b1a17f5623\``); + await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_8c8f821cb0fe0dd387491ea7d9e\``); + await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_aca65a79fe0c1ec9e6a59022c54\``); + await queryRunner.query(`ALTER TABLE \`timesheet\` DROP FOREIGN KEY \`FK_25b8df69c9b7f5752c6a6a6ef7f\``); + await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_9272701d3da8bd8507f316c9154\``); + await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_82c5edbd179359212f16f0d386a\``); + await queryRunner.query(`ALTER TABLE \`time_slot_minute\` DROP FOREIGN KEY \`FK_c7f72cb68b22b8ab988158e4d26\``); + await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_7913305b850c7afc89b6ed96a30\``); + await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_b407841271245501dd1a8c75513\``); + await queryRunner.query(`ALTER TABLE \`time_slot\` DROP FOREIGN KEY \`FK_b8284109257b5137256b5b3e848\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_18dcdf754396f0cb0308dc91f4c\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_d1e8f22c02c5e949453dde7f2d1\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_1ddf2da35e34378fd845d80a18b\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_54776f6f5fd3c13c3bc1fbfac5b\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_e65393bb52aa8275b1392c73f72\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_a89a849957e005bafb8e4220bc7\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_aed2d5cc5680fba9d387c7f931d\``); + await queryRunner.query(`ALTER TABLE \`time_log\` DROP FOREIGN KEY \`FK_fa9018cb248ea0f3b2b30ef143b\``); + await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_fa1896dc735403799311968f7ec\``); + await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_5b594d02d98d5defcde323abe5b\``); + await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_0951aacffe3f8d0cff54cf2f341\``); + await queryRunner.query(`ALTER TABLE \`screenshot\` DROP FOREIGN KEY \`FK_235004f3dafac90692cd64d9158\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_2743f8990fde12f9586287eb09f\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_4e382caaf07ab0923b2e06bf918\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_5a898f44fa31ef7916f0c38b016\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_a6f74ae99d549932391f0f44609\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_fdb3f018c2bba4885bfa5757d16\``); + await queryRunner.query(`ALTER TABLE \`activity\` DROP FOREIGN KEY \`FK_f2401d8fdff5d8970dfe30d3aed\``); + await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_c009cdd795be674c20470623742\``); + await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_c1f8ae47dc2f1882afc5045c739\``); + await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_981333982a6df8b815957dcbf27\``); + await queryRunner.query(`ALTER TABLE \`time_off_request\` DROP FOREIGN KEY \`FK_4989834dd1c9c8ea3576ed99ce5\``); + await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP FOREIGN KEY \`FK_c2744cffeca55c3c9c52bb9789c\``); + await queryRunner.query(`ALTER TABLE \`time_off_policy\` DROP FOREIGN KEY \`FK_1c0ed84d54f8fbe4af10dfcda1c\``); + await queryRunner.query(`ALTER TABLE \`tenant\` DROP FOREIGN KEY \`FK_d154d06dac0d0e0a5d9a083e253\``); + await queryRunner.query(`ALTER TABLE \`tenant_setting\` DROP FOREIGN KEY \`FK_affdab301e348b892175f30fa39\``); + await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_959e77718a2e76ee56498c1106a\``); + await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_91988120385964f213aec8aa84c\``); + await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_9c845f353378371ee3aa60f6865\``); + await queryRunner.query(`ALTER TABLE \`task_version\` DROP FOREIGN KEY \`FK_379c8bd0ce203341148c1f99ee7\``); + await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_0330b4a942b536d8d1f264abe32\``); + await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_a19e8975e5c296640d457dfc11f\``); + await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_9b9a828a49f4bd6383a4073fe23\``); + await queryRunner.query(`ALTER TABLE \`task_status\` DROP FOREIGN KEY \`FK_efbaf00a743316b394cc31e4a20\``); + await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_f4438327b3c2afb0832569b2a1e\``); + await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_ad6792b26526bd96ab18d634544\``); + await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_596512cc6508a482cc23ae6ab78\``); + await queryRunner.query(`ALTER TABLE \`task_size\` DROP FOREIGN KEY \`FK_f6ec2207e50680a475d71c89793\``); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_4967ebdca0aefb9d43e56695e42\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_d99fe5b50dbe5078e0d9a9b6a9d\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_bed691e21fe01cf5aceee722952\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_related_issue_type\` DROP FOREIGN KEY \`FK_b7b0ea8ac2825fb981c1181d115\`` + ); + await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_52b039cff6a1adf6b7f9e49ee44\``); + await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_db4237960ca989eb7a48cd433b1\``); + await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_7fd1b30d159b608cbf59009f681\``); + await queryRunner.query(`ALTER TABLE \`task_priority\` DROP FOREIGN KEY \`FK_1818655f27b8cf4f0d1dbfeb8db\``); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_0848fd2b8c23c0ab55146297cff\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_6deea7b3671e45973e191a1502c\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_24114c4059e6b6991daba541b1d\`` + ); + await queryRunner.query( + `ALTER TABLE \`task_linked_issues\` DROP FOREIGN KEY \`FK_20b50abc5c97610a75d49ad3817\`` + ); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_b8616deefe44d0622233e73fbf9\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_2f4bdd2593fd6038aaa91fd1076\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_0cbe714983eb0aae5feeee8212b\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_1e1f64696aa3a26d3e12c840e55\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_94fe6b3a5aec5f85427df4f8cd7\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_3797a20ef5553ae87af126bc2fe\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_8c9920b5fb32c3d8453f64b705c\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_5b0272d923a31c972bed1a1ac4d\``); + await queryRunner.query(`ALTER TABLE \`task\` DROP FOREIGN KEY \`FK_e91cbff3d206f150ccc14d0c3a1\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_586513cceb16777fd14a17bfe10\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_131331557078611a68b4a5b2e7e\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_33779b0395f72af0b50dc526d1d\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_16dbef9d1b2b422abdce8ee3ae2\``); + await queryRunner.query(`ALTER TABLE \`issue_type\` DROP FOREIGN KEY \`FK_8b12c913c39c72fe5980427c963\``); + await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_a3ee022203211f678376cd919bb\``); + await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_8f274646f2bdf4e12990feeb040\``); + await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_16507eb222e3c50be077fb4ace2\``); + await queryRunner.query(`ALTER TABLE \`task_estimation\` DROP FOREIGN KEY \`FK_87bfea6d0b9a1ec602ee88e5f68\``); + await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_49746602acc4e5e8721062b69ec\``); + await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_c2f6bec0b39eaa3a6d90903ae99\``); + await queryRunner.query(`ALTER TABLE \`tag\` DROP FOREIGN KEY \`FK_b08dd29fb6a8acdf83c83d8988f\``); + await queryRunner.query(`ALTER TABLE \`skill\` DROP FOREIGN KEY \`FK_b2923d394f3636671ff9b3c3e81\``); + await queryRunner.query(`ALTER TABLE \`skill\` DROP FOREIGN KEY \`FK_8e502eac7ed1347c71c26beae81\``); + await queryRunner.query(`ALTER TABLE \`role\` DROP FOREIGN KEY \`FK_1751a572e91385a09d41c624714\``); + await queryRunner.query(`ALTER TABLE \`role_permission\` DROP FOREIGN KEY \`FK_e3130a39c1e4a740d044e685730\``); + await queryRunner.query(`ALTER TABLE \`role_permission\` DROP FOREIGN KEY \`FK_cbd053921056e77c0a8e03122af\``); + await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_26bb3420001d31337393ed05bc3\``); + await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_8343741e7929043b2a7de89f739\``); + await queryRunner.query(`ALTER TABLE \`request_approval\` DROP FOREIGN KEY \`FK_9feaa23ed7bc47d51315e304bb5\``); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_9ccdaee6c5c62cda8f7375e8417\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_6c75d8a8c609e88896b2653cc41\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_77e1050669b32cfff482f960169\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_team\` DROP FOREIGN KEY \`FK_94b2a3d0f17c9549dea1493dc96\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_ce2113039f070b3f003aa0db611\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_563fec5539b89a57f40731f9858\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_4071f027554eefff65ac8123e6e\`` + ); + await queryRunner.query( + `ALTER TABLE \`request_approval_employee\` DROP FOREIGN KEY \`FK_a5445b38b780b29b09369e36a9b\`` + ); + await queryRunner.query(`ALTER TABLE \`report\` DROP FOREIGN KEY \`FK_230652e48daa99c50c000fc5d10\``); + await queryRunner.query( + `ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_a085d6f9bcfd19f8bae1dbfe135\`` + ); + await queryRunner.query( + `ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_5193788a3ebc1143bedb74cf725\`` + ); + await queryRunner.query( + `ALTER TABLE \`report_organization\` DROP FOREIGN KEY \`FK_edf9bd011d7f08e3e18a5becb8b\`` + ); + await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_61c45ab51852e4b0e539756d40f\``); + await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_f399488a0f3ea10bb511e3f5aa3\``); + await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_d59ec6899d435f430799795ad7b\``); + await queryRunner.query(`ALTER TABLE \`proposal\` DROP FOREIGN KEY \`FK_4177329f5e6ddbfb64165927134\``); + await queryRunner.query( + `ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_d24bc28e54f1dc296452a255917\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_e6abcacc3d3a4f9cf5ca97f2b28\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_translation\` DROP FOREIGN KEY \`FK_7533fd275bfb3219ce9eb4004c7\`` + ); + await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_618194d24a7ea86a165d7ec628e\``); + await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_374bfd0d1b0e1398d7206456d98\``); + await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_4627873dbc1af07d732e6eec7be\``); + await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_32a4bdd261ec81f4ca6b3abe262\``); + await queryRunner.query(`ALTER TABLE \`product\` DROP FOREIGN KEY \`FK_08293ca31a601d3cd0228120bc9\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_b83f23626741630a86299607156\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_6e420052844edf3a5506d863ce6\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_9f0fd369dfeb275415c649d110b\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_41b31a71dda350cfe5da07e0e4f\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_6a289b10030ae86903406e3c9bd\``); + await queryRunner.query(`ALTER TABLE \`product_variant\` DROP FOREIGN KEY \`FK_9121e00c4dc3500dc610cf8722e\``); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_5842f603bd85d924127d63d73cd\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_0cfba32db58a952f58b1e35cf1c\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_price\` DROP FOREIGN KEY \`FK_7052eaf00a5795afa5ebf359950\`` + ); + await queryRunner.query(`ALTER TABLE \`product_type\` DROP FOREIGN KEY \`FK_e4e4120b0c19d3a207ce38d7581\``); + await queryRunner.query(`ALTER TABLE \`product_type\` DROP FOREIGN KEY \`FK_f206c807fc7e41fc8a8b6679ae0\``); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_f4b767c43b4e9130c63382c9b28\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_2dd271bdeb602b8c3956287e33c\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_type_translation\` DROP FOREIGN KEY \`FK_30aafca59cdb456bf5231f9e463\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_b0d86990fe7160a5f3e4011fb23\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_bed9d45e15866d9b8e87e7a7bfe\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_variant_setting\` DROP FOREIGN KEY \`FK_2efe48435d4ba480a4bb8b96fa6\`` + ); + await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_a6debf9198e2fbfa006aa10d710\``); + await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_47ffb82a65c43f102b7e0efa41a\``); + await queryRunner.query(`ALTER TABLE \`product_option\` DROP FOREIGN KEY \`FK_985d235aa5394937c4493262c7f\``); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_f43c46e12db0580af320db77381\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_4dc2f466cfa3d0b7fef19d12731\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_translation\` DROP FOREIGN KEY \`FK_9869d7680f48487e584f5d2fca7\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_c9ce1da98b6d93293daafee63aa\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_0e2fcc31743e20a45fc3cf0211d\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group_translation\` DROP FOREIGN KEY \`FK_fd6b39f1fd1db026b5dcc3c7953\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_a6e91739227bf4d442f23c52c75\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_4a1430a01b71ecdfcd54b2b6c5c\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_option_group\` DROP FOREIGN KEY \`FK_462a7fd3ce68935cf973c6709f9\`` + ); + await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_f38e86bd280ff9c9c7d9cb78393\``); + await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_853302351eaa4daa39920c270a9\``); + await queryRunner.query(`ALTER TABLE \`product_category\` DROP FOREIGN KEY \`FK_0a0cf25cd8232a154d1cce2641c\``); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_586294149d24cd835678878ef12\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_e46203bf1dbf3291d174f02cb34\`` + ); + await queryRunner.query( + `ALTER TABLE \`product_category_translation\` DROP FOREIGN KEY \`FK_27d71aa2e843f07fbf36329be3f\`` + ); + await queryRunner.query(`ALTER TABLE \`pipeline\` DROP FOREIGN KEY \`FK_873ade98fbd6ca71c8b4d1bbcac\``); + await queryRunner.query(`ALTER TABLE \`pipeline\` DROP FOREIGN KEY \`FK_683274c59fb08b21249096e305c\``); + await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_73ec3158bf224b485fd715cb3a6\``); + await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_04d16bdd72668de12c3e41a85a6\``); + await queryRunner.query(`ALTER TABLE \`pipeline_stage\` DROP FOREIGN KEY \`FK_28965bf63ad4c0976892d0fd5e8\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_82753b9e315af84b20eaf84d778\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_8846e403ec45e1ad8c309f91a37\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_3f13c738eff604a85700746ec7d\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_87223c7f1d4c2ca51cf69927844\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_62ef561a3bb084a7d12dad8a2d9\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_be7fcc9fb8cd5a74cb602ec6c9b\``); + await queryRunner.query(`ALTER TABLE \`payment\` DROP FOREIGN KEY \`FK_6959c37c3acf0832103a2535703\``); + await queryRunner.query(`ALTER TABLE \`password_reset\` DROP FOREIGN KEY \`FK_1fa632f2d12a06ef8dcc00858ff\``); + await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_47b6a97e09895a06606a4a80421\``); + await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_7965db2b12872551b586f76dd79\``); + await queryRunner.query(`ALTER TABLE \`organization\` DROP FOREIGN KEY \`FK_745a293c8b2c750bc421fa06332\``); + await queryRunner.query( + `ALTER TABLE \`organization_vendor\` DROP FOREIGN KEY \`FK_56dd132aa3743cfa9b034d020eb\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_vendor\` DROP FOREIGN KEY \`FK_7e0bf6063e1728c9813d5da7caa\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_51e91be110fa0b8e70066f5727f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_da625f694eb1e23e585f3010082\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_eef1c19a0cb5321223cfe3286c4\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team\` DROP FOREIGN KEY \`FK_176f5ed3c4534f3110d423d5690\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_171b852be7c1f387eca93775aad\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_5e73656ce0355347477c42ae19b\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_c15823bf3f63b1fe331d9de6625\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_join_request\` DROP FOREIGN KEY \`FK_d9529008c733cb90044b8c2ad6b\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_ce83034f38496f5fe3f19796977\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_a2a5601d799fbfc29c17b99243f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_8dc83cdd7c519d73afc0d8bdf09\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_719aeb37fa7a1dd80d25336a0cf\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_d8eba1c0e500c60be1b69c1e777\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_team_employee\` DROP FOREIGN KEY \`FK_fe12e1b76bbb76209134d9bdc2e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_20a290f166c0810eafbf2717171\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_19ab7adf33199bc6f913db277d7\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_5830901876e426adfc15fb7341b\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_task_setting\` DROP FOREIGN KEY \`FK_582768159ef0c749e8552ea9bcd\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_a140b7e30ff3455551a0fd599fb\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_8a1fe8afb3aa672bae5993fbe7d\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_sprint\` DROP FOREIGN KEY \`FK_f57ad03c4e471bd8530494ea63d\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_recurring_expense\` DROP FOREIGN KEY \`FK_8a12e7a0d47d3c6a6b35f7984e3\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_recurring_expense\` DROP FOREIGN KEY \`FK_0b19a287858af40661bd3eb7411\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_063324fdceb51f7086e401ed2c9\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_bc1e32c13683dbb16ada1c6da14\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_904ae0b765faef6ba2db8b1e698\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_9d8afc1e1e64d4b7d48dd2229d7\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project\` DROP FOREIGN KEY \`FK_7cf84e8b5775f349f81a1f3cc44\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_position\` DROP FOREIGN KEY \`FK_a0409e39f23ff6d418f2c03df58\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_position\` DROP FOREIGN KEY \`FK_a8f497b1006ec967964abb0d497\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_020516e74a57cb85d75381e841a\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_4513931e2d530f78d7144c8c7cd\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_language\` DROP FOREIGN KEY \`FK_225e476592214e32e117a85213c\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type\` DROP FOREIGN KEY \`FK_a583cfe32f492f5ba99b7bb2050\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_employment_type\` DROP FOREIGN KEY \`FK_227b5bd9867287cbbeece8f6ba9\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_c129dee7d1cb84e01e69b5e2c66\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_1057ec001a4c6b258658143047a\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_document\` DROP FOREIGN KEY \`FK_4bc83945c022a862a33629ff1e1\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department\` DROP FOREIGN KEY \`FK_c61a562a2379d1c0077fe7de332\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_department\` DROP FOREIGN KEY \`FK_b3644ff7cd65239e29d292a41d1\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_8cfcdc6bc8fb55e273d9ace5fd5\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_a86d2e378b953cb39261f457d26\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_6200736cb4d3617b004e5b647ff\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_contact\` DROP FOREIGN KEY \`FK_e68c43e315ad3aaea4e99cf461d\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_award\` DROP FOREIGN KEY \`FK_2e0d21aab892b5993abaac09bcd\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_award\` DROP FOREIGN KEY \`FK_af6423760433da72002a7f369eb\`` + ); + await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_20acc3c3a6c900c6ef9fc681996\``); + await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_e03ddff05652be527e04abdc56f\``); + await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_d306a524b507f72fa8550aeffe4\``); + await queryRunner.query(`ALTER TABLE \`merchant\` DROP FOREIGN KEY \`FK_533144d7ae94180235ea456625b\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_3e1d08761a717c1dd71fe67249b\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_4e1e975124c1d717814a4bb2ec8\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_d8547e21ccb8e37ac9f0d69c1af\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_38dc003f3484eff4b59918e9ae3\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_c89adeff0de3aedb2e772a5bf4c\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_5880347716f9ec5056ec15112cc\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_d1f45ca98f17bd84a5e430feaf4\``); + await queryRunner.query(`ALTER TABLE \`key_result\` DROP FOREIGN KEY \`FK_8ac2c6b487d03157adda874789f\``); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_7497a70a581e5f56f792015dd37\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_fd4b0cb7a44ed914acdda55e29c\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_update\` DROP FOREIGN KEY \`FK_cd9cbc0d5b6d62dbb63c3b3a65b\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_46426ea45456e240a092b732047\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_4bc62c3d2ffdd6f9c7f8b3dcd1c\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_fab6b6200b9ed6fd002c1ff62ab\`` + ); + await queryRunner.query( + `ALTER TABLE \`key_result_template\` DROP FOREIGN KEY \`FK_86c09eb673b0e66129dbdc72111\`` + ); + await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_d9e965da0f63c94983d3a1006ac\``); + await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_b5c33892e630b66c65d623baf8e\``); + await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_058ef835f99e28fc6717cd7c80f\``); + await queryRunner.query(`ALTER TABLE \`invoice\` DROP FOREIGN KEY \`FK_7fb52a5f267f53b7d93af3d8c3c\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_e558df60d7d9a3e412ef0bbb844\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_16f1d0e74b4d33e59c0eabdaac7\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_d4d92abde074b3da8054d7cfbc7\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_62d486728b272e3b4d23a6b5db6\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_553d5aac210d22fdca5c8d48ead\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_897c33b49a04cf3db7acd336afc\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_e89749c8e8258b2ec110c0776ff\``); + await queryRunner.query(`ALTER TABLE \`invoice_item\` DROP FOREIGN KEY \`FK_f78214cd9de76e80fe8a6305f52\``); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_31ec3d5a6b0985cec544c642178\`` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_da2893697d57368470952a76f65\`` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_856f24297f120604f8ae2942769\`` + ); + await queryRunner.query( + `ALTER TABLE \`invoice_estimate_history\` DROP FOREIGN KEY \`FK_cc0ac824ba89deda98bb418e8ca\`` + ); + await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_91bfeec7a9574f458e5b592472d\``); + await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_900a3ed40499c79c1c289fec284\``); + await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_5a182e8b3e225b14ddf6df7e6c3\``); + await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_68eef4ab86b67747f24f288a16c\``); + await queryRunner.query(`ALTER TABLE \`invite\` DROP FOREIGN KEY \`FK_7c2328f76efb850b81147972476\``); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_5065401113abb6e9608225e5678\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_6c8e119fc6a2a7d3413aa76d3bd\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository_issue\` DROP FOREIGN KEY \`FK_b3234be5b70c2362cdf67bb1889\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_add7dbec156589dd0b27e2e0c49\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_69d75a47af6bfcda545a865691b\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_github_repository\` DROP FOREIGN KEY \`FK_480158f21938444e4f62fb31857\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_0d6ddc27d687ca879042c5f3ce3\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_33ab224e7755a46fff5bc1e64e5\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_tenant\` DROP FOREIGN KEY \`FK_24e37d03ef224f1a16a35069c2c\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_34daf030004ad37b88f1f3d863c\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_369eaafb13afe9903a170077edb\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_setting\` DROP FOREIGN KEY \`FK_954c6b05297814776d9cb66ca77\`` + ); + await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_c327ea26bda3d349a1eceb5658e\``); + await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_7022dafd72c1b92f7d506914411\``); + await queryRunner.query(`ALTER TABLE \`integration_map\` DROP FOREIGN KEY \`FK_eec3d6064578610ddc609dd360e\``); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_f80ff4ebbf0b33a67dce5989117\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_c6c01e38eebd8b26b9214b90441\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting\` DROP FOREIGN KEY \`FK_23e9cfcf1bfff07dcc3254378df\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_3fb863167095805e33f38a0fdcc\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_d5ac36aa3d5919908414154fca0\`` + ); + await queryRunner.query( + `ALTER TABLE \`integration_entity_setting_tied\` DROP FOREIGN KEY \`FK_b208a754c7a538cb3422f39f5b9\`` + ); + await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_29fbd3a17710a27e6f856072c01\``); + await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_a05d52b7ffe89140f9cbcf114b3\``); + await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_64409de4711cd14e2c43371cc02\``); + await queryRunner.query(`ALTER TABLE \`income\` DROP FOREIGN KEY \`FK_8608b275644cfc7a0f3f5850814\``); + await queryRunner.query(`ALTER TABLE \`image_asset\` DROP FOREIGN KEY \`FK_d3675304df9971cccf96d9a7c34\``); + await queryRunner.query(`ALTER TABLE \`image_asset\` DROP FOREIGN KEY \`FK_01856a9a730b7e79d70aa661cb0\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_4c8b4e887a994182fd6132e6400\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_af0a11734e70412b742ac339c88\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_35526ff1063ab5fa2b20e71bd66\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_ac161c1a0c0ff8e83554f097e5e\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_c6e8ae55a4db3584686cbf6afe1\``); + await queryRunner.query(`ALTER TABLE \`goal\` DROP FOREIGN KEY \`FK_6b4758a5442713070c9a366d0e5\``); + await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP FOREIGN KEY \`FK_405bc5bba9ed71aefef84a29f10\``); + await queryRunner.query(`ALTER TABLE \`goal_time_frame\` DROP FOREIGN KEY \`FK_b56723b53a76ca1c171890c479b\``); + await queryRunner.query(`ALTER TABLE \`goal_template\` DROP FOREIGN KEY \`FK_5708fe06608c72fc77b65ae6519\``); + await queryRunner.query(`ALTER TABLE \`goal_template\` DROP FOREIGN KEY \`FK_774bf82989475befe301fe1bca5\``); + await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_d4f093ca4eb7c40db68d9a789d0\``); + await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_e49e37fe88a2725a38a3b058493\``); + await queryRunner.query(`ALTER TABLE \`goal_kpi\` DROP FOREIGN KEY \`FK_43aa2985216560cd9fa93f501e5\``); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_f69e740b066c6469d1c68a4a28b\`` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_df7ab026698c02859ff75408093\`` + ); + await queryRunner.query( + `ALTER TABLE \`goal_kpi_template\` DROP FOREIGN KEY \`FK_cc72d4e8e4284dcc8ffbf96caf4\`` + ); + await queryRunner.query( + `ALTER TABLE \`goal_general_setting\` DROP FOREIGN KEY \`FK_e35d0f7b794ca8850669d12c78c\`` + ); + await queryRunner.query( + `ALTER TABLE \`goal_general_setting\` DROP FOREIGN KEY \`FK_d17a5159d888ac6320459eda392\`` + ); + await queryRunner.query(`ALTER TABLE \`feature\` DROP FOREIGN KEY \`FK_d4a28a8e70d450a412bf0cfb52a\``); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_6d413f9fdd5366b1b9add464836\`` + ); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_6a94e6b0a572f591288ac44a421\`` + ); + await queryRunner.query( + `ALTER TABLE \`feature_organization\` DROP FOREIGN KEY \`FK_8f71803d96dcdbcc6b19bb28d38\`` + ); + await queryRunner.query(`ALTER TABLE \`import-record\` DROP FOREIGN KEY \`FK_a43b235c35c2c4d3263ada770c6\``); + await queryRunner.query(`ALTER TABLE \`import-history\` DROP FOREIGN KEY \`FK_54868607115e2fee3b0b764eec2\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_047b8b5c0782d5a6d4c8bfc1a4e\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_9971c4171ae051e74b833984a30\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_42eea5debc63f4d1bf89881c10a\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_eacb116ab0521ad9b96f2bb53ba\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_5e7b197dbac69012dbdb4964f37\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_c5fb146726ff128e600f23d0a1b\``); + await queryRunner.query(`ALTER TABLE \`expense\` DROP FOREIGN KEY \`FK_6d171c9d5f81095436b99da5e62\``); + await queryRunner.query(`ALTER TABLE \`expense_category\` DROP FOREIGN KEY \`FK_9c9bfe5baaf83f53533ff035fc0\``); + await queryRunner.query(`ALTER TABLE \`expense_category\` DROP FOREIGN KEY \`FK_37504e920ee5ca46a4000b89da5\``); + await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_24d905ec9e127ade23754a363dd\``); + await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_fc8818d6fde74370ec703a01352\``); + await queryRunner.query(`ALTER TABLE \`event_type\` DROP FOREIGN KEY \`FK_92fc62260c0c7ff108622850bff\``); + await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP FOREIGN KEY \`FK_233c1d351d63441aeb039d1164f\``); + await queryRunner.query(`ALTER TABLE \`estimate_email\` DROP FOREIGN KEY \`FK_391d3f83244fea73c619aecadd9\``); + await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_0ab80a66282582ae8b0282508e7\``); + await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_f98ce0d210aa9f91b729d447806\``); + await queryRunner.query(`ALTER TABLE \`equipment\` DROP FOREIGN KEY \`FK_fb6808468066849ab7b7454d5f3\``); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_0ecfe0ce0cd2b197249d5f1c105\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_acad51a6362806fc499e583e402\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_ea9254be07ae4a8604f0aaab196\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing\` DROP FOREIGN KEY \`FK_fa525e61fb3d8d9efec0f364a4b\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing_policy\` DROP FOREIGN KEY \`FK_5311a833ff255881454bd5b3b58\`` + ); + await queryRunner.query( + `ALTER TABLE \`equipment_sharing_policy\` DROP FOREIGN KEY \`FK_5443ca8ed830626656d8cfecef7\`` + ); + await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_5e719204dcafa8d6b2ecdeda130\``); + await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_1c0c1370ecd98040259625e17e2\``); + await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_f4b0d329c4a3cf79ffe9d565047\``); + await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_c6a48286f3aa8ae903bee0d1e72\``); + await queryRunner.query(`ALTER TABLE \`employee\` DROP FOREIGN KEY \`FK_4b3303a6b7eb92d237a4379734e\``); + await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_95ea18af6ef8123503d332240c2\``); + await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_56e96cd218a185ed59b5a8e7869\``); + await queryRunner.query(`ALTER TABLE \`employee_setting\` DROP FOREIGN KEY \`FK_9516a627a131626d2a5738a05a8\``); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_0ac8526c48a3daa267c86225fb5\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_3ee5147bb1fde625fa33c0e956b\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_recurring_expense\` DROP FOREIGN KEY \`FK_5fde7be40b3c03bc0fdac0c2f66\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_2be728a7f8b118712a4200990d4\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_ee780fbd8f91de31c004929eecb\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_proposal_template\` DROP FOREIGN KEY \`FK_f577c9bc6183c1d1eae1e154bbc\`` + ); + await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_329ebd01a757d1a0c3c4d628e29\``); + await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_0f9cefa604913e1ab3225915469\``); + await queryRunner.query(`ALTER TABLE \`employee_phone\` DROP FOREIGN KEY \`FK_d543336994b1f764c449e0b1d3c\``); + await queryRunner.query(`ALTER TABLE \`employee_level\` DROP FOREIGN KEY \`FK_c4668533292bf4526e61aedf74a\``); + await queryRunner.query(`ALTER TABLE \`employee_level\` DROP FOREIGN KEY \`FK_d3fc52d497bc44d6f493dbedc3a\``); + await queryRunner.query( + `ALTER TABLE \`job_search_occupation\` DROP FOREIGN KEY \`FK_1a62a99e1016e4a2b461e886ecd\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_occupation\` DROP FOREIGN KEY \`FK_44e22d88b47daf2095491b7cac3\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_category\` DROP FOREIGN KEY \`FK_86381fb6d28978b101b3aec8ca4\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_search_category\` DROP FOREIGN KEY \`FK_35e120f2b6e5188391cf068d3ba\`` + ); + await queryRunner.query(`ALTER TABLE \`job_preset\` DROP FOREIGN KEY \`FK_a4b038417e3221c0791dd8c7714\``); + await queryRunner.query(`ALTER TABLE \`job_preset\` DROP FOREIGN KEY \`FK_7e53ea80aca15da11a8a5ec0380\``); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_b909a3df761d7e489aca80f138a\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d45b36b85ffbd5189f7e70f29f5\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_9a687ce1a10a3abda460922cf84\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d5ca48cfacfb516543d6507ca4a\`` + ); + await queryRunner.query( + `ALTER TABLE \`job_preset_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_2323220b4decfd2f4d8307fd78f\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_d2b148ddd67e520fb8061f4c133\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_b6bcd5ceb60e4bb493344a6b4f2\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_c872e6e3ab28e813c2324d1f4fb\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_2dc73e07ac7040f273cea3c999d\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_630337302efe97cc93deeb21516\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_upwork_job_search_criterion\` DROP FOREIGN KEY \`FK_afe6c40d3d9951388fa05f83f28\`` + ); + await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_0c5266f3f488add404f92d56ec7\``); + await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_caf8363b0ed7d5f24ae866ba3bb\``); + await queryRunner.query(`ALTER TABLE \`employee_award\` DROP FOREIGN KEY \`FK_91e0f7efcd17d20b5029fb1342d\``); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_2f58132c57108540887dc3e88eb\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_86cf36c137712e779dd7e2301e6\`` + ); + await queryRunner.query( + `ALTER TABLE \`employee_appointment\` DROP FOREIGN KEY \`FK_a35637bb659c59e18adb4f38f87\`` + ); + await queryRunner.query(`ALTER TABLE \`email_template\` DROP FOREIGN KEY \`FK_c160fe6234675fac031aa3e7c50\``); + await queryRunner.query(`ALTER TABLE \`email_template\` DROP FOREIGN KEY \`FK_753e005a45556b5909e11937aaf\``); + await queryRunner.query(`ALTER TABLE \`email_reset\` DROP FOREIGN KEY \`FK_e37af4ab2ba0bf268bfd9826345\``); + await queryRunner.query(`ALTER TABLE \`email_reset\` DROP FOREIGN KEY \`FK_93799dfaeff51de06f1e02ac414\``); + await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_9033faf41b23c61ba201c487969\``); + await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_1261c457b3035b77719556995bf\``); + await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_525f4873c6edc3d94559f88900c\``); + await queryRunner.query(`ALTER TABLE \`email_sent\` DROP FOREIGN KEY \`FK_0af511c44de7a16beb45cc37852\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_1ae3abc0ae1dcf6c13f49b62b56\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_9211f5b62988df6e95522be7daa\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_4b1ff44e6bae5065429dbab554b\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_38fb85abdf9995efcf217f59554\``); + await queryRunner.query(`ALTER TABLE \`deal\` DROP FOREIGN KEY \`FK_46a3c00bfc3e36b4412d8bcdb08\``); + await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP FOREIGN KEY \`FK_15a1306132d66c63ef31f7288c1\``); + await queryRunner.query(`ALTER TABLE \`custom_smtp\` DROP FOREIGN KEY \`FK_2aa3fc8daa25beec4788d2be26c\``); + await queryRunner.query(`ALTER TABLE \`contact\` DROP FOREIGN KEY \`FK_7719d73cd16a9f57ecc6ac24b3d\``); + await queryRunner.query(`ALTER TABLE \`contact\` DROP FOREIGN KEY \`FK_60468af1ce34043a900809c84f2\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_8b900e8a39f76125e610ab30c0e\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_3930aa71e0fa24f09201811b1bb\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_4ea108fd8b089237964d5f98fba\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_1e3e8228e7df634fa4cec6322c7\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_b674793a804b7d69d74c8f6c5ba\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_16fb27ffd1a99c6506c92ad57a7\``); + await queryRunner.query(`ALTER TABLE \`candidate\` DROP FOREIGN KEY \`FK_77ac426e04553ff1654421bce4d\``); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_063663c7e61e45d172d1b832656\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_9d46b8c5382acd4d4514bc5c62e\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_technology\` DROP FOREIGN KEY \`FK_a6fecb615b07987b480defac647\`` + ); + await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP FOREIGN KEY \`FK_e92027b5280828cadd7cd6ea719\``); + await queryRunner.query(`ALTER TABLE \`candidate_source\` DROP FOREIGN KEY \`FK_b2a1ba27a76dd819cd8294cce38\``); + await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_492548e6c176f5655adfae9f5ea\``); + await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_d7986743e7f11720349a6c95572\``); + await queryRunner.query(`ALTER TABLE \`candidate_skill\` DROP FOREIGN KEY \`FK_8a07f780c6fce2b82830ab06877\``); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_a0d171f45bdbcf2b990c0c37c32\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_d321f4547ed467d07cce1e7d9a5\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_personal_quality\` DROP FOREIGN KEY \`FK_045de7c208adcd0c68c0a651748\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_9e7b20eb3dfa082b83b198fdad4\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_ecb65075e94b47bbab11cfa5a1e\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_5f1e315db848990dfffa72817ca\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interviewer\` DROP FOREIGN KEY \`FK_f0ca69c78eea92c95d9044764a2\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_91996439c4baafee8395d3df153\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_03be41e88b1fecfe4e24d6b04b2\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_interview\` DROP FOREIGN KEY \`FK_59b765e6d13d83dba4852a43eb5\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_44f3d80c3293e1de038c87f115d\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_0862c274d336126b951bfe009a7\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_98c008fd8cf597e83dcdccfd161\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_3a6928f8501fce33820721a8fe8\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_feedback\` DROP FOREIGN KEY \`FK_6cb21fa0f65ff69679966c836f2\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_cf75465b3663652a28cf1841ce2\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_a50eb955f940ca93e044d175c62\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_experience\` DROP FOREIGN KEY \`FK_8dcf5fc8bc7f77a80b0fc648bfc\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_59b61ba52a58851cfc85b1e6c66\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_f660af89b2c69fea2334508cbbd\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_education\` DROP FOREIGN KEY \`FK_00cdd9ed7571be8e2c8d09e7cd4\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_3f9053719c9d11ebdea03e5a2d4\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_d108a827199fda86a9ec216989a\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_document\` DROP FOREIGN KEY \`FK_4d9b7ab09f9f9517d488b5fed1e\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_159f821dd214792f1d2ad9cff7c\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_ba4c376b2069aa82745d4e96822\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_d1d16bc87d3afaf387f34cdceb7\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_b106406e94bb7317493efc2c989\`` + ); + await queryRunner.query( + `ALTER TABLE \`candidate_criterion_rating\` DROP FOREIGN KEY \`FK_9d5bd131452ef689df2b46551b4\`` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_46ed3c2287423f5dc089100feeb\`` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_d544bd3a63634a4438509ac958d\`` + ); + await queryRunner.query( + `ALTER TABLE \`availability_slot\` DROP FOREIGN KEY \`FK_f008a481cb4eed547704bb9d839\`` + ); + await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP FOREIGN KEY \`FK_dfe3b357df3ce136917b1f09843\``); + await queryRunner.query(`ALTER TABLE \`approval_policy\` DROP FOREIGN KEY \`FK_1462391059ebe137645098d7276\``); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_e9ca170a0fae05e44a9bd137d8b\`` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_0ddc50b7521b9a905d9ca8c8ba3\`` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_3c3a62226896345c4716bfe1d96\`` + ); + await queryRunner.query( + `ALTER TABLE \`appointment_employee\` DROP FOREIGN KEY \`FK_2c0494466d5a7e1165cea3dca98\`` + ); + await queryRunner.query( + `ALTER TABLE \`accounting_template\` DROP FOREIGN KEY \`FK_e66511b175393255c6c4e7b007f\`` + ); + await queryRunner.query( + `ALTER TABLE \`accounting_template\` DROP FOREIGN KEY \`FK_2ca6a49062a4ed884e413bf572e\`` + ); + await queryRunner.query(`DROP INDEX \`IDX_3557d514afd3794d40128e0542\` ON \`tag_warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_08385e1e045b83d25978568743\` ON \`tag_warehouse\``); + await queryRunner.query(`DROP TABLE \`tag_warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_e64a306f3215dbb99bbb26ca59\` ON \`tag_user\``); + await queryRunner.query(`DROP INDEX \`IDX_6a58ed56a12604c076a8e0cfda\` ON \`tag_user\``); + await queryRunner.query(`DROP TABLE \`tag_user\``); + await queryRunner.query(`DROP INDEX \`IDX_2fc2675c79cb3cbceb32bf2dc7\` ON \`time_slot_time_logs\``); + await queryRunner.query(`DROP INDEX \`IDX_63c61a88461ff5c115c3b6bcde\` ON \`time_slot_time_logs\``); + await queryRunner.query(`DROP TABLE \`time_slot_time_logs\``); + await queryRunner.query(`DROP INDEX \`IDX_0ef34c9f9d6dc8d14f1fbb10e8\` ON \`task_team\``); + await queryRunner.query(`DROP INDEX \`IDX_47689f911b0cbb16c94a56a9c5\` ON \`task_team\``); + await queryRunner.query(`DROP TABLE \`task_team\``); + await queryRunner.query(`DROP INDEX \`IDX_f38b1bd46f8831704348003bbf\` ON \`task_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_790858593698e54cba501eb690\` ON \`task_employee\``); + await queryRunner.query(`DROP TABLE \`task_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_bf7c34187a346f499e4dbc4b08\` ON \`tag_task\``); + await queryRunner.query(`DROP INDEX \`IDX_4b4e8f61e866248f2ddf8ce181\` ON \`tag_task\``); + await queryRunner.query(`DROP TABLE \`tag_task\``); + await queryRunner.query(`DROP INDEX \`IDX_b65cfda00c52e1fc26cc96e52c\` ON \`skill_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_61593ade5fed9445738ddbe39c\` ON \`skill_organization\``); + await queryRunner.query(`DROP TABLE \`skill_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_760034f54e598d519b5f0c4ece\` ON \`skill_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_e699b50ca468e75bbd36913dcc\` ON \`skill_employee\``); + await queryRunner.query(`DROP TABLE \`skill_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6c6576bff4b497a4975337fa5e\` ON \`tag_request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_74938a30181630c480b36e27d7\` ON \`tag_request_approval\``); + await queryRunner.query(`DROP TABLE \`tag_request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_451853704de278eef61a37fa7a\` ON \`tag_proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_3f55851a03524e567594d50774\` ON \`tag_proposal\``); + await queryRunner.query(`DROP TABLE \`tag_proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_825848065557eac3678b164cee\` ON \`product_gallery_item\``); + await queryRunner.query(`DROP INDEX \`IDX_f7187fa710c6a5d22f46192637\` ON \`product_gallery_item\``); + await queryRunner.query(`DROP TABLE \`product_gallery_item\``); + await queryRunner.query(`DROP INDEX \`IDX_f75a28915b38d926902c0f85b2\` ON \`tag_product\``); + await queryRunner.query(`DROP INDEX \`IDX_e516b4a2a1a8d4beda7217eeac\` ON \`tag_product\``); + await queryRunner.query(`DROP TABLE \`tag_product\``); + await queryRunner.query( + `DROP INDEX \`IDX_e96a71affe63c97f7fa2f076da\` ON \`product_variant_options_product_option\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_526f0131260eec308a3bd2b61b\` ON \`product_variant_options_product_option\`` + ); + await queryRunner.query(`DROP TABLE \`product_variant_options_product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_e087c0540b5098d115b50d954c\` ON \`tag_payment\``); + await queryRunner.query(`DROP INDEX \`IDX_1fcb2a337ee905ab36c4aea3a3\` ON \`tag_payment\``); + await queryRunner.query(`DROP TABLE \`tag_payment\``); + await queryRunner.query(`DROP INDEX \`IDX_f5e70849adc6f2f81fcbccae77\` ON \`tag_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_7ca79ff010025397cf9f216bde\` ON \`tag_organization\``); + await queryRunner.query(`DROP TABLE \`tag_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_f71369c1cb86ae9fd4d5452f9a\` ON \`tag_organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_7dde3307daf6d6dec1513ecc56\` ON \`tag_organization_vendor\``); + await queryRunner.query(`DROP TABLE \`tag_organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_d15fbe1e1d9c1f56651d8d3831\` ON \`organization_team_tasks_task\``); + await queryRunner.query(`DROP INDEX \`IDX_2a6fb43dc7e7aebcda95e32a10\` ON \`organization_team_tasks_task\``); + await queryRunner.query(`DROP TABLE \`organization_team_tasks_task\``); + await queryRunner.query(`DROP INDEX \`IDX_2382356b63c832a137079210bd\` ON \`tag_organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_4b5e0ca086e6124eeddf84252f\` ON \`tag_organization_team\``); + await queryRunner.query(`DROP TABLE \`tag_organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_599a5f7f6c190822dcfdbbb6eb\` ON \`organization_project_team\``); + await queryRunner.query(`DROP INDEX \`IDX_7c31431ff2173c2c939a0aa036\` ON \`organization_project_team\``); + await queryRunner.query(`DROP TABLE \`organization_project_team\``); + await queryRunner.query(`DROP INDEX \`IDX_18be859b371e9159dfc2cecbe1\` ON \`tag_organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_b69fa5d1b1d02cdbe301ea6b10\` ON \`tag_organization_project\``); + await queryRunner.query(`DROP TABLE \`tag_organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_c71c381e77b0543ed4023aeef7\` ON \`tag_organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_1f7e0230bc542d703781020378\` ON \`tag_organization_position\``); + await queryRunner.query(`DROP TABLE \`tag_organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_8c5db3a96baffba025729ebe86\` ON \`candidate_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_b4b51067c538f78b8585ef2a17\` ON \`candidate_employment_type\``); + await queryRunner.query(`DROP TABLE \`candidate_employment_type\``); + await queryRunner.query( + `DROP INDEX \`IDX_3ed17d3e624435e9f2ad71e058\` ON \`organization_employment_type_employee\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_3bfdb894d67e6a29aa95780bb4\` ON \`organization_employment_type_employee\`` + ); + await queryRunner.query(`DROP TABLE \`organization_employment_type_employee\``); + await queryRunner.query( + `DROP INDEX \`IDX_904a731b2ae6bc1aa52c8302a9\` ON \`tag_organization_employment_type\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_41a87d3cfa58c851bbf03ad4e8\` ON \`tag_organization_employment_type\`` + ); + await queryRunner.query(`DROP TABLE \`tag_organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_ef6e8d34b95dcb2b21d5de08a6\` ON \`candidate_department\``); + await queryRunner.query(`DROP INDEX \`IDX_c58533f9ba63f42fef682e1ee7\` ON \`candidate_department\``); + await queryRunner.query(`DROP TABLE \`candidate_department\``); + await queryRunner.query( + `DROP INDEX \`IDX_0d4f83695591ae3c98a0544ac8\` ON \`organization_department_employee\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_c34e79a3aa682bbd3f0e8cf4c4\` ON \`organization_department_employee\`` + ); + await queryRunner.query(`DROP TABLE \`organization_department_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_0eb285a6b1ac7e3d0a542e50a4\` ON \`tag_organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_c2c9cd2ea533d5442de455fb3e\` ON \`tag_organization_department\``); + await queryRunner.query(`DROP TABLE \`tag_organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_cd2bd8302bfb6093d0908c36dc\` ON \`organization_contact_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_beffeb7f338fa98354948c0789\` ON \`organization_contact_employee\``); + await queryRunner.query(`DROP TABLE \`organization_contact_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_8a06f5aded97d1b5e81005e121\` ON \`tag_organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_1fb664a63f20bea6a3f0b38771\` ON \`tag_organization_contact\``); + await queryRunner.query(`DROP TABLE \`tag_organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_a6bfc0dc6e5234e8e7ef698a36\` ON \`warehouse_merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_812f0cfb560ac6dda0d1345765\` ON \`warehouse_merchant\``); + await queryRunner.query(`DROP TABLE \`warehouse_merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_4af822b453c7d7d5f033e6ea16\` ON \`tag_merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_e7d60a4e9906d056a8966e279f\` ON \`tag_merchant\``); + await queryRunner.query(`DROP TABLE \`tag_merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_0728fc2cc26e8802cbf41aaf27\` ON \`tag_invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_5a07958d7c6253b311dbdc34ff\` ON \`tag_invoice\``); + await queryRunner.query(`DROP TABLE \`tag_invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_1132ec0c3618e53fc8cf7ed669\` ON \`invite_organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_104140c94e838a058a34b30a09\` ON \`invite_organization_team\``); + await queryRunner.query(`DROP TABLE \`invite_organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_fe2eea7a939442efde885303ef\` ON \`invite_organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_0935b93b3498a0f98db1af7176\` ON \`invite_organization_department\``); + await queryRunner.query(`DROP TABLE \`invite_organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_c5a147ce2a0ec69ccc61149262\` ON \`invite_organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_a0c92b6393c7a13266003d552e\` ON \`invite_organization_contact\``); + await queryRunner.query(`DROP TABLE \`invite_organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_f2806968dd846cb49fcdac195a\` ON \`invite_organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_020325728f0979a2822a829565\` ON \`invite_organization_project\``); + await queryRunner.query(`DROP TABLE \`invite_organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_0f19ad9872190b7a67a9652d5e\` ON \`tag_integration\``); + await queryRunner.query(`DROP INDEX \`IDX_c9a85b16615bc5c3035802adb0\` ON \`tag_integration\``); + await queryRunner.query(`DROP TABLE \`tag_integration\``); + await queryRunner.query(`DROP INDEX \`IDX_8dd2062499a6c2a708ddd05650\` ON \`integration_integration_type\``); + await queryRunner.query(`DROP INDEX \`IDX_34c86921ee9b462bc5c7b61fad\` ON \`integration_integration_type\``); + await queryRunner.query(`DROP TABLE \`integration_integration_type\``); + await queryRunner.query(`DROP INDEX \`IDX_00e2fd30761a36911648166044\` ON \`tag_income\``); + await queryRunner.query(`DROP INDEX \`IDX_55c9568ebe1c4addc3deb6922e\` ON \`tag_income\``); + await queryRunner.query(`DROP TABLE \`tag_income\``); + await queryRunner.query(`DROP INDEX \`IDX_8dcfbd0d960672fefe681bcba9\` ON \`tag_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_6f1108552ea7a70a4d958b338c\` ON \`tag_expense\``); + await queryRunner.query(`DROP TABLE \`tag_expense\``); + await queryRunner.query( + `DROP INDEX \`IDX_727dbf5e1100023681e216d6a9\` ON \`tag_organization_expense_category\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_107a93f89c8f31f4386ae4b19d\` ON \`tag_organization_expense_category\`` + ); + await queryRunner.query(`DROP TABLE \`tag_organization_expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_34b8f471aac00eaec6f2830e5b\` ON \`tag_event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_094af399a26d4a1d3ae17ea11e\` ON \`tag_event_type\``); + await queryRunner.query(`DROP TABLE \`tag_event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_0360b8197c2a38d6fe882cb1af\` ON \`tag_equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_bb0062d51a75164fcb64041ee7\` ON \`tag_equipment\``); + await queryRunner.query(`DROP TABLE \`tag_equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_7ccef49dd56c8c74daa8d12186\` ON \`equipment_shares_teams\``); + await queryRunner.query(`DROP INDEX \`IDX_f84171695b7aedfc454483bcf2\` ON \`equipment_shares_teams\``); + await queryRunner.query(`DROP TABLE \`equipment_shares_teams\``); + await queryRunner.query(`DROP INDEX \`IDX_57f6461f1a710f0f4abdcb8d0e\` ON \`equipment_shares_employees\``); + await queryRunner.query(`DROP INDEX \`IDX_8676224f55a965c53e4bb7cbf8\` ON \`equipment_shares_employees\``); + await queryRunner.query(`DROP TABLE \`equipment_shares_employees\``); + await queryRunner.query(`DROP INDEX \`IDX_6bbbe677c5fc5115916b4eccfb\` ON \`employee_tasks_task\``); + await queryRunner.query(`DROP INDEX \`IDX_eae5eea1c6a3fcf4a2c95f1a5f\` ON \`employee_tasks_task\``); + await queryRunner.query(`DROP TABLE \`employee_tasks_task\``); + await queryRunner.query(`DROP INDEX \`IDX_0a8cf0aacf95ce66e73e75a95c\` ON \`time_off_request_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_cd312469204347b1210397770a\` ON \`time_off_request_employee\``); + await queryRunner.query(`DROP TABLE \`time_off_request_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_0f823750ac5a7d899cc5d8d040\` ON \`time_off_policy_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_c451f53f5a6cd97db94e1c9482\` ON \`time_off_policy_employee\``); + await queryRunner.query(`DROP TABLE \`time_off_policy_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_b1ffe2a63a48b486e18dc59d1b\` ON \`tag_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_e0ddfccfe9816681c410ebf2b9\` ON \`tag_employee\``); + await queryRunner.query(`DROP TABLE \`tag_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP TABLE \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3caf4cc158fe8b8e06578e792\` ON \`tag_employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_b3565ff8073d4f66c46d27fe88\` ON \`tag_employee_level\``); + await queryRunner.query(`DROP TABLE \`tag_employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_68e75e49f06409fd385b4f8774\` ON \`employee_job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_7ae5b4d4bdec77971dab319f2e\` ON \`employee_job_preset\``); + await queryRunner.query(`DROP TABLE \`employee_job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_7e0891bb331b08bd4abb6776b7\` ON \`tag_candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_34e4625cc9b010079f1b5758b3\` ON \`tag_candidate\``); + await queryRunner.query(`DROP TABLE \`tag_candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_c2037b621d2e8023898aee4ac7\` ON \`changelog\``); + await queryRunner.query(`DROP INDEX \`IDX_744268ee0ec6073883267bc3b6\` ON \`changelog\``); + await queryRunner.query(`DROP INDEX \`IDX_cbc2b8338d45e774afd8682ffe\` ON \`changelog\``); + await queryRunner.query(`DROP INDEX \`IDX_cc89233c87fcf64b01df07e038\` ON \`changelog\``); + await queryRunner.query(`DROP TABLE \`changelog\``); + await queryRunner.query(`DROP INDEX \`IDX_2d5ecab1f06b327bad54553614\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_8eb7e413257d7a26104f4e326f\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_81558bb2bef673628d92540b4e\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_1551e821871d9230cc0dafbbe5\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_a9130ad7824fb843f06103971e\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_b9623984c84eb7be4c0eb076c2\` ON \`knowledge_base_author\``); + await queryRunner.query(`DROP TABLE \`knowledge_base_author\``); + await queryRunner.query(`DROP INDEX \`IDX_66af194845635058239e794e1b\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_3547f82f867489542ceae58a49\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_06a9902fedc1f9dcdbaf14afb0\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_e9720156c57ff1ad841e95ace7\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_1544c43e36e1ccf7d578c70607\` ON \`knowledge_base_article\``); + await queryRunner.query(`DROP TABLE \`knowledge_base_article\``); + await queryRunner.query(`DROP INDEX \`IDX_ff979040ce93cbc60863d322ec\` ON \`knowledge_base\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba72a9dec732a10e8c05bcdec\` ON \`knowledge_base\``); + await queryRunner.query(`DROP INDEX \`IDX_bcb30c9893f4c8d0c4e556b4ed\` ON \`knowledge_base\``); + await queryRunner.query(`DROP INDEX \`IDX_0765098c5a6f93f51a55bda026\` ON \`knowledge_base\``); + await queryRunner.query(`DROP INDEX \`IDX_9b22423b8cb20087c16613ecba\` ON \`knowledge_base\``); + await queryRunner.query(`DROP TABLE \`knowledge_base\``); + await queryRunner.query(`DROP INDEX \`REL_84594016a98da8b87e0f51cd93\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_84594016a98da8b87e0f51cd93\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_f502dc6d9802306f9d1584932b\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_f5735eafddabdb4b20f621a976\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_9b2f00761a6b1b77cb6289e3ff\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_835691d3dd62d0b705302cbb2d\` ON \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_ee85901ae866ffe2061d5b35c8\` ON \`warehouse\``); + await queryRunner.query(`DROP TABLE \`warehouse\``); + await queryRunner.query(`DROP INDEX \`IDX_617306cb3613dd8d59301ae16f\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_a2f863689d1316810c41c1ea38\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_d5f4b64e6a80546fd6dd4ac3ed\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_a1c4a97b928b547c3041d3ac1f\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_40aa52eaed1ce133f5fee76bca\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_5f32a52e9bd19bf323b02efcd1\` ON \`warehouse_product_variant\``); + await queryRunner.query(`DROP TABLE \`warehouse_product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_3f934c4772e7c7f2c66d7ea4e7\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_a8c9aee14d47ec7b3f2ac429eb\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_c899e17322d11e1977832e8c65\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_62573a939f834f2de343f98288\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_3370818c940a51996d80bb4d16\` ON \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_7a584a02d15a022e9c4f06ea72\` ON \`warehouse_product\``); + await queryRunner.query(`DROP TABLE \`warehouse_product\``); + await queryRunner.query(`DROP INDEX \`IDX_5e028298e103e1694147ada69e\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_c28e52f758e7bbc53828db9219\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_78a916df40e02a9deb1c4b75ed\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_f2578043e491921209f5dadd08\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_e12875dfb3b1d92d7d7c5377e2\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_f0e1b4ecdca13b177e2e3a0613\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_58e4dbff0e1a32a9bdc861bb29\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_19de43e9f1842360ce646253d7\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_685bf353c85f23b6f848e4dcde\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_557cb712d32a9ad9ffbb4cd50d\` ON \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_fde2ce12ab12b02ae583dd76c7\` ON \`user\``); + await queryRunner.query(`DROP TABLE \`user\``); + await queryRunner.query(`DROP INDEX \`IDX_29c3c8cc3ea9db22e4a347f4b5\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_1f97ff07fb198bd0a7786b2abd\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_7143f31467178a6164a42426c1\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_611e1392c8cc9b101e3ea7ad80\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_c764336019c69cc4927f317cb0\` ON \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_ca24fc59aac015d9660955f5f6\` ON \`user_organization\``); + await queryRunner.query(`DROP TABLE \`user_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_6c1f81934a3f597b3b1a17f562\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_8c8f821cb0fe0dd387491ea7d9\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_23fdffa8369387d87101090684\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_c828facbb4250117f83416d9f7\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_ea81b5247ecdf5d82cf71fa096\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_3502c60f98a7cda58dea75bcb5\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_3f8fc4b5718fcaa913f9438e27\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_6a79eb7534066b11f59243ede1\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_f6558fbb3158ab90da1c41d943\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_930e2b28de9ecb1ea689d5a97a\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_aca65a79fe0c1ec9e6a59022c5\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_25b8df69c9b7f5752c6a6a6ef7\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_f2d4cd3a7e839bfc7cb6b993ff\` ON \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_42205a9e6af108364e5cc62dd4\` ON \`timesheet\``); + await queryRunner.query(`DROP TABLE \`timesheet\``); + await queryRunner.query(`DROP INDEX \`IDX_0ac1d2777eefcee82db52ca366\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_9272701d3da8bd8507f316c915\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_82c5edbd179359212f16f0d386\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_c7f72cb68b22b8ab988158e4d2\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_a3eeb9629f550c367bb752855e\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_8260fdc7862ca27d8cf10e6290\` ON \`time_slot_minute\``); + await queryRunner.query(`DROP TABLE \`time_slot_minute\``); + await queryRunner.query(`DROP INDEX \`IDX_7913305b850c7afc89b6ed96a3\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_c6e7d1075bfd97eea6643b1479\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_f44e721669d5c6bed32cd6a3bf\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_0c707825a7c2ecc4e186b07ebf\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_b407841271245501dd1a8c7551\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_b8284109257b5137256b5b3e84\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_81060c5dbe69efa1f3b6e1a2e5\` ON \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_645a6bc3f1141d4a111a3166d8\` ON \`time_slot\``); + await queryRunner.query(`DROP TABLE \`time_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_18dcdf754396f0cb0308dc91f4\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_d1e8f22c02c5e949453dde7f2d\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_1ddf2da35e34378fd845d80a18\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_54776f6f5fd3c13c3bc1fbfac5\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_e65393bb52aa8275b1392c73f7\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_a89a849957e005bafb8e4220bc\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_79001d281ecb766005b3d331c1\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_f447474d185cd70b3015853874\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_722b9cb3a991c964d86396b6bc\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_402290e7045e0c10ef97d9f982\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_e80fb588b1086ce2a4f2244814\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_154e9120e2acb632d8bd9b91ff\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_a1f8fcd70164d915fe7dd4a1ec\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_189b79acd611870aba62b3594e\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_aed2d5cc5680fba9d387c7f931\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_fa9018cb248ea0f3b2b30ef143\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_91a64228fbbe1516730a0cab5d\` ON \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_a1910a76044b971609b75ea165\` ON \`time_log\``); + await queryRunner.query(`DROP TABLE \`time_log\``); + await queryRunner.query(`DROP INDEX \`IDX_fa1896dc735403799311968f7e\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_5b594d02d98d5defcde323abe5\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_eea7986acfb827bf5d0622c41f\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_1b0867d86ead2332f3d4edba7d\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_2b374e5cdee1145ebb2a832f20\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_3d7feb5fe793e4811cdb79f983\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_0951aacffe3f8d0cff54cf2f34\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_235004f3dafac90692cd64d915\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_892e285e1da2b3e61e51e50628\` ON \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_742688858e0484d66f04e4d4c4\` ON \`screenshot\``); + await queryRunner.query(`DROP TABLE \`screenshot\``); + await queryRunner.query(`DROP INDEX \`IDX_2743f8990fde12f9586287eb09\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_4e382caaf07ab0923b2e06bf91\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_5a898f44fa31ef7916f0c38b01\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_a6f74ae99d549932391f0f4460\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_ffd736f18ba71b3221e4f835a9\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_0e36a2c95e2f1df7f1b3059d24\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_f27285af15ef48363745ab2d79\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_b5525385e85f7429e233d4a0fa\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_302b60a4970ffe94d5223f1c23\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_a28a1682ea80f10d1ecc7babaa\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_fdb3f018c2bba4885bfa5757d1\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_f2401d8fdff5d8970dfe30d3ae\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_d2d6db7f03da5632687e5d140e\` ON \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_ae6ac57aafef59f561d4db3dd7\` ON \`activity\``); + await queryRunner.query(`DROP TABLE \`activity\``); + await queryRunner.query(`DROP INDEX \`IDX_c009cdd795be674c2047062374\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_c1f8ae47dc2f1882afc5045c73\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_981333982a6df8b815957dcbf2\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_4989834dd1c9c8ea3576ed99ce\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_5ddef92c4694e6d650d9e557b3\` ON \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_45e4bc4476681f4db2097cc2d5\` ON \`time_off_request\``); + await queryRunner.query(`DROP TABLE \`time_off_request\``); + await queryRunner.query(`DROP INDEX \`IDX_7d7f69c79df4a6f152b0e362b1\` ON \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_c2744cffeca55c3c9c52bb9789\` ON \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_1c0ed84d54f8fbe4af10dfcda1\` ON \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_22d919e53cf5f6d836b18d407a\` ON \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_cf9377d3bcb7cb996f72268941\` ON \`time_off_policy\``); + await queryRunner.query(`DROP TABLE \`time_off_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_d154d06dac0d0e0a5d9a083e25\` ON \`tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_56211336b5ff35fd944f225917\` ON \`tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_eeedffab85b3534a1068d9270f\` ON \`tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_b8eb9f3e420aa846f30e291960\` ON \`tenant\``); + await queryRunner.query(`DROP TABLE \`tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_affdab301e348b892175f30fa3\` ON \`tenant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_a7500f9b1b7917bf10882c820e\` ON \`tenant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_1d9975b98d82f385ae14b4d7c6\` ON \`tenant_setting\``); + await queryRunner.query(`DROP TABLE \`tenant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_959e77718a2e76ee56498c1106\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_91988120385964f213aec8aa84\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_e9fd8df772ad2d955a65f4c68a\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_3396dda57286ca17ab61fd3704\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_9c845f353378371ee3aa60f686\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_379c8bd0ce203341148c1f99ee\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_313b0e55871c1c9b6c22341536\` ON \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_7e509a66367ecaf8e3bc96f263\` ON \`task_version\``); + await queryRunner.query(`DROP TABLE \`task_version\``); + await queryRunner.query(`DROP INDEX \`IDX_0330b4a942b536d8d1f264abe3\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_a19e8975e5c296640d457dfc11\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_68eaba689ed6d3e27ec93d3e88\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_b0c955f276679dd2b2735c3936\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_9b9a828a49f4bd6383a4073fe2\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_efbaf00a743316b394cc31e4a2\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_79c525a8c2209e90186bfcbea9\` ON \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_25d9737ee153411871b4d20c67\` ON \`task_status\``); + await queryRunner.query(`DROP TABLE \`task_status\``); + await queryRunner.query(`DROP INDEX \`IDX_f4438327b3c2afb0832569b2a1\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_ad6792b26526bd96ab18d63454\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_1a7b137d009616a2ff1aa6834f\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_90c54f57b29cc8b67edc2738ae\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_596512cc6508a482cc23ae6ab7\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_f6ec2207e50680a475d71c8979\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_8f26ffc61abaef417b0f807695\` ON \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_d65afcfe2d64e49d43931579a3\` ON \`task_size\``); + await queryRunner.query(`DROP TABLE \`task_size\``); + await queryRunner.query(`DROP INDEX \`IDX_4967ebdca0aefb9d43e56695e4\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_d99fe5b50dbe5078e0d9a9b6a9\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_61a7cb4452d9e23f91231b7fd6\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_9423f99da972c150f85dbc11c1\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_bed691e21fe01cf5aceee72295\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_b7b0ea8ac2825fb981c1181d11\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_8177dd93be8044b37d3bb9285d\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_5a341f51d8f5ec12db24ab033f\` ON \`task_related_issue_type\``); + await queryRunner.query(`DROP TABLE \`task_related_issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_52b039cff6a1adf6b7f9e49ee4\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_db4237960ca989eb7a48cd433b\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_46daede7b19176b6ad959d70da\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_7d656b4cba8f11e639dbc5aab3\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_7fd1b30d159b608cbf59009f68\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_1818655f27b8cf4f0d1dbfeb8d\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_e6adb82db368af15f2b8cdd4e8\` ON \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_8ddcc5eeaf96314f53ca486821\` ON \`task_priority\``); + await queryRunner.query(`DROP TABLE \`task_priority\``); + await queryRunner.query(`DROP INDEX \`IDX_0848fd2b8c23c0ab55146297cf\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_6deea7b3671e45973e191a1502\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_24114c4059e6b6991daba541b1\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_20b50abc5c97610a75d49ad381\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_88021c0cd9508757d3d90333f8\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`IDX_d49853e18e5bc772f5435b01a5\` ON \`task_linked_issues\``); + await queryRunner.query(`DROP TABLE \`task_linked_issues\``); + await queryRunner.query(`DROP INDEX \`taskNumber\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_b8616deefe44d0622233e73fbf\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_2f4bdd2593fd6038aaa91fd107\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_0cbe714983eb0aae5feeee8212\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_1e1f64696aa3a26d3e12c840e5\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_94fe6b3a5aec5f85427df4f8cd\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_3797a20ef5553ae87af126bc2f\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_ed5441fb13e82854a994da5a78\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_7127880d6fae956ecc1c84ac31\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_f092f3386f10f2e2ef5b0b6ad1\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_2fe7a278e6f08d2be55740a939\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_5b0272d923a31c972bed1a1ac4\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_e91cbff3d206f150ccc14d0c3a\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_ca2f7edd5a5ce8f14b257c9d54\` ON \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_3e16c81005c389a4db83c0e5e3\` ON \`task\``); + await queryRunner.query(`DROP TABLE \`task\``); + await queryRunner.query(`DROP INDEX \`IDX_586513cceb16777fd14a17bfe1\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_131331557078611a68b4a5b2e7\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_33779b0395f72af0b50dc526d1\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_af2d743ed61571bcdc5d9a27a0\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_4af451ab46a94e94394c72d911\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_16dbef9d1b2b422abdce8ee3ae\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_8b12c913c39c72fe5980427c96\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_1909e9bae7d8b2c920b3e4d859\` ON \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_722ce5d7535524b96c6d03f7c4\` ON \`issue_type\``); + await queryRunner.query(`DROP TABLE \`issue_type\``); + await queryRunner.query(`DROP INDEX \`IDX_a3ee022203211f678376cd919b\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_8f274646f2bdf4e12990feeb04\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_16507eb222e3c50be077fb4ace\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_87bfea6d0b9a1ec602ee88e5f6\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_1f3ffda4fce02682e76308b476\` ON \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_b1a7086c279309b20e8384d0d9\` ON \`task_estimation\``); + await queryRunner.query(`DROP TABLE \`task_estimation\``); + await queryRunner.query(`DROP INDEX \`IDX_49746602acc4e5e8721062b69e\` ON \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_c2f6bec0b39eaa3a6d90903ae9\` ON \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_b08dd29fb6a8acdf83c83d8988\` ON \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_58876ee26a90170551027459bf\` ON \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_1f22c73374bcca1ea84a4dca59\` ON \`tag\``); + await queryRunner.query(`DROP TABLE \`tag\``); + await queryRunner.query(`DROP INDEX \`IDX_b2923d394f3636671ff9b3c3e8\` ON \`skill\``); + await queryRunner.query(`DROP INDEX \`IDX_8e502eac7ed1347c71c26beae8\` ON \`skill\``); + await queryRunner.query(`DROP INDEX \`IDX_ca52119f9e4857399706d723e9\` ON \`skill\``); + await queryRunner.query(`DROP INDEX \`IDX_f4cdbe61d68413f4d6a671f8c2\` ON \`skill\``); + await queryRunner.query(`DROP TABLE \`skill\``); + await queryRunner.query(`DROP INDEX \`IDX_ae4578dcaed5adff96595e6166\` ON \`role\``); + await queryRunner.query(`DROP INDEX \`IDX_1751a572e91385a09d41c62471\` ON \`role\``); + await queryRunner.query(`DROP INDEX \`IDX_09868c0733ba37a4753ff8931f\` ON \`role\``); + await queryRunner.query(`DROP INDEX \`IDX_c5f75cd3367769b6f22b298d29\` ON \`role\``); + await queryRunner.query(`DROP TABLE \`role\``); + await queryRunner.query(`DROP INDEX \`IDX_e3130a39c1e4a740d044e68573\` ON \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_8307c5c44a4ad6210b767b17a9\` ON \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_cbd053921056e77c0a8e03122a\` ON \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_5c36df1a5c85016952e90d760f\` ON \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_78f93dbb42a97f6785bcf53efd\` ON \`role_permission\``); + await queryRunner.query(`DROP TABLE \`role_permission\``); + await queryRunner.query(`DROP INDEX \`IDX_26bb3420001d31337393ed05bc\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_c63fafc733ff8ab37dede8ffec\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_8343741e7929043b2a7de89f73\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_9feaa23ed7bc47d51315e304bb\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_c77295d7f5d6086c815de3c120\` ON \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_db152600f88a9a4888df0b626e\` ON \`request_approval\``); + await queryRunner.query(`DROP TABLE \`request_approval\``); + await queryRunner.query(`DROP INDEX \`IDX_9ccdaee6c5c62cda8f7375e841\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_6c75d8a8c609e88896b2653cc4\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_77e1050669b32cfff482f96016\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_94b2a3d0f17c9549dea1493dc9\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_bdcb4ea389bdb794bae75b0170\` ON \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_34b2e8f794e0336b9ac410d8bd\` ON \`request_approval_team\``); + await queryRunner.query(`DROP TABLE \`request_approval_team\``); + await queryRunner.query(`DROP INDEX \`IDX_ce2113039f070b3f003aa0db61\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_563fec5539b89a57f40731f985\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_4071f027554eefff65ac8123e6\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a5445b38b780b29b09369e36a9\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_3d66190c19b9fe69a8bbb300df\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2634ff04775e659c4792325f38\` ON \`request_approval_employee\``); + await queryRunner.query(`DROP TABLE \`request_approval_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_230652e48daa99c50c000fc5d1\` ON \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_ef16fed5f7e6951027502e6458\` ON \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_6f9ee54eb839117e83b937648d\` ON \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_1316fdd7b9a2926437a13271bf\` ON \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_143ead1a6ac5f73125d8c4c3aa\` ON \`report\``); + await queryRunner.query(`DROP TABLE \`report\``); + await queryRunner.query(`DROP INDEX \`IDX_5193788a3ebc1143bedb74cf72\` ON \`report_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_edf9bd011d7f08e3e18a5becb8\` ON \`report_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_40459267d68604655aa6df4251\` ON \`report_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_a6bde8f44e18f17b1ca603e150\` ON \`report_organization\``); + await queryRunner.query(`DROP TABLE \`report_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_fa278d337ba5e200d44ade6697\` ON \`report_category\``); + await queryRunner.query(`DROP INDEX \`IDX_656f05f951faa13d7195853424\` ON \`report_category\``); + await queryRunner.query(`DROP INDEX \`IDX_dd9fcd7916d0a22189ecea6a36\` ON \`report_category\``); + await queryRunner.query(`DROP TABLE \`report_category\``); + await queryRunner.query(`DROP INDEX \`IDX_cc28a54171231fbd9a127051f0\` ON \`proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_d59ec6899d435f430799795ad7\` ON \`proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_4177329f5e6ddbfb6416592713\` ON \`proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_e2836e856f491dd4676e1ec8d3\` ON \`proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_61a30a7d83666bf265fd86a72d\` ON \`proposal\``); + await queryRunner.query(`DROP TABLE \`proposal\``); + await queryRunner.query(`DROP INDEX \`IDX_d24bc28e54f1dc296452a25591\` ON \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_e6abcacc3d3a4f9cf5ca97f2b2\` ON \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_7533fd275bfb3219ce9eb4004c\` ON \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_96413a8061ff4ccdc418d4e16a\` ON \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_1d9ca23c7e1c606061fec8bb74\` ON \`product_translation\``); + await queryRunner.query(`DROP TABLE \`product_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_618194d24a7ea86a165d7ec628\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_374bfd0d1b0e1398d7206456d9\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_4627873dbc1af07d732e6eec7b\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_32a4bdd261ec81f4ca6b3abe26\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_08293ca31a601d3cd0228120bc\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_6f58935aa2175d930e47e97c9f\` ON \`product\``); + await queryRunner.query(`DROP INDEX \`IDX_7bb2b2f7a4c8a4916d4339d7f4\` ON \`product\``); + await queryRunner.query(`DROP TABLE \`product\``); + await queryRunner.query(`DROP INDEX \`REL_9f0fd369dfeb275415c649d110\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`REL_41b31a71dda350cfe5da07e0e4\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_b83f23626741630a8629960715\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_6e420052844edf3a5506d863ce\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_6a289b10030ae86903406e3c9b\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_9121e00c4dc3500dc610cf8722\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_e0005cbdabb760488f66f3fbba\` ON \`product_variant\``); + await queryRunner.query(`DROP INDEX \`IDX_e0d896cadbc695a490f64bb7e7\` ON \`product_variant\``); + await queryRunner.query(`DROP TABLE \`product_variant\``); + await queryRunner.query(`DROP INDEX \`REL_5842f603bd85d924127d63d73c\` ON \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_0cfba32db58a952f58b1e35cf1\` ON \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_7052eaf00a5795afa5ebf35995\` ON \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_24ac11e35221577e4ba4fdd229\` ON \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_562ef5984b6d4bed640bfcc6a2\` ON \`product_variant_price\``); + await queryRunner.query(`DROP TABLE \`product_variant_price\``); + await queryRunner.query(`DROP INDEX \`IDX_e4e4120b0c19d3a207ce38d758\` ON \`product_type\``); + await queryRunner.query(`DROP INDEX \`IDX_f206c807fc7e41fc8a8b6679ae\` ON \`product_type\``); + await queryRunner.query(`DROP INDEX \`IDX_49064ee0f3acd5882f4d893f3d\` ON \`product_type\``); + await queryRunner.query(`DROP INDEX \`IDX_90cc635a1065702ed3b79da6ec\` ON \`product_type\``); + await queryRunner.query(`DROP TABLE \`product_type\``); + await queryRunner.query(`DROP INDEX \`IDX_f4b767c43b4e9130c63382c9b2\` ON \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_2dd271bdeb602b8c3956287e33\` ON \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_30aafca59cdb456bf5231f9e46\` ON \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_65874d6bab7fefcaeccd2252c1\` ON \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_e9dca49bad996f1761db3b2f56\` ON \`product_type_translation\``); + await queryRunner.query(`DROP TABLE \`product_type_translation\``); + await queryRunner.query(`DROP INDEX \`REL_b0d86990fe7160a5f3e4011fb2\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_bed9d45e15866d9b8e87e7a7bf\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_2efe48435d4ba480a4bb8b96fa\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_ae78776111e1906accfd61511d\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_ad107ba78e487cd8b13313593b\` ON \`product_variant_setting\``); + await queryRunner.query(`DROP TABLE \`product_variant_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_a6debf9198e2fbfa006aa10d71\` ON \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_47ffb82a65c43f102b7e0efa41\` ON \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_985d235aa5394937c4493262c7\` ON \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_35d083f4ecfe72cce72ee88f58\` ON \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_d81028785f188c253e0bd49a03\` ON \`product_option\``); + await queryRunner.query(`DROP TABLE \`product_option\``); + await queryRunner.query(`DROP INDEX \`IDX_f43c46e12db0580af320db7738\` ON \`product_option_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_4dc2f466cfa3d0b7fef19d1273\` ON \`product_option_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_9869d7680f48487e584f5d2fca\` ON \`product_option_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_2f581c3477a5c7a66de5d7f264\` ON \`product_option_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_f284f666950392c55afa0806c8\` ON \`product_option_translation\``); + await queryRunner.query(`DROP TABLE \`product_option_translation\``); + await queryRunner.query( + `DROP INDEX \`IDX_c9ce1da98b6d93293daafee63a\` ON \`product_option_group_translation\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_0e2fcc31743e20a45fc3cf0211\` ON \`product_option_group_translation\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_fd6b39f1fd1db026b5dcc3c795\` ON \`product_option_group_translation\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_e9e50109d3054fb81205c0a74e\` ON \`product_option_group_translation\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_75b7065234a6d32fbd03d8703f\` ON \`product_option_group_translation\`` + ); + await queryRunner.query(`DROP TABLE \`product_option_group_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_a6e91739227bf4d442f23c52c7\` ON \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_4a1430a01b71ecdfcd54b2b6c5\` ON \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_462a7fd3ce68935cf973c6709f\` ON \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_76bda4c33c83614617278617ae\` ON \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_0fc743f2bc16502dbc5e85420c\` ON \`product_option_group\``); + await queryRunner.query(`DROP TABLE \`product_option_group\``); + await queryRunner.query(`DROP INDEX \`IDX_f38e86bd280ff9c9c7d9cb7839\` ON \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_853302351eaa4daa39920c270a\` ON \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_0a0cf25cd8232a154d1cce2641\` ON \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_06cd3959f09e0b12793a763515\` ON \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_198fba43f049ea621407e7d188\` ON \`product_category\``); + await queryRunner.query(`DROP TABLE \`product_category\``); + await queryRunner.query(`DROP INDEX \`IDX_586294149d24cd835678878ef1\` ON \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_e46203bf1dbf3291d174f02cb3\` ON \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_27d71aa2e843f07fbf36329be3\` ON \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_d32c5d5e4451acf44fd5b212ce\` ON \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_e690dd59b69e74a6bb5d94f32b\` ON \`product_category_translation\``); + await queryRunner.query(`DROP TABLE \`product_category_translation\``); + await queryRunner.query(`DROP INDEX \`IDX_873ade98fbd6ca71c8b4d1bbca\` ON \`pipeline\``); + await queryRunner.query(`DROP INDEX \`IDX_683274c59fb08b21249096e305\` ON \`pipeline\``); + await queryRunner.query(`DROP INDEX \`IDX_1adf9f97094bc93e176ede2482\` ON \`pipeline\``); + await queryRunner.query(`DROP INDEX \`IDX_f3027eabd451ec18b93fab7ed5\` ON \`pipeline\``); + await queryRunner.query(`DROP TABLE \`pipeline\``); + await queryRunner.query(`DROP INDEX \`IDX_04d16bdd72668de12c3e41a85a\` ON \`pipeline_stage\``); + await queryRunner.query(`DROP INDEX \`IDX_28965bf63ad4c0976892d0fd5e\` ON \`pipeline_stage\``); + await queryRunner.query(`DROP INDEX \`IDX_074caa106ee22d5d675a696a98\` ON \`pipeline_stage\``); + await queryRunner.query(`DROP INDEX \`IDX_a6acee4ad726734b73f3886c14\` ON \`pipeline_stage\``); + await queryRunner.query(`DROP TABLE \`pipeline_stage\``); + await queryRunner.query(`DROP INDEX \`IDX_82753b9e315af84b20eaf84d77\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_8846e403ec45e1ad8c309f91a3\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_3f13c738eff604a85700746ec7\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_87223c7f1d4c2ca51cf6992784\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_62ef561a3bb084a7d12dad8a2d\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_be7fcc9fb8cd5a74cb602ec6c9\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_6959c37c3acf0832103a253570\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_8c4018eab11e92c3b09583495f\` ON \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_16a49d62227bf23686b77b5a21\` ON \`payment\``); + await queryRunner.query(`DROP TABLE \`payment\``); + await queryRunner.query(`DROP INDEX \`IDX_36e929b98372d961bb63bd4b4e\` ON \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_1c88db6e50f0704688d1f1978c\` ON \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_1fa632f2d12a06ef8dcc00858f\` ON \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_e71a736d52820b568f6b0ca203\` ON \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_380c03025a41ad032191f1ef2d\` ON \`password_reset\``); + await queryRunner.query(`DROP TABLE \`password_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_47b6a97e09895a06606a4a8042\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_7965db2b12872551b586f76dd7\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_2360aa7a4b5ab99e026584f305\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_15458cef74076623c270500053\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_9ea70bf5c390b00e7bb96b86ed\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_c75285bf286b17c7ca5537857b\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_f37d866c3326eca5f579cef35c\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_b03a8a28f6ebdb6df8f630216b\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_6cc2b2052744e352834a4c9e78\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_40460ab803bf6e5a62b75a35c5\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_03e5eecc2328eb545ff748cbdd\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_c21e615583a3ebbb0977452afb\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_745a293c8b2c750bc421fa0633\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_b2091c1795f1d0d919b278ab23\` ON \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_6de52b8f3de32abee3df2628a3\` ON \`organization\``); + await queryRunner.query(`DROP TABLE \`organization\``); + await queryRunner.query(`DROP INDEX \`IDX_e56e80136b07ecd52545368611\` ON \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_56dd132aa3743cfa9b034d020e\` ON \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_7e0bf6063e1728c9813d5da7ca\` ON \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_266972cd6ff9656eec8818e12d\` ON \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_04c6320f910056ecb11b147ac8\` ON \`organization_vendor\``); + await queryRunner.query(`DROP TABLE \`organization_vendor\``); + await queryRunner.query(`DROP INDEX \`IDX_51e91be110fa0b8e70066f5727\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_da625f694eb1e23e585f301008\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_e22ab0f1236b1a07785b641727\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_103ae3eb65f4b091efc55cb532\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_eef1c19a0cb5321223cfe3286c\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_176f5ed3c4534f3110d423d569\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_38f1d96e8c2d59e4f0f84209ab\` ON \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_722d648e0b83267d4a66332ccb\` ON \`organization_team\``); + await queryRunner.query(`DROP TABLE \`organization_team\``); + await queryRunner.query(`DROP INDEX \`IDX_171b852be7c1f387eca93775aa\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_5e73656ce0355347477c42ae19\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_c15823bf3f63b1fe331d9de662\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_d9529008c733cb90044b8c2ad6\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_b027ee2cb18245356b8d963d2f\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_29ece7e3bb764028387cdbc888\` ON \`organization_team_join_request\``); + await queryRunner.query(`DROP TABLE \`organization_team_join_request\``); + await queryRunner.query(`DROP INDEX \`IDX_ce83034f38496f5fe3f1979697\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a2a5601d799fbfc29c17b99243\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_8dc83cdd7c519d73afc0d8bdf0\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_719aeb37fa7a1dd80d25336a0c\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_d8eba1c0e500c60be1b69c1e77\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_fe12e1b76bbb76209134d9bdc2\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_752d7a0fe6597ee6bbc6502a12\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_70fcc451944fbde73d223c2af3\` ON \`organization_team_employee\``); + await queryRunner.query(`DROP TABLE \`organization_team_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_20a290f166c0810eafbf271717\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_19ab7adf33199bc6f913db277d\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_5830901876e426adfc15fb7341\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_582768159ef0c749e8552ea9bc\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_b7be7e61daf2b5af3232c9c4d6\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_f0e2385b2d5f176f9ed3b6a9e3\` ON \`organization_task_setting\``); + await queryRunner.query(`DROP TABLE \`organization_task_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_8a1fe8afb3aa672bae5993fbe7\` ON \`organization_sprint\``); + await queryRunner.query(`DROP INDEX \`IDX_f57ad03c4e471bd8530494ea63\` ON \`organization_sprint\``); + await queryRunner.query(`DROP INDEX \`IDX_76e53f9609ca05477d50980743\` ON \`organization_sprint\``); + await queryRunner.query(`DROP INDEX \`IDX_5596b4fa7fb2ceb0955580becd\` ON \`organization_sprint\``); + await queryRunner.query(`DROP TABLE \`organization_sprint\``); + await queryRunner.query(`DROP INDEX \`IDX_637ac2c467df4bc3b71795a866\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_61387780d015923453f4b015b4\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_f1e5497ee6be7ba3f2ee90bf4b\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_8a12e7a0d47d3c6a6b35f7984e\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_0b19a287858af40661bd3eb741\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_f3ef2000abb9762b138cc5a1b3\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_9ad08dbc039d08279dae2dd94e\` ON \`organization_recurring_expense\``); + await queryRunner.query(`DROP TABLE \`organization_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_063324fdceb51f7086e401ed2c\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_bc1e32c13683dbb16ada1c6da1\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_904ae0b765faef6ba2db8b1e69\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_3e128d30e9910ff920eee4ef37\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_c5c4366237dc2bb176c1503426\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_75855b44250686f84b7c4bc1f1\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_c210effeb6314d325bc024d21e\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_37215da8dee9503d759adb3538\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_9d8afc1e1e64d4b7d48dd2229d\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_7cf84e8b5775f349f81a1f3cc4\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_3590135ac2034d7aa88efa7e52\` ON \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_18e22d4b569159bb91dec869aa\` ON \`organization_project\``); + await queryRunner.query(`DROP TABLE \`organization_project\``); + await queryRunner.query(`DROP INDEX \`IDX_3f02c20145af9997253531349c\` ON \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_a0409e39f23ff6d418f2c03df5\` ON \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_a8f497b1006ec967964abb0d49\` ON \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_ce8721ddf715f0efa4bd3d2c5f\` ON \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_7317abf7a05a169783b6aa7932\` ON \`organization_position\``); + await queryRunner.query(`DROP TABLE \`organization_position\``); + await queryRunner.query(`DROP INDEX \`IDX_020516e74a57cb85d75381e841\` ON \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_4513931e2d530f78d7144c8c7c\` ON \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_225e476592214e32e117a85213\` ON \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_6577ec9ca4cef331a507264d44\` ON \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_b79e8d45a3ef5503579643f5de\` ON \`organization_language\``); + await queryRunner.query(`DROP TABLE \`organization_language\``); + await queryRunner.query(`DROP INDEX \`IDX_a583cfe32f492f5ba99b7bb205\` ON \`organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_227b5bd9867287cbbeece8f6ba\` ON \`organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_cc096d49e2399e89cdf32297da\` ON \`organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_880f3cce5e03f42bec3da6e6dc\` ON \`organization_employment_type\``); + await queryRunner.query(`DROP TABLE \`organization_employment_type\``); + await queryRunner.query(`DROP INDEX \`IDX_c129dee7d1cb84e01e69b5e2c6\` ON \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_1057ec001a4c6b258658143047\` ON \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_4bc83945c022a862a33629ff1e\` ON \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_72c6a8ad9de5c04b2b689fd229\` ON \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_e5edb48261db95f46c3b4d34a5\` ON \`organization_document\``); + await queryRunner.query(`DROP TABLE \`organization_document\``); + await queryRunner.query(`DROP INDEX \`IDX_91b652409dc1fb2f712590dd21\` ON \`organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_c61a562a2379d1c0077fe7de33\` ON \`organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_b3644ff7cd65239e29d292a41d\` ON \`organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_b65059949804b20048b1c86c3d\` ON \`organization_department\``); + await queryRunner.query(`DROP INDEX \`IDX_6139cd4c620e81aefd4895d370\` ON \`organization_department\``); + await queryRunner.query(`DROP TABLE \`organization_department\``); + await queryRunner.query(`DROP INDEX \`REL_a86d2e378b953cb39261f457d2\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_8cfcdc6bc8fb55e273d9ace5fd\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_a86d2e378b953cb39261f457d2\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_de33f92e042365d196d959e774\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_6200736cb4d3617b004e5b647f\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_e68c43e315ad3aaea4e99cf461\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_f91783c7a8565c648b65635efc\` ON \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_53627a383c9817dbf1164d7dc6\` ON \`organization_contact\``); + await queryRunner.query(`DROP TABLE \`organization_contact\``); + await queryRunner.query(`DROP INDEX \`IDX_31626e7d39eb95b710d5a2d80f\` ON \`organization_award\``); + await queryRunner.query(`DROP INDEX \`IDX_2e0d21aab892b5993abaac09bc\` ON \`organization_award\``); + await queryRunner.query(`DROP INDEX \`IDX_af6423760433da72002a7f369e\` ON \`organization_award\``); + await queryRunner.query(`DROP INDEX \`IDX_34c6749e2bc94b2e52e9572f32\` ON \`organization_award\``); + await queryRunner.query(`DROP INDEX \`IDX_4062b5d54aa740aaff9a6c5fbb\` ON \`organization_award\``); + await queryRunner.query(`DROP TABLE \`organization_award\``); + await queryRunner.query(`DROP INDEX \`REL_e03ddff05652be527e04abdc56\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_20acc3c3a6c900c6ef9fc68199\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_e03ddff05652be527e04abdc56\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_d306a524b507f72fa8550aeffe\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_533144d7ae94180235ea456625\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_0a0f972564e74c9c4905e3abcb\` ON \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_a03be8a86e528e2720504a041f\` ON \`merchant\``); + await queryRunner.query(`DROP TABLE \`merchant\``); + await queryRunner.query(`DROP INDEX \`IDX_465b3173cdddf0ac2d3fe73a33\` ON \`language\``); + await queryRunner.query(`DROP INDEX \`IDX_15fcb8179bc7b0642ca78da69e\` ON \`language\``); + await queryRunner.query(`DROP INDEX \`IDX_3a7abee35dfa3c90ed491583eb\` ON \`language\``); + await queryRunner.query(`DROP TABLE \`language\``); + await queryRunner.query(`DROP INDEX \`IDX_3e1d08761a717c1dd71fe67249\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_4e1e975124c1d717814a4bb2ec\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_d8547e21ccb8e37ac9f0d69c1a\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_38dc003f3484eff4b59918e9ae\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_c89adeff0de3aedb2e772a5bf4\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_5880347716f9ec5056ec15112c\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_d1f45ca98f17bd84a5e430feaf\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_8ac2c6b487d03157adda874789\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_8889e2618366faefa575a8049b\` ON \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_9b62dd2dddcde032f46a981733\` ON \`key_result\``); + await queryRunner.query(`DROP TABLE \`key_result\``); + await queryRunner.query(`DROP INDEX \`IDX_fd4b0cb7a44ed914acdda55e29\` ON \`key_result_update\``); + await queryRunner.query(`DROP INDEX \`IDX_cd9cbc0d5b6d62dbb63c3b3a65\` ON \`key_result_update\``); + await queryRunner.query(`DROP INDEX \`IDX_94aad97b26aede6545a3226fb3\` ON \`key_result_update\``); + await queryRunner.query(`DROP INDEX \`IDX_12b8b54f416ec9f5ec002f0a83\` ON \`key_result_update\``); + await queryRunner.query(`DROP TABLE \`key_result_update\``); + await queryRunner.query(`DROP INDEX \`IDX_46426ea45456e240a092b73204\` ON \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_fab6b6200b9ed6fd002c1ff62a\` ON \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_86c09eb673b0e66129dbdc7211\` ON \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_aa0e9b0cfcba1926925b025512\` ON \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_f4e813d72dc732f16497ee2c52\` ON \`key_result_template\``); + await queryRunner.query(`DROP TABLE \`key_result_template\``); + await queryRunner.query(`DROP INDEX \`IDX_d7bed97fb47876e03fd7d7c285\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_d9e965da0f63c94983d3a1006a\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_b5c33892e630b66c65d623baf8\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_058ef835f99e28fc6717cd7c80\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_7fb52a5f267f53b7d93af3d8c3\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_eabacf7474d75e53d7b7046f3e\` ON \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_850ca385c1985c1808cd4ea241\` ON \`invoice\``); + await queryRunner.query(`DROP TABLE \`invoice\``); + await queryRunner.query(`DROP INDEX \`IDX_e89749c8e8258b2ec110c0776f\` ON \`invoice_item\``); + await queryRunner.query(`DROP INDEX \`IDX_f78214cd9de76e80fe8a6305f5\` ON \`invoice_item\``); + await queryRunner.query(`DROP INDEX \`IDX_b7da14d2b61cf1dd5c65188b9c\` ON \`invoice_item\``); + await queryRunner.query(`DROP INDEX \`IDX_e2835fd8776ae5d56d892e087e\` ON \`invoice_item\``); + await queryRunner.query(`DROP TABLE \`invoice_item\``); + await queryRunner.query(`DROP INDEX \`IDX_31ec3d5a6b0985cec544c64217\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_da2893697d57368470952a76f6\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_856f24297f120604f8ae294276\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_cc0ac824ba89deda98bb418e8c\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_8106063f79cce8e67790d79092\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_483eb296a94d821ebedb375858\` ON \`invoice_estimate_history\``); + await queryRunner.query(`DROP TABLE \`invoice_estimate_history\``); + await queryRunner.query(`DROP INDEX \`IDX_91bfeec7a9574f458e5b592472\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_900a3ed40499c79c1c289fec28\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_5a182e8b3e225b14ddf6df7e6c\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_68eef4ab86b67747f24f288a16\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_7c2328f76efb850b8114797247\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_3cef860504647ccd52d39d7dc2\` ON \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_bd44bcb10034bc0c5fe4427b3e\` ON \`invite\``); + await queryRunner.query(`DROP TABLE \`invite\``); + await queryRunner.query(`DROP INDEX \`IDX_52d7fa32a7832b377fc2d7f619\` ON \`integration\``); + await queryRunner.query(`DROP INDEX \`IDX_85d7b0f07f3e3707b4586670a9\` ON \`integration\``); + await queryRunner.query(`DROP INDEX \`IDX_24981cd300007cf88601c2d616\` ON \`integration\``); + await queryRunner.query(`DROP TABLE \`integration\``); + await queryRunner.query(`DROP INDEX \`IDX_83443d669822bbbf2bd0ebdacd\` ON \`integration_type\``); + await queryRunner.query(`DROP INDEX \`IDX_e7b65ef60492b1c34007736f99\` ON \`integration_type\``); + await queryRunner.query(`DROP INDEX \`IDX_34a49d941459e1031c766b941f\` ON \`integration_type\``); + await queryRunner.query(`DROP TABLE \`integration_type\``); + await queryRunner.query( + `DROP INDEX \`IDX_5065401113abb6e9608225e567\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_a8709a9c5cc142c6fbe92df274\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_055f310a04a928343494a5255a\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_6c8e119fc6a2a7d3413aa76d3b\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_b3234be5b70c2362cdf67bb188\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_c774c276d6b7ea05a7e12d3c81\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_d706210d377ece2a1bc3386388\` ON \`organization_github_repository_issue\`` + ); + await queryRunner.query(`DROP TABLE \`organization_github_repository_issue\``); + await queryRunner.query(`DROP INDEX \`IDX_add7dbec156589dd0b27e2e0c4\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_59407d03d189560ac1a0a4b0eb\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_2eec784cadcb7847b64937fb58\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_34c48d11eb82ef42e89370bdc7\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_04717f25bea7d9cef0d51cac50\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_9e8a77c1d330554fab9230100a\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_a146e202c19f521bf5ec69bb26\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_6eea42a69e130bbd14b7ea3659\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_ca0fa80f50baed7287a499dc2c\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_69d75a47af6bfcda545a865691\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_480158f21938444e4f62fb3185\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_ef65338e8597b9f56fd0fe3c94\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_5e97728cfda96f49cc7f95bbaf\` ON \`organization_github_repository\``); + await queryRunner.query(`DROP TABLE \`organization_github_repository\``); + await queryRunner.query(`DROP INDEX \`IDX_0d6ddc27d687ca879042c5f3ce\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_d0532ed8020981736b58748de6\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_33ab224e7755a46fff5bc1e64e\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_24e37d03ef224f1a16a35069c2\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_5487f9197c106d774bae20991c\` ON \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_c5ff5d3ab364b7da72bf3fbb46\` ON \`integration_tenant\``); + await queryRunner.query(`DROP TABLE \`integration_tenant\``); + await queryRunner.query(`DROP INDEX \`IDX_34daf030004ad37b88f1f3d863\` ON \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_369eaafb13afe9903a170077ed\` ON \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_954c6b05297814776d9cb66ca7\` ON \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_f515574f1251562c52fe25b6a3\` ON \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_97c0d54aae21ccdbb5c3581642\` ON \`integration_setting\``); + await queryRunner.query(`DROP TABLE \`integration_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_c327ea26bda3d349a1eceb5658\` ON \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_7022dafd72c1b92f7d50691441\` ON \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_eec3d6064578610ddc609dd360\` ON \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_e63f4791631e7572ca213ac4a4\` ON \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_c79464c4ccf7e5195d69675c15\` ON \`integration_map\``); + await queryRunner.query(`DROP TABLE \`integration_map\``); + await queryRunner.query(`DROP INDEX \`IDX_f80ff4ebbf0b33a67dce598911\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_c6c01e38eebd8b26b9214b9044\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_23e9cfcf1bfff07dcc3254378d\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_1c653ebceca3b9c8766131db91\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_e3d407c5532edaceaa4df34623\` ON \`integration_entity_setting\``); + await queryRunner.query(`DROP TABLE \`integration_entity_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_3fb863167095805e33f38a0fdc\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_d5ac36aa3d5919908414154fca\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_b208a754c7a538cb3422f39f5b\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_101cd83aa75949cfb5b8eec084\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_6d43cc33c80221dbe4854b38e6\` ON \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP TABLE \`integration_entity_setting_tied\``); + await queryRunner.query(`DROP INDEX \`IDX_29fbd3a17710a27e6f856072c0\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_a05d52b7ffe89140f9cbcf114b\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_20207d9f915066dfbc2210bcf1\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_86b5a121b3775a1b0b7fa75680\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_bd39a647a2843177723ddf733e\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_64409de4711cd14e2c43371cc0\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_8608b275644cfc7a0f3f585081\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_aedb8b1d10c498309bed9edf53\` ON \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_904ab9ee6ac5e74bf3616c8ccb\` ON \`income\``); + await queryRunner.query(`DROP TABLE \`income\``); + await queryRunner.query(`DROP INDEX \`IDX_d3675304df9971cccf96d9a7c3\` ON \`image_asset\``); + await queryRunner.query(`DROP INDEX \`IDX_01856a9a730b7e79d70aa661cb\` ON \`image_asset\``); + await queryRunner.query(`DROP INDEX \`IDX_af1a212cb378bb0eed51c1b2bc\` ON \`image_asset\``); + await queryRunner.query(`DROP INDEX \`IDX_9d44ce9eb8689e578b941a6a54\` ON \`image_asset\``); + await queryRunner.query(`DROP TABLE \`image_asset\``); + await queryRunner.query(`DROP INDEX \`IDX_4c8b4e887a994182fd6132e640\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_af0a11734e70412b742ac339c8\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_35526ff1063ab5fa2b20e71bd6\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_ac161c1a0c0ff8e83554f097e5\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_c6e8ae55a4db3584686cbf6afe\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_6b4758a5442713070c9a366d0e\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_4a2c00a44350a063d75be80ba9\` ON \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_72641ffde44e1a1627aa2d040f\` ON \`goal\``); + await queryRunner.query(`DROP TABLE \`goal\``); + await queryRunner.query(`DROP INDEX \`IDX_405bc5bba9ed71aefef84a29f1\` ON \`goal_time_frame\``); + await queryRunner.query(`DROP INDEX \`IDX_b56723b53a76ca1c171890c479\` ON \`goal_time_frame\``); + await queryRunner.query(`DROP INDEX \`IDX_ef4ec26ca3a7e0d8c9e1748be2\` ON \`goal_time_frame\``); + await queryRunner.query(`DROP INDEX \`IDX_646565982726362cc2ca4fb807\` ON \`goal_time_frame\``); + await queryRunner.query(`DROP TABLE \`goal_time_frame\``); + await queryRunner.query(`DROP INDEX \`IDX_5708fe06608c72fc77b65ae651\` ON \`goal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_774bf82989475befe301fe1bca\` ON \`goal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_056e869152a335f88c38c5b693\` ON \`goal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_cd91c5925942061527b1bc112c\` ON \`goal_template\``); + await queryRunner.query(`DROP TABLE \`goal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_d4f093ca4eb7c40db68d9a789d\` ON \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_e49e37fe88a2725a38a3b05849\` ON \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_43aa2985216560cd9fa93f501e\` ON \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_a96c22c51607f878c8a98bc488\` ON \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_cfc393bd9835d8259e73019226\` ON \`goal_kpi\``); + await queryRunner.query(`DROP TABLE \`goal_kpi\``); + await queryRunner.query(`DROP INDEX \`IDX_df7ab026698c02859ff7540809\` ON \`goal_kpi_template\``); + await queryRunner.query(`DROP INDEX \`IDX_cc72d4e8e4284dcc8ffbf96caf\` ON \`goal_kpi_template\``); + await queryRunner.query(`DROP INDEX \`IDX_26311c417ba945c901c65d515d\` ON \`goal_kpi_template\``); + await queryRunner.query(`DROP INDEX \`IDX_b4f4701ddb0e973602445ed1c6\` ON \`goal_kpi_template\``); + await queryRunner.query(`DROP TABLE \`goal_kpi_template\``); + await queryRunner.query(`DROP INDEX \`IDX_e35d0f7b794ca8850669d12c78\` ON \`goal_general_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_d17a5159d888ac6320459eda39\` ON \`goal_general_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_4a44905db4ca1e40b62021fdfb\` ON \`goal_general_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_bdee8704ebeb79368ff6154fc7\` ON \`goal_general_setting\``); + await queryRunner.query(`DROP TABLE \`goal_general_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_d4a28a8e70d450a412bf0cfb52\` ON \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_c30465b5a6e0fae1c8ee7e3120\` ON \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_4832be692a2dc63d67e8e93c75\` ON \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_a26cc341268d22bd55f06e3ef6\` ON \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_5405b67f1df904831a358df7c4\` ON \`feature\``); + await queryRunner.query(`DROP TABLE \`feature\``); + await queryRunner.query(`DROP INDEX \`IDX_6d413f9fdd5366b1b9add46483\` ON \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_6a94e6b0a572f591288ac44a42\` ON \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_8f71803d96dcdbcc6b19bb28d3\` ON \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_e4c142f37091b47056012d34ba\` ON \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_4ee685760ddb60ff71f763d8f6\` ON \`feature_organization\``); + await queryRunner.query(`DROP TABLE \`feature_organization\``); + await queryRunner.query(`DROP INDEX \`IDX_a43b235c35c2c4d3263ada770c\` ON \`import-record\``); + await queryRunner.query(`DROP INDEX \`IDX_339328a7247aa09d061c642ae1\` ON \`import-record\``); + await queryRunner.query(`DROP INDEX \`IDX_b90957ef81e74c43d6ae037560\` ON \`import-record\``); + await queryRunner.query(`DROP TABLE \`import-record\``); + await queryRunner.query(`DROP INDEX \`IDX_54868607115e2fee3b0b764eec\` ON \`import-history\``); + await queryRunner.query(`DROP INDEX \`IDX_d6a626bee6cddf4bc53a493bc3\` ON \`import-history\``); + await queryRunner.query(`DROP INDEX \`IDX_e339340014a6c4e2f57be00b0c\` ON \`import-history\``); + await queryRunner.query(`DROP TABLE \`import-history\``); + await queryRunner.query(`DROP INDEX \`IDX_047b8b5c0782d5a6d4c8bfc1a4\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_9971c4171ae051e74b833984a3\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_42eea5debc63f4d1bf89881c10\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_eacb116ab0521ad9b96f2bb53b\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_5e7b197dbac69012dbdb4964f3\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_5f57d077c28b378a6c885e81c5\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_97ed0e2b80f2e7ec260fd81cd9\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_0006d3025b6c92fbd4089b9465\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_dd8ab9312fb8d787982b9feebf\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_cbfebdb1419f9b8036a8b0546e\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_89508d119b1a279c037d9da151\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_3826d6ca74a08a8498fa17d330\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_b5bb8f62d401475fcc8c2ba35e\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_846a933af451a33b95b7b198c6\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_c5fb146726ff128e600f23d0a1\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_6d171c9d5f81095436b99da5e6\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_d77aeb93f2439ebdf4babaab4c\` ON \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_1aa0e5fd480214ae4851471e3c\` ON \`expense\``); + await queryRunner.query(`DROP TABLE \`expense\``); + await queryRunner.query(`DROP INDEX \`IDX_9c9bfe5baaf83f53533ff035fc\` ON \`expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_37504e920ee5ca46a4000b89da\` ON \`expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_e9cef5d359dfa48ee5d0cd5fcc\` ON \`expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_8376e41fd82aba147a433dc097\` ON \`expense_category\``); + await queryRunner.query(`DROP TABLE \`expense_category\``); + await queryRunner.query(`DROP INDEX \`IDX_24d905ec9e127ade23754a363d\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_5bde7aeb2c7fb3a421b175871e\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_43459c650957e478203c738574\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_9d5980ff1064e2edb77509d312\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_4b02d8616129f39fca2b10e98b\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_fc8818d6fde74370ec703a0135\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_92fc62260c0c7ff108622850bf\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_613cfa5783e164cad10dc27e58\` ON \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_f14eee32875b112fab1139b332\` ON \`event_type\``); + await queryRunner.query(`DROP TABLE \`event_type\``); + await queryRunner.query(`DROP INDEX \`IDX_233c1d351d63441aeb039d1164\` ON \`estimate_email\``); + await queryRunner.query(`DROP INDEX \`IDX_391d3f83244fea73c619aecadd\` ON \`estimate_email\``); + await queryRunner.query(`DROP INDEX \`IDX_f1fac79e17c475f00daa4db3d2\` ON \`estimate_email\``); + await queryRunner.query(`DROP INDEX \`IDX_1a4bd2a8034bb1309b4ea87882\` ON \`estimate_email\``); + await queryRunner.query(`DROP TABLE \`estimate_email\``); + await queryRunner.query(`DROP INDEX \`IDX_f98ce0d210aa9f91b729d44780\` ON \`equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_fb6808468066849ab7b7454d5f\` ON \`equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_d8452bfe9f18ced4ce76c4b70b\` ON \`equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_39e1b443404ea7fa42b3d36ccb\` ON \`equipment\``); + await queryRunner.query(`DROP TABLE \`equipment\``); + await queryRunner.query(`DROP INDEX \`IDX_0ecfe0ce0cd2b197249d5f1c10\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_acad51a6362806fc499e583e40\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_ea9254be07ae4a8604f0aaab19\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_fa525e61fb3d8d9efec0f364a4\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_a734598f5637cf1501288331e3\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_70ff31cefa0f578f6fa82d2bcc\` ON \`equipment_sharing\``); + await queryRunner.query(`DROP TABLE \`equipment_sharing\``); + await queryRunner.query(`DROP INDEX \`IDX_04c9e514ed70897f6ad8cadc3c\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_5311a833ff255881454bd5b3b5\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_5443ca8ed830626656d8cfecef\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_b0fc293cf47f31ba512fd29bf0\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_0f3ee47a5fb7192d5eb00c71ae\` ON \`equipment_sharing_policy\``); + await queryRunner.query(`DROP TABLE \`equipment_sharing_policy\``); + await queryRunner.query(`DROP INDEX \`REL_1c0c1370ecd98040259625e17e\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`REL_f4b0d329c4a3cf79ffe9d56504\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_5e719204dcafa8d6b2ecdeda13\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_1c0c1370ecd98040259625e17e\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f4b0d329c4a3cf79ffe9d56504\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_96dfbcaa2990df01fe5bb39ccc\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_c6a48286f3aa8ae903bee0d1e7\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_4b3303a6b7eb92d237a4379734\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_175b7be641928a31521224daa8\` ON \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_510cb87f5da169e57e694d1a5c\` ON \`employee\``); + await queryRunner.query(`DROP TABLE \`employee\``); + await queryRunner.query(`DROP INDEX \`IDX_95ea18af6ef8123503d332240c\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_710c71526edb89b2a7033abcdf\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_9537fae454ebebc98ee5adb3a2\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_56e96cd218a185ed59b5a8e786\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_9516a627a131626d2a5738a05a\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_01237d04f882cf1ea794678e8d\` ON \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_48fae30026b4e166a3445fee6d\` ON \`employee_setting\``); + await queryRunner.query(`DROP TABLE \`employee_setting\``); + await queryRunner.query(`DROP INDEX \`IDX_0ac8526c48a3daa267c86225fb\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_6e570174fda71e97616e9d2eea\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_739f8cdce21cc72d400559ce00\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_a4b5a2ea2afecf1ee254f1a704\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_3ee5147bb1fde625fa33c0e956\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_5fde7be40b3c03bc0fdac0c2f6\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_3980b0fe1e757b092ea5323656\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_25f8915182128f377d84b60d26\` ON \`employee_recurring_expense\``); + await queryRunner.query(`DROP TABLE \`employee_recurring_expense\``); + await queryRunner.query(`DROP INDEX \`IDX_2be728a7f8b118712a4200990d\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_a13f3564eae9db44ddc4308afc\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_0111963c9cb4dd14565c0d9c84\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_dc2ff85f7de16dea6453a833dd\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_ee780fbd8f91de31c004929eec\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_f577c9bc6183c1d1eae1e154bb\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_e396663e1a31114eac39087829\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_2bb17670e2bea3980ff960bbcf\` ON \`employee_proposal_template\``); + await queryRunner.query(`DROP TABLE \`employee_proposal_template\``); + await queryRunner.query(`DROP INDEX \`IDX_329ebd01a757d1a0c3c4d628e2\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_ba7b2ef5a9cd165a1e4e2ad0ef\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_0f9cefa604913e1ab322591546\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_d543336994b1f764c449e0b1d3\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_aa98ea786d490db300d3dbbdb6\` ON \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_587d11ffbd87adb6dff367f3cd\` ON \`employee_phone\``); + await queryRunner.query(`DROP TABLE \`employee_phone\``); + await queryRunner.query(`DROP INDEX \`IDX_c4668533292bf4526e61aedf74\` ON \`employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_d3fc52d497bc44d6f493dbedc3\` ON \`employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_88a58d149404145ed7b3385387\` ON \`employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_90bd442869709bae9d1b18e489\` ON \`employee_level\``); + await queryRunner.query(`DROP TABLE \`employee_level\``); + await queryRunner.query(`DROP INDEX \`IDX_c8723c90a6f007f8d7e882a04f\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_cb64573b18dd7b23f591f15502\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_9f1288205ae91f91cf356cac2f\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_1a62a99e1016e4a2b461e886ec\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_44e22d88b47daf2095491b7cac\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_e4bc75a1cbb07d117a0acfcdba\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_4b8450a24233df8b47ca472923\` ON \`job_search_occupation\``); + await queryRunner.query(`DROP TABLE \`job_search_occupation\``); + await queryRunner.query(`DROP INDEX \`IDX_6ee5218c869b57197e4a209bed\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_d0a798419c775b9157bf0269f4\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_3b335bbcbf7d5e00853acaa165\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_86381fb6d28978b101b3aec8ca\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_35e120f2b6e5188391cf068d3b\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_015231c6e28cfb2b789ca4b76f\` ON \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_36333846c37e5f8812a5c9f7ff\` ON \`job_search_category\``); + await queryRunner.query(`DROP TABLE \`job_search_category\``); + await queryRunner.query(`DROP INDEX \`IDX_f2c1b6770dd2a3abfa35f49411\` ON \`job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_a4b038417e3221c0791dd8c771\` ON \`job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_7e53ea80aca15da11a8a5ec038\` ON \`job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_e210f70c3904cf84ab5113be8f\` ON \`job_preset\``); + await queryRunner.query(`DROP INDEX \`IDX_46226c3185e3ca3d7033831d7a\` ON \`job_preset\``); + await queryRunner.query(`DROP TABLE \`job_preset\``); + await queryRunner.query( + `DROP INDEX \`IDX_d5ca48cfacfb516543d6507ca4\` ON \`job_preset_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_2323220b4decfd2f4d8307fd78\` ON \`job_preset_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_4070b6f3480e9c4b2dcf3f7b56\` ON \`job_preset_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_af850e1fa48af82d66e9bf81c7\` ON \`job_preset_upwork_job_search_criterion\`` + ); + await queryRunner.query(`DROP TABLE \`job_preset_upwork_job_search_criterion\``); + await queryRunner.query( + `DROP INDEX \`IDX_630337302efe97cc93deeb2151\` ON \`employee_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_afe6c40d3d9951388fa05f83f2\` ON \`employee_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_0e130a25bb4abe1b27c8a0adf4\` ON \`employee_upwork_job_search_criterion\`` + ); + await queryRunner.query( + `DROP INDEX \`IDX_6bae61744663a416e73903d9af\` ON \`employee_upwork_job_search_criterion\`` + ); + await queryRunner.query(`DROP TABLE \`employee_upwork_job_search_criterion\``); + await queryRunner.query(`DROP INDEX \`IDX_0c5266f3f488add404f92d56ec\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_6912685bbb0e303eab392978d9\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_caf8363b0ed7d5f24ae866ba3b\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_91e0f7efcd17d20b5029fb1342\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_8fb47e8bfd26340ddaeabd24e5\` ON \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_c07390f325c847be7df93d0d17\` ON \`employee_award\``); + await queryRunner.query(`DROP TABLE \`employee_award\``); + await queryRunner.query(`DROP INDEX \`IDX_86cf36c137712e779dd7e2301e\` ON \`employee_appointment\``); + await queryRunner.query(`DROP INDEX \`IDX_a35637bb659c59e18adb4f38f8\` ON \`employee_appointment\``); + await queryRunner.query(`DROP INDEX \`IDX_64c83df9d37d9ada96edb66557\` ON \`employee_appointment\``); + await queryRunner.query(`DROP INDEX \`IDX_d0219ada2359ede9e7b0d511ba\` ON \`employee_appointment\``); + await queryRunner.query(`DROP TABLE \`employee_appointment\``); + await queryRunner.query(`DROP INDEX \`IDX_7e688e6613930ba721b841db43\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_274708db64fcce5448f2c4541c\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_c160fe6234675fac031aa3e7c5\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_753e005a45556b5909e11937aa\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_29d60114e1968c0cd68a19e3c5\` ON \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_e4932e0a726b9b07d81d8b6905\` ON \`email_template\``); + await queryRunner.query(`DROP TABLE \`email_template\``); + await queryRunner.query(`DROP INDEX \`IDX_e37af4ab2ba0bf268bfd982634\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_4ac734f2a1a3c055dca04fba99\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_9e80c9ec749dfda6dbe2cd9704\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_4be518a169bbcbfe92025ac574\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_03d16a2fd43d7c601743440212\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_93799dfaeff51de06f1e02ac41\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_13247a755d17e7905d5bb4cfda\` ON \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_e3321e3575289b7ee1e8eb1042\` ON \`email_reset\``); + await queryRunner.query(`DROP TABLE \`email_reset\``); + await queryRunner.query(`DROP INDEX \`IDX_5956ce758c01ebf8a539e8d4f0\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_9033faf41b23c61ba201c48796\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_1261c457b3035b77719556995b\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_a954fda57cca81dc48446e73b8\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_953df0eb0df3035baf140399f6\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_525f4873c6edc3d94559f88900\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_0af511c44de7a16beb45cc3785\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_9a69f7077e0333d2c848895a1b\` ON \`email_sent\``); + await queryRunner.query(`DROP INDEX \`IDX_d825bc6da1c52a3900a9373260\` ON \`email_sent\``); + await queryRunner.query(`DROP TABLE \`email_sent\``); + await queryRunner.query(`DROP INDEX \`REL_1ae3abc0ae1dcf6c13f49b62b5\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_9211f5b62988df6e95522be7da\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_4b1ff44e6bae5065429dbab554\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_38fb85abdf9995efcf217f5955\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_46a3c00bfc3e36b4412d8bcdb0\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_443c561d45f6c57f3790a759ba\` ON \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_0d8c964237e5061627de82df80\` ON \`deal\``); + await queryRunner.query(`DROP TABLE \`deal\``); + await queryRunner.query(`DROP INDEX \`IDX_15a1306132d66c63ef31f7288c\` ON \`custom_smtp\``); + await queryRunner.query(`DROP INDEX \`IDX_2aa3fc8daa25beec4788d2be26\` ON \`custom_smtp\``); + await queryRunner.query(`DROP INDEX \`IDX_f10372f9d038d0954d5b20635a\` ON \`custom_smtp\``); + await queryRunner.query(`DROP INDEX \`IDX_e2c7d28bb07adc915d74437c7b\` ON \`custom_smtp\``); + await queryRunner.query(`DROP TABLE \`custom_smtp\``); + await queryRunner.query(`DROP INDEX \`IDX_0b0fbda74f6c82c943e706a3cc\` ON \`currency\``); + await queryRunner.query(`DROP INDEX \`IDX_8203f1410475748bbbc6d3029d\` ON \`currency\``); + await queryRunner.query(`DROP INDEX \`IDX_03cc024ddc2f196dca7fead7cb\` ON \`currency\``); + await queryRunner.query(`DROP TABLE \`currency\``); + await queryRunner.query(`DROP INDEX \`IDX_6eba1a52ee121d100c8a0a6510\` ON \`country\``); + await queryRunner.query(`DROP INDEX \`IDX_6cd9b7ea6818e862217035436c\` ON \`country\``); + await queryRunner.query(`DROP INDEX \`IDX_97ebcd8db30a408b5f907d6ff4\` ON \`country\``); + await queryRunner.query(`DROP TABLE \`country\``); + await queryRunner.query(`DROP INDEX \`IDX_7719d73cd16a9f57ecc6ac24b3\` ON \`contact\``); + await queryRunner.query(`DROP INDEX \`IDX_60468af1ce34043a900809c84f\` ON \`contact\``); + await queryRunner.query(`DROP INDEX \`IDX_4164bd34bdcce8754641f0e567\` ON \`contact\``); + await queryRunner.query(`DROP INDEX \`IDX_05831d37eabeb6150f99c69784\` ON \`contact\``); + await queryRunner.query(`DROP TABLE \`contact\``); + await queryRunner.query(`DROP INDEX \`REL_8b900e8a39f76125e610ab30c0\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`REL_3930aa71e0fa24f09201811b1b\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`REL_4ea108fd8b089237964d5f98fb\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`REL_b674793a804b7d69d74c8f6c5b\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_8b900e8a39f76125e610ab30c0\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_3930aa71e0fa24f09201811b1b\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_4ea108fd8b089237964d5f98fb\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_1e3e8228e7df634fa4cec6322c\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_b674793a804b7d69d74c8f6c5b\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_16fb27ffd1a99c6506c92ad57a\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_77ac426e04553ff1654421bce4\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_af835b66fa10279103bd89e225\` ON \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_2b8091376a529383e23ba3356a\` ON \`candidate\``); + await queryRunner.query(`DROP TABLE \`candidate\``); + await queryRunner.query(`DROP INDEX \`IDX_063663c7e61e45d172d1b83265\` ON \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_9d46b8c5382acd4d4514bc5c62\` ON \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_a6fecb615b07987b480defac64\` ON \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_97aa0328b72e1bf919e61bccdc\` ON \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_199ca43300fa4e64239656a677\` ON \`candidate_technology\``); + await queryRunner.query(`DROP TABLE \`candidate_technology\``); + await queryRunner.query(`DROP INDEX \`IDX_e92027b5280828cadd7cd6ea71\` ON \`candidate_source\``); + await queryRunner.query(`DROP INDEX \`IDX_b2a1ba27a76dd819cd8294cce3\` ON \`candidate_source\``); + await queryRunner.query(`DROP INDEX \`IDX_509101ab1a46a5934ee278d447\` ON \`candidate_source\``); + await queryRunner.query(`DROP INDEX \`IDX_2be9182096747fb18cb8afb1f0\` ON \`candidate_source\``); + await queryRunner.query(`DROP TABLE \`candidate_source\``); + await queryRunner.query(`DROP INDEX \`IDX_d7986743e7f11720349a6c9557\` ON \`candidate_skill\``); + await queryRunner.query(`DROP INDEX \`IDX_8a07f780c6fce2b82830ab0687\` ON \`candidate_skill\``); + await queryRunner.query(`DROP INDEX \`IDX_a38fe0c3f2ff0a4e475f2a1347\` ON \`candidate_skill\``); + await queryRunner.query(`DROP INDEX \`IDX_6907163d0bb8e9f0440b9bf2a7\` ON \`candidate_skill\``); + await queryRunner.query(`DROP TABLE \`candidate_skill\``); + await queryRunner.query(`DROP INDEX \`IDX_a0d171f45bdbcf2b990c0c37c3\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_d321f4547ed467d07cce1e7d9a\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_045de7c208adcd0c68c0a65174\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_ff6776d92db4ef71edbfba9903\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_afe01503d4337c9623c06f22df\` ON \`candidate_personal_quality\``); + await queryRunner.query(`DROP TABLE \`candidate_personal_quality\``); + await queryRunner.query(`DROP INDEX \`IDX_9e7b20eb3dfa082b83b198fdad\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_ecb65075e94b47bbab11cfa5a1\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_5f1e315db848990dfffa72817c\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_f0ca69c78eea92c95d9044764a\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_2043abff09f084fb8690009fb8\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_b9132118c3a98c4c48e417c0c5\` ON \`candidate_interviewer\``); + await queryRunner.query(`DROP TABLE \`candidate_interviewer\``); + await queryRunner.query(`DROP INDEX \`IDX_91996439c4baafee8395d3df15\` ON \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`IDX_03be41e88b1fecfe4e24d6b04b\` ON \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`IDX_59b765e6d13d83dba4852a43eb\` ON \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`IDX_7b49ce2928b327213f2de66b95\` ON \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`IDX_b9191cf49f8cd1f192cb74233c\` ON \`candidate_interview\``); + await queryRunner.query(`DROP TABLE \`candidate_interview\``); + await queryRunner.query(`DROP INDEX \`REL_44f3d80c3293e1de038c87f115\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_0862c274d336126b951bfe009a\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_98c008fd8cf597e83dcdccfd16\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_3a6928f8501fce33820721a8fe\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_6cb21fa0f65ff69679966c836f\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_05ed49a5ebdd5ec533f913b620\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_c660aef2ca5aff9dbf45a9a4bb\` ON \`candidate_feedback\``); + await queryRunner.query(`DROP TABLE \`candidate_feedback\``); + await queryRunner.query(`DROP INDEX \`IDX_a50eb955f940ca93e044d175c6\` ON \`candidate_experience\``); + await queryRunner.query(`DROP INDEX \`IDX_8dcf5fc8bc7f77a80b0fc648bf\` ON \`candidate_experience\``); + await queryRunner.query(`DROP INDEX \`IDX_c24bce6dd33e56ef8e8dacef1a\` ON \`candidate_experience\``); + await queryRunner.query(`DROP INDEX \`IDX_dafa68d060cf401d5f62a57ad4\` ON \`candidate_experience\``); + await queryRunner.query(`DROP TABLE \`candidate_experience\``); + await queryRunner.query(`DROP INDEX \`IDX_f660af89b2c69fea2334508cbb\` ON \`candidate_education\``); + await queryRunner.query(`DROP INDEX \`IDX_00cdd9ed7571be8e2c8d09e7cd\` ON \`candidate_education\``); + await queryRunner.query(`DROP INDEX \`IDX_b443c78c3796f2e9aab05a2bb9\` ON \`candidate_education\``); + await queryRunner.query(`DROP INDEX \`IDX_336eb14606016757d2302efa4d\` ON \`candidate_education\``); + await queryRunner.query(`DROP TABLE \`candidate_education\``); + await queryRunner.query(`DROP INDEX \`IDX_3f9053719c9d11ebdea03e5a2d\` ON \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_d108a827199fda86a9ec216989\` ON \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_4d9b7ab09f9f9517d488b5fed1\` ON \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_3ed4bac12d0ca32eada4ea5a49\` ON \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_bf8070715e42b3afe9730e7b30\` ON \`candidate_document\``); + await queryRunner.query(`DROP TABLE \`candidate_document\``); + await queryRunner.query(`DROP INDEX \`IDX_159f821dd214792f1d2ad9cff7\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_ba4c376b2069aa82745d4e9682\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_d1d16bc87d3afaf387f34cdceb\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_b106406e94bb7317493efc2c98\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_9d5bd131452ef689df2b46551b\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_fcab96cef60fd8bccac610ccef\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_0a417dafb1dd14eb92a69fa641\` ON \`candidate_criterion_rating\``); + await queryRunner.query(`DROP TABLE \`candidate_criterion_rating\``); + await queryRunner.query(`DROP INDEX \`IDX_46ed3c2287423f5dc089100fee\` ON \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_d544bd3a63634a4438509ac958\` ON \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_f008a481cb4eed547704bb9d83\` ON \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_3aabb2cdf5b6e0df87cb94bdca\` ON \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_3e20b617c7d7a87b8bf53ddcbe\` ON \`availability_slot\``); + await queryRunner.query(`DROP TABLE \`availability_slot\``); + await queryRunner.query(`DROP INDEX \`IDX_45f32a5a12d42fba17fe62a279\` ON \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_dfe3b357df3ce136917b1f0984\` ON \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_1462391059ebe137645098d727\` ON \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_f50ce5a39d610cfcd9da9652b1\` ON \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_338364927c68961167606e989c\` ON \`approval_policy\``); + await queryRunner.query(`DROP TABLE \`approval_policy\``); + await queryRunner.query(`DROP INDEX \`IDX_e9ca170a0fae05e44a9bd137d8\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_0ddc50b7521b9a905d9ca8c8ba\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_3c3a62226896345c4716bfe1d9\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2c0494466d5a7e1165cea3dca9\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2a6f8c4b8da6f85e2903daf5c3\` ON \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_379af16b0aeed6a4d8f15c53bc\` ON \`appointment_employee\``); + await queryRunner.query(`DROP TABLE \`appointment_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a841eabc6b656c965d8846223e\` ON \`accounting_template\``); + await queryRunner.query(`DROP INDEX \`IDX_968c1c9a131a61a3720b3a72f6\` ON \`accounting_template\``); + await queryRunner.query(`DROP INDEX \`IDX_e66511b175393255c6c4e7b007\` ON \`accounting_template\``); + await queryRunner.query(`DROP INDEX \`IDX_2ca6a49062a4ed884e413bf572\` ON \`accounting_template\``); + await queryRunner.query(`DROP INDEX \`IDX_7ac2c1c487dd77fe38c2d571ea\` ON \`accounting_template\``); + await queryRunner.query(`DROP INDEX \`IDX_5cf7c007fc9c83bee748f08806\` ON \`accounting_template\``); + await queryRunner.query(`DROP TABLE \`accounting_template\``); + } } diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 8f7989d78c5..21ddf86c104 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -222,12 +222,168 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * * @param queryRunner */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + // Add new columns + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`isManager\` tinyint NULL DEFAULT 0` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`assignedAt\` datetime NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); + + // Populate the 'id' column with UUIDs for existing records + await queryRunner.query( + `UPDATE \`organization_project_employee\` SET \`id\` = (SELECT UUID()) WHERE \`id\` IS NULL` + ); + + // Alter the 'id' column to be NOT NULL + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` MODIFY \`id\` varchar(36) NOT NULL`); + + // Drop and recreate primary keys + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + + // Re-create foreign keys and indices + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(255) NOT NULL` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(255) NOT NULL` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\` (\`isArchived\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\` (\`tenantId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\` (\`organizationId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\` (\`isManager\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\` (\`assignedAt\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` + ); + + // Add foreign key constraints back + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + } /** * MySQL Down Migration * * @param queryRunner */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + // Drop foreign key constraints that depend on columns or constraints we're about to modify + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` + ); + + // Drop indices + await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); + + // Drop primary key constraint + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + + // Modify 'employeeId' and 'organizationProjectId' columns back to their original definitions + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(36) NOT NULL` + ); + + // Add composite primary key + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + + // Drop the 'id' column + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); + + // Drop other columns added in the Up migration + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + + // Recreate indices on 'employeeId' and 'organizationProjectId' + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + + // Add foreign key constraints back + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + } } From c0df2f02166be8aac76058765c3a9b43b0e185ef Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 12:51:14 +0530 Subject: [PATCH 22/47] fix: add table migration for MySQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 21ddf86c104..f186cc730fc 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -223,6 +223,14 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { + // Drop existing foreign keys + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + // Add new columns await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); @@ -286,6 +294,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `CREATE INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\` (\`assignedAt\`)` ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); await queryRunner.query( `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` ); @@ -300,6 +311,12 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); @@ -311,7 +328,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - // Drop foreign key constraints that depend on columns or constraints we're about to modify + // Drop foreign key constraints await queryRunner.query( `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` ); @@ -331,6 +348,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Drop indices await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); @@ -341,12 +359,14 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Drop primary key constraint await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - // Modify 'employeeId' and 'organizationProjectId' columns back to their original definitions + // Restore 'employeeId' and 'organizationProjectId' columns + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(36) NOT NULL` + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(36) NOT NULL` + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` ); // Add composite primary key From 3180cf09b6fe81d41137f77ac1c663a519746bfd Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 14:56:57 +0530 Subject: [PATCH 23/47] fix: add table up migration for MySQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 110 +----------------- 1 file changed, 5 insertions(+), 105 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index f186cc730fc..b462e5e79f8 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -223,14 +223,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - // Drop existing foreign keys - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - // Add new columns await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); @@ -258,9 +250,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); // Populate the 'id' column with UUIDs for existing records - await queryRunner.query( - `UPDATE \`organization_project_employee\` SET \`id\` = (SELECT UUID()) WHERE \`id\` IS NULL` - ); + await queryRunner.query(`UPDATE \`organization_project_employee\` SET \`id\` = UUID() WHERE \`id\` IS NULL`); // Alter the 'id' column to be NOT NULL await queryRunner.query(`ALTER TABLE \`organization_project_employee\` MODIFY \`id\` varchar(36) NOT NULL`); @@ -269,13 +259,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - // Re-create foreign keys and indices - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(255) NOT NULL` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(255) NOT NULL` - ); + // Re-create indices await queryRunner.query( `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` ); @@ -294,12 +278,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `CREATE INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\` (\`assignedAt\`)` ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); await queryRunner.query( `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` ); @@ -312,10 +290,10 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` @@ -327,83 +305,5 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * * @param queryRunner */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - // Drop foreign key constraints - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` - ); - - // Drop indices - await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); - - // Drop primary key constraint - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - - // Restore 'employeeId' and 'organizationProjectId' columns - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` - ); - - // Add composite primary key - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` - ); - - // Drop the 'id' column - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); - - // Drop other columns added in the Up migration - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - - // Recreate indices on 'employeeId' and 'organizationProjectId' - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - - // Add foreign key constraints back - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - } + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} } From ee0d36925020ba302ea67b52bab71939f38fce60 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 16:03:51 +0530 Subject: [PATCH 24/47] fix: add table down migration for MySQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 71 ++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index b462e5e79f8..08b312a4965 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -305,5 +305,74 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * * @param queryRunner */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { + // Drop foreign key constraints that depend on columns or constraints we're about to modify + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` + ); + + // Drop indices + await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_a9abd98013154ec1edfa1ec18c\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); + + // Drop primary key constraint + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + + // Modify 'employeeId' and 'organizationProjectId' columns back to their original definitions + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(36) NOT NULL` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(36) NOT NULL` + ); + + // Add composite primary key + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` + ); + + // Drop the 'id' column + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); + + // Drop other columns added in the Up migration + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + + // Recreate indices on 'employeeId' and 'organizationProjectId' + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + + // Add foreign key constraints back + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + } } From aef663bdd57396c7dbf522dcf4b09bb992740bd7 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 16:15:17 +0530 Subject: [PATCH 25/47] fix: add table down migration for MySQL --- ...726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 08b312a4965..e6b94814704 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -319,7 +319,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Drop indices await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); - await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_a77a507b7402f0adb6a6b41e41\` ON \`organization_project_employee\``); From 5ca9f769fbf92449a223835d606e222af163494b Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 16:37:26 +0530 Subject: [PATCH 26/47] fix: add table down migration for MySQL --- ...9379-AddColumnsToOrganizationProjectEmployeeEntity.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index e6b94814704..e0bf3f3a01e 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -344,7 +344,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Drop the 'id' column await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); - // Drop other columns added in the Up migration await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); @@ -358,14 +357,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - // Recreate indices on 'employeeId' and 'organizationProjectId' - await queryRunner.query( - `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` - ); - await queryRunner.query( - `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` - ); - // Add foreign key constraints back await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` From d3ab0690f32e9556c38dfcd0b5af374daf17d250 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 16:56:52 +0530 Subject: [PATCH 27/47] fix: add table down migration for MySQL --- ...509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index e0bf3f3a01e..b8cb744b54b 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -359,10 +359,10 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Add foreign key constraints back await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); } } From 4048c09b02abdd28ee30bfa65beaecb8b27e7b16 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 17:17:41 +0530 Subject: [PATCH 28/47] fix: organization project employee table up/down migration for MySQL --- ...ddColumnsToOrganizationProjectEmployeeEntity.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index b8cb744b54b..584d42654e2 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -289,12 +289,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` - ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); @@ -356,13 +350,5 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); - - // Add foreign key constraints back - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` - ); } } From 1ba19a31b9448ca12eccd09a9b69bcb8b2552da9 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 17:39:18 +0530 Subject: [PATCH 29/47] fix: add table down migration for SQLite --- ...umnsToOrganizationProjectEmployeeEntity.ts | 234 +++++++++++++++++- 1 file changed, 232 insertions(+), 2 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 584d42654e2..22a971b6cd7 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -208,14 +208,244 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * * @param queryRunner */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + } /** * SqliteDB and BetterSQlite3DB Down Migration * * @param queryRunner */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + } /** * MySQL Up Migration From 1076b3d3938af6ab2daf443270bf8a2ab3313558 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 18:28:59 +0530 Subject: [PATCH 30/47] fix: add table upmigration for SQLite --- ...umnsToOrganizationProjectEmployeeEntity.ts | 414 ++++++++---------- 1 file changed, 190 insertions(+), 224 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 22a971b6cd7..db5d6825391 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -204,132 +204,206 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen } /** - * SqliteDB and BetterSQlite3DB Up Migration + * SqliteDB and BetterSQLite3DB Up Migration * * @param queryRunner */ public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` - ); + // Step 1: Drop existing indexes to avoid conflicts during migration + console.log('Step 1: Dropping existing indexes'); + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_2ba868f42c2301075b7c141359"`); + console.log('Dropped index IDX_2ba868f42c2301075b7c141359'); + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_6b5b0c3d994f59d9c800922257"`); + console.log('Dropped index IDX_6b5b0c3d994f59d9c800922257'); + + // Step 2: Create a temporary table with the new schema (without constraints) + console.log('Step 2: Creating temporary table with new schema'); + await queryRunner.query(` + CREATE TABLE "temporary_organization_project_employee" ( + "employeeId" VARCHAR NOT NULL, + "organizationProjectId" VARCHAR NOT NULL, + "deletedAt" DATETIME, + "id" VARCHAR PRIMARY KEY NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT (DATETIME('now')), + "updatedAt" DATETIME NOT NULL DEFAULT (DATETIME('now')), + "isActive" BOOLEAN DEFAULT (1), + "isArchived" BOOLEAN DEFAULT (0), + "archivedAt" DATETIME, + "tenantId" VARCHAR, + "organizationId" VARCHAR, + "isManager" BOOLEAN DEFAULT (0), + "assignedAt" DATETIME, + "roleId" VARCHAR + ) + `); + console.log('Temporary table temporary_organization_project_employee created'); + + // Step 3: Copy data to the temporary table, generating UUIDs for the 'id' column + console.log('Step 3: Copying data to temporary table with generated UUIDs for id column'); + await queryRunner.query(` + INSERT INTO "temporary_organization_project_employee" ( + "employeeId", + "organizationProjectId", + "id" + ) + SELECT + "employeeId", + "organizationProjectId", + LOWER(HEX(RANDOMBLOB(4))) || '-' || + LOWER(HEX(RANDOMBLOB(2))) || '-' || + LOWER(HEX(RANDOMBLOB(2))) || '-' || + LOWER(HEX(RANDOMBLOB(2))) || '-' || + LOWER(HEX(RANDOMBLOB(6))) AS "id" + FROM "organization_project_employee" + `); + console.log('Data copied to temporary table with new UUIDs'); + + // Step 4: Drop the old table + console.log('Step 4: Dropping the old organization_project_employee table'); await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + console.log('Dropped old organization_project_employee table'); + + // Step 5: Rename the temporary table to the original table name + console.log('Step 5: Renaming temporary table to organization_project_employee'); + await queryRunner.query(` + ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee" + `); + console.log('Renamed temporary table to organization_project_employee'); + + // Step 6: Recreate indexes on the new table + console.log('Step 6: Recreating indexes on organization_project_employee'); + await queryRunner.query(` + CREATE INDEX "IDX_2ba868f42c2301075b7c141359" + ON "organization_project_employee" ("organizationProjectId") + `); + console.log('Created index IDX_2ba868f42c2301075b7c141359'); + await queryRunner.query(` + CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" + ON "organization_project_employee" ("employeeId") + `); + console.log('Created index IDX_6b5b0c3d994f59d9c800922257'); + + // Step 7: Create a new temporary table with constraints + console.log('Step 7: Creating a new temporary table with constraints'); + await queryRunner.query(` + CREATE TABLE "temporary_organization_project_employee_with_constraints" ( + "employeeId" VARCHAR NOT NULL, + "organizationProjectId" VARCHAR NOT NULL, + "deletedAt" DATETIME, + "id" VARCHAR PRIMARY KEY NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT (DATETIME('now')), + "updatedAt" DATETIME NOT NULL DEFAULT (DATETIME('now')), + "isActive" BOOLEAN DEFAULT (1), + "isArchived" BOOLEAN DEFAULT (0), + "archivedAt" DATETIME, + "tenantId" VARCHAR, + "organizationId" VARCHAR, + "isManager" BOOLEAN DEFAULT (0), + "assignedAt" DATETIME, + "roleId" VARCHAR, + CONSTRAINT "FK_employee" FOREIGN KEY ("employeeId") + REFERENCES "employee" ("id") ON DELETE CASCADE, + CONSTRAINT "FK_organization_project" FOREIGN KEY ("organizationProjectId") + REFERENCES "organization_project" ("id") ON DELETE CASCADE, + CONSTRAINT "FK_tenant" FOREIGN KEY ("tenantId") + REFERENCES "tenant" ("id") ON DELETE CASCADE, + CONSTRAINT "FK_organization" FOREIGN KEY ("organizationId") + REFERENCES "organization" ("id") ON DELETE CASCADE, + CONSTRAINT "FK_role" FOREIGN KEY ("roleId") + REFERENCES "role" ("id") ON DELETE CASCADE + ) + `); + console.log( + 'Created temporary table temporary_organization_project_employee_with_constraints with foreign key constraints' ); + + // Step 8: Copy data from the current table into the new temporary table + console.log('Step 8: Copying data into the temporary table with constraints'); + await queryRunner.query(` + INSERT INTO "temporary_organization_project_employee_with_constraints" ( + "employeeId", + "organizationProjectId", + "id" + ) + SELECT + "employeeId", + "organizationProjectId", + "id" + FROM "organization_project_employee" + `); + console.log('Data copied into temporary_organization_project_employee_with_constraints'); + + // Step 9: Drop the current table + console.log('Step 9: Dropping the organization_project_employee table'); await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + console.log('Dropped organization_project_employee table'); + + // Step 10: Rename the temporary table to the original table name + console.log( + 'Step 10: Renaming temporary_organization_project_employee_with_constraints to organization_project_employee' ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + await queryRunner.query(` + ALTER TABLE "temporary_organization_project_employee_with_constraints" RENAME TO "organization_project_employee" + `); + console.log( + 'Renamed temporary_organization_project_employee_with_constraints to organization_project_employee' ); + + // Step 11: Recreate indexes on the new table with constraints + console.log('Step 11: Recreating indexes on the new table with constraints'); + await queryRunner.query(` + CREATE INDEX "IDX_2ba868f42c2301075b7c141359" + ON "organization_project_employee" ("organizationProjectId") + `); + console.log('Created index IDX_2ba868f42c2301075b7c141359'); + await queryRunner.query(` + CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" + ON "organization_project_employee" ("employeeId") + `); + console.log('Created index IDX_6b5b0c3d994f59d9c800922257'); + // Recreate any other indexes you require + await queryRunner.query(` + CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" + ON "organization_project_employee" ("isActive") + `); + console.log('Created index IDX_f3d1102a8aa6442cdfce5d57c3'); + + await queryRunner.query(` + CREATE INDEX "IDX_abbe29504bb642647a69959cc0" + ON "organization_project_employee" ("isArchived") + `); + console.log('Created index IDX_abbe29504bb642647a69959cc0'); + + await queryRunner.query(` + CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" + ON "organization_project_employee" ("tenantId") + `); + console.log('Created index IDX_a9abd98013154ec1edfa1ec18c'); + + await queryRunner.query(` + CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" + ON "organization_project_employee" ("organizationId") + `); + console.log('Created index IDX_a77a507b7402f0adb6a6b41e41'); + await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ` CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` ); + console.log('Created index IDX_509be755cdaf837c263ffaa6b6'); + + await queryRunner.query(` + CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" + ON "organization_project_employee" ("assignedAt") + `); + console.log('Created index IDX_25de67f7f3f030438e3ecb1c0e'); + + await queryRunner.query(` + CREATE INDEX "IDX_1c5e006185395a6193ede3456c" + ON "organization_project_employee" ("roleId") + `); + console.log('Created index IDX_1c5e006185395a6193ede3456c'); + + console.log('Migration completed successfully.'); } /** @@ -337,115 +411,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * * @param queryRunner */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, PRIMARY KEY ("employeeId", "organizationProjectId", "id"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY ("employeeId", "organizationProjectId"))` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId") SELECT "employeeId", "organizationProjectId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - } + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} /** * MySQL Up Migration From eb766b751e6946412272184e9e1830bed959b2ce Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 18:43:24 +0530 Subject: [PATCH 31/47] fix: add table upmigration for SQLite --- ...umnsToOrganizationProjectEmployeeEntity.ts | 91 +++++-------------- 1 file changed, 25 insertions(+), 66 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index db5d6825391..7c3fa6c2615 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -212,9 +212,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Step 1: Drop existing indexes to avoid conflicts during migration console.log('Step 1: Dropping existing indexes'); await queryRunner.query(`DROP INDEX IF EXISTS "IDX_2ba868f42c2301075b7c141359"`); - console.log('Dropped index IDX_2ba868f42c2301075b7c141359'); await queryRunner.query(`DROP INDEX IF EXISTS "IDX_6b5b0c3d994f59d9c800922257"`); - console.log('Dropped index IDX_6b5b0c3d994f59d9c800922257'); // Step 2: Create a temporary table with the new schema (without constraints) console.log('Step 2: Creating temporary table with new schema'); @@ -236,7 +234,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen "roleId" VARCHAR ) `); - console.log('Temporary table temporary_organization_project_employee created'); // Step 3: Copy data to the temporary table, generating UUIDs for the 'id' column console.log('Step 3: Copying data to temporary table with generated UUIDs for id column'); @@ -256,19 +253,16 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen LOWER(HEX(RANDOMBLOB(6))) AS "id" FROM "organization_project_employee" `); - console.log('Data copied to temporary table with new UUIDs'); // Step 4: Drop the old table console.log('Step 4: Dropping the old organization_project_employee table'); await queryRunner.query(`DROP TABLE "organization_project_employee"`); - console.log('Dropped old organization_project_employee table'); // Step 5: Rename the temporary table to the original table name console.log('Step 5: Renaming temporary table to organization_project_employee'); await queryRunner.query(` ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee" `); - console.log('Renamed temporary table to organization_project_employee'); // Step 6: Recreate indexes on the new table console.log('Step 6: Recreating indexes on organization_project_employee'); @@ -276,12 +270,10 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") `); - console.log('Created index IDX_2ba868f42c2301075b7c141359'); await queryRunner.query(` CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") `); - console.log('Created index IDX_6b5b0c3d994f59d9c800922257'); // Step 7: Create a new temporary table with constraints console.log('Step 7: Creating a new temporary table with constraints'); @@ -313,9 +305,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen REFERENCES "role" ("id") ON DELETE CASCADE ) `); - console.log( - 'Created temporary table temporary_organization_project_employee_with_constraints with foreign key constraints' - ); // Step 8: Copy data from the current table into the new temporary table console.log('Step 8: Copying data into the temporary table with constraints'); @@ -331,12 +320,10 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen "id" FROM "organization_project_employee" `); - console.log('Data copied into temporary_organization_project_employee_with_constraints'); // Step 9: Drop the current table console.log('Step 9: Dropping the organization_project_employee table'); await queryRunner.query(`DROP TABLE "organization_project_employee"`); - console.log('Dropped organization_project_employee table'); // Step 10: Rename the temporary table to the original table name console.log( @@ -345,65 +332,37 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(` ALTER TABLE "temporary_organization_project_employee_with_constraints" RENAME TO "organization_project_employee" `); - console.log( - 'Renamed temporary_organization_project_employee_with_constraints to organization_project_employee' - ); // Step 11: Recreate indexes on the new table with constraints console.log('Step 11: Recreating indexes on the new table with constraints'); - await queryRunner.query(` - CREATE INDEX "IDX_2ba868f42c2301075b7c141359" - ON "organization_project_employee" ("organizationProjectId") - `); - console.log('Created index IDX_2ba868f42c2301075b7c141359'); - await queryRunner.query(` - CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" - ON "organization_project_employee" ("employeeId") - `); - console.log('Created index IDX_6b5b0c3d994f59d9c800922257'); + await queryRunner.query( + ` CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + ` CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); // Recreate any other indexes you require - await queryRunner.query(` - CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" - ON "organization_project_employee" ("isActive") - `); - console.log('Created index IDX_f3d1102a8aa6442cdfce5d57c3'); - - await queryRunner.query(` - CREATE INDEX "IDX_abbe29504bb642647a69959cc0" - ON "organization_project_employee" ("isArchived") - `); - console.log('Created index IDX_abbe29504bb642647a69959cc0'); - - await queryRunner.query(` - CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" - ON "organization_project_employee" ("tenantId") - `); - console.log('Created index IDX_a9abd98013154ec1edfa1ec18c'); - - await queryRunner.query(` - CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" - ON "organization_project_employee" ("organizationId") - `); - console.log('Created index IDX_a77a507b7402f0adb6a6b41e41'); - await queryRunner.query( - ` CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId")` ); - console.log('Created index IDX_509be755cdaf837c263ffaa6b6'); - - await queryRunner.query(` - CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" - ON "organization_project_employee" ("assignedAt") - `); - console.log('Created index IDX_25de67f7f3f030438e3ecb1c0e'); - - await queryRunner.query(` - CREATE INDEX "IDX_1c5e006185395a6193ede3456c" - ON "organization_project_employee" ("roleId") - `); - console.log('Created index IDX_1c5e006185395a6193ede3456c'); - - console.log('Migration completed successfully.'); } /** From 7be3e8cd423bbebe483873cd62a03eb29f915e3b Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 18:50:51 +0530 Subject: [PATCH 32/47] fix: add table down migration for SQLite --- ...umnsToOrganizationProjectEmployeeEntity.ts | 89 +++++++++++++++---- 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 7c3fa6c2615..562c76983e9 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -260,20 +260,18 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Step 5: Rename the temporary table to the original table name console.log('Step 5: Renaming temporary table to organization_project_employee'); - await queryRunner.query(` - ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee" - `); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); // Step 6: Recreate indexes on the new table console.log('Step 6: Recreating indexes on organization_project_employee'); - await queryRunner.query(` - CREATE INDEX "IDX_2ba868f42c2301075b7c141359" - ON "organization_project_employee" ("organizationProjectId") - `); - await queryRunner.query(` - CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" - ON "organization_project_employee" ("employeeId") - `); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId")` + ); // Step 7: Create a new temporary table with constraints console.log('Step 7: Creating a new temporary table with constraints'); @@ -336,10 +334,10 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Step 11: Recreate indexes on the new table with constraints console.log('Step 11: Recreating indexes on the new table with constraints'); await queryRunner.query( - ` CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId")` ); await queryRunner.query( - ` CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId")` ); // Recreate any other indexes you require await queryRunner.query( @@ -366,11 +364,69 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen } /** - * SqliteDB and BetterSQlite3DB Down Migration + * SqliteDB and BetterSQLite3DB Down Migration * * @param queryRunner */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise {} + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + // Step 1: Drop indexes related to new columns + console.log('Step 1: Dropping indexes related to new columns'); + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_1c5e006185395a6193ede3456c"`); // index on "roleId" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_25de67f7f3f030438e3ecb1c0e"`); // index on "assignedAt" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_509be755cdaf837c263ffaa6b6"`); // index on "isManager" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_a77a507b7402f0adb6a6b41e41"`); // index on "organizationId" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_a9abd98013154ec1edfa1ec18c"`); // index on "tenantId" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_abbe29504bb642647a69959cc0"`); // index on "isArchived" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_f3d1102a8aa6442cdfce5d57c3"`); // index on "isActive" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_6b5b0c3d994f59d9c800922257"`); // index on "employeeId" + await queryRunner.query(`DROP INDEX IF EXISTS "IDX_2ba868f42c2301075b7c141359"`); // index on "organizationProjectId" + + // Step 2: Create a temporary table with the original schema + console.log('Step 2: Creating temporary table with original schema'); + await queryRunner.query(` + CREATE TABLE "temporary_organization_project_employee" ( + "employeeId" VARCHAR NOT NULL, + "organizationProjectId" VARCHAR NOT NULL, + CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") + REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") + REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + PRIMARY KEY ("employeeId", "organizationProjectId") + ) + `); + + // Step 3: Copy data from the current table to the temporary table, selecting only the original columns + console.log('Step 3: Copying data to temporary table'); + await queryRunner.query(` + INSERT INTO "temporary_organization_project_employee" ( + "employeeId", + "organizationProjectId" + ) + SELECT + "employeeId", "organizationProjectId" + FROM + "organization_project_employee" + `); + + // Step 4: Drop the current table + console.log('Step 4: Dropping the current organization_project_employee table'); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + + // Step 5: Rename the temporary table to the original table name + console.log('Step 5: Renaming temporary table to organization_project_employee'); + await queryRunner.query(` + ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee" + `); + + // Step 6: Recreate indexes on the original columns + console.log('Step 6: Recreating indexes on the original columns'); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId")` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId")` + ); + } /** * MySQL Up Migration @@ -491,9 +547,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` ); - // Drop the 'id' column - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); // Drop other columns added in the Up migration + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); From 3f708a4f0802b29ddc5bb5e66944ec45f72052fe Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 17 Sep 2024 22:29:30 +0530 Subject: [PATCH 33/47] fix: updated tenant & organization filter --- .../handlers/organization-contact-create.handler.ts | 10 +++++++--- .../src/lib/components/avatar/avatar.component.ts | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts b/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts index a134af71c03..2edf43764a8 100644 --- a/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts +++ b/packages/core/src/organization-contact/commands/handlers/organization-contact-create.handler.ts @@ -34,7 +34,7 @@ export class OrganizationContactCreateHandler implements ICommandHandler project.id); - // Fetch projects with members + // Retrieve projects with specified IDs, belonging to the given organization and tenant. const projects = await this._organizationProjectService.find({ where: { id: In(projectIds), @@ -66,7 +66,8 @@ export class OrganizationContactCreateHandler implements ICommandHandler Date: Wed, 18 Sep 2024 15:33:22 +0530 Subject: [PATCH 34/47] fix: modify table up/down migration for MySQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 137 ++++++++++++++---- .../organization-project-employee.entity.ts | 2 - 2 files changed, 105 insertions(+), 34 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 562c76983e9..e2d51a864b2 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -434,15 +434,40 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - // Add new columns + // Step 1: Drop foreign keys + console.log('Step 1: Dropping foreign keys...'); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + + // Step 2: Drop indexes + console.log('Step 2: Dropping indexes...'); + await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); + await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); + + // Step 3: Add new columns + console.log('Step 3: Adding new columns...'); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); + + // Step 4: Modify primary keys and add timestamps + console.log('Step 4: Modifying primary keys and adding timestamps...'); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` ); + + // Step 5: Add more status and management-related columns + console.log('Step 5: Adding status and management-related columns...'); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` ); @@ -460,17 +485,25 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`assignedAt\` datetime NULL`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); - // Populate the 'id' column with UUIDs for existing records - await queryRunner.query(`UPDATE \`organization_project_employee\` SET \`id\` = UUID() WHERE \`id\` IS NULL`); - - // Alter the 'id' column to be NOT NULL - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` MODIFY \`id\` varchar(36) NOT NULL`); - - // Drop and recreate primary keys + // Step 6: Adjust primary key, drop and re-add organizationProjectId, employeeId + console.log('Step 6: Adjusting primary key and modifying columns organizationProjectId and employeeId...'); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + ); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` + ); - // Re-create indices + // Step 7: Recreate indexes + console.log('Step 7: Recreating indexes...'); await queryRunner.query( `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` ); @@ -493,16 +526,25 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` ); - // Add foreign key constraints back + // Step 8: Recreate foreign keys + console.log('Step 8: Recreating foreign keys...'); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a77a507b7402f0adb6a6b41e412\` FOREIGN KEY (\`organizationId\`) REFERENCES \`organization\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` + ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); + + console.log('Migration completed.'); } /** @@ -511,10 +553,17 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise { - // Drop foreign key constraints that depend on columns or constraints we're about to modify + // Step 1: Drop existing foreign keys + console.log('Step 1: Dropping existing foreign keys...'); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_1c5e006185395a6193ede3456c6\`` ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` + ); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a77a507b7402f0adb6a6b41e412\`` ); @@ -522,7 +571,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_a9abd98013154ec1edfa1ec18cd\`` ); - // Drop indices + // Step 2: Drop existing indexes + console.log('Step 2: Dropping existing indexes...'); await queryRunner.query(`DROP INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_25de67f7f3f030438e3ecb1c0e\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_509be755cdaf837c263ffaa6b6\` ON \`organization_project_employee\``); @@ -531,34 +581,57 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`DROP INDEX \`IDX_abbe29504bb642647a69959cc0\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\``); - // Drop primary key constraint + // Step 3: Modify columns and primary keys + console.log('Step 3: Modifying columns and primary keys...'); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(36) NOT NULL` + ); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - - // Modify 'employeeId' and 'organizationProjectId' columns back to their original definitions await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`employeeId\` varchar(36) NOT NULL` + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` MODIFY \`organizationProjectId\` varchar(36) NOT NULL` + `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(36) NOT NULL` ); - - // Add composite primary key + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` + ); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`)` ); - - // Drop other columns added in the Up migration await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`id\``); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`deletedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`createdAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`updatedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isActive\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isArchived\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`archivedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`tenantId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationId\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`isManager\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`assignedAt\``); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`roleId\``); + + // Step 4: Recreate original indexes + console.log('Step 4: Recreating original indexes...'); + await queryRunner.query( + `CREATE INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\` (\`organizationProjectId\`)` + ); + await queryRunner.query( + `CREATE INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\` (\`employeeId\`)` + ); + + // Step 5: Recreate original foreign keys + console.log('Step 5: Recreating original foreign keys...'); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_6b5b0c3d994f59d9c800922257f\` FOREIGN KEY (\`employeeId\`) REFERENCES \`employee\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_2ba868f42c2301075b7c141359e\` FOREIGN KEY (\`organizationProjectId\`) REFERENCES \`organization_project\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE` + ); } } diff --git a/packages/core/src/organization-project/organization-project-employee.entity.ts b/packages/core/src/organization-project/organization-project-employee.entity.ts index 15fa58aa1ca..96bf2b6cfc2 100644 --- a/packages/core/src/organization-project/organization-project-employee.entity.ts +++ b/packages/core/src/organization-project/organization-project-employee.entity.ts @@ -45,7 +45,6 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im @IsNotEmpty() @IsUUID() @RelationId((it: OrganizationProjectEmployee) => it.organizationProject) - @ColumnIndex() @MultiORMColumn({ relationId: true }) organizationProjectId: ID; @@ -62,7 +61,6 @@ export class OrganizationProjectEmployee extends TenantOrganizationBaseEntity im @IsNotEmpty() @IsUUID() @RelationId((it: OrganizationProjectEmployee) => it.employee) - @ColumnIndex() @MultiORMColumn({ relationId: true }) employeeId?: ID; From 076b095aa07e815581c59c46bee507774f7b65cf Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 18 Sep 2024 16:43:04 +0530 Subject: [PATCH 35/47] fix: modify table up migration for MySQL --- ...umnsToOrganizationProjectEmployeeEntity.ts | 87 +++++++++---------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index e2d51a864b2..e4394f25c46 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -434,7 +434,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise { - // Step 1: Drop foreign keys + // Step 1: Drop existing foreign keys console.log('Step 1: Dropping foreign keys...'); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_2ba868f42c2301075b7c141359e\`` @@ -443,39 +443,16 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `ALTER TABLE \`organization_project_employee\` DROP FOREIGN KEY \`FK_6b5b0c3d994f59d9c800922257f\`` ); - // Step 2: Drop indexes - console.log('Step 2: Dropping indexes...'); + // Step 2: Drop existing indexes that might conflict with column modifications + console.log('Step 2: Dropping existing indexes...'); await queryRunner.query(`DROP INDEX \`IDX_6b5b0c3d994f59d9c800922257\` ON \`organization_project_employee\``); await queryRunner.query(`DROP INDEX \`IDX_2ba868f42c2301075b7c141359\` ON \`organization_project_employee\``); - // Step 3: Add new columns + // Step 3: Add new columns (deletedAt, tenantId, archivedAt, etc.) console.log('Step 3: Adding new columns...'); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`deletedAt\` datetime(6) NULL`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NOT NULL`); - - // Step 4: Modify primary keys and add timestamps - console.log('Step 4: Modifying primary keys and adding timestamps...'); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`organizationProjectId\`, \`id\`)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` - ); - - // Step 5: Add more status and management-related columns - console.log('Step 5: Adding status and management-related columns...'); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` - ); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` - ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`tenantId\` varchar(255) NULL`); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`archivedAt\` datetime NULL`); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD \`organizationId\` varchar(255) NULL` ); @@ -484,26 +461,50 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen ); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`assignedAt\` datetime NULL`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`roleId\` varchar(255) NULL`); - - // Step 6: Adjust primary key, drop and re-add organizationProjectId, employeeId - console.log('Step 6: Adjusting primary key and modifying columns organizationProjectId and employeeId...'); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`employeeId\`, \`id\`)` + `ALTER TABLE \`organization_project_employee\` ADD \`isActive\` tinyint NULL DEFAULT 1` ); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`organizationProjectId\``); await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`organizationProjectId\` varchar(255) NOT NULL` + `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` ); + + // Step 4: Add 'id' column as nullable to allow old records to remain valid + console.log('Step 4: Adding nullable id column...'); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); + + // Step 5: Generate UUIDs for existing records + console.log('Step 5: Generating UUIDs for existing records...'); + await queryRunner.query(`UPDATE \`organization_project_employee\` SET \`id\` = (UUID()) WHERE \`id\` IS NULL`); + + // Step 5: Generate unique UUIDs for each existing record + console.log('Step 5: Generating unique UUIDs for existing records...'); + + // Fetch records where id is null + const records = await queryRunner.query( + `SELECT \`employeeId\`, \`organizationProjectId\` FROM \`organization_project_employee\` WHERE \`id\` IS NULL` + ); + // Loop through each record and assign a unique UUID + for await (const { employeeId, organizationProjectId } of records) { + // Update the record with the generated UUID + await queryRunner.query( + `UPDATE \`organization_project_employee\` + SET \`id\` = (UUID()) + WHERE \`employeeId\` = '${employeeId}' + AND \`organizationProjectId\` = '${organizationProjectId}'` + ); + } + + // Step 6: Alter 'id' column to NOT NULL after populating with UUIDs + console.log('Step 6: Setting id column to NOT NULL...'); + await queryRunner.query(`ALTER TABLE \`organization_project_employee\` MODIFY \`id\` varchar(36) NOT NULL`); + + // Step 7: Make 'id' the only primary key + console.log('Step 7: Setting id as the only primary key...'); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP PRIMARY KEY`); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD PRIMARY KEY (\`id\`)`); - await queryRunner.query(`ALTER TABLE \`organization_project_employee\` DROP COLUMN \`employeeId\``); - await queryRunner.query( - `ALTER TABLE \`organization_project_employee\` ADD \`employeeId\` varchar(255) NOT NULL` - ); - // Step 7: Recreate indexes - console.log('Step 7: Recreating indexes...'); + // Step 8: Recreate indexes on new columns + console.log('Step 8: Recreating indexes on new columns...'); await queryRunner.query( `CREATE INDEX \`IDX_f3d1102a8aa6442cdfce5d57c3\` ON \`organization_project_employee\` (\`isActive\`)` ); @@ -526,7 +527,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `CREATE INDEX \`IDX_1c5e006185395a6193ede3456c\` ON \`organization_project_employee\` (\`roleId\`)` ); - // Step 8: Recreate foreign keys + // Step 9: Recreate foreign keys console.log('Step 8: Recreating foreign keys...'); await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_a9abd98013154ec1edfa1ec18cd\` FOREIGN KEY (\`tenantId\`) REFERENCES \`tenant\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` @@ -543,8 +544,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD CONSTRAINT \`FK_1c5e006185395a6193ede3456c6\` FOREIGN KEY (\`roleId\`) REFERENCES \`role\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION` ); - - console.log('Migration completed.'); } /** From 38399b690fb99c88277ff865d45b1daf60c94df4 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 18 Sep 2024 16:58:39 +0530 Subject: [PATCH 36/47] fix: modify table up migration for MySQL --- ...9379-AddColumnsToOrganizationProjectEmployeeEntity.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index e4394f25c46..dbffc8aa1cf 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -472,10 +472,6 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen console.log('Step 4: Adding nullable id column...'); await queryRunner.query(`ALTER TABLE \`organization_project_employee\` ADD \`id\` varchar(36) NULL`); - // Step 5: Generate UUIDs for existing records - console.log('Step 5: Generating UUIDs for existing records...'); - await queryRunner.query(`UPDATE \`organization_project_employee\` SET \`id\` = (UUID()) WHERE \`id\` IS NULL`); - // Step 5: Generate unique UUIDs for each existing record console.log('Step 5: Generating unique UUIDs for existing records...'); @@ -483,7 +479,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen const records = await queryRunner.query( `SELECT \`employeeId\`, \`organizationProjectId\` FROM \`organization_project_employee\` WHERE \`id\` IS NULL` ); - // Loop through each record and assign a unique UUID + console.log('Retrieved records: ', JSON.stringify(records)); + + // Loop through each record and assign a unique UUID to the id column for await (const { employeeId, organizationProjectId } of records) { // Update the record with the generated UUID await queryRunner.query( @@ -492,6 +490,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen WHERE \`employeeId\` = '${employeeId}' AND \`organizationProjectId\` = '${organizationProjectId}'` ); + console.log(`Assigned UUID to ${employeeId}, ${organizationProjectId}`); } // Step 6: Alter 'id' column to NOT NULL after populating with UUIDs From 4f692a924fb4e104fe5f2b16b3f7823aec6ecb15 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 18 Sep 2024 18:43:56 +0530 Subject: [PATCH 37/47] feat: alter organization project employee table migration for sqlite --- ...-AlterOrganizationProjectEmployeeEntity.ts | 349 ++++++++++++++++++ 1 file changed, 349 insertions(+) create mode 100644 packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts diff --git a/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts new file mode 100644 index 00000000000..a11c8507e34 --- /dev/null +++ b/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts @@ -0,0 +1,349 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { yellow } from 'chalk'; +import { DatabaseTypeEnum } from '@gauzy/config'; + +export class AlterOrganizationProjectEmployeeEntity1726664754860 implements MigrationInterface { + name = 'AlterOrganizationProjectEmployeeEntity1726664754860'; + + /** + * Up Migration + * + * @param queryRunner + */ + public async up(queryRunner: QueryRunner): Promise { + console.log(yellow(this.name + ' start running!')); + + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresUpQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlUpQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * Down Migration + * + * @param queryRunner + */ + public async down(queryRunner: QueryRunner): Promise { + switch (queryRunner.connection.options.type) { + case DatabaseTypeEnum.sqlite: + case DatabaseTypeEnum.betterSqlite3: + await this.sqliteDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.postgres: + await this.postgresDownQueryRunner(queryRunner); + break; + case DatabaseTypeEnum.mysql: + await this.mysqlDownQueryRunner(queryRunner); + break; + default: + throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); + } + } + + /** + * PostgresDB Up Migration + * + * @param queryRunner + */ + public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * PostgresDB Down Migration + * + * @param queryRunner + */ + public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * SqliteDB and BetterSQlite3DB Up Migration + * + * @param queryRunner + */ + public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query( + `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "organization_project_employee"`); + await queryRunner.query( + `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + } + + /** + * SqliteDB and BetterSQlite3DB Down Migration + * + * @param queryRunner + */ + public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); + await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); + await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); + await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); + await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); + await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); + await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); + await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); + await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); + await queryRunner.query( + `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` + ); + await queryRunner.query( + `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` + ); + await queryRunner.query( + `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` + ); + await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); + await queryRunner.query( + `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` + ); + await queryRunner.query( + `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` + ); + } + + /** + * MySQL Up Migration + * + * @param queryRunner + */ + public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} + + /** + * MySQL Down Migration + * + * @param queryRunner + */ + public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} +} From aae4ceb0dc5adc9aee8c17b448e9513fbb060c7f Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 18 Sep 2024 19:00:54 +0530 Subject: [PATCH 38/47] fix: logging for postgres --- ...umnsToOrganizationProjectEmployeeEntity.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index dbffc8aa1cf..00751d5a82a 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -57,22 +57,33 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise { + // Step 1: Drop existing foreign keys + console.log('Step 1: Dropping existing foreign keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_2ba868f42c2301075b7c141359e"` ); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f"` ); + + // Step 2: Add new columns + console.log('Step 2: Adding new columns (deletedAt, tenantId, archivedAt, etc.)...'); await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "deletedAt" TIMESTAMP`); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD "id" uuid NOT NULL DEFAULT gen_random_uuid()` ); + + // Step 3: Modify primary keys + console.log('Step 3: Modifying primary keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4"` ); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` ); + + // Step 4: Add timestamps and status columns + console.log('Step 4: Adding timestamps and status columns...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()` ); @@ -87,6 +98,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "isManager" boolean DEFAULT false`); await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "assignedAt" TIMESTAMP`); await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); + + // Step 5: Modify primary keys again + console.log('Step 5: Modifying primary keys again...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` ); @@ -99,6 +113,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` ); + + // Step 6: Create new indexes + console.log('Step 6: Creating new indexes...'); await queryRunner.query( `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` ); @@ -120,6 +137,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` ); + + // Step 7: Recreate foreign keys + console.log('Step 7: Recreating foreign keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` ); @@ -135,6 +155,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role"("id") ON DELETE CASCADE ON UPDATE NO ACTION` ); + + console.log('PostgresDB Up Migration completed.'); } /** @@ -143,6 +165,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen * @param queryRunner */ public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise { + // Step 1: Drop foreign keys + console.log('Step 1: Dropping foreign keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_1c5e006185395a6193ede3456c6"` ); @@ -158,6 +182,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd"` ); + + // Step 2: Drop indexes + console.log('Step 2: Dropping indexes...'); await queryRunner.query(`DROP INDEX "public"."IDX_1c5e006185395a6193ede3456c"`); await queryRunner.query(`DROP INDEX "public"."IDX_25de67f7f3f030438e3ecb1c0e"`); await queryRunner.query(`DROP INDEX "public"."IDX_509be755cdaf837c263ffaa6b6"`); @@ -165,6 +192,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`DROP INDEX "public"."IDX_a9abd98013154ec1edfa1ec18c"`); await queryRunner.query(`DROP INDEX "public"."IDX_abbe29504bb642647a69959cc0"`); await queryRunner.query(`DROP INDEX "public"."IDX_f3d1102a8aa6442cdfce5d57c3"`); + + // Step 3: Modify primary keys and constraints + console.log('Step 3: Modifying primary keys and constraints...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_cb8069ff5917c90adbc48139147"` ); @@ -177,6 +207,9 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36" PRIMARY KEY ("employeeId", "organizationProjectId", "id")` ); + + // Step 4: Drop newly added columns + console.log('Step 4: Dropping newly added columns...'); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "roleId"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "assignedAt"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isManager"`); @@ -187,14 +220,22 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "isActive"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "updatedAt"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "createdAt"`); + + // Step 5: Restore original primary key constraint + console.log('Step 5: Restoring original primary key constraint...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` ); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_5be2464327d74ba4e2b2240aac4" PRIMARY KEY ("employeeId", "organizationProjectId")` ); + + console.log('Step 6: Dropping newly added columns...'); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "id"`); await queryRunner.query(`ALTER TABLE "organization_project_employee" DROP COLUMN "deletedAt"`); + + // Step 6: Recreate original foreign keys + console.log('Step 7: Recreating original foreign keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee"("id") ON DELETE CASCADE ON UPDATE CASCADE` ); From 376fb82c225f2bb56b3d12aa22a298be732e40cf Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Thu, 19 Sep 2024 15:18:50 +0530 Subject: [PATCH 39/47] fix: organization project members seeder --- .../core/src/core/seeds/seed-data.service.ts | 970 ++++-------------- .../organization-project.seed.ts | 356 ++++--- packages/core/src/tags/tag.seed.ts | 83 +- 3 files changed, 458 insertions(+), 951 deletions(-) diff --git a/packages/core/src/core/seeds/seed-data.service.ts b/packages/core/src/core/seeds/seed-data.service.ts index a5323fc8e4c..6c955219354 100644 --- a/packages/core/src/core/seeds/seed-data.service.ts +++ b/packages/core/src/core/seeds/seed-data.service.ts @@ -10,19 +10,8 @@ import { DataSource, DataSourceOptions } from 'typeorm'; import * as chalk from 'chalk'; import * as moment from 'moment'; import { environment as env, ConfigService, DatabaseTypeEnum } from '@gauzy/config'; -import { - IEmployee, - IOrganization, - IOrganizationProject, - IRole, - ITenant, - IUser, -} from '@gauzy/contracts'; -import { - getPluginModules, - hasLifecycleMethod, - PluginLifecycleMethods, -} from '@gauzy/plugin'; +import { IEmployee, IOrganization, IOrganizationProject, IRole, ITenant, IUser } from '@gauzy/contracts'; +import { getPluginModules, hasLifecycleMethod, PluginLifecycleMethods } from '@gauzy/plugin'; import { createRoles } from '../../role/role.seed'; import { createDefaultSkills } from '../../skills/skill.seed'; import { createLanguages } from '../../language/language.seed'; @@ -31,219 +20,158 @@ import { createDefaultEmployeesUsers, createDefaultUsers, createRandomSuperAdminUsers, - createRandomUsers, + createRandomUsers } from '../../user/user.seed'; -import { - createDefaultEmployees, - createRandomEmployees, -} from '../../employee/employee.seed'; +import { createDefaultEmployees, createRandomEmployees } from '../../employee/employee.seed'; import { createDefaultOrganizations, createRandomOrganizations, DEFAULT_EVER_ORGANIZATIONS, - DEFAULT_ORGANIZATIONS, + DEFAULT_ORGANIZATIONS } from '../../organization'; -import { - createDefaultIncomes, - createRandomIncomes, -} from '../../income/income.seed'; -import { - createDefaultExpenses, - createRandomExpenses, -} from '../../expense/expense.seed'; +import { createDefaultIncomes, createRandomIncomes } from '../../income/income.seed'; +import { createDefaultExpenses, createRandomExpenses } from '../../expense/expense.seed'; import { createDefaultUsersOrganizations, - createRandomUsersOrganizations, + createRandomUsersOrganizations } from '../../user-organization/user-organization.seed'; import { createCountries } from '../../country/country.seed'; -import { - createDefaultTeams, - createRandomTeam, -} from '../../organization-team/organization-team.seed'; +import { createDefaultTeams, createRandomTeam } from '../../organization-team/organization-team.seed'; import { createRolePermissions } from '../../role-permission/role-permission.seed'; -import { - createDefaultTenant, - createRandomTenants, - DEFAULT_EVER_TENANT, - DEFAULT_TENANT, -} from '../../tenant'; +import { createDefaultTenant, createRandomTenants, DEFAULT_EVER_TENANT, DEFAULT_TENANT } from '../../tenant'; import { createDefaultTenantSetting } from './../../tenant/tenant-setting/tenant-setting.seed'; import { createDefaultEmailTemplates } from '../../email-template/email-template.seed'; import { seedDefaultEmploymentTypes, - seedRandomEmploymentTypes, + seedRandomEmploymentTypes } from '../../organization-employment-type/organization-employment-type.seed'; import { createEmployeeLevels } from '../../employee-level/employee-level.seed'; -import { - createDefaultTimeOffPolicy, - createRandomTimeOffPolicies, -} from '../../time-off-policy/time-off-policy.seed'; +import { createDefaultTimeOffPolicy, createRandomTimeOffPolicies } from '../../time-off-policy/time-off-policy.seed'; import { createDefaultApprovalPolicyForOrg, - createRandomApprovalPolicyForOrg, + createRandomApprovalPolicyForOrg } from '../../approval-policy/approval-policy.seed'; import { createExpenseCategories, - createRandomExpenseCategories, + createRandomExpenseCategories } from '../../expense-categories/expense-categories.seed'; import { createOrganizationVendors, - createRandomOrganizationVendors, + createRandomOrganizationVendors } from '../../organization-vendor/organization-vendor.seed'; -import { - createDefaultCandidates, - createRandomCandidates, -} from '../../candidate/candidate.seed'; -import { - createCandidateSources, - createRandomCandidateSources, -} from '../../candidate-source/candidate-source.seed'; +import { createDefaultCandidates, createRandomCandidates } from '../../candidate/candidate.seed'; +import { createCandidateSources, createRandomCandidateSources } from '../../candidate-source/candidate-source.seed'; import { createDefaultIntegrationTypes } from '../../integration/integration-type.seed'; import { createDefaultIntegrations } from '../../integration/integration.seed'; -import { - createDefaultProducts, - createRandomProduct, -} from '../../product/product.seed'; +import { createDefaultProducts, createRandomProduct } from '../../product/product.seed'; import { createCandidateDocuments, - createRandomCandidateDocuments, + createRandomCandidateDocuments } from '../../candidate-documents/candidate-documents.seed'; import { createCandidateFeedbacks, - createRandomCandidateFeedbacks, + createRandomCandidateFeedbacks } from '../../candidate-feedbacks/candidate-feedbacks.seed'; -import { - createDefaultTimeSheet, - createRandomTimesheet, -} from './../../time-tracking/timesheet/timesheet.seed'; +import { createDefaultTimeSheet, createRandomTimesheet } from './../../time-tracking/timesheet/timesheet.seed'; import { createDefaultTask, createRandomTask } from '../../tasks/task.seed'; import { createDefaultOrganizationProjects, - createRandomOrganizationProjects, + createRandomOrganizationProjects } from '../../organization-project/organization-project.seed'; import { createDefaultTimeFrames } from '../../goal-time-frame/goal-time-frame.seed'; -import { - createDefaultGoals, - createRandomGoal, - updateDefaultGoalProgress, -} from '../../goal/goal.seed'; +import { createDefaultGoals, createRandomGoal, updateDefaultGoalProgress } from '../../goal/goal.seed'; import { createDefaultKeyResults, createRandomKeyResult, - updateDefaultKeyResultProgress, + updateDefaultKeyResultProgress } from '../../keyresult/keyresult.seed'; import { createDefaultKeyResultUpdates } from '../../keyresult-update/keyresult-update.seed'; import { seedRandomOrganizationDepartments, - createDefaultOrganizationDepartments, + createDefaultOrganizationDepartments } from '../../organization-department/organization-department.seed'; import { seedDefaultOrganizationPosition, - seedRandomOrganizationPosition, + seedRandomOrganizationPosition } from '../../organization-position/organization-position.seed'; +import { createDefaultTags, createRandomOrganizationTags, createTags } from '../../tags/tag.seed'; +import { createDefaultEmailSent, createRandomEmailSent } from '../../email-history/email-history.seed'; +import { createDefaultEmployeeInviteSent, createRandomEmployeeInviteSent } from '../../invite/invite.seed'; import { - createDefaultTags, - createRandomOrganizationTags, - createTags, -} from '../../tags/tag.seed'; -import { - createDefaultEmailSent, - createRandomEmailSent, -} from '../../email-history/email-history.seed'; -import { - createDefaultEmployeeInviteSent, - createRandomEmployeeInviteSent, -} from '../../invite/invite.seed'; -import { createDefaultRequestApprovalEmployee, createRandomRequestApproval } from '../../request-approval/request-approval.seed'; + createDefaultRequestApprovalEmployee, + createRandomRequestApproval +} from '../../request-approval/request-approval.seed'; import { createDefaultEmployeeTimeOff, - createRandomEmployeeTimeOff, + createRandomEmployeeTimeOff } from '../../time-off-request/time-off-request.seed'; import { createOrganizationDocuments, - createRandomOrganizationDocuments, + createRandomOrganizationDocuments } from '../../organization-document/organization-document.seed'; -import { - createDefaultEquipments, - createRandomEquipments, -} from '../../equipment/equipment.seed'; +import { createDefaultEquipments, createRandomEquipments } from '../../equipment/equipment.seed'; import { createDefaultEquipmentSharing, - createRandomEquipmentSharing, + createRandomEquipmentSharing } from '../../equipment-sharing/equipment-sharing.seed'; -import { - createDefaultInvoiceItem, - createRandomInvoiceItem, -} from '../../invoice-item/invoice-item.seed'; -import { - createDefaultInvoice, - createRandomInvoice, -} from '../../invoice/invoice.seed'; -import { - createCandidateSkills, - createRandomCandidateSkills, -} from '../../candidate-skill/candidate-skill.seed'; +import { createDefaultInvoiceItem, createRandomInvoiceItem } from '../../invoice-item/invoice-item.seed'; +import { createDefaultInvoice, createRandomInvoice } from '../../invoice/invoice.seed'; +import { createCandidateSkills, createRandomCandidateSkills } from '../../candidate-skill/candidate-skill.seed'; import { createRandomCandidateExperience } from '../../candidate-experience/candidate-experience.seed'; import { createCandidateEducations, - createRandomCandidateEducations, + createRandomCandidateEducations } from '../../candidate-education/candidate-education.seed'; import { createRandomContacts } from '../../contact/contact.seed'; import { createDefaultOrganizationContact, - createRandomOrganizationContact, + createRandomOrganizationContact } from '../../organization-contact/organization-contact.seed'; import { createDefaultAvailabilitySlots, - createRandomAvailabilitySlots, + createRandomAvailabilitySlots } from '../../availability-slots/availability-slots.seed'; import { createDefaultCandidatePersonalQualities, - createRandomCandidatePersonalQualities, + createRandomCandidatePersonalQualities } from '../../candidate-personal-qualities/candidate-personal-qualities.seed'; import { createDefaultCandidateTechnologies, - createRandomCandidateTechnologies, + createRandomCandidateTechnologies } from '../../candidate-technologies/candidate-technologies.seed'; import { createDefaultCandidateInterview, - createRandomCandidateInterview, + createRandomCandidateInterview } from '../../candidate-interview/candidate-interview.seed'; -import { - createDefaultAwards, - createRandomAwards, -} from '../../organization-award/organization-award.seed'; +import { createDefaultAwards, createRandomAwards } from '../../organization-award/organization-award.seed'; import { createDefaultGeneralGoalSetting } from '../../goal-general-setting/goal-general-setting.seed'; import { createDefaultCandidateCriterionRating, - createRandomCandidateCriterionRating, + createRandomCandidateCriterionRating } from '../../candidate-criterions-rating/candidate-criterion-rating.seed'; import { createDefaultGoalKpi } from '../../goal-kpi/goal-kpi.seed'; import { createRandomEmployeeSetting } from '../../employee-setting/employee-setting.seed'; import { createRandomEmployeeRecurringExpense } from '../../employee-recurring-expense/employee-recurring-expense.seed'; import { createDefaultCandidateInterviewers, - createRandomCandidateInterviewers, + createRandomCandidateInterviewers } from '../../candidate-interviewers/candidate-interviewers.seed'; import { createRandomPipelineStage } from '../../pipeline-stage/pipeline-stage.seed'; -import { - createDefaultPipeline, - createRandomPipeline, -} from '../../pipeline/pipeline.seed'; +import { createDefaultPipeline, createRandomPipeline } from '../../pipeline/pipeline.seed'; import { createDefaultOrganizationRecurringExpense, - createRandomOrganizationRecurringExpense, + createRandomOrganizationRecurringExpense } from '../../organization-recurring-expense/organization-recurring-expense.seed'; import { createDefaultOrganizationLanguage, - createRandomOrganizationLanguage, + createRandomOrganizationLanguage } from '../../organization-language/organization-language.seed'; import { createRandomOrganizationSprint } from '../../organization-sprint/organization-sprint.seed'; import { createRandomOrganizationTeamEmployee } from '../../organization-team-employee/organization-team-employee.seed'; import { createRandomAppointmentEmployees } from '../../appointment-employees/appointment-employees.seed'; import { createDefaultEmployeeAppointment, - createRandomEmployeeAppointment, + createRandomEmployeeAppointment } from '../../employee-appointment/employee-appointment.seed'; import { createRandomDeal } from '../../deal/deal.seed'; import { createRandomIntegrationSetting } from '../../integration-setting/integration-setting.seed'; @@ -253,53 +181,29 @@ import { createRandomIntegrationEntitySetting } from '../../integration-entity-s import { createRandomIntegrationEntitySettingTied } from '../../integration-entity-setting-tied/integration-entity-setting-tied.seed'; import { createRandomRequestApprovalTeam } from '../../request-approval-team/request-approval-team.seed'; import { createRandomRequestApprovalEmployee } from '../../request-approval-employee/request-approval-employee.seed'; -import { - createDefaultPayment, - createRandomPayment, -} from '../../payment/payment.seed'; -import { - createDefaultEventTypes, - createRandomEventType, -} from '../../event-types/event-type.seed'; +import { createDefaultPayment, createRandomPayment } from '../../payment/payment.seed'; +import { createDefaultEventTypes, createRandomEventType } from '../../event-types/event-type.seed'; import { createDefaultEquipmentSharingPolicy, - createRandomEquipmentSharingPolicy, + createRandomEquipmentSharingPolicy } from '../../equipment-sharing-policy/equipment-sharing-policy.seed'; -import { - createRandomProductOption, - createRandomProductOptionGroups, -} from '../../product-option/product-option.seed'; +import { createRandomProductOption, createRandomProductOptionGroups } from '../../product-option/product-option.seed'; import { createRandomProductVariantSettings } from '../../product-setting/product-setting.seed'; import { createRandomProductVariant } from '../../product-variant/product-variant.seed'; import { createRandomProductVariantPrice } from '../../product-variant-price/product-variant-price.seed'; -import { - createCategories, - createRandomProductCategories, -} from '../../product-category/category.seed'; -import { - createDefaultProductType, - createRandomProductType, -} from '../../product-type/type.seed'; +import { createCategories, createRandomProductCategories } from '../../product-category/category.seed'; +import { createDefaultProductType, createRandomProductType } from '../../product-type/type.seed'; import { createDefaultGoalTemplates } from '../../goal-template/goal-template.seed'; import { createDefaultKeyResultTemplates } from '../../keyresult-template/keyresult-template.seed'; import { createDefaultEmployeeAwards } from '../../employee-award/employee-award.seed'; import { createDefaultGoalKpiTemplate } from '../../goal-kpi-template/goal-kpi-template.seed'; import { randomSeedConfig } from './random-seed-config'; -import { - createDefaultReport, - createRandomTenantOrganizationsReport, -} from '../../reports/report.seed'; +import { createDefaultReport, createRandomTenantOrganizationsReport } from '../../reports/report.seed'; import { createCurrencies } from '../../currency/currency.seed'; -import { - createDefaultFeatureToggle, - createRandomFeatureToggle, -} from '../../feature/feature.seed'; +import { createDefaultFeatureToggle, createRandomFeatureToggle } from '../../feature/feature.seed'; import { createDefaultAccountingTemplates } from './../../accounting-template/accounting-template.seed'; import { DEFAULT_EMPLOYEES, DEFAULT_EVER_EMPLOYEES } from './../../employee'; -import { - createRandomMerchants, - createDefaultMerchants, -} from './../../merchant/merchant.seed'; +import { createRandomMerchants, createDefaultMerchants } from './../../merchant/merchant.seed'; import { createRandomWarehouses } from './../../warehouse/warehouse.seed'; import { createDefaultStatuses } from './../../tasks/statuses/status.seed'; import { createDefaultPriorities } from './../../tasks/priorities/priority.seed'; @@ -310,12 +214,11 @@ import { getDBType } from './../../core/utils'; export enum SeederTypeEnum { ALL = 'all', EVER = 'ever', - DEFAULT = 'default', + DEFAULT = 'default' } @Injectable() export class SeedDataService { - dataSource: DataSource; log = console.log; @@ -335,10 +238,7 @@ export class SeedDataService { randomTenantOrganizationsMap: Map; randomOrganizationEmployeesMap: Map; - constructor( - private readonly moduleRef: ModuleRef, - private readonly configService: ConfigService - ) { } + constructor(private readonly moduleRef: ModuleRef, private readonly configService: ConfigService) {} /** * This config is applied only for `yarn seed:*` type calls because @@ -346,7 +246,7 @@ export class SeedDataService { */ overrideDbConfig = { logging: 'all', - logger: 'file', //Removes console logging, instead logs all queries in a file ormlogs.log + logger: 'file' //Removes console logging, instead logs all queries in a file ormlogs.log // dropSchema: !env.production //Drops the schema each time connection is being established in development mode. }; @@ -504,28 +404,14 @@ export class SeedDataService { */ private async seedReportsData() { try { - this.log( - chalk.green( - `🌱 SEEDING ${env.production ? 'PRODUCTION' : '' - } REPORTS DATABASE...` - ) - ); + this.log(chalk.green(`🌱 SEEDING ${env.production ? 'PRODUCTION' : ''} REPORTS DATABASE...`)); await this.tryExecute( 'Default Report Category & Report', - createDefaultReport( - this.dataSource, - this.configService.config, - this.tenant - ) + createDefaultReport(this.dataSource, this.configService.config, this.tenant) ); - this.log( - chalk.green( - `✅ SEEDED ${env.production ? 'PRODUCTION' : '' - } REPORTS DATABASE` - ) - ); + this.log(chalk.green(`✅ SEEDED ${env.production ? 'PRODUCTION' : ''} REPORTS DATABASE`)); } catch (error) { this.handleError(error); } @@ -546,12 +432,7 @@ export class SeedDataService { * Populate Database with Basic Default Data */ private async seedBasicDefaultData() { - this.log( - chalk.magenta( - `🌱 SEEDING BASIC ${env.production ? 'PRODUCTION' : '' - } DATABASE...` - ) - ); + this.log(chalk.magenta(`🌱 SEEDING BASIC ${env.production ? 'PRODUCTION' : ''} DATABASE...`)); // Seed data which only needs connection await this.tryExecute('Countries', createCountries(this.dataSource)); @@ -569,14 +450,8 @@ export class SeedDataService { await this.tryExecute('Issue Types', createDefaultIssueTypes(this.dataSource)); // default and internal tenant - const tenantName = - this.seedType !== SeederTypeEnum.DEFAULT - ? DEFAULT_EVER_TENANT - : DEFAULT_TENANT; - this.tenant = (await this.tryExecute( - 'Tenant', - createDefaultTenant(this.dataSource, tenantName) - )) as ITenant; + const tenantName = this.seedType !== SeederTypeEnum.DEFAULT ? DEFAULT_EVER_TENANT : DEFAULT_TENANT; + this.tenant = (await this.tryExecute('Tenant', createDefaultTenant(this.dataSource, tenantName))) as ITenant; this.roles = await createRoles(this.dataSource, [this.tenant]); @@ -586,84 +461,50 @@ export class SeedDataService { // Tenant level inserts which only need connection, tenant, roles const organizations = - this.seedType !== SeederTypeEnum.DEFAULT - ? DEFAULT_EVER_ORGANIZATIONS - : DEFAULT_ORGANIZATIONS; + this.seedType !== SeederTypeEnum.DEFAULT ? DEFAULT_EVER_ORGANIZATIONS : DEFAULT_ORGANIZATIONS; this.organizations = (await this.tryExecute( 'Organizations', - createDefaultOrganizations( - this.dataSource, - this.tenant, - organizations - ) + createDefaultOrganizations(this.dataSource, this.tenant, organizations) )) as IOrganization[]; // default organization set as main organization - this.defaultOrganization = this.organizations.find( - (organization: IOrganization) => organization.isDefault - ); + this.defaultOrganization = this.organizations.find((organization: IOrganization) => organization.isDefault); await this.tryExecute( 'Default Feature Toggle', - createDefaultFeatureToggle( - this.dataSource, - this.configService.config, - this.tenant - ) + createDefaultFeatureToggle(this.dataSource, this.configService.config, this.tenant) ); - await this.tryExecute( - 'Default Email Templates', - createDefaultEmailTemplates(this.dataSource) - ); + await this.tryExecute('Default Email Templates', createDefaultEmailTemplates(this.dataSource)); - await this.tryExecute( - 'Default Accounting Templates', - createDefaultAccountingTemplates(this.dataSource) - ); + await this.tryExecute('Default Accounting Templates', createDefaultAccountingTemplates(this.dataSource)); - await this.tryExecute( - 'Skills', - createDefaultSkills( - this.dataSource, - this.tenant, - this.defaultOrganization - ) - ); - - const { defaultSuperAdminUsers, defaultAdminUsers } = - await createDefaultAdminUsers(this.dataSource, this.tenant); - this.superAdminUsers.push(...(defaultSuperAdminUsers as IUser[])); + await this.tryExecute('Skills', createDefaultSkills(this.dataSource, this.tenant, this.defaultOrganization)); - const { defaultEmployeeUsers } = await createDefaultEmployeesUsers( + const { defaultSuperAdminUsers, defaultAdminUsers } = await createDefaultAdminUsers( this.dataSource, this.tenant ); + this.superAdminUsers.push(...(defaultSuperAdminUsers as IUser[])); + + const { defaultEmployeeUsers } = await createDefaultEmployeesUsers(this.dataSource, this.tenant); if (this.seedType !== SeederTypeEnum.DEFAULT) { - const { defaultEverEmployeeUsers, defaultCandidateUsers } = await createDefaultUsers(this.dataSource, this.tenant); + const { defaultEverEmployeeUsers, defaultCandidateUsers } = await createDefaultUsers( + this.dataSource, + this.tenant + ); this.defaultCandidateUsers.push(...defaultCandidateUsers); defaultEmployeeUsers.push(...defaultEverEmployeeUsers); } - const defaultUsers = [ - ...this.superAdminUsers, - ...defaultAdminUsers, - ...defaultEmployeeUsers, - ]; + const defaultUsers = [...this.superAdminUsers, ...defaultAdminUsers, ...defaultEmployeeUsers]; await this.tryExecute( 'Users', - createDefaultUsersOrganizations( - this.dataSource, - this.tenant, - this.organizations, - defaultUsers - ) + createDefaultUsersOrganizations(this.dataSource, this.tenant, this.organizations, defaultUsers) ); - const allDefaultEmployees = DEFAULT_EMPLOYEES.concat( - DEFAULT_EVER_EMPLOYEES - ); + const allDefaultEmployees = DEFAULT_EMPLOYEES.concat(DEFAULT_EVER_EMPLOYEES); //User level data that needs dataSource, tenant, organization, role, users this.defaultEmployees = await createDefaultEmployees( this.dataSource, @@ -675,29 +516,17 @@ export class SeedDataService { await this.tryExecute( 'Default General Goal Setting', - createDefaultGeneralGoalSetting( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultGeneralGoalSetting(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Goal Template', - createDefaultGoalTemplates( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultGoalTemplates(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( 'Default Goal KPI Template', - createDefaultGoalKpiTemplate( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultGoalKpiTemplate(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( @@ -707,12 +536,7 @@ export class SeedDataService { await this.tryExecute( 'Default Time Off Policy', - createDefaultTimeOffPolicy( - this.dataSource, - this.tenant, - this.defaultOrganization, - this.defaultEmployees - ) + createDefaultTimeOffPolicy(this.dataSource, this.tenant, this.defaultOrganization, this.defaultEmployees) ); // seed default integrations with types @@ -721,18 +545,11 @@ export class SeedDataService { createDefaultIntegrationTypes(this.dataSource) ); - await this.tryExecute( - 'Default Integrations', - createDefaultIntegrations(this.dataSource, integrationTypes) - ); + await this.tryExecute('Default Integrations', createDefaultIntegrations(this.dataSource, integrationTypes)); await this.tryExecute( 'Default Event Types', - createDefaultEventTypes( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultEventTypes(this.dataSource, this.tenant, this.organizations) ); // run all plugins random seed method @@ -741,75 +558,42 @@ export class SeedDataService { console.log(chalk.green(`SEEDED Basic Plugin [${pluginName}]`)); }); - this.log( - chalk.magenta( - `✅ SEEDED BASIC ${env.production ? 'PRODUCTION' : ''} DATABASE` - ) - ); + this.log(chalk.magenta(`✅ SEEDED BASIC ${env.production ? 'PRODUCTION' : ''} DATABASE`)); } /** * Populate default data for default tenant */ private async seedDefaultData() { - this.log( - chalk.magenta( - `🌱 SEEDING DEFAULT ${env.production ? 'PRODUCTION' : '' - } DATABASE...` - ) - ); + this.log(chalk.magenta(`🌱 SEEDING DEFAULT ${env.production ? 'PRODUCTION' : ''} DATABASE...`)); await this.tryExecute( 'Default Employee Invite', - createDefaultEmployeeInviteSent( - this.dataSource, - this.tenant, - this.organizations, - this.superAdminUsers - ) + createDefaultEmployeeInviteSent(this.dataSource, this.tenant, this.organizations, this.superAdminUsers) ); - await this.tryExecute( - 'Default Tags', - createDefaultTags(this.dataSource, this.tenant, this.organizations) - ); + await this.tryExecute('Default Tags', createDefaultTags(this.dataSource, this.tenant, this.organizations)); // Organization level inserts which need connection, tenant, role, organizations const categories = await this.tryExecute( 'Default Expense Categories', - createExpenseCategories( - this.dataSource, - this.tenant, - this.organizations - ) + createExpenseCategories(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Employee Levels', - createEmployeeLevels( - this.dataSource, - this.tenant, - this.organizations - ) + createEmployeeLevels(this.dataSource, this.tenant, this.organizations) ); // TODO: needs to fix error of seeding Product Category await this.tryExecute( 'Default Product Categories', - createCategories( - this.dataSource, - this.tenant, - this.organizations - ) + createCategories(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Product Types', - createDefaultProductType( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultProductType(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( @@ -824,134 +608,73 @@ export class SeedDataService { await this.tryExecute( 'Default Organization Contacts', - createDefaultOrganizationContact( - this.dataSource, - this.tenant, - randomSeedConfig.noOfContactsPerOrganization - ) + createDefaultOrganizationContact(this.dataSource, this.tenant, randomSeedConfig.noOfContactsPerOrganization) ); // Employee level data that need connection, tenant, organization, role, users, employee await this.tryExecute( 'Default Teams', - createDefaultTeams( - this.dataSource, - this.defaultOrganization, - this.defaultEmployees, - this.roles - ) + createDefaultTeams(this.dataSource, this.defaultOrganization, this.defaultEmployees, this.roles) ); this.defaultProjects = await this.tryExecute( 'Default Organization Projects', - createDefaultOrganizationProjects( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultOrganizationProjects(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( 'Default Projects Task', - createDefaultTask( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultTask(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( 'Default Organization Departments', - createDefaultOrganizationDepartments( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultOrganizationDepartments(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Products', - createDefaultProducts( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultProducts(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( 'Default Merchants', - createDefaultMerchants( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultMerchants(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Time Frames', - createDefaultTimeFrames( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultTimeFrames(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Equipments', - createDefaultEquipments( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultEquipments(this.dataSource, this.tenant, this.defaultOrganization) ); const organizationVendors = await this.tryExecute( 'Default Organization Vendors', - createOrganizationVendors( - this.dataSource, - this.tenant, - this.organizations - ) + createOrganizationVendors(this.dataSource, this.tenant, this.organizations) ); const defaultCandidates = await this.tryExecute( 'Default Candidates', - createDefaultCandidates( - this.dataSource, - this.tenant, - this.defaultOrganization, - this.defaultCandidateUsers - ) + createDefaultCandidates(this.dataSource, this.tenant, this.defaultOrganization, this.defaultCandidateUsers) ); await this.tryExecute( 'Default Candidate Sources', - createCandidateSources( - this.dataSource, - this.tenant, - defaultCandidates, - this.defaultOrganization - ) + createCandidateSources(this.dataSource, this.tenant, defaultCandidates, this.defaultOrganization) ); await this.tryExecute( 'Default Candidate Documents', - createCandidateDocuments( - this.dataSource, - this.tenant, - defaultCandidates, - this.defaultOrganization - ) + createCandidateDocuments(this.dataSource, this.tenant, defaultCandidates, this.defaultOrganization) ); await this.tryExecute( 'Default Candidate Interview', - createDefaultCandidateInterview( - this.dataSource, - this.tenant, - this.defaultOrganization, - defaultCandidates - ) + createDefaultCandidateInterview(this.dataSource, this.tenant, this.defaultOrganization, defaultCandidates) ); await this.tryExecute( @@ -967,41 +690,22 @@ export class SeedDataService { await this.tryExecute( 'Default Candidate Feedbacks', - createCandidateFeedbacks( - this.dataSource, - this.tenant, - this.defaultOrganization, - defaultCandidates - ) + createCandidateFeedbacks(this.dataSource, this.tenant, this.defaultOrganization, defaultCandidates) ); await this.tryExecute( 'Default Candidate Educations', - createCandidateEducations( - this.dataSource, - this.tenant, - defaultCandidates - ) + createCandidateEducations(this.dataSource, this.tenant, defaultCandidates) ); await this.tryExecute( 'Default Candidate Skills', - createCandidateSkills( - this.dataSource, - this.tenant, - defaultCandidates, - this.defaultOrganization - ) + createCandidateSkills(this.dataSource, this.tenant, defaultCandidates, this.defaultOrganization) ); await this.tryExecute( 'Default Incomes', - createDefaultIncomes( - this.dataSource, - this.tenant, - [this.defaultOrganization], - this.defaultEmployees - ) + createDefaultIncomes(this.dataSource, this.tenant, [this.defaultOrganization], this.defaultEmployees) ); await this.tryExecute( @@ -1018,118 +722,64 @@ export class SeedDataService { await this.tryExecute( 'Default Employment Types', - seedDefaultEmploymentTypes( - this.dataSource, - this.tenant, - this.defaultEmployees, - this.defaultOrganization - ) + seedDefaultEmploymentTypes(this.dataSource, this.tenant, this.defaultEmployees, this.defaultOrganization) ); await this.tryExecute( 'Default Goal KPIs', - createDefaultGoalKpi( - this.dataSource, - this.tenant, - this.organizations, - this.defaultEmployees - ) + createDefaultGoalKpi(this.dataSource, this.tenant, this.organizations, this.defaultEmployees) ); const goals = await this.tryExecute( 'Default Goals', - createDefaultGoals( - this.dataSource, - this.tenant, - this.organizations, - this.defaultEmployees - ) + createDefaultGoals(this.dataSource, this.tenant, this.organizations, this.defaultEmployees) ); const keyResults = await this.tryExecute( 'Default Key Results', - createDefaultKeyResults( - this.dataSource, - this.tenant, - this.defaultEmployees, - goals - ) + createDefaultKeyResults(this.dataSource, this.tenant, this.defaultEmployees, goals) ); await this.tryExecute( 'Default Key Result Updates', - createDefaultKeyResultUpdates( - this.dataSource, - this.tenant, - this.defaultOrganization, - keyResults - ) + createDefaultKeyResultUpdates(this.dataSource, this.tenant, this.defaultOrganization, keyResults) ); - await this.tryExecute( - 'Default Key Result Progress', - updateDefaultKeyResultProgress(this.dataSource) - ); + await this.tryExecute('Default Key Result Progress', updateDefaultKeyResultProgress(this.dataSource)); - await this.tryExecute( - 'Default Goal Progress', - updateDefaultGoalProgress(this.dataSource) - ); + await this.tryExecute('Default Goal Progress', updateDefaultGoalProgress(this.dataSource)); const approvalPolicies = await this.tryExecute( 'Default Approval Policies', createDefaultApprovalPolicyForOrg(this.dataSource, { - orgs: this.organizations, + orgs: this.organizations }) ); - await this.tryExecute( 'Default Request Approval Employee', - createDefaultRequestApprovalEmployee( - this.dataSource, - { - employees: this.defaultEmployees, - orgs: this.organizations, - approvalPolicies - } - ) + createDefaultRequestApprovalEmployee(this.dataSource, { + employees: this.defaultEmployees, + orgs: this.organizations, + approvalPolicies + }) ); await this.tryExecute( 'Default Equipment Sharing Policies', - createDefaultEquipmentSharingPolicy( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultEquipmentSharingPolicy(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( 'Default Organization Languages', - createDefaultOrganizationLanguage( - this.dataSource, - this.tenant, - this.organizations - ) + createDefaultOrganizationLanguage(this.dataSource, this.tenant, this.organizations) ); - await this.tryExecute( - 'Default Awards', - createDefaultAwards( - this.dataSource, - this.tenant, - this.organizations - ) - ); + await this.tryExecute('Default Awards', createDefaultAwards(this.dataSource, this.tenant, this.organizations)); await this.tryExecute( 'Default Employee Awards', - createDefaultEmployeeAwards( - this.dataSource, - this.tenant, - this.defaultEmployees[0] - ) + createDefaultEmployeeAwards(this.dataSource, this.tenant, this.defaultEmployees[0]) ); await this.tryExecute( @@ -1154,21 +804,12 @@ export class SeedDataService { await this.tryExecute( 'Default Payment', - createDefaultPayment( - this.dataSource, - this.tenant, - this.defaultEmployees, - this.organizations - ) + createDefaultPayment(this.dataSource, this.tenant, this.defaultEmployees, this.organizations) ); await this.tryExecute( 'Default Pipelines', - createDefaultPipeline( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultPipeline(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( @@ -1183,20 +824,12 @@ export class SeedDataService { await this.tryExecute( 'Default Organization Position', - seedDefaultOrganizationPosition( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + seedDefaultOrganizationPosition(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( 'Default Organization Documents', - createOrganizationDocuments( - this.dataSource, - this.tenant, - this.organizations - ) + createOrganizationDocuments(this.dataSource, this.tenant, this.organizations) ); await this.tryExecute( @@ -1253,11 +886,7 @@ export class SeedDataService { await this.tryExecute( 'Default Organization Recurring Expense', - createDefaultOrganizationRecurringExpense( - this.dataSource, - this.tenant, - this.defaultOrganization - ) + createDefaultOrganizationRecurringExpense(this.dataSource, this.tenant, this.defaultOrganization) ); await this.tryExecute( @@ -1298,32 +927,19 @@ export class SeedDataService { console.log(chalk.green(`SEEDED Default Plugin [${pluginName}]`)); }); - this.log( - chalk.magenta( - `✅ SEEDED DEFAULT ${env.production ? 'PRODUCTION' : '' - } DATABASE` - ) - ); + this.log(chalk.magenta(`✅ SEEDED DEFAULT ${env.production ? 'PRODUCTION' : ''} DATABASE`)); } /** * Populate database with random generated data */ private async seedRandomData() { - this.log( - chalk.magenta( - `🌱 SEEDING RANDOM ${env.production ? 'PRODUCTION' : '' - } DATABASE...` - ) - ); + this.log(chalk.magenta(`🌱 SEEDING RANDOM ${env.production ? 'PRODUCTION' : ''} DATABASE...`)); await this.tryExecute('Random Tags', createTags(this.dataSource)); // Platform level data which only need database connection - this.randomTenants = await createRandomTenants( - this.dataSource, - randomSeedConfig.tenants || 1 - ); + this.randomTenants = await createRandomTenants(this.dataSource, randomSeedConfig.tenants || 1); await this.tryExecute( 'Random Tenant Settings', @@ -1335,10 +951,7 @@ export class SeedDataService { createRandomTenantOrganizationsReport(this.dataSource, this.randomTenants) ); - await this.tryExecute( - 'Random Feature Toggle', - createRandomFeatureToggle(this.dataSource, this.randomTenants) - ); + await this.tryExecute('Random Feature Toggle', createRandomFeatureToggle(this.dataSource, this.randomTenants)); // Independent roles and role permissions for each tenant const roles: IRole[] = await createRoles(this.dataSource, this.randomTenants); @@ -1355,11 +968,7 @@ export class SeedDataService { randomSeedConfig.organizationsPerTenant || 1 ); - const tenantSuperAdminsMap = await createRandomSuperAdminUsers( - this.dataSource, - this.randomTenants, - 1 - ); + const tenantSuperAdminsMap = await createRandomSuperAdminUsers(this.dataSource, this.randomTenants, 1); const tenantUsersMap = await createRandomUsers( this.dataSource, @@ -1393,47 +1002,27 @@ export class SeedDataService { const tags = await this.tryExecute( 'Random Organization Tags', - createRandomOrganizationTags( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomOrganizationTags(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Organization Documents', - createRandomOrganizationDocuments( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomOrganizationDocuments(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Product Categories', - createRandomProductCategories( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomProductCategories(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Product Types', - createRandomProductType( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomProductType(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Products', - createRandomProduct( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomProduct(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1468,38 +1057,22 @@ export class SeedDataService { await this.tryExecute( 'Random Product Variant Prices', - createRandomProductVariantPrice( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomProductVariantPrice(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Warehouses', - createRandomWarehouses( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomWarehouses(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Merchants', - createRandomMerchants( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomMerchants(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Product Variant Settings', - createRandomProductVariantSettings( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomProductVariantSettings(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1557,65 +1130,37 @@ export class SeedDataService { await this.tryExecute( 'Random Candidate Sources', - createRandomCandidateSources( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateSources(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Documents', - createRandomCandidateDocuments( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateDocuments(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Experiences', - createRandomCandidateExperience( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateExperience(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Skills', - createRandomCandidateSkills( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateSkills(this.dataSource, this.randomTenants, tenantCandidatesMap) ); const organizationVendorsMap = await this.tryExecute( 'Random Organization Vendors', - createRandomOrganizationVendors( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomOrganizationVendors(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Time Off Policies', - createRandomTimeOffPolicies( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomTimeOffPolicies(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); const categoriesMap = await this.tryExecute( 'Random Expense Categories', - createRandomExpenseCategories( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomExpenseCategories(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1632,11 +1177,7 @@ export class SeedDataService { await this.tryExecute( 'Random Equipments', - createRandomEquipments( - this.dataSource, - this.randomTenants, - randomSeedConfig.equipmentPerTenant || 20 - ) + createRandomEquipments(this.dataSource, this.randomTenants, randomSeedConfig.equipmentPerTenant || 20) ); await this.tryExecute( @@ -1652,20 +1193,12 @@ export class SeedDataService { await this.tryExecute( 'Random Employment Types', - seedRandomEmploymentTypes( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + seedRandomEmploymentTypes(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Organization Departments', - seedRandomOrganizationDepartments( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + seedRandomOrganizationDepartments(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1681,29 +1214,17 @@ export class SeedDataService { await this.tryExecute( 'Random Organization Positions', - seedRandomOrganizationPosition( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + seedRandomOrganizationPosition(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Approval Policies', - createRandomApprovalPolicyForOrg( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomApprovalPolicyForOrg(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Equipment Sharing Policies', - createRandomEquipmentSharingPolicy( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomEquipmentSharingPolicy(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1723,7 +1244,7 @@ export class SeedDataService { this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap, - tags, + tags || [], randomSeedConfig.projectsPerOrganization || 10 ) ); @@ -1749,10 +1270,7 @@ export class SeedDataService { ) ); - await this.tryExecute( - 'Random Tasks', - createRandomTask(this.dataSource, this.randomTenants) - ); + await this.tryExecute('Random Tasks', createRandomTask(this.dataSource, this.randomTenants)); await this.tryExecute( 'Random Organization Contacts', @@ -1806,47 +1324,27 @@ export class SeedDataService { await this.tryExecute( 'Random Candidate Educations', - createRandomCandidateEducations( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateEducations(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Interviews', - createRandomCandidateInterview( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateInterview(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Technologies', - createRandomCandidateTechnologies( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateTechnologies(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Candidate Personal Qualities', - createRandomCandidatePersonalQualities( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidatePersonalQualities(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( 'Random Awards', - createRandomAwards( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomAwards(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1862,11 +1360,7 @@ export class SeedDataService { await this.tryExecute( 'Random Candidate Feedbacks', - createRandomCandidateFeedbacks( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateFeedbacks(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( @@ -1891,11 +1385,7 @@ export class SeedDataService { await this.tryExecute( 'Random Organization Languages', - createRandomOrganizationLanguage( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomOrganizationLanguage(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1909,11 +1399,7 @@ export class SeedDataService { await this.tryExecute( 'Random Organization Sprints', - createRandomOrganizationSprint( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomOrganizationSprint(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -1948,20 +1434,12 @@ export class SeedDataService { await this.tryExecute( 'Random Pipelines', - createRandomPipeline( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomPipeline(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Pipeline Stages', - createRandomPipelineStage( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomPipelineStage(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( @@ -2011,20 +1489,12 @@ export class SeedDataService { await this.tryExecute( 'Random Request Approval Team', - createRandomRequestApprovalTeam( - this.dataSource, - this.randomTenants, - this.randomTenantOrganizationsMap - ) + createRandomRequestApprovalTeam(this.dataSource, this.randomTenants, this.randomTenantOrganizationsMap) ); await this.tryExecute( 'Random Candidate Criterion Ratings', - createRandomCandidateCriterionRating( - this.dataSource, - this.randomTenants, - tenantCandidatesMap - ) + createRandomCandidateCriterionRating(this.dataSource, this.randomTenants, tenantCandidatesMap) ); await this.tryExecute( @@ -2039,11 +1509,7 @@ export class SeedDataService { await this.tryExecute( 'Random TimeSheets', - createRandomTimesheet( - this.dataSource, - this.configService.config, - this.randomTenants - ) + createRandomTimesheet(this.dataSource, this.configService.config, this.randomTenants) ); // run all plugins random seed method @@ -2052,12 +1518,7 @@ export class SeedDataService { console.log(chalk.green(`SEEDED Random Plugin [${pluginName}]`)); }); - this.log( - chalk.magenta( - `✅ SEEDED RANDOM ${env.production ? 'PRODUCTION' : '' - } DATABASE` - ) - ); + this.log(chalk.magenta(`✅ SEEDED RANDOM ${env.production ? 'PRODUCTION' : ''} DATABASE`)); } /** @@ -2069,10 +1530,7 @@ export class SeedDataService { await new Promise((resolve) => { const assetOptions = this.configService.assetOptions; const dir = env.isElectron - ? path.join( - path.resolve(env.gauzyUserPath, ...['public']), - 'screenshots' - ) + ? path.join(path.resolve(env.gauzyUserPath, ...['public']), 'screenshots') : path.join(assetOptions.assetPublicPath, 'screenshots'); // delete old generated screenshots @@ -2088,9 +1546,7 @@ export class SeedDataService { */ private async createConnection() { if (!this.dataSource) { - this.log( - 'NOTE: DATABASE CONNECTION DOES NOT EXIST YET. NEW ONE WILL BE CREATED!' - ); + this.log('NOTE: DATABASE CONNECTION DOES NOT EXIST YET. NEW ONE WILL BE CREATED!'); } const { dbConnectionOptions } = this.configService; if (!this.dataSource || !this.dataSource.isInitialized) { @@ -2098,10 +1554,10 @@ export class SeedDataService { this.log(chalk.green(`CONNECTING TO DATABASE...`)); const options = { ...dbConnectionOptions, - ...this.overrideDbConfig, + ...this.overrideDbConfig }; const dataSource = new DataSource({ - ...options, + ...options } as DataSourceOptions); if (!dataSource.isInitialized) { @@ -2124,9 +1580,7 @@ export class SeedDataService { this.log(chalk.green(`✅ DISCONNECTED TO DATABASE!`)); } } catch (error) { - this.log( - 'NOTE: DATABASE CONNECTION DOES NOT EXIST YET. CANT CLOSE CONNECTION!' - ); + this.log('NOTE: DATABASE CONNECTION DOES NOT EXIST YET. CANT CLOSE CONNECTION!'); } } @@ -2151,7 +1605,7 @@ export class SeedDataService { this.dataSource.entityMetadatas.forEach((entity) => entities.push({ name: entity.name, - tableName: entity.tableName, + tableName: entity.tableName }) ); return entities; @@ -2171,21 +1625,15 @@ export class SeedDataService { switch (databaseType) { case DatabaseTypeEnum.postgres: - const tables = entities.map( - (entity) => '"' + entity.tableName + '"' - ); - const truncateSql = `TRUNCATE TABLE ${tables.join( - ',' - )} RESTART IDENTITY CASCADE;`; + const tables = entities.map((entity) => '"' + entity.tableName + '"'); + const truncateSql = `TRUNCATE TABLE ${tables.join(',')} RESTART IDENTITY CASCADE;`; await manager.query(truncateSql); break; case DatabaseTypeEnum.mysql: // -- disable foreign_key_checks to avoid query failing when there is a foreign key in the table await manager.query(`SET foreign_key_checks = 0;`); for (const entity of entities) { - await manager.query( - `DELETE FROM \`${entity.tableName}\`;` - ); + await manager.query(`DELETE FROM \`${entity.tableName}\`;`); } await manager.query(`SET foreign_key_checks = 1;`); break; @@ -2193,10 +1641,8 @@ export class SeedDataService { case DatabaseTypeEnum.betterSqlite3: await manager.query(`PRAGMA foreign_keys = OFF;`); for (const entity of entities) { - await manager.query( - `DELETE FROM "${entity.tableName}";` - ); - }; + await manager.query(`DELETE FROM "${entity.tableName}";`); + } break; default: throw Error(`Unsupported database type: ${databaseType}`); @@ -2238,35 +1684,19 @@ export class SeedDataService { * Use this wrapper function for all seed functions which are not essential. * Essentials seeds are ONLY those which are required to start the UI/login */ - public tryExecute( - name: string, - p: Promise - ): Promise | Promise { - this.log( - chalk.green( - `${moment().format('DD.MM.YYYY HH:mm:ss')} SEEDING ${name}` - ) - ); + public tryExecute(name: string, p: Promise): Promise | Promise { + this.log(chalk.green(`${moment().format('DD.MM.YYYY HH:mm:ss')} SEEDING ${name}`)); return (p as any).then( (x: T) => x, (error: Error) => { - this.log( - chalk.bgRed( - `🛑 ERROR: ${error ? error.message : 'unknown'}` - ) - ); + this.log(chalk.bgRed(`🛑 ERROR: ${error ? error.message : 'unknown'}`)); } ); } private handleError(error: Error, message?: string): void { - this.log( - chalk.bgRed( - `🛑 ERROR: ${message ? message + '-> ' : ''} ${error ? error.message : '' - }` - ) - ); + this.log(chalk.bgRed(`🛑 ERROR: ${message ? message + '-> ' : ''} ${error ? error.message : ''}`)); throw error; } } diff --git a/packages/core/src/organization-project/organization-project.seed.ts b/packages/core/src/organization-project/organization-project.seed.ts index 6a6f59336c1..bea5a285757 100644 --- a/packages/core/src/organization-project/organization-project.seed.ts +++ b/packages/core/src/organization-project/organization-project.seed.ts @@ -1,216 +1,280 @@ import { DataSource } from 'typeorm'; import { faker } from '@faker-js/faker'; import { chain } from 'underscore'; -import { OrganizationProject } from './organization-project.entity'; import { IOrganization, IOrganizationProject, - ITag, ITenant, OrganizationProjectBudgetTypeEnum, TaskListTypeEnum, TaskStatusEnum } from '@gauzy/contracts'; +import { DatabaseTypeEnum } from '@gauzy/config'; import { DEFAULT_ORGANIZATION_PROJECTS } from './default-organization-projects'; -import { Employee, OrganizationContact, Tag } from './../core/entities/internal'; -import { prepareSQLQuery as p } from './../database/database.helper'; +import { Employee, OrganizationContact, OrganizationProjectEmployee, Tag } from './../core/entities/internal'; +import { OrganizationProject } from './organization-project.entity'; +import { prepareSQLQuery as p } from '../database/database.helper'; +import { replacePlaceholders } from '../core/utils'; +/** + * Creates default organization projects, assigns them to employees, and seeds project member counts. + * + * @param dataSource - The TypeORM data source instance for database operations. + * @param tenant - The tenant information. + * @param organization - The organization information. + * @returns A promise that resolves to an array of created organization projects. + */ export const createDefaultOrganizationProjects = async ( dataSource: DataSource, tenant: ITenant, organization: IOrganization ): Promise => { - const { id: tenantId } = tenant; - const { id: organizationId } = organization; - - const tag = await dataSource.getRepository(Tag).save({ - name: 'Web', - description: '', - color: faker.color.human() - }); - - const projects: IOrganizationProject[] = []; - for (let index = 0; index < DEFAULT_ORGANIZATION_PROJECTS.length; index++) { - const name = DEFAULT_ORGANIZATION_PROJECTS[index]; + const { id: organizationId, tenantId } = organization; + + try { + // Create and save the Tag + const tags = await dataSource.getRepository(Tag).save([ + { + name: 'Web', + description: '', + color: faker.color.human() + }, + { + name: 'API', + description: '', + color: faker.color.human() + } + ]); + + // Fetch all OrganizationContacts once to avoid redundant queries const organizationContacts = await dataSource.manager.findBy(OrganizationContact, { tenantId, organizationId }); - const project = new OrganizationProject(); - project.tags = [tag]; - project.name = name; - project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); - project.organizationContact = faker.helpers.arrayElement(organizationContacts); - project.organization = organization; - project.tenant = tenant; - project.budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); - project.budget = - project.budgetType == OrganizationProjectBudgetTypeEnum.COST - ? faker.number.int({ min: 500, max: 5000 }) - : faker.number.int({ min: 40, max: 400 }); - project.taskListType = faker.helpers.arrayElement(Object.values(TaskListTypeEnum)); - // TODO: this seed creates default projects without tenantId. - projects.push(project); + + if (organizationContacts.length === 0) { + console.warn( + `No OrganizationContacts found for tenantId: ${tenantId} and organizationId: ${organizationId}` + ); + } + + // Define a mapping between Budget Types and their respective min and max values + const budgetRanges: Record = { + [OrganizationProjectBudgetTypeEnum.COST]: { min: 500, max: 5000 }, + [OrganizationProjectBudgetTypeEnum.HOURS]: { min: 40, max: 400 } + }; + + // Initialize an array to hold the created projects + const projects: OrganizationProject[] = []; + + // Iterate over the default project names and create OrganizationProject instances + for (const projectName of DEFAULT_ORGANIZATION_PROJECTS) { + const budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); + + // Retrieve the budget range based on the budgetType + const { min, max } = budgetRanges[budgetType] || { min: 0, max: 0 }; + + // Generate the budget using faker with the determined range + const budget = faker.number.int({ min, max }); + + // Create a new OrganizationProject instance + const project = new OrganizationProject(); + project.name = projectName; + project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); + project.tags = tags; + project.organizationContact = faker.helpers.arrayElement(organizationContacts || []); + project.organization = organization; + project.tenant = tenant; + project.budgetType = budgetType; + project.budget = budget; + project.taskListType = faker.helpers.arrayElement(Object.values(TaskListTypeEnum)); + + // Add project to projects array + projects.push(project); + } + + // Bulk save all projects + const savedProjects = await dataSource.manager.save(projects, { chunk: 100 }); + + // Assign projects to employees + await assignOrganizationProjectToEmployee(dataSource, organization); + + // Seed project member counts for the tenant + await seedProjectMembersCount(dataSource, [tenant]); + + return savedProjects; + } catch (error) { + console.log('Error creating default organization projects:', error?.message); } - await dataSource.manager.save(projects); - - /** - * Seeder for assign organization project to the employee of the specific organization - */ - await assignOrganizationProjectToEmployee(dataSource, tenant, organization); - - /** - * Seeder for update project member count for specific tenant - */ - await seedProjectMembersCount(dataSource, [tenant]); - return projects; }; +/** + * Creates random organization projects for given tenants and their organizations. + * + * @param dataSource - The TypeORM data source instance for database operations. + * @param tenants - An array of tenant entities. + * @param tenantOrganizationsMap - A map linking each tenant to its organizations. + * @param tags - An array of tag entities to associate with projects. + * @param maxProjectsPerOrganization - The maximum number of projects to create per organization. + * @returns A promise that resolves to an array of created OrganizationProject entities. + */ export const createRandomOrganizationProjects = async ( dataSource: DataSource, tenants: ITenant[], tenantOrganizationsMap: Map, - tags: ITag[] | void, - maxProjectsPerOrganization + tags: Tag[] = [], + maxProjectsPerOrganization: number ) => { - if (!tags) { - console.warn('Warning: tags not found, RandomOrganizationProjects will not be created'); - return; - } - + // Iterate over each tenant and create random projects for each organization for await (const tenant of tenants) { + // Get the ID of the current tenant const { id: tenantId } = tenant; + // Fetch organizations for the current tenant + const organizations = tenantOrganizationsMap.get(tenant); + // Determine the number of projects to create for each organization const projectsPerOrganization = Math.floor(Math.random() * (maxProjectsPerOrganization - 5)) + 5; - const organizations = tenantOrganizationsMap.get(tenant); + if (!organizations || organizations.length === 0) { + console.warn(`No organizations found for tenant ID: ${tenantId}`); + continue; // Skip to the next tenant if no organizations are found + } + + // Define a mapping between Budget Types and their respective min and max values + const budgetRanges: Record = { + [OrganizationProjectBudgetTypeEnum.COST]: { min: 500, max: 5000 }, + [OrganizationProjectBudgetTypeEnum.HOURS]: { min: 40, max: 400 } + }; + + // Create random projects for each organization for await (const organization of organizations) { const { id: organizationId } = organization; + + // Fetch all OrganizationContacts once to avoid redundant queries const organizationContacts = await dataSource.manager.findBy(OrganizationContact, { tenantId, organizationId }); - const organizationContact = faker.helpers.arrayElement(organizationContacts); const projects: OrganizationProject[] = []; + + // Iterate over each organization and create projects for (let i = 0; i < projectsPerOrganization; i++) { + const budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); + // Retrieve the budget range based on the budgetType + const { min, max } = budgetRanges[budgetType] || { min: 0, max: 0 }; + // Generate the budget using faker with the determined range + const budget = faker.number.int({ min, max }); + + // Create a new OrganizationProject instance const project = new OrganizationProject(); project.tags = [tags[Math.floor(Math.random() * tags.length)]]; project.name = faker.company.name(); project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); - project.organizationContact = organizationContact; + project.organizationContact = faker.helpers.arrayElement(organizationContacts); project.organization = organization; project.tenant = tenant; - project.budgetType = faker.helpers.arrayElement(Object.values(OrganizationProjectBudgetTypeEnum)); - - if (project.budgetType === OrganizationProjectBudgetTypeEnum.COST) { - // Set budget for COST type - project.budget = faker.number.int({ min: 500, max: 5000 }); - } else { - // Set budget for other types - project.budget = faker.number.int({ min: 40, max: 400 }); - } + project.budgetType = budgetType; + project.budget = budget; project.startDate = faker.date.past({ years: 5 }); - // Generate endDate as a date in the future - faker.date.between({ from: project.startDate, to: new Date() }); + project.endDate = faker.date.between({ from: project.startDate, to: new Date() }); projects.push(project); } - await dataSource.manager.save(projects); - /** - * Seeder for assign organization project to the employee of the specific organization - */ - await assignOrganizationProjectToEmployee(dataSource, tenant, organization); + // Bulk save all projects + await dataSource.manager.save(projects, { chunk: 100 }); + + // Assign projects to employees + await assignOrganizationProjectToEmployee(dataSource, organization); } - /** - * Seeder for update project member count for specific tenant - */ + // Seed project member counts for the tenant await seedProjectMembersCount(dataSource, [tenant]); } }; -/* - * Assign Organization Project To Respective Employees +/** + * Assigns unique Organization Projects to each Employee within an Organization. + * + * @param dataSource - The data source instance for database operations. + * @param organization - The organization object containing `id` and `tenantId`. */ -export const assignOrganizationProjectToEmployee = async ( - dataSource: DataSource, - tenant: ITenant, - organization: IOrganization -) => { - const { id: tenantId } = tenant; - const { id: organizationId } = organization; - - const organizationProjects = await dataSource.manager.findBy(OrganizationProject, { - tenantId, - organizationId - }); - const employees = await dataSource.manager.findBy(Employee, { - tenantId, - organizationId - }); - for await (const employee of employees) { - employee.projects = chain(organizationProjects) - .shuffle() - .take(faker.number.int({ min: 2, max: 4 })) - .unique() - .values() - .value(); +export const assignOrganizationProjectToEmployee = async (dataSource: DataSource, organization: IOrganization) => { + const { id: organizationId, tenantId } = organization; + + // Fetch all projects and employees for the organization and tenant + const [organizationProjects, employees] = await Promise.all([ + dataSource.manager.findBy(OrganizationProject, { tenantId, organizationId }), + dataSource.manager.findBy(Employee, { tenantId, organizationId }) + ]); + + // Check if there are enough projects to assign + if (organizationProjects.length == 0) { + console.warn('Not enough projects to assign. At least 1 projects are required.'); + return; } - await dataSource.manager.save(employees); + + // Initialize an array to store the OrganizationProjectEmployee instances + const members: OrganizationProjectEmployee[] = []; + + // Iterate over each employee and assign projects + for (const employee of employees) { + // Determine the number of projects to assign (between 2 and 4) + const numberOfProjects = faker.number.int({ min: 2, max: 4 }); + + // Shuffle and select unique projects + const projects = chain(organizationProjects).shuffle().take(numberOfProjects).value(); + + // Create OrganizationProjectEmployee instances for the selected projects + for (const project of projects) { + const projectEmployee = new OrganizationProjectEmployee(); + projectEmployee.employee = employee; + projectEmployee.organizationProject = project; + projectEmployee.organization = organization; + projectEmployee.tenant = organization.tenant; + + members.push(projectEmployee); + } + } + + // Save all OrganizationProjectEmployee relationships in bulk + await dataSource.manager.save(members, { chunk: 100 }); }; -export async function seedProjectMembersCount(dataSource: DataSource, tenants: ITenant[]) { - const isSqliteOrMysql = ['sqlite', 'better-sqlite3', 'mysql'].includes(dataSource.options.type); - /** - * GET all tenants in the system - */ - for await (const tenant of tenants) { - const tenantId = tenant.id; - - /** - * GET all tenant projects for specific tenant - */ - const projects = await dataSource.manager.query( - p( - `SELECT * FROM "organization_project" WHERE "organization_project"."tenantId" = ${ - isSqliteOrMysql ? '?' : '$1' - }` - ), - [tenantId] - ); - - for await (const project of projects) { - const projectId = project.id; - - /** - * GET member counts for organization project - */ - const [members] = await dataSource.manager.query( +/** + * Seeds the members count for each organization project associated with the provided tenants. + * + * @param dataSource - The TypeORM data source instance for database operations. + * @param tenants - An array of tenant entities. + * + * @returns A promise that resolves when the seeding is complete. + */ +export async function seedProjectMembersCount(dataSource: DataSource, tenants: ITenant[]): Promise { + try { + for (const tenant of tenants) { + const tenantId = tenant.id; + + // Consolidated SQL to update membersCount for all projects of the current tenant + const query = replacePlaceholders( p(` - SELECT - COUNT("organization_project_employee"."employeeId") AS count - FROM "organization_project_employee" - INNER JOIN - "employee" ON "employee"."id"="organization_project_employee"."employeeId" - INNER JOIN - "organization_project" ON "organization_project"."id"="organization_project_employee"."organizationProjectId" - WHERE - "organization_project_employee"."organizationProjectId" = ${isSqliteOrMysql ? '?' : '$1'} - `), - [projectId] + UPDATE "organization_project" AS op + SET "membersCount" = sub.count + FROM ( + SELECT "organizationProjectId", COUNT("employeeId") AS count + FROM "organization_project_employee" + GROUP BY "organizationProjectId" + ) AS sub + WHERE op.id = sub."organizationProjectId" + AND op."tenantId" = $1; + `), + dataSource.options.type as DatabaseTypeEnum ); - const count = members['count']; - - await dataSource.manager.query( - p( - `UPDATE "organization_project" SET "membersCount" = ${isSqliteOrMysql ? '?' : '$1'} WHERE "id" = ${ - isSqliteOrMysql ? '?' : '$2' - }` - ), - [count, projectId] - ); + // Execute the consolidated update query with the appropriate parameter + await dataSource.manager.query(query, [tenantId]); + console.log(`Updated membersCount for tenant ID: ${tenantId}`); } + } catch (error) { + console.error('Error seeding project members count:', error); } } diff --git a/packages/core/src/tags/tag.seed.ts b/packages/core/src/tags/tag.seed.ts index c8dbdbc09b2..fdf37b1dc21 100644 --- a/packages/core/src/tags/tag.seed.ts +++ b/packages/core/src/tags/tag.seed.ts @@ -11,20 +11,18 @@ export const createDefaultTags = async ( ): Promise => { let tags: Tag[] = []; for (const organization of organizations) { - const organizationTags: Tag[] = Object.values(DEFAULT_GLOBAL_TAGS).map( - (name) => { - const orgTags = new Tag(); - orgTags.name = name; - orgTags.description = ''; - orgTags.color = faker.color.human(); - if (orgTags.color === 'white') { - orgTags.color = 'red'; - } - orgTags.organization = organization; - orgTags.tenant = tenant; - return orgTags; + const organizationTags: Tag[] = Object.values(DEFAULT_GLOBAL_TAGS).map((name) => { + const orgTags = new Tag(); + orgTags.name = name; + orgTags.description = ''; + orgTags.color = faker.color.human(); + if (orgTags.color === 'white') { + orgTags.color = 'red'; } - ); + orgTags.organization = organization; + orgTags.tenant = tenant; + return orgTags; + }); tags = [...tags, ...organizationTags]; } return await dataSource.manager.save(tags); @@ -43,16 +41,19 @@ export const createTags = async (dataSource: DataSource): Promise => { tags.push(tag); } - await dataSource - .createQueryBuilder() - .insert() - .into(Tag) - .values(tags) - .execute(); + await dataSource.createQueryBuilder().insert().into(Tag).values(tags).execute(); return tags; }; +/** + * Creates random organization tags for given tenants and their organizations. + * + * @param dataSource - The TypeORM data source instance for database operations. + * @param tenants - An array of tenant entities. + * @param tenantOrganizationsMap - A map linking each tenant to its organizations. + * @returns A promise that resolves to an array of created Tag entities. + */ export const createRandomOrganizationTags = async ( dataSource: DataSource, tenants: ITenant[], @@ -61,24 +62,36 @@ export const createRandomOrganizationTags = async ( let tags: Tag[] = []; for (const tenant of tenants) { + // Fetch organizations for the current tenant const organizations = tenantOrganizationsMap.get(tenant); - organizations.forEach((org) => { - const organizationTags: Tag[] = Object.values( - DEFAULT_ORGANIZATION_TAGS - ).map((name) => { - const orgTags = new Tag(); - orgTags.name = name; - orgTags.description = ''; - orgTags.color = faker.color.human(); - orgTags.organization = org; - orgTags.tenant = tenant; - if (orgTags.color === 'white') { - orgTags.color = 'red'; - } - return orgTags; + + if (!organizations || organizations.length === 0) { + console.warn(`No organizations found for tenant ID: ${tenant.id}`); + continue; // Skip to the next tenant if no organizations are found + } + + for (const organization of organizations) { + // If DEFAULT_ORGANIZATION_TAGS is an object, use Object.values; otherwise, use it directly if it's already an array + const tags = Array.isArray(DEFAULT_ORGANIZATION_TAGS) + ? DEFAULT_ORGANIZATION_TAGS + : Object.values(DEFAULT_ORGANIZATION_TAGS); + + // Create Tag instances for the current organization + const organizationTags: Tag[] = tags.map((name: string) => { + const tag = new Tag(); + tag.name = name; + tag.description = ''; // Consider adding meaningful descriptions if applicable + tag.color = faker.color.human(); + tag.organization = organization; + tag.tenant = tenant; + return tag; }); - tags = [...tags, ...organizationTags]; - }); + + // Efficiently add the new tags to the 'tags' array using push with spread + tags.push(...organizationTags); + } } + + // Bulk save all tags return await dataSource.manager.save(tags); }; From fea4f7ce0840a9b9825026146f63911867905493 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Thu, 19 Sep 2024 15:19:18 +0530 Subject: [PATCH 40/47] fix: removed unnecessary console.log --- packages/core/src/feature/feature.subscriber.ts | 1 - .../src/organization-contact/organization-contact.subscriber.ts | 1 - .../src/organization-project/organization-project.subscriber.ts | 1 - .../core/src/organization-team/organization-team.subscriber.ts | 1 - packages/core/src/organization/organization.subscriber.ts | 1 - .../core/src/product-category/product-category.subscriber.ts | 1 - packages/core/src/reports/report.subscriber.ts | 1 - packages/core/src/tags/tag.subscriber.ts | 1 - 8 files changed, 8 deletions(-) diff --git a/packages/core/src/feature/feature.subscriber.ts b/packages/core/src/feature/feature.subscriber.ts index f58f55a3bc5..cb2d88b684e 100644 --- a/packages/core/src/feature/feature.subscriber.ts +++ b/packages/core/src/feature/feature.subscriber.ts @@ -30,7 +30,6 @@ export class FeatureSubscriber extends BaseEntityEventSubscriber { // Set imageUrl based on the entity's image property if (Object.prototype.hasOwnProperty.call(entity, 'image')) { - console.log('Feature: Setting imageUrl for feature ID ' + entity.id); await this.setImageUrl(entity); } } catch (error) { diff --git a/packages/core/src/organization-contact/organization-contact.subscriber.ts b/packages/core/src/organization-contact/organization-contact.subscriber.ts index b930a75d602..f5dcabfc50e 100644 --- a/packages/core/src/organization-contact/organization-contact.subscriber.ts +++ b/packages/core/src/organization-contact/organization-contact.subscriber.ts @@ -24,7 +24,6 @@ export class OrganizationContactSubscriber extends BaseEntityEventSubscriber { try { // Update the imageUrl if an image property is present if (Object.prototype.hasOwnProperty.call(entity, 'image')) { - console.log('Report: Setting imageUrl for report ID ' + entity.id); await this.setImageUrl(entity); } } catch (error) { diff --git a/packages/core/src/tags/tag.subscriber.ts b/packages/core/src/tags/tag.subscriber.ts index 3a7fa0d740e..fa0ca19908d 100644 --- a/packages/core/src/tags/tag.subscriber.ts +++ b/packages/core/src/tags/tag.subscriber.ts @@ -25,7 +25,6 @@ export class TagSubscriber extends BaseEntityEventSubscriber { try { // Update the fullIconUrl if an icon is present if (Object.prototype.hasOwnProperty.call(entity, 'icon')) { - console.log('Tag: Setting imageUrl for tag ID ' + entity.id); await this.setFullIconUrl(entity); } } catch (error) { From 847c3af3dcaba134d498ee7518d4e2d3741a3c98 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Thu, 19 Sep 2024 18:23:31 +0530 Subject: [PATCH 41/47] fix: migration missing createdAt and updatedAt --- ...umnsToOrganizationProjectEmployeeEntity.ts | 6 + ...-AlterOrganizationProjectEmployeeEntity.ts | 349 ------------------ 2 files changed, 6 insertions(+), 349 deletions(-) delete mode 100644 packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 00751d5a82a..9aa35cdba50 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -508,6 +508,12 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query( `ALTER TABLE \`organization_project_employee\` ADD \`isArchived\` tinyint NULL DEFAULT 0` ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`createdAt\` DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)` + ); + await queryRunner.query( + `ALTER TABLE \`organization_project_employee\` ADD \`updatedAt\` DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` + ); // Step 4: Add 'id' column as nullable to allow old records to remain valid console.log('Step 4: Adding nullable id column...'); diff --git a/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts deleted file mode 100644 index a11c8507e34..00000000000 --- a/packages/core/src/database/migrations/1726664754860-AlterOrganizationProjectEmployeeEntity.ts +++ /dev/null @@ -1,349 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { yellow } from 'chalk'; -import { DatabaseTypeEnum } from '@gauzy/config'; - -export class AlterOrganizationProjectEmployeeEntity1726664754860 implements MigrationInterface { - name = 'AlterOrganizationProjectEmployeeEntity1726664754860'; - - /** - * Up Migration - * - * @param queryRunner - */ - public async up(queryRunner: QueryRunner): Promise { - console.log(yellow(this.name + ' start running!')); - - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresUpQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlUpQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * Down Migration - * - * @param queryRunner - */ - public async down(queryRunner: QueryRunner): Promise { - switch (queryRunner.connection.options.type) { - case DatabaseTypeEnum.sqlite: - case DatabaseTypeEnum.betterSqlite3: - await this.sqliteDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.postgres: - await this.postgresDownQueryRunner(queryRunner); - break; - case DatabaseTypeEnum.mysql: - await this.mysqlDownQueryRunner(queryRunner); - break; - default: - throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); - } - } - - /** - * PostgresDB Up Migration - * - * @param queryRunner - */ - public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise {} - - /** - * PostgresDB Down Migration - * - * @param queryRunner - */ - public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise {} - - /** - * SqliteDB and BetterSQlite3DB Up Migration - * - * @param queryRunner - */ - public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query( - `CREATE TABLE "temporary_organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "temporary_organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "organization_project_employee"`); - await queryRunner.query( - `ALTER TABLE "temporary_organization_project_employee" RENAME TO "organization_project_employee"` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - } - - /** - * SqliteDB and BetterSQlite3DB Down Migration - * - * @param queryRunner - */ - public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "updatedAt" datetime NOT NULL DEFAULT (datetime('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query(`DROP INDEX "IDX_2ba868f42c2301075b7c141359"`); - await queryRunner.query(`DROP INDEX "IDX_6b5b0c3d994f59d9c800922257"`); - await queryRunner.query(`DROP INDEX "IDX_f3d1102a8aa6442cdfce5d57c3"`); - await queryRunner.query(`DROP INDEX "IDX_abbe29504bb642647a69959cc0"`); - await queryRunner.query(`DROP INDEX "IDX_a9abd98013154ec1edfa1ec18c"`); - await queryRunner.query(`DROP INDEX "IDX_a77a507b7402f0adb6a6b41e41"`); - await queryRunner.query(`DROP INDEX "IDX_509be755cdaf837c263ffaa6b6"`); - await queryRunner.query(`DROP INDEX "IDX_25de67f7f3f030438e3ecb1c0e"`); - await queryRunner.query(`DROP INDEX "IDX_1c5e006185395a6193ede3456c"`); - await queryRunner.query( - `ALTER TABLE "organization_project_employee" RENAME TO "temporary_organization_project_employee"` - ); - await queryRunner.query( - `CREATE TABLE "organization_project_employee" ("employeeId" varchar NOT NULL, "organizationProjectId" varchar NOT NULL, "deletedAt" datetime, "id" varchar PRIMARY KEY NOT NULL, "createdAt" datetime NOT NULL DEFAULT (DATETIME('now')), "updatedAt" datetime NOT NULL DEFAULT (DATETIME('now')), "isActive" boolean DEFAULT (1), "isArchived" boolean DEFAULT (0), "archivedAt" datetime, "tenantId" varchar, "organizationId" varchar, "isManager" boolean DEFAULT (0), "assignedAt" datetime, "roleId" varchar, CONSTRAINT "FK_1c5e006185395a6193ede3456c6" FOREIGN KEY ("roleId") REFERENCES "role" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a77a507b7402f0adb6a6b41e412" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_2ba868f42c2301075b7c141359e" FOREIGN KEY ("organizationProjectId") REFERENCES "organization_project" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_6b5b0c3d994f59d9c800922257f" FOREIGN KEY ("employeeId") REFERENCES "employee" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)` - ); - await queryRunner.query( - `INSERT INTO "organization_project_employee"("employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId") SELECT "employeeId", "organizationProjectId", "deletedAt", "id", "createdAt", "updatedAt", "isActive", "isArchived", "archivedAt", "tenantId", "organizationId", "isManager", "assignedAt", "roleId" FROM "temporary_organization_project_employee"` - ); - await queryRunner.query(`DROP TABLE "temporary_organization_project_employee"`); - await queryRunner.query( - `CREATE INDEX "IDX_2ba868f42c2301075b7c141359" ON "organization_project_employee" ("organizationProjectId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_6b5b0c3d994f59d9c800922257" ON "organization_project_employee" ("employeeId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_abbe29504bb642647a69959cc0" ON "organization_project_employee" ("isArchived") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a9abd98013154ec1edfa1ec18c" ON "organization_project_employee" ("tenantId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_a77a507b7402f0adb6a6b41e41" ON "organization_project_employee" ("organizationId") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_509be755cdaf837c263ffaa6b6" ON "organization_project_employee" ("isManager") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_25de67f7f3f030438e3ecb1c0e" ON "organization_project_employee" ("assignedAt") ` - ); - await queryRunner.query( - `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` - ); - } - - /** - * MySQL Up Migration - * - * @param queryRunner - */ - public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise {} - - /** - * MySQL Down Migration - * - * @param queryRunner - */ - public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise {} -} From 3a0659c42e0850270bd869a5d4af957cf015eca1 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Thu, 19 Sep 2024 19:01:07 +0530 Subject: [PATCH 42/47] fix: updated ID,. tenantId and organizationId --- ...umnsToOrganizationProjectEmployeeEntity.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 9aa35cdba50..0a958998a1b 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -1,5 +1,6 @@ import { MigrationInterface, QueryRunner } from 'typeorm'; import { yellow } from 'chalk'; +import { v4 as uuidv4 } from 'uuid'; import { DatabaseTypeEnum } from '@gauzy/config'; export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implements MigrationInterface { @@ -530,14 +531,22 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Loop through each record and assign a unique UUID to the id column for await (const { employeeId, organizationProjectId } of records) { + const uuid = uuidv4(); + // Update the record with the generated UUID - await queryRunner.query( - `UPDATE \`organization_project_employee\` - SET \`id\` = (UUID()) - WHERE \`employeeId\` = '${employeeId}' - AND \`organizationProjectId\` = '${organizationProjectId}'` - ); - console.log(`Assigned UUID to ${employeeId}, ${organizationProjectId}`); + await queryRunner.query(` + UPDATE \`organization_project_employee\` AS ope + JOIN \`organization_project\` AS op ON ope.\`organizationProjectId\` = op.\`id\` + SET + ope.\`id\` = '${uuid}', + ope.\`tenantId\` = op.\`tenantId\`, + ope.\`organizationId\` = op.\`organizationId\` + WHERE + \`employeeId\` = '${employeeId}' AND + \`organizationProjectId\` = '${organizationProjectId}' + `); + + console.log(`Assigned UUID: ${uuid} to ${employeeId}, ${organizationProjectId}`); } // Step 6: Alter 'id' column to NOT NULL after populating with UUIDs From d6d89015312c2c9e512a3dcb7b6fefaae258fe7c Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Fri, 20 Sep 2024 11:38:08 +0530 Subject: [PATCH 43/47] Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity --- ...umnsToOrganizationProjectEmployeeEntity.ts | 83 ++++++++++++------- 1 file changed, 54 insertions(+), 29 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index 0a958998a1b..f1139859ef6 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -100,8 +100,20 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "assignedAt" TIMESTAMP`); await queryRunner.query(`ALTER TABLE "organization_project_employee" ADD "roleId" uuid`); - // Step 5: Modify primary keys again - console.log('Step 5: Modifying primary keys again...'); + // Step 5: Setting tenantId and organizationId for existing records in bulk + console.log('Step 5: Setting tenantId and organizationId for existing records...'); + await queryRunner.query(` + UPDATE "organization_project_employee" AS ope + SET + "tenantId" = op."tenantId", + "organizationId" = op."organizationId" + FROM "organization_project" AS op + WHERE + ope."organizationProjectId" = op."id"; + `); + + // Step 6: Modify primary keys again + console.log('Step 6: Modifying primary keys again...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" DROP CONSTRAINT "PK_ce1fc15962d70f8776be4e19c36"` ); @@ -115,8 +127,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "PK_cb8069ff5917c90adbc48139147" PRIMARY KEY ("id")` ); - // Step 6: Create new indexes - console.log('Step 6: Creating new indexes...'); + // Step 7: Create new indexes + console.log('Step 7: Creating new indexes...'); await queryRunner.query( `CREATE INDEX "IDX_f3d1102a8aa6442cdfce5d57c3" ON "organization_project_employee" ("isActive") ` ); @@ -139,8 +151,8 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen `CREATE INDEX "IDX_1c5e006185395a6193ede3456c" ON "organization_project_employee" ("roleId") ` ); - // Step 7: Recreate foreign keys - console.log('Step 7: Recreating foreign keys...'); + // Step 8: Recreate foreign keys + console.log('Step 8: Recreating foreign keys...'); await queryRunner.query( `ALTER TABLE "organization_project_employee" ADD CONSTRAINT "FK_a9abd98013154ec1edfa1ec18cd" FOREIGN KEY ("tenantId") REFERENCES "tenant"("id") ON DELETE CASCADE ON UPDATE NO ACTION` ); @@ -283,17 +295,23 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen INSERT INTO "temporary_organization_project_employee" ( "employeeId", "organizationProjectId", + "tenantId", + "organizationId", "id" ) SELECT - "employeeId", - "organizationProjectId", - LOWER(HEX(RANDOMBLOB(4))) || '-' || - LOWER(HEX(RANDOMBLOB(2))) || '-' || - LOWER(HEX(RANDOMBLOB(2))) || '-' || - LOWER(HEX(RANDOMBLOB(2))) || '-' || - LOWER(HEX(RANDOMBLOB(6))) AS "id" - FROM "organization_project_employee" + ope."employeeId", + ope."organizationProjectId", + op."tenantId", + op."organizationId", + LOWER(hex(randomblob(4))) || '-' || + LOWER(hex(randomblob(2))) || '-' || + LOWER(hex(randomblob(2))) || '-' || + LOWER(hex(randomblob(2))) || '-' || + LOWER(hex(randomblob(6))) AS "id" + FROM "organization_project_employee" AS ope + INNER JOIN "organization_project" AS op ON ope."organizationProjectId" = op."id" + WHERE ope."id" IS NULL; `); // Step 4: Drop the old table @@ -352,11 +370,15 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen INSERT INTO "temporary_organization_project_employee_with_constraints" ( "employeeId", "organizationProjectId", + "tenantId", + "organizationId", "id" ) SELECT "employeeId", "organizationProjectId", + "tenantId", + "organizationId", "id" FROM "organization_project_employee" `); @@ -524,29 +546,32 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen console.log('Step 5: Generating unique UUIDs for existing records...'); // Fetch records where id is null - const records = await queryRunner.query( - `SELECT \`employeeId\`, \`organizationProjectId\` FROM \`organization_project_employee\` WHERE \`id\` IS NULL` - ); - console.log('Retrieved records: ', JSON.stringify(records)); + const records = await queryRunner.query(` + SELECT \`employeeId\`, \`organizationProjectId\` + FROM \`organization_project_employee\` + WHERE \`id\` IS NULL; + `); + console.log(`Retrieved ${records.length} records with NULL id.`); // Loop through each record and assign a unique UUID to the id column - for await (const { employeeId, organizationProjectId } of records) { - const uuid = uuidv4(); - - // Update the record with the generated UUID - await queryRunner.query(` + for (const { employeeId, organizationProjectId } of records) { + // Update the record with the generated UUID, tenantId, and organizationId + await queryRunner.query( + ` UPDATE \`organization_project_employee\` AS ope JOIN \`organization_project\` AS op ON ope.\`organizationProjectId\` = op.\`id\` SET - ope.\`id\` = '${uuid}', + ope.\`id\` = UUID(), ope.\`tenantId\` = op.\`tenantId\`, ope.\`organizationId\` = op.\`organizationId\` WHERE - \`employeeId\` = '${employeeId}' AND - \`organizationProjectId\` = '${organizationProjectId}' - `); - - console.log(`Assigned UUID: ${uuid} to ${employeeId}, ${organizationProjectId}`); + ope.\`id\` IS NULL AND + ope.\`employeeId\` = ? AND + ope.\`organizationProjectId\` = ?; + `, + [employeeId, organizationProjectId] + ); + console.log(`Assigned UUID to employeeId: ${employeeId}, organizationProjectId: ${organizationProjectId}`); } // Step 6: Alter 'id' column to NOT NULL after populating with UUIDs From eb773263182c3149510aa2ad421c94a324927163 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Sun, 22 Sep 2024 02:20:54 -0700 Subject: [PATCH 44/47] Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity --- ...6509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index f1139859ef6..bee8fb04d1a 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -310,8 +310,7 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen LOWER(hex(randomblob(2))) || '-' || LOWER(hex(randomblob(6))) AS "id" FROM "organization_project_employee" AS ope - INNER JOIN "organization_project" AS op ON ope."organizationProjectId" = op."id" - WHERE ope."id" IS NULL; + INNER JOIN "organization_project" AS op ON ope."organizationProjectId" = op."id"; `); // Step 4: Drop the old table From 700450cfae31b1442bb67a552e557340f1adf2e7 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Sun, 22 Sep 2024 03:24:57 -0700 Subject: [PATCH 45/47] Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity --- ...-AddColumnsToOrganizationProjectEmployeeEntity.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts index bee8fb04d1a..4722b6745f7 100644 --- a/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts +++ b/packages/core/src/database/migrations/1726509769379-AddColumnsToOrganizationProjectEmployeeEntity.ts @@ -554,23 +554,23 @@ export class AddColumnsToOrganizationProjectEmployeeEntity1726509769379 implemen // Loop through each record and assign a unique UUID to the id column for (const { employeeId, organizationProjectId } of records) { + const uuid = uuidv4(); + // Update the record with the generated UUID, tenantId, and organizationId - await queryRunner.query( - ` + await queryRunner.query(` UPDATE \`organization_project_employee\` AS ope JOIN \`organization_project\` AS op ON ope.\`organizationProjectId\` = op.\`id\` SET - ope.\`id\` = UUID(), + ope.\`id\` = ?, ope.\`tenantId\` = op.\`tenantId\`, ope.\`organizationId\` = op.\`organizationId\` WHERE - ope.\`id\` IS NULL AND ope.\`employeeId\` = ? AND ope.\`organizationProjectId\` = ?; `, - [employeeId, organizationProjectId] + [uuid, employeeId, organizationProjectId] ); - console.log(`Assigned UUID to employeeId: ${employeeId}, organizationProjectId: ${organizationProjectId}`); + console.log(`Assigned UUID: ${uuid} to employeeId: ${employeeId}, organizationProjectId: ${organizationProjectId}`); } // Step 6: Alter 'id' column to NOT NULL after populating with UUIDs From 89d28ff69959b1944a97b96f29101ce3aa2bfcea Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Sun, 22 Sep 2024 03:38:23 -0700 Subject: [PATCH 46/47] fix(deepscan): accessed without null check prior --- .../organization-project.seed.ts | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/core/src/organization-project/organization-project.seed.ts b/packages/core/src/organization-project/organization-project.seed.ts index bea5a285757..d3b2adda785 100644 --- a/packages/core/src/organization-project/organization-project.seed.ts +++ b/packages/core/src/organization-project/organization-project.seed.ts @@ -52,11 +52,6 @@ export const createDefaultOrganizationProjects = async ( organizationId }); - if (organizationContacts.length === 0) { - console.warn( - `No OrganizationContacts found for tenantId: ${tenantId} and organizationId: ${organizationId}` - ); - } // Define a mapping between Budget Types and their respective min and max values const budgetRanges: Record = { @@ -82,13 +77,22 @@ export const createDefaultOrganizationProjects = async ( project.name = projectName; project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); project.tags = tags; - project.organizationContact = faker.helpers.arrayElement(organizationContacts || []); + project.organizationContact = faker.helpers.arrayElement(organizationContacts); project.organization = organization; project.tenant = tenant; project.budgetType = budgetType; project.budget = budget; project.taskListType = faker.helpers.arrayElement(Object.values(TaskListTypeEnum)); + // If organizationContacts is not empty, assign a random organization contact + if (organizationContacts.length > 0) { + project.organizationContact = faker.helpers.arrayElement(organizationContacts); + } else { + console.warn( + `No OrganizationContacts found for tenantId: ${tenantId} and organizationId: ${organizationId}` + ); + } + // Add project to projects array projects.push(project); } @@ -171,13 +175,23 @@ export const createRandomOrganizationProjects = async ( project.tags = [tags[Math.floor(Math.random() * tags.length)]]; project.name = faker.company.name(); project.status = faker.helpers.arrayElement(Object.values(TaskStatusEnum)); - project.organizationContact = faker.helpers.arrayElement(organizationContacts); project.organization = organization; project.tenant = tenant; project.budgetType = budgetType; project.budget = budget; project.startDate = faker.date.past({ years: 5 }); project.endDate = faker.date.between({ from: project.startDate, to: new Date() }); + + + // If organizationContacts is not empty, assign a random organization contact + if (organizationContacts.length > 0) { + project.organizationContact = faker.helpers.arrayElement(organizationContacts); + } else { + console.warn( + `No OrganizationContacts found for tenantId: ${tenantId} and organizationId: ${organizationId}` + ); + } + projects.push(project); } From 6ad4eea86a01f6922a21e32e759e8e81fb4cbdae Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Sun, 22 Sep 2024 03:52:11 -0700 Subject: [PATCH 47/47] fix: updated isManager and assignedAt --- .../organization-project.service.ts | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/packages/core/src/organization-project/organization-project.service.ts b/packages/core/src/organization-project/organization-project.service.ts index 4b9f4cb323b..9afbf446b19 100644 --- a/packages/core/src/organization-project/organization-project.service.ts +++ b/packages/core/src/organization-project/organization-project.service.ts @@ -78,31 +78,39 @@ export class OrganizationProjectService extends TenantAwareCrudService { + const tenantId = RequestContext.currentTenantId() || input.tenantId; + const employeeId = RequestContext.currentEmployeeId(); + const currentRoleId = RequestContext.currentRoleId(); + const { tags = [], members = [], managers = [], ...entity } = input; const { organizationId } = entity; + try { // Retrieve members and managers IDs const managerIds = managers.map((manager) => manager.id); const memberIds = members.map((member) => member.id); - const tenantId = RequestContext.currentTenantId(); - const employeeId = RequestContext.currentEmployeeId(); - const currentRoleId = RequestContext.currentRoleId(); - - // If, employee create project, default add as a manager + // If the employee creates the project, default add as a manager try { // Check if the current role is EMPLOYEE await this.roleService.findOneByIdString(currentRoleId, { where: { name: RolesEnum.EMPLOYEE } }); - // Check if the employeeId is not already included in the managerIds array + + // Add the current employee to the managerIds if they have the EMPLOYEE role and are not already included if (!managerIds.includes(employeeId)) { // If not included, add the employeeId to the managerIds array managerIds.push(employeeId); } } catch (error) {} + // Retrieves a collection of employees based on specified criteria. - const employees = await this.retrieveEmployees(memberIds, managerIds, organizationId, tenantId); + const employees = await this.retrieveEmployees( + memberIds, + managerIds, + organizationId, + tenantId + ); // Find the manager role const managerRole = await this.roleService.findOneByWhereOptions({ name: RolesEnum.MANAGER }); @@ -110,30 +118,46 @@ export class OrganizationProjectService extends TenantAwareCrudService [em.employee.id, em.assignedAt])); + // Use destructuring to directly extract 'id' from 'employee' - const projectMembers = employees.map( - ({ id: employeeId }) => - new OrganizationProjectEmployee({ - employee: { id: employeeId }, - organization: { id: organizationId }, - tenant: { id: tenantId }, - role: managerIdsSet.has(employeeId) ? managerRole : null - }) - ); + const projectMembers = employees.map(({ id: employeeId }) => { + // Check if the employee is a manager + const isManager = managerIdsSet.has(employeeId); + + // If the employee is a manager, assign the existing manager with the latest assignedAt date + return new OrganizationProjectEmployee({ + employeeId, + organizationId, + tenantId, + isManager, + role: isManager ? managerRole : null, + assignedAt: isManager && !existingManagersMap.has(employeeId) ? new Date() : existingManagersMap.get(employeeId) || null + }); + }); // Create the organization team with the prepared members return await super.create({ ...entity, - organization: { id: organizationId }, - tenant: { id: tenantId }, + members: projectMembers, tags, - members: projectMembers + organizationId, + tenantId }); } catch (error) { throw new BadRequestException(`Failed to create project: ${error}`); } } + /** * Update an organization project. * @@ -214,7 +238,7 @@ export class OrganizationProjectService extends TenantAwareCrudService { // Map member IDs to deletion promises - const deletePromises = memberIds.map((memberId: string) => + const deletePromises = memberIds.map((memberId: ID) => this.typeOrmOrganizationProjectEmployeeRepository.delete(memberId) );