Skip to content

The open alternative to Salesforce, designed for AI.

Squash migration files up to v1.5.5 (#15183)

Félix Malfait84e7fabaab40
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1708535112230-addBillingCoreTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1708535112230-addBillingCoreTables.ts
index 7b51ce43700..cd7040edd23 100644
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1708535112230-addBillingCoreTables.ts
+++ b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1708535112230-addBillingCoreTables.ts
@@ -5,27 +5,125 @@ export class AddBillingCoreTables1708535112230 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
- `CREATE TABLE "core"."billingSubscriptionItem" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "billingSubscriptionId" uuid NOT NULL, "stripeProductId" character varying NOT NULL, "stripePriceId" character varying NOT NULL, "quantity" integer NOT NULL, CONSTRAINT "PK_0287b2d9fca488edcbf748281fc" PRIMARY KEY ("id"))`,
+ `CREATE TABLE "core"."billingEntitlement" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" text NOT NULL, "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, "value" boolean NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IDX_BILLING_ENTITLEMENT_KEY_WORKSPACE_ID_UNIQUE" UNIQUE ("key", "workspaceId"), CONSTRAINT "PK_4e6ed788c3ca0bf6610d5022576" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
- `CREATE TABLE "core"."billingSubscription" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, "stripeSubscriptionId" character varying NOT NULL, "status" character varying NOT NULL, CONSTRAINT "UQ_9120b7586c3471463480b58d20a" UNIQUE ("stripeCustomerId"), CONSTRAINT "UQ_1a858c28c7766d429cbd25f05e8" UNIQUE ("stripeSubscriptionId"), CONSTRAINT "REL_4abfb70314c18da69e1bee1954" UNIQUE ("workspaceId"), CONSTRAINT "PK_6e9c72c32d91640b8087cb53666" PRIMARY KEY ("id"))`,
+ `CREATE TABLE "core"."billingCustomer" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, CONSTRAINT "UQ_53c2ef50e9611082f83d760897d" UNIQUE ("workspaceId"), CONSTRAINT "UQ_b35a0ef2e2f0d40101dd7f161b9" UNIQUE ("stripeCustomerId"), CONSTRAINT "PK_5fffcd69bf722c297a3d5c3f3bc" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "FK_a602e7c9da619b8290232f6eeab" FOREIGN KEY ("billingSubscriptionId") REFERENCES "core"."billingSubscription"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ `CREATE TYPE "core"."billingMeter_status_enum" AS ENUM('ACTIVE', 'INACTIVE')`,
);
await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_4abfb70314c18da69e1bee1954d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ `CREATE TYPE "core"."billingMeter_eventtimewindow_enum" AS ENUM('DAY', 'HOUR')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."billingMeter" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "stripeMeterId" character varying NOT NULL, "displayName" character varying NOT NULL, "eventName" character varying NOT NULL, "status" "core"."billingMeter_status_enum" NOT NULL, "customerMapping" jsonb NOT NULL, "eventTimeWindow" "core"."billingMeter_eventtimewindow_enum", "valueSettings" jsonb NOT NULL, CONSTRAINT "UQ_340c08c4e5dd33cf963cbb133ae" UNIQUE ("stripeMeterId"), CONSTRAINT "PK_0bba5f7d2e3713332a0138ea1b3" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_taxbehavior_enum" AS ENUM('EXCLUSIVE', 'INCLUSIVE', 'UNSPECIFIED')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_type_enum" AS ENUM('ONE_TIME', 'RECURRING')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_billingscheme_enum" AS ENUM('PER_UNIT', 'TIERED')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_tiersmode_enum" AS ENUM('GRADUATED', 'VOLUME')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_usagetype_enum" AS ENUM('METERED', 'LICENSED')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingPrice_interval_enum" AS ENUM('day', 'month', 'week', 'year')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."billingPrice" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "stripePriceId" character varying NOT NULL, "active" boolean NOT NULL, "stripeProductId" character varying NOT NULL, "currency" character varying NOT NULL, "nickname" text, "taxBehavior" "core"."billingPrice_taxbehavior_enum" NOT NULL, "type" "core"."billingPrice_type_enum" NOT NULL, "billingScheme" "core"."billingPrice_billingscheme_enum" NOT NULL, "currencyOptions" jsonb, "tiers" jsonb, "recurring" jsonb, "transformQuantity" jsonb, "tiersMode" "core"."billingPrice_tiersmode_enum", "unitAmountDecimal" text, "unitAmount" numeric, "stripeMeterId" character varying, "usageType" "core"."billingPrice_usagetype_enum" NOT NULL, "interval" "core"."billingPrice_interval_enum", CONSTRAINT "UQ_f66d20a329f5f4b9d12afeae7d0" UNIQUE ("stripePriceId"), CONSTRAINT "PK_13927aef8d4e68e176a61c33d89" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."billingProduct" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "active" boolean NOT NULL, "description" text NOT NULL DEFAULT '', "name" character varying NOT NULL, "taxCode" text, "images" jsonb NOT NULL DEFAULT '[]', "marketingFeatures" jsonb NOT NULL DEFAULT '[]', "stripeProductId" character varying NOT NULL, "defaultStripePriceId" text, "metadata" jsonb NOT NULL DEFAULT '{}', "unitLabel" text, "url" text, CONSTRAINT "UQ_1ba1ba118792aa9eec92f132e82" UNIQUE ("stripeProductId"), CONSTRAINT "PK_8bb3c7be66db8e05476808b0ca7" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."billingSubscriptionItem" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "billingSubscriptionId" uuid NOT NULL, "stripeSubscriptionId" character varying, "metadata" jsonb NOT NULL DEFAULT '{}', "billingThresholds" jsonb, "stripeProductId" character varying NOT NULL, "stripePriceId" character varying NOT NULL, "stripeSubscriptionItemId" character varying NOT NULL, "quantity" numeric, "hasReachedCurrentPeriodCap" boolean NOT NULL DEFAULT false, CONSTRAINT "UQ_6a989264cab5ee2d4b424e78526" UNIQUE ("stripeSubscriptionItemId"), CONSTRAINT "IDX_BILLING_SUBSCRIPTION_ITEM_BILLING_SUBSCRIPTION_ID_STRIPE_PRODUCT_ID_UNIQUE" UNIQUE ("billingSubscriptionId", "stripeProductId"), CONSTRAINT "PK_0287b2d9fca488edcbf748281fc" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingSubscription_status_enum" AS ENUM('active', 'canceled', 'incomplete', 'incomplete_expired', 'past_due', 'paused', 'trialing', 'unpaid')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingSubscription_interval_enum" AS ENUM('day', 'month', 'week', 'year')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."billingSubscription_collectionmethod_enum" AS ENUM('CHARGE_AUTOMATICALLY', 'SEND_INVOICE')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."billingSubscription" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, "stripeSubscriptionId" character varying NOT NULL, "status" "core"."billingSubscription_status_enum" NOT NULL, "interval" "core"."billingSubscription_interval_enum", "cancelAtPeriodEnd" boolean NOT NULL DEFAULT false, "currency" character varying NOT NULL DEFAULT 'USD', "currentPeriodEnd" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "currentPeriodStart" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "metadata" jsonb NOT NULL DEFAULT '{}', "cancelAt" TIMESTAMP WITH TIME ZONE, "canceledAt" TIMESTAMP WITH TIME ZONE, "automaticTax" jsonb, "cancellationDetails" jsonb, "collectionMethod" "core"."billingSubscription_collectionmethod_enum" NOT NULL DEFAULT 'CHARGE_AUTOMATICALLY', "endedAt" TIMESTAMP WITH TIME ZONE, "trialStart" TIMESTAMP WITH TIME ZONE, "trialEnd" TIMESTAMP WITH TIME ZONE, CONSTRAINT "UQ_1a858c28c7766d429cbd25f05e8" UNIQUE ("stripeSubscriptionId"), CONSTRAINT "PK_6e9c72c32d91640b8087cb53666" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_BILLING_SUBSCRIPTION_WORKSPACE_ID_UNIQUE" ON "core"."billingSubscription" ("workspaceId") WHERE status IN ('trialing', 'active', 'past_due')`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356" FOREIGN KEY ("stripeCustomerId") REFERENCES "core"."billingCustomer"("stripeCustomerId") ON DELETE CASCADE ON UPDATE CASCADE`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingCustomer" ADD CONSTRAINT "FK_53c2ef50e9611082f83d760897d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "FK_d6eb2f6674a26736c8b2fa4ab11" FOREIGN KEY ("billingSubscriptionId") REFERENCES "core"."billingSubscription"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_0e793f67ed79fac873fb0eb30fb" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_6e7dda21d7fd1c0be7b3b07b3c4" FOREIGN KEY ("stripeCustomerId") REFERENCES "core"."billingCustomer"("stripeCustomerId") ON DELETE CASCADE ON UPDATE CASCADE`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_4abfb70314c18da69e1bee1954d"`,
+ `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_6e7dda21d7fd1c0be7b3b07b3c4"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_0e793f67ed79fac873fb0eb30fb"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "FK_d6eb2f6674a26736c8b2fa4ab11"`,
);
await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "FK_a602e7c9da619b8290232f6eeab"`,
+ `ALTER TABLE "core"."billingCustomer" DROP CONSTRAINT "FK_53c2ef50e9611082f83d760897d"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_BILLING_SUBSCRIPTION_WORKSPACE_ID_UNIQUE"`,
);
await queryRunner.query(`DROP TABLE "core"."billingSubscription"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."billingSubscription_collectionmethod_enum"`,
+ );
+ await queryRunner.query(
+ `DROP TYPE "core"."billingSubscription_interval_enum"`,
+ );
+ await queryRunner.query(
+ `DROP TYPE "core"."billingSubscription_status_enum"`,
+ );
await queryRunner.query(`DROP TABLE "core"."billingSubscriptionItem"`);
+ await queryRunner.query(`DROP TABLE "core"."billingProduct"`);
+ await queryRunner.query(`DROP TABLE "core"."billingPrice"`);
+ await queryRunner.query(`DROP TYPE "core"."billingPrice_interval_enum"`);
+ await queryRunner.query(`DROP TYPE "core"."billingPrice_usagetype_enum"`);
+ await queryRunner.query(`DROP TYPE "core"."billingPrice_tiersmode_enum"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."billingPrice_billingscheme_enum"`,
+ );
+ await queryRunner.query(`DROP TYPE "core"."billingPrice_type_enum"`);
+ await queryRunner.query(`DROP TYPE "core"."billingPrice_taxbehavior_enum"`);
+ await queryRunner.query(`DROP TABLE "core"."billingMeter"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."billingMeter_eventtimewindow_enum"`,
+ );
+ await queryRunner.query(`DROP TYPE "core"."billingMeter_status_enum"`);
+ await queryRunner.query(`DROP TABLE "core"."billingCustomer"`);
+ await queryRunner.query(`DROP TABLE "core"."billingEntitlement"`);
}
}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709233666080-updateBillingCoreTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709233666080-updateBillingCoreTables.ts
deleted file mode 100644
index feef5f1b306..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709233666080-updateBillingCoreTables.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateBillingCoreTables1709233666080
- implements MigrationInterface
-{
- name = 'UpdateBillingCoreTables1709233666080';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "stripeSubscriptionItemId" character varying NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeSubscriptionItemIdUnique" UNIQUE ("billingSubscriptionId", "stripeSubscriptionItemId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeProductIdUnique" UNIQUE ("billingSubscriptionId", "stripeProductId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt" AT TIME ZONE 'UTC'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeProductIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeSubscriptionItemIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "stripeSubscriptionItemId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ALTER COLUMN "deletedAt" TYPE TIMESTAMP`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709914564361-updateBillingSubscription.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709914564361-updateBillingSubscription.ts
deleted file mode 100644
index 44595f3c9fa..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1709914564361-updateBillingSubscription.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateBillingSubscription1709914564361
- implements MigrationInterface
-{
- name = 'UpdateBillingSubscription1709914564361';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_4abfb70314c18da69e1bee1954d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "REL_4abfb70314c18da69e1bee1954"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "UQ_9120b7586c3471463480b58d20a"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_4abfb70314c18da69e1bee1954d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" TYPE text`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingSubscription_status_enum" AS ENUM('active', 'canceled', 'incomplete', 'incomplete_expired', 'past_due', 'paused', 'trialing', 'unpaid')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" TYPE "core"."billingSubscription_status_enum" USING "status"::"core"."billingSubscription_status_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" SET NOT NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" DROP NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_4abfb70314c18da69e1bee1954d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "UQ_9120b7586c3471463480b58d20a" UNIQUE ("stripeCustomerId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "REL_4abfb70314c18da69e1bee1954" UNIQUE ("workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_4abfb70314c18da69e1bee1954d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" TYPE text`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."billingSubscription_status_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "status" TYPE character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "deletedAt" TYPE TIMESTAMP`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1710926613773-addIntervalToBillingSubscription.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1710926613773-addIntervalToBillingSubscription.ts
deleted file mode 100644
index a65cfe4f0bd..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1710926613773-addIntervalToBillingSubscription.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIntervalToBillingSubscription1710926613773
- implements MigrationInterface
-{
- name = 'AddIntervalToBillingSubscription1710926613773';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "interval" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "interval" TYPE text`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingSubscription_interval_enum" AS ENUM('day', 'month', 'week', 'year')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "interval" TYPE "core"."billingSubscription_interval_enum" USING "interval"::"core"."billingSubscription_interval_enum"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ALTER COLUMN "interval" TYPE text`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "interval"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."billingSubscription_interval_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1732098580545-addBillingEntitlementTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1732098580545-addBillingEntitlementTable.ts
deleted file mode 100644
index 174ee339a3d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1732098580545-addBillingEntitlementTable.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddBillingEntitlementTable1732098580545
- implements MigrationInterface
-{
- name = 'AddBillingEntitlementTable1732098580545';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."billingEntitlement" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" text NOT NULL, "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, "value" boolean NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IndexOnFeatureKeyAndWorkspaceIdUnique" UNIQUE ("key", "workspaceId"), CONSTRAINT "PK_4e6ed788c3ca0bf6610d5022576" PRIMARY KEY ("id"))`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_599121a93d8177b5d713b941982" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_599121a93d8177b5d713b941982"`,
- );
-
- await queryRunner.query(`DROP TABLE "core"."billingEntitlement"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733397937967-addNewBillingStripeTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733397937967-addNewBillingStripeTables.ts
deleted file mode 100644
index 5b710b27442..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733397937967-addNewBillingStripeTables.ts
+++ /dev/null
@@ -1,187 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddNewBillingStripeTables1733397937967
- implements MigrationInterface
-{
- name = 'AddNewBillingStripeTables1733397937967';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."billingCustomer" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "workspaceId" uuid NOT NULL, "stripeCustomerId" character varying NOT NULL, CONSTRAINT "UQ_b35a0ef2e2f0d40101dd7f161b9" UNIQUE ("stripeCustomerId"), CONSTRAINT "IndexOnWorkspaceIdAndStripeCustomerIdUnique" UNIQUE ("workspaceId", "stripeCustomerId"), CONSTRAINT "PK_5fffcd69bf722c297a3d5c3f3bc" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingMeter_status_enum" AS ENUM('ACTIVE', 'INACTIVE')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingMeter_eventtimewindow_enum" AS ENUM('DAY', 'HOUR')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."billingMeter" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "stripeMeterId" character varying NOT NULL, "displayName" character varying NOT NULL, "eventName" character varying NOT NULL, "status" "core"."billingMeter_status_enum" NOT NULL, "customerMapping" jsonb NOT NULL, "eventTimeWindow" "core"."billingMeter_eventtimewindow_enum", "valueSettings" jsonb NOT NULL, CONSTRAINT "UQ_340c08c4e5dd33cf963cbb133ae" UNIQUE ("stripeMeterId"), CONSTRAINT "PK_0bba5f7d2e3713332a0138ea1b3" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."billingProduct" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "active" boolean NOT NULL, "description" text, "name" character varying NOT NULL, "taxCode" text, "images" jsonb NOT NULL DEFAULT '[]', "marketingFeatures" jsonb NOT NULL DEFAULT '[]', "stripeProductId" character varying NOT NULL, "defaultStripePriceId" text, "metadata" jsonb NOT NULL DEFAULT '{}', "unitLabel" text, "url" text, CONSTRAINT "UQ_1ba1ba118792aa9eec92f132e82" UNIQUE ("stripeProductId"), CONSTRAINT "PK_8bb3c7be66db8e05476808b0ca7" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_taxbehavior_enum" AS ENUM('EXCLUSIVE', 'INCLUSIVE', 'UNSPECIFIED')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_type_enum" AS ENUM('ONE_TIME', 'RECURRING')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_billingscheme_enum" AS ENUM('PER_UNIT', 'TIERED')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_tiersmode_enum" AS ENUM('GRADUATED', 'VOLUME')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_usagetype_enum" AS ENUM('METERED', 'LICENSED')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingPrice_interval_enum" AS ENUM('day', 'month', 'week', 'year')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."billingPrice" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "stripePriceId" character varying NOT NULL, "active" boolean NOT NULL, "stripeProductId" character varying NOT NULL, "currency" character varying NOT NULL, "nickname" text, "taxBehavior" "core"."billingPrice_taxbehavior_enum" NOT NULL, "type" "core"."billingPrice_type_enum" NOT NULL, "billingScheme" "core"."billingPrice_billingscheme_enum" NOT NULL, "currencyOptions" jsonb, "tiers" jsonb, "recurring" jsonb, "transformQuantity" jsonb, "tiersMode" "core"."billingPrice_tiersmode_enum", "unitAmountDecimal" text, "unitAmount" numeric, "stripeMeterId" character varying, "usageType" "core"."billingPrice_usagetype_enum" NOT NULL, "interval" "core"."billingPrice_interval_enum", CONSTRAINT "UQ_f66d20a329f5f4b9d12afeae7d0" UNIQUE ("stripePriceId"), CONSTRAINT "PK_13927aef8d4e68e176a61c33d89" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "stripeSubscriptionId" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "metadata" jsonb NOT NULL DEFAULT '{}'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "billingThresholds" jsonb`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "cancelAtPeriodEnd" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "currency" character varying NOT NULL DEFAULT 'USD'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "currentPeriodEnd" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "currentPeriodStart" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "metadata" jsonb NOT NULL DEFAULT '{}'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "cancelAt" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "canceledAt" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "automaticTax" jsonb`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "cancellationDetails" jsonb`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."billingSubscription_collectionmethod_enum" AS ENUM('CHARGE_AUTOMATICALLY', 'SEND_INVOICE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "collectionMethod" "core"."billingSubscription_collectionmethod_enum" NOT NULL DEFAULT 'CHARGE_AUTOMATICALLY'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "endedAt" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "trialStart" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD "trialEnd" TIMESTAMP WITH TIME ZONE`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" ADD CONSTRAINT "FK_53c2ef50e9611082f83d760897d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."billingPrice" ADD CONSTRAINT "FK_4d57ee4dbfc8b4075eb24026fca" FOREIGN KEY ("stripeProductId") REFERENCES "core"."billingProduct"("stripeProductId") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingPrice" ADD CONSTRAINT "FK_c8b4375b7bf8724ba54065372e1" FOREIGN KEY ("stripeMeterId") REFERENCES "core"."billingMeter"("stripeMeterId") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingPrice" DROP CONSTRAINT "FK_c8b4375b7bf8724ba54065372e1"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingPrice" DROP CONSTRAINT "FK_4d57ee4dbfc8b4075eb24026fca"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" DROP CONSTRAINT "FK_53c2ef50e9611082f83d760897d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "trialEnd"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "trialStart"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "endedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "collectionMethod"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."billingSubscription_collectionmethod_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "cancellationDetails"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "automaticTax"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "canceledAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "cancelAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "metadata"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "currentPeriodStart"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "currentPeriodEnd"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "currency"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP COLUMN "cancelAtPeriodEnd"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "billingThresholds"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "metadata"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "stripeSubscriptionId"`,
- );
- await queryRunner.query(`DROP TABLE "core"."billingPrice"`);
- await queryRunner.query(`DROP TYPE "core"."billingPrice_interval_enum"`);
- await queryRunner.query(`DROP TYPE "core"."billingPrice_usagetype_enum"`);
- await queryRunner.query(`DROP TYPE "core"."billingPrice_tiersmode_enum"`);
- await queryRunner.query(
- `DROP TYPE "core"."billingPrice_billingscheme_enum"`,
- );
- await queryRunner.query(`DROP TYPE "core"."billingPrice_type_enum"`);
- await queryRunner.query(`DROP TYPE "core"."billingPrice_taxbehavior_enum"`);
- await queryRunner.query(`DROP TABLE "core"."billingProduct"`);
- await queryRunner.query(`DROP TABLE "core"."billingMeter"`);
- await queryRunner.query(
- `DROP TYPE "core"."billingMeter_eventtimewindow_enum"`,
- );
- await queryRunner.query(`DROP TYPE "core"."billingMeter_status_enum"`);
- await queryRunner.query(`DROP TABLE "core"."billingCustomer"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733753649142-removeBillingFKWithCore.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733753649142-removeBillingFKWithCore.ts
deleted file mode 100644
index 73fcd7c655f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1733753649142-removeBillingFKWithCore.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveBillingFKWithCore1733753649142
- implements MigrationInterface
-{
- name = 'RemoveBillingFKWithCore1733753649142';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_599121a93d8177b5d713b941982"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" DROP CONSTRAINT "FK_4abfb70314c18da69e1bee1954d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" DROP CONSTRAINT "FK_53c2ef50e9611082f83d760897d"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" ADD CONSTRAINT "FK_53c2ef50e9611082f83d760897d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscription" ADD CONSTRAINT "FK_4abfb70314c18da69e1bee1954d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_599121a93d8177b5d713b941982" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1734450749954-addConstraintsOnBillingTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1734450749954-addConstraintsOnBillingTables.ts
deleted file mode 100644
index c370ac5b70a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1734450749954-addConstraintsOnBillingTables.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddConstraintsOnBillingTables1734450749954
- implements MigrationInterface
-{
- name = 'AddConstraintsOnBillingTables1734450749954';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeSubscriptionItemIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" DROP CONSTRAINT "IndexOnWorkspaceIdAndStripeCustomerIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "UQ_6a989264cab5ee2d4b424e78526" UNIQUE ("stripeSubscriptionItemId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "quantity"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "quantity" numeric`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" ADD CONSTRAINT "UQ_53c2ef50e9611082f83d760897d" UNIQUE ("workspaceId")`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IndexOnActiveSubscriptionPerWorkspace" ON "core"."billingSubscription" ("workspaceId") WHERE status IN ('trialing', 'active', 'past_due')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356" FOREIGN KEY ("stripeCustomerId") REFERENCES "core"."billingCustomer"("stripeCustomerId") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnActiveSubscriptionPerWorkspace"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" DROP CONSTRAINT "UQ_53c2ef50e9611082f83d760897d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "quantity"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "quantity" integer NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP CONSTRAINT "UQ_6a989264cab5ee2d4b424e78526"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingCustomer" ADD CONSTRAINT "IndexOnWorkspaceIdAndStripeCustomerIdUnique" UNIQUE ("workspaceId", "stripeCustomerId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD CONSTRAINT "IndexOnBillingSubscriptionIdAndStripeSubscriptionItemIdUnique" UNIQUE ("billingSubscriptionId", "stripeSubscriptionItemId")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1737127856478-addNonNullableProductDescription.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1737127856478-addNonNullableProductDescription.ts
deleted file mode 100644
index 8123e622b6a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1737127856478-addNonNullableProductDescription.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddNonNullableProductDescription1737127856478
- implements MigrationInterface
-{
- name = 'AddNonNullableProductDescription1737127856478';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingProduct" ALTER COLUMN "description" SET DEFAULT ''`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingProduct" ALTER COLUMN "description" SET NOT NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingProduct" ALTER COLUMN "description" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingProduct" ALTER COLUMN "description" DROP NOT NULL`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1739981257356-addOnUpdateInEntitlements.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1739981257356-addOnUpdateInEntitlements.ts
deleted file mode 100644
index c49a9b753ea..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1739981257356-addOnUpdateInEntitlements.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddOnUpdateInEntitlements1739981257356
- implements MigrationInterface
-{
- name = 'AddOnUpdateInEntitlements1739981257356';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356" FOREIGN KEY ("stripeCustomerId") REFERENCES "core"."billingCustomer"("stripeCustomerId") ON DELETE CASCADE ON UPDATE CASCADE`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" DROP CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."billingEntitlement" ADD CONSTRAINT "FK_766a1918aa3dbe0d67d3df62356" FOREIGN KEY ("stripeCustomerId") REFERENCES "core"."billingCustomer"("stripeCustomerId") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1743577268972-addHasReachedCurrentPeriodCapColumnInBillingSubscriptionItemTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/billing/1743577268972-addHasReachedCurrentPeriodCapColumnInBillingSubscriptionItemTable.ts
deleted file mode 100644
index caa86073efe..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/billing/1743577268972-addHasReachedCurrentPeriodCapColumnInBillingSubscriptionItemTable.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddHasReachedCurrentPeriodCapColumnInBillingSubscriptionItemTable1743577268972
- implements MigrationInterface
-{
- name =
- 'AddHasReachedCurrentPeriodCapColumnInBillingSubscriptionItemTable1743577268972';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" ADD "hasReachedCurrentPeriodCap" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."billingSubscriptionItem" DROP COLUMN "hasReachedCurrentPeriodCap"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700140427984-setupMetadataTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700140427984-setupMetadataTables.ts
index b3586e3683c..c2a5caea1d0 100644
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700140427984-setupMetadataTables.ts
+++ b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700140427984-setupMetadataTables.ts
@@ -4,68 +4,1026 @@ export class SetupMetadataTables1700140427984 implements MigrationInterface {
name = 'SetupMetadataTables1700140427984';
public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(`
+ CREATE TABLE "core"."_typeorm_generated_columns_and_materialized_views" (
+ "type" character varying NOT NULL,
+ "database" character varying,
+ "schema" character varying,
+ "table" character varying,
+ "name" character varying,
+ "value" text
+ )
+ `);
await queryRunner.query(
- `CREATE TABLE "core"."relationMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "relationType" character varying NOT NULL, "fromObjectMetadataId" uuid NOT NULL, "toObjectMetadataId" uuid NOT NULL, "fromFieldMetadataId" uuid NOT NULL, "toFieldMetadataId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_3deb257254145a3bdde9575e7d" UNIQUE ("fromFieldMetadataId"), CONSTRAINT "REL_9dea8f90d04edbbf9c541a95c3" UNIQUE ("toFieldMetadataId"), CONSTRAINT "PK_2724f60cb4f17a89481a7e8d7d3" PRIMARY KEY ("id"))`,
+ `CREATE TABLE "core"."apiKey" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "revokedAt" TIMESTAMP WITH TIME ZONE, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_2ae3a5e8e04fb402b2dc8d6ce4b" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
- `CREATE TABLE "core"."fieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "objectMetadataId" uuid NOT NULL, "type" character varying NOT NULL, "name" character varying NOT NULL, "label" character varying NOT NULL, "targetColumnMap" jsonb NOT NULL, "defaultValue" jsonb, "description" text, "icon" character varying, "enums" text array, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "isNullable" boolean DEFAULT true, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique" UNIQUE ("name", "objectMetadataId", "workspaceId"), CONSTRAINT "PK_d046b1c7cea325ebc4cdc25e7a9" PRIMARY KEY ("id"))`,
+ `CREATE INDEX "IDX_API_KEY_WORKSPACE_ID" ON "core"."apiKey" ("workspaceId") `,
);
await queryRunner.query(
- `CREATE TABLE "core"."objectMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "dataSourceId" uuid NOT NULL, "nameSingular" character varying NOT NULL, "namePlural" character varying NOT NULL, "labelSingular" character varying NOT NULL, "labelPlural" character varying NOT NULL, "description" text, "icon" character varying, "targetTableName" character varying NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNamePluralAndWorkspaceIdUnique" UNIQUE ("namePlural", "workspaceId"), CONSTRAINT "IndexOnNameSingularAndWorkspaceIdUnique" UNIQUE ("nameSingular", "workspaceId"), CONSTRAINT "PK_81fb7f4f4244211cfbd188af1e8" PRIMARY KEY ("id"))`,
+ `CREATE TYPE "core"."keyValuePair_type_enum" AS ENUM('USER_VARIABLE', 'FEATURE_FLAG', 'CONFIG_VARIABLE')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."keyValuePair" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid, "workspaceId" uuid, "key" text NOT NULL, "value" jsonb, "textValueDeprecated" text, "type" "core"."keyValuePair_type_enum" NOT NULL DEFAULT 'USER_VARIABLE', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IDX_KEY_VALUE_PAIR_KEY_USER_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("key", "userId", "workspaceId"), CONSTRAINT "PK_c5a1ca828435d3eaf8f9361ed4b" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_KEY_VALUE_PAIR_KEY_USER_ID_NULL_WORKSPACE_ID_UNIQUE" ON "core"."keyValuePair" ("key", "userId") WHERE "workspaceId" is NULL`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_KEY_VALUE_PAIR_KEY_WORKSPACE_ID_NULL_USER_ID_UNIQUE" ON "core"."keyValuePair" ("key", "workspaceId") WHERE "userId" is NULL`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."twoFactorAuthenticationMethod_status_enum" AS ENUM('PENDING', 'VERIFIED')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."twoFactorAuthenticationMethod_strategy_enum" AS ENUM('TOTP')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."twoFactorAuthenticationMethod" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userWorkspaceId" uuid NOT NULL, "secret" text NOT NULL, "status" "core"."twoFactorAuthenticationMethod_status_enum" NOT NULL, "strategy" "core"."twoFactorAuthenticationMethod_strategy_enum" NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_c455f6a499e7110fc95e4bea540" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_2909f5139c479e4632df03fd5e" ON "core"."twoFactorAuthenticationMethod" ("userWorkspaceId", "strategy") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."userWorkspace" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "defaultAvatarUrl" character varying, "locale" character varying NOT NULL DEFAULT 'en', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_222871f3641385e36e0b9f82aeb" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_USER_WORKSPACE_WORKSPACE_ID" ON "core"."userWorkspace" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_USER_WORKSPACE_USER_ID" ON "core"."userWorkspace" ("userId") `,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE" ON "core"."userWorkspace" ("userId", "workspaceId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "firstName" character varying NOT NULL DEFAULT '', "lastName" character varying NOT NULL DEFAULT '', "email" character varying NOT NULL, "defaultAvatarUrl" character varying, "isEmailVerified" boolean NOT NULL DEFAULT false, "disabled" boolean NOT NULL DEFAULT false, "passwordHash" character varying, "canImpersonate" boolean NOT NULL DEFAULT false, "canAccessFullAdminPanel" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "locale" character varying NOT NULL DEFAULT 'en', CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "UQ_USER_EMAIL" ON "core"."user" ("email") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."appToken" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid, "workspaceId" uuid, "type" text NOT NULL DEFAULT 'REFRESH_TOKEN', "value" text, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "revokedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "context" jsonb, CONSTRAINT "PK_143bfe36c6284c6d3a52c94741f" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."approvedAccessDomain" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "domain" character varying NOT NULL, "isValidated" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, CONSTRAINT "IDX_APPROVED_ACCESS_DOMAIN_DOMAIN_WORKSPACE_ID_UNIQUE" UNIQUE ("domain", "workspaceId"), CONSTRAINT "PK_523281ce57c84e1a039f4538c19" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."featureFlag" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" text NOT NULL, "workspaceId" uuid NOT NULL, "value" boolean NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_FEATURE_FLAG_KEY_WORKSPACE_ID_UNIQUE" UNIQUE ("key", "workspaceId"), CONSTRAINT "PK_894efa1b1822de801f3b9e04069" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."postgresCredentials" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "user" character varying NOT NULL, "passwordHash" character varying NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "workspaceId" uuid NOT NULL, CONSTRAINT "PK_3f9c4cdf895bfea0a6ea15bdd81" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."workspaceSSOIdentityProvider_status_enum" AS ENUM('Active', 'Inactive', 'Error')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."workspaceSSOIdentityProvider_type_enum" AS ENUM('OIDC', 'SAML')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."workspaceSSOIdentityProvider" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "status" "core"."workspaceSSOIdentityProvider_status_enum" NOT NULL DEFAULT 'Active', "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "type" "core"."workspaceSSOIdentityProvider_type_enum" NOT NULL DEFAULT 'OIDC', "issuer" character varying NOT NULL, "clientID" character varying, "clientSecret" character varying, "ssoURL" character varying, "certificate" character varying, "fingerprint" character varying, CONSTRAINT "PK_a4e3928eb641e7cd612042b628b" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TYPE "core"."dataSource_type_enum" AS ENUM('postgres')`,
);
await queryRunner.query(
- `CREATE TABLE "core"."dataSource" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "url" character varying, "schema" character varying, "type" "core"."dataSource_type_enum" NOT NULL DEFAULT 'postgres', "label" character varying, "isRemote" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_6d01ae6c0f47baf4f8e37342268" PRIMARY KEY ("id"))`,
+ `CREATE TABLE "core"."dataSource" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "label" character varying, "url" character varying, "schema" character varying, "type" "core"."dataSource_type_enum" NOT NULL DEFAULT 'postgres', "isRemote" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_6d01ae6c0f47baf4f8e37342268" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_DATA_SOURCE_WORKSPACE_ID_CREATED_AT" ON "core"."dataSource" ("workspaceId", "createdAt") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."objectPermission" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "objectMetadataId" uuid NOT NULL, "canReadObjectRecords" boolean, "canUpdateObjectRecords" boolean, "canSoftDeleteObjectRecords" boolean, "canDestroyObjectRecords" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_OBJECT_PERMISSION_OBJECT_METADATA_ID_ROLE_ID_UNIQUE" UNIQUE ("objectMetadataId", "roleId"), CONSTRAINT "PK_23a4033c1aa380d0d1431731add" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_OBJECT_PERMISSION_WORKSPACE_ID_ROLE_ID" ON "core"."objectPermission" ("workspaceId", "roleId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."permissionFlag" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "flag" character varying NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_PERMISSION_FLAG_FLAG_ROLE_ID_UNIQUE" UNIQUE ("flag", "roleId"), CONSTRAINT "PK_a02789db60620a1e9f90147b50f" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."roleTargets" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "workspaceId" uuid NOT NULL, "roleId" uuid NOT NULL, "userWorkspaceId" uuid, "agentId" uuid, "apiKeyId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_ROLE_TARGETS_UNIQUE" UNIQUE ("userWorkspaceId", "roleId", "agentId", "apiKeyId"), CONSTRAINT "CHK_role_targets_single_entity" CHECK (("agentId" IS NOT NULL AND "userWorkspaceId" IS NULL AND "apiKeyId" IS NULL) OR ("agentId" IS NULL AND "userWorkspaceId" IS NOT NULL AND "apiKeyId" IS NULL) OR ("agentId" IS NULL AND "userWorkspaceId" IS NULL AND "apiKeyId" IS NOT NULL)), CONSTRAINT "PK_0fe0b3be0a4a966e76c00f44df9" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_ROLE_TARGETS_API_KEY_ID" ON "core"."roleTargets" ("apiKeyId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_ROLE_TARGETS_AGENT_ID" ON "core"."roleTargets" ("agentId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_ROLE_TARGETS_WORKSPACE_ID" ON "core"."roleTargets" ("userWorkspaceId", "workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."role" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "standardId" uuid, "label" character varying NOT NULL, "canUpdateAllSettings" boolean NOT NULL DEFAULT false, "canAccessAllTools" boolean NOT NULL DEFAULT false, "canReadAllObjectRecords" boolean NOT NULL DEFAULT false, "canUpdateAllObjectRecords" boolean NOT NULL DEFAULT false, "canSoftDeleteAllObjectRecords" boolean NOT NULL DEFAULT false, "canDestroyAllObjectRecords" boolean NOT NULL DEFAULT false, "description" text, "icon" character varying, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "isEditable" boolean NOT NULL DEFAULT true, "canBeAssignedToUsers" boolean NOT NULL DEFAULT true, "canBeAssignedToAgents" boolean NOT NULL DEFAULT true, "canBeAssignedToApiKeys" boolean NOT NULL DEFAULT true, CONSTRAINT "IDX_ROLE_LABEL_WORKSPACE_ID_UNIQUE" UNIQUE ("label", "workspaceId"), CONSTRAINT "PK_b36bcfe02fc8de3c57a8b2391c2" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."fieldPermission" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "objectMetadataId" uuid NOT NULL, "fieldMetadataId" uuid NOT NULL, "canReadFieldValue" boolean, "canUpdateFieldValue" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_FIELD_PERMISSION_FIELD_METADATA_ID_ROLE_ID_UNIQUE" UNIQUE ("fieldMetadataId", "roleId"), CONSTRAINT "PK_d7bb911e4f9b1b5e3bfcfdd1c4b" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_PERMISSION_WORKSPACE_ID_ROLE_ID" ON "core"."fieldPermission" ("workspaceId", "roleId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."objectMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "standardId" uuid, "dataSourceId" uuid NOT NULL, "nameSingular" character varying NOT NULL, "namePlural" character varying NOT NULL, "labelSingular" character varying NOT NULL, "labelPlural" character varying NOT NULL, "description" text, "icon" character varying, "standardOverrides" jsonb, "targetTableName" character varying NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "isRemote" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "isUIReadOnly" boolean NOT NULL DEFAULT false, "isAuditLogged" boolean NOT NULL DEFAULT true, "isSearchable" boolean NOT NULL DEFAULT false, "duplicateCriteria" jsonb, "shortcut" character varying, "labelIdentifierFieldMetadataId" uuid, "imageIdentifierFieldMetadataId" uuid, "isLabelSyncedWithName" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_OBJECT_METADATA_NAME_PLURAL_WORKSPACE_ID_UNIQUE" UNIQUE ("namePlural", "workspaceId"), CONSTRAINT "IDX_OBJECT_METADATA_NAME_SINGULAR_WORKSPACE_ID_UNIQUE" UNIQUE ("nameSingular", "workspaceId"), CONSTRAINT "PK_81fb7f4f4244211cfbd188af1e8" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."indexMetadata_indextype_enum" AS ENUM('BTREE', 'GIN')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."indexMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "name" character varying NOT NULL, "workspaceId" character varying, "objectMetadataId" uuid NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "isUnique" boolean NOT NULL DEFAULT false, "indexWhereClause" text, "indexType" "core"."indexMetadata_indextype_enum" NOT NULL DEFAULT 'BTREE', CONSTRAINT "IDX_INDEX_METADATA_NAME_WORKSPACE_ID_OBJECT_METADATA_ID_UNIQUE" UNIQUE ("name", "workspaceId", "objectMetadataId"), CONSTRAINT "PK_f73bb3c3678aee204e341f0ca4e" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_INDEX_METADATA_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."indexMetadata" ("workspaceId", "objectMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."indexFieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "indexMetadataId" uuid NOT NULL, "fieldMetadataId" uuid NOT NULL, "order" integer NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_5928f67e43eff7d95aa79fd96fd" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_INDEX_FIELD_METADATA_FIELD_METADATA_ID" ON "core"."indexFieldMetadata" ("fieldMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."fieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "standardId" uuid, "objectMetadataId" uuid NOT NULL, "type" character varying NOT NULL, "name" character varying NOT NULL, "label" character varying NOT NULL, "defaultValue" jsonb, "description" text, "icon" character varying, "standardOverrides" jsonb, "options" jsonb, "settings" jsonb, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "isUIReadOnly" boolean NOT NULL DEFAULT false, "isNullable" boolean DEFAULT true, "isUnique" boolean DEFAULT false, "workspaceId" uuid NOT NULL, "isLabelSyncedWithName" boolean NOT NULL DEFAULT false, "relationTargetFieldMetadataId" uuid, "relationTargetObjectMetadataId" uuid, "morphId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_47a6c57e1652b6475f8248cff7" UNIQUE ("relationTargetFieldMetadataId"), CONSTRAINT "CHK_FIELD_METADATA_MORPH_RELATION_REQUIRES_MORPH_ID" CHECK (("type" != 'MORPH_RELATION') OR ("type" = 'MORPH_RELATION' AND "morphId" IS NOT NULL)), CONSTRAINT "PK_d046b1c7cea325ebc4cdc25e7a9" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_METADATA_OBJECT_METADATA_ID" ON "core"."fieldMetadata" ("objectMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_METADATA_WORKSPACE_ID" ON "core"."fieldMetadata" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_METADATA_OBJECT_METADATA_ID_WORKSPACE_ID" ON "core"."fieldMetadata" ("objectMetadataId", "workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_METADATA_RELATION_TARGET_OBJECT_METADATA_ID" ON "core"."fieldMetadata" ("relationTargetObjectMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FIELD_METADATA_RELATION_TARGET_FIELD_METADATA_ID" ON "core"."fieldMetadata" ("relationTargetFieldMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."viewFilter_operand_enum" AS ENUM('IS', 'IS_NOT_NULL', 'IS_NOT', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN_OR_EQUAL', 'IS_BEFORE', 'IS_AFTER', 'CONTAINS', 'DOES_NOT_CONTAIN', 'IS_EMPTY', 'IS_NOT_EMPTY', 'IS_RELATIVE', 'IS_IN_PAST', 'IS_IN_FUTURE', 'IS_TODAY', 'VECTOR_SEARCH')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."viewFilter" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "operand" "core"."viewFilter_operand_enum" NOT NULL DEFAULT 'CONTAINS', "value" jsonb NOT NULL, "viewFilterGroupId" uuid, "positionInViewFilterGroup" double precision, "subFieldName" text, "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_09f9ffa2f66263b9eb301460137" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_cd4588bfc9ad73345b3953a039" ON "core"."viewFilter" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FILTER_FIELD_METADATA_ID" ON "core"."viewFilter" ("fieldMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FILTER_VIEW_ID" ON "core"."viewFilter" ("viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FILTER_WORKSPACE_ID_VIEW_ID" ON "core"."viewFilter" ("workspaceId", "viewId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."viewFilterGroup_logicaloperator_enum" AS ENUM('AND', 'OR', 'NOT')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."viewFilterGroup" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "parentViewFilterGroupId" uuid, "logicalOperator" "core"."viewFilterGroup_logicaloperator_enum" NOT NULL DEFAULT 'AND', "positionInViewFilterGroup" double precision, "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_16f55359d609168b826405ed307" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_e6ed40a61e4584e98584019a47" ON "core"."viewFilterGroup" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FILTER_GROUP_VIEW_ID" ON "core"."viewFilterGroup" ("viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FILTER_GROUP_WORKSPACE_ID_VIEW_ID" ON "core"."viewFilterGroup" ("workspaceId", "viewId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."viewGroup" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "isVisible" boolean NOT NULL DEFAULT true, "fieldValue" text NOT NULL, "position" double precision NOT NULL DEFAULT '0', "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_d2aa8cad01e9d5e99c23f9ccec3" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_a44e3b03f0eca32d0504d5ef73" ON "core"."viewGroup" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_GROUP_VIEW_ID" ON "core"."viewGroup" ("viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_GROUP_WORKSPACE_ID_VIEW_ID" ON "core"."viewGroup" ("workspaceId", "viewId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."viewSort_direction_enum" AS ENUM('ASC', 'DESC')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."viewSort" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "direction" "core"."viewSort_direction_enum" NOT NULL DEFAULT 'ASC', "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_eceb74d297f926313af6463d496" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_38232fc0c6567ed029c2b1a12c" ON "core"."viewSort" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE" ON "core"."viewSort" ("fieldMetadataId", "viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_SORT_VIEW_ID" ON "core"."viewSort" ("viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_SORT_WORKSPACE_ID_VIEW_ID" ON "core"."viewSort" ("workspaceId", "viewId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."view_type_enum" AS ENUM('TABLE', 'KANBAN')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."view_key_enum" AS ENUM('INDEX')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."view_openrecordin_enum" AS ENUM('SIDE_PANEL', 'RECORD_PAGE')`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."view_kanbanaggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."view" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" text NOT NULL DEFAULT '', "objectMetadataId" uuid NOT NULL, "type" "core"."view_type_enum" NOT NULL DEFAULT 'TABLE', "key" "core"."view_key_enum", "icon" text NOT NULL, "position" double precision NOT NULL DEFAULT '0', "isCompact" boolean NOT NULL DEFAULT false, "isCustom" boolean NOT NULL DEFAULT false, "openRecordIn" "core"."view_openrecordin_enum" NOT NULL DEFAULT 'SIDE_PANEL', "kanbanAggregateOperation" "core"."view_kanbanaggregateoperation_enum", "kanbanAggregateOperationFieldMetadataId" uuid, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "anyFieldFilterValue" text, CONSTRAINT "PK_86cfb9e426c77d60b900fe2b543" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_552aa6908966e980099b3e5ebf" ON "core"."view" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."view" ("workspaceId", "objectMetadataId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."viewField_aggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."viewField" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "isVisible" boolean NOT NULL DEFAULT true, "size" integer NOT NULL DEFAULT '0', "position" double precision NOT NULL DEFAULT '0', "aggregateOperation" "core"."viewField_aggregateoperation_enum", "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_ba2a5aa5f0bd7ac82788fae921e" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_b86af4ea24cae518dee8eae996" ON "core"."viewField" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE" ON "core"."viewField" ("fieldMetadataId", "viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FIELD_VIEW_ID" ON "core"."viewField" ("viewId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_VIEW_FIELD_WORKSPACE_ID_VIEW_ID" ON "core"."viewField" ("workspaceId", "viewId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."webhook" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "targetUrl" character varying NOT NULL, "operations" text array NOT NULL DEFAULT '{*.*}', "description" character varying, "secret" character varying NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_e6765510c2d078db49632b59020" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_WEBHOOK_WORKSPACE_ID" ON "core"."webhook" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."file" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "fullPath" character varying NOT NULL, "size" bigint NOT NULL, "type" character varying NOT NULL, "workspaceId" uuid NOT NULL, "messageId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_36b46d232307066b3a2c9ea3a1d" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_FILE_WORKSPACE_ID" ON "core"."file" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."agentChatMessage_role_enum" AS ENUM('user', 'assistant')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."agentChatMessage" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "threadId" uuid NOT NULL, "role" "core"."agentChatMessage_role_enum" NOT NULL, "content" text NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f54a95b34e98d94251bce37a180" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_cd5b23d4e471b630137b3017ba" ON "core"."agentChatMessage" ("threadId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."agentChatThread" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "agentId" uuid NOT NULL, "userWorkspaceId" uuid NOT NULL, "title" character varying, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_82f67c93227868769e9553f059e" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_d0bdc80c68a48b1f26727aabfe" ON "core"."agentChatThread" ("agentId") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_3bd935d6f8c5ce87194b8db824" ON "core"."agentChatThread" ("userWorkspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."agent" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "standardId" uuid, "name" character varying NOT NULL, "label" character varying NOT NULL, "icon" character varying, "description" character varying, "prompt" text NOT NULL, "modelId" character varying NOT NULL DEFAULT 'auto', "responseFormat" jsonb, "workspaceId" uuid NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_1000e989398c5d4ed585cf9a46f" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE" ON "core"."agent" ("name", "workspaceId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_AGENT_ID_DELETED_AT" ON "core"."agent" ("id", "deletedAt") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."agentHandoff" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fromAgentId" uuid NOT NULL, "toAgentId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "description" text, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_93611f5714c0c28198616f9e83b" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_AGENT_HANDOFF_FROM_TO_WORKSPACE_UNIQUE" ON "core"."agentHandoff" ("fromAgentId", "toAgentId", "workspaceId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_AGENT_HANDOFF_ID_DELETED_AT" ON "core"."agentHandoff" ("id", "deletedAt") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."workspace_activationStatus_enum" AS ENUM('ONGOING_CREATION', 'PENDING_CREATION', 'ACTIVE', 'INACTIVE', 'SUSPENDED')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."workspace" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "displayName" character varying, "logo" character varying, "inviteHash" character varying, "deletedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "allowImpersonation" boolean NOT NULL DEFAULT true, "isPublicInviteLinkEnabled" boolean NOT NULL DEFAULT true, "activationStatus" "core"."workspace_activationStatus_enum" NOT NULL DEFAULT 'INACTIVE', "metadataVersion" integer NOT NULL DEFAULT '1', "databaseUrl" character varying NOT NULL DEFAULT '', "databaseSchema" character varying NOT NULL DEFAULT '', "subdomain" character varying NOT NULL, "customDomain" character varying, "isGoogleAuthEnabled" boolean NOT NULL DEFAULT true, "isTwoFactorAuthenticationEnforced" boolean NOT NULL DEFAULT false, "isPasswordAuthEnabled" boolean NOT NULL DEFAULT true, "isMicrosoftAuthEnabled" boolean NOT NULL DEFAULT true, "isCustomDomainEnabled" boolean NOT NULL DEFAULT false, "defaultRoleId" uuid, "defaultAgentId" uuid, "version" character varying, CONSTRAINT "UQ_cba6255a24deb1fff07dd7351b8" UNIQUE ("subdomain"), CONSTRAINT "UQ_900f0a3eb789159c26c8bcb39cd" UNIQUE ("customDomain"), CONSTRAINT "onboarded_workspace_requires_default_role" CHECK ("activationStatus" IN ('PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL), CONSTRAINT "PK_ca86b6f9b3be5fe26d307d09b49" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_WORKSPACE_ACTIVATION_STATUS" ON "core"."workspace" ("activationStatus") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."workspaceMigration" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "migrations" jsonb, "name" character varying NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "appliedAt" TIMESTAMP WITH TIME ZONE, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_33f481ae58d08030a3a007efde1" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."cronTrigger" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "settings" jsonb NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "serverlessFunctionId" uuid, CONSTRAINT "PK_153e054abdb2663942d4661e3bb" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_8adc1fd6cb0dad2fbfd945954d" ON "core"."cronTrigger" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_CRON_TRIGGER_WORKSPACE_ID" ON "core"."cronTrigger" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."databaseEventTrigger" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "settings" jsonb NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "serverlessFunctionId" uuid, CONSTRAINT "PK_30dd6c9713cb9dc86d75211d84c" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_960465af116edf9ac501bfb3db" ON "core"."databaseEventTrigger" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_DATABASE_EVENT_TRIGGER_WORKSPACE_ID" ON "core"."databaseEventTrigger" ("workspaceId") `,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."route_httpmethod_enum" AS ENUM('GET', 'POST', 'PUT', 'PATCH', 'DELETE')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."route" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "path" character varying NOT NULL, "isAuthRequired" boolean NOT NULL DEFAULT true, "httpMethod" "core"."route_httpmethod_enum" NOT NULL DEFAULT 'GET', "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "serverlessFunctionId" uuid, CONSTRAINT "IDX_ROUTE_PATH_HTTP_METHOD_WORKSPACE_ID_UNIQUE" UNIQUE ("path", "httpMethod", "workspaceId"), CONSTRAINT "PK_08affcd076e46415e5821acf52d" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE UNIQUE INDEX "IDX_1c39502392dd9cbb186deba158" ON "core"."route" ("workspaceId", "universalIdentifier") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."serverlessFunction" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "description" character varying, "latestVersion" character varying, "publishedVersions" jsonb NOT NULL DEFAULT '[]', "latestVersionInputSchema" jsonb, "runtime" character varying NOT NULL DEFAULT 'nodejs22.x', "timeoutSeconds" integer NOT NULL DEFAULT '300', "layerVersion" integer, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "CHK_4a5179975ee017934a91703247" CHECK ("timeoutSeconds" >= 1 AND "timeoutSeconds" <= 900), CONSTRAINT "PK_49bfacee064bee9d0d486483b60" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_SERVERLESS_FUNCTION_ID_DELETED_AT" ON "core"."serverlessFunction" ("id", "deletedAt") `,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."remoteTable" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "distantTableName" character varying NOT NULL, "localTableName" character varying NOT NULL, "workspaceId" uuid NOT NULL, "remoteServerId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_632b3858de52c8c2eb00c709b52" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."remoteServer" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "foreignDataWrapperId" uuid NOT NULL DEFAULT uuid_generate_v4(), "foreignDataWrapperType" text, "label" text, "foreignDataWrapperOptions" jsonb, "userMappingOptions" jsonb, "schema" text, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_8e5d208498fa2c9710bb934023a" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."pageLayoutWidget_type_enum" AS ENUM('VIEW', 'IFRAME', 'FIELDS', 'GRAPH')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."pageLayoutWidget" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "pageLayoutTabId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "title" character varying NOT NULL, "type" "core"."pageLayoutWidget_type_enum" NOT NULL DEFAULT 'VIEW', "objectMetadataId" uuid, "gridPosition" jsonb NOT NULL, "configuration" jsonb, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_2f997489b8b15cb26a0b9d4220b" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_PAGE_LAYOUT_WIDGET_WORKSPACE_ID_PAGE_LAYOUT_TAB_ID" ON "core"."pageLayoutWidget" ("workspaceId", "pageLayoutTabId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."pageLayoutTab" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "title" character varying NOT NULL, "workspaceId" uuid NOT NULL, "position" double precision NOT NULL DEFAULT '0', "pageLayoutId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_f1327f6ea950cdc59fe17569c5c" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_PAGE_LAYOUT_TAB_WORKSPACE_ID_PAGE_LAYOUT_ID" ON "core"."pageLayoutTab" ("workspaceId", "pageLayoutId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `CREATE TYPE "core"."pageLayout_type_enum" AS ENUM('RECORD_INDEX', 'RECORD_PAGE', 'DASHBOARD')`,
+ );
+ await queryRunner.query(
+ `CREATE TABLE "core"."pageLayout" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "workspaceId" uuid NOT NULL, "type" "core"."pageLayout_type_enum" NOT NULL DEFAULT 'RECORD_PAGE', "objectMetadataId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_5028ccb46ffa0c945d2f9246dfa" PRIMARY KEY ("id"))`,
+ );
+ await queryRunner.query(
+ `CREATE INDEX "IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."pageLayout" ("workspaceId", "objectMetadataId") WHERE "deletedAt" IS NULL`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."apiKey" ADD CONSTRAINT "FK_c8b3efa54a29aa873043e72fb1d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "FK_0dae35d1c0fbdda6495be4ae71a" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "FK_c137e3d8b3980901e114941daa2" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."twoFactorAuthenticationMethod" ADD CONSTRAINT "FK_b0f44ffd7c794beb48cb1e1b1a9" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_a2da2ea7d6cd1e5a4c5cb1791f8" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_22f5e76f493c3fb20237cfc48b0" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_8cd4819144baf069777b5729136" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."approvedAccessDomain" ADD CONSTRAINT "FK_73d3e340b6ce0716a25a86361fc" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."featureFlag" ADD CONSTRAINT "FK_6be7761fa8453f3a498aab6e72b" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."postgresCredentials" ADD CONSTRAINT "FK_9494639abc06f9c8c3691bf5d22" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "FK_bc8d8855198de1fbc32fba8df93" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "FK_826052747c82e59f0a006204256" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "FK_efbcf3528718de2b5c45c0a8a83" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."permissionFlag" ADD CONSTRAINT "FK_13f8ca9c517976733a1ce4c10eb" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "FK_d5838ba43033ee6266d8928d7d7" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "FK_915c8bcb0f861a56f793a4b8331" FOREIGN KEY ("apiKeyId") REFERENCES "core"."apiKey"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_bbf16a91f5a10199e5b18c019ba" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_dc8e552397f5e44d175fedf752a" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_d5c47a26fe71648894d05da3d3a" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_2763aee5614b54019d692333fe1" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "FK_0b19dd17369574578bc18c405b2" FOREIGN KEY ("dataSourceId") REFERENCES "core"."dataSource"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."indexMetadata" ADD CONSTRAINT "FK_051487e9b745cb175950130b63f" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."indexFieldMetadata" ADD CONSTRAINT "FK_b20192c432612eb710801dd5664" FOREIGN KEY ("indexMetadataId") REFERENCES "core"."indexMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."indexFieldMetadata" ADD CONSTRAINT "FK_be0950612a54b58c72bd62d629e" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_de2a09b9e3e690440480d2dee26" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_47a6c57e1652b6475f8248cff78" FOREIGN KEY ("relationTargetFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_6f6c87ec32cca956d8be321071c" FOREIGN KEY ("relationTargetObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_193548db5abc45713087f7d1af6" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_32cabc67e40d24acab541c469a8" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_06858adf0fb54ec88fa602198ca" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_b518bd61175e0963370e09ef15e" FOREIGN KEY ("viewFilterGroupId") REFERENCES "core"."viewFilterGroup"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_dce74ab06fa7a2effcbf1b98dff" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_8919a390f4022ab1e40182a5ac3" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_6aa17342705ae5526de377bf7ed" FOREIGN KEY ("parentViewFilterGroupId") REFERENCES "core"."viewFilterGroup"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_b3aa7ec58cdd9e83729f2232591" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_61053f5509cc31e5d7139fba1cb" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_2d7cfc4748058a0ca648835d046" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_818522b962a9b756accb5b3149d" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_5f3278d6791aa4c58423e556ae6" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_2b36c6adea4542b4844d9fb1806" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."view" ADD CONSTRAINT "FK_3e5ea41c239ef1b75b0d42bef99" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."view" ADD CONSTRAINT "FK_580dad12c8b92f3a3c307c4e66d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_0a48a0b66daedac1314437be5eb" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_96158de54c78944b5340b6f708e" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_c5ab40cd4debb51d588752a4857" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."webhook" ADD CONSTRAINT "FK_597ab5e7de76f1836b8fd80d6b9" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."file" ADD CONSTRAINT "FK_de468b3d8dcf7e94f7074220929" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."file" ADD CONSTRAINT "FK_a78a68c3f577a485dd4c741909f" FOREIGN KEY ("messageId") REFERENCES "core"."agentChatMessage"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatMessage" ADD CONSTRAINT "FK_cd5b23d4e471b630137b3017ba6" FOREIGN KEY ("threadId") REFERENCES "core"."agentChatThread"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatThread" ADD CONSTRAINT "FK_d0bdc80c68a48b1f26727aabfe6" FOREIGN KEY ("agentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatThread" ADD CONSTRAINT "FK_3bd935d6f8c5ce87194b8db8240" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agent" ADD CONSTRAINT "FK_c4cb56621768a4a325dd772bbe1" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_7128daa5ac9f787388391b52269" FOREIGN KEY ("fromAgentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `CREATE TABLE "core"."workspaceMigration" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "migrations" jsonb, "name" character varying, "isCustom" boolean NOT NULL DEFAULT false, "appliedAt" TIMESTAMP, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f9b06eb42494795f73acb5c2350" PRIMARY KEY ("id"))`,
+ `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_020114432e51baf65bbbc46e350" FOREIGN KEY ("toAgentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d" FOREIGN KEY ("fromObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_7ea2d1182dc5324e7cef9903302" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824" FOREIGN KEY ("toObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."cronTrigger" ADD CONSTRAINT "FK_f70831ec336e0cb42d6a33b80ba" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_3deb257254145a3bdde9575e7d6" FOREIGN KEY ("fromFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."databaseEventTrigger" ADD CONSTRAINT "FK_7650f1b8b693cde204f44ab0aa4" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b" FOREIGN KEY ("toFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."route" ADD CONSTRAINT "FK_c63b1110bbf09051be2f495d0be" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_de2a09b9e3e690440480d2dee26" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."remoteTable" ADD CONSTRAINT "FK_3db5ae954f9197def326053f06a" FOREIGN KEY ("remoteServerId") REFERENCES "core"."remoteServer"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "FK_0b19dd17369574578bc18c405b2" FOREIGN KEY ("dataSourceId") REFERENCES "core"."dataSource"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_555948f84165dce1fe1f5f955ce" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_0659a4d171c93f5c046f18d24cd" FOREIGN KEY ("pageLayoutTabId") REFERENCES "core"."pageLayoutTab"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_c4dc95034f53a12601e623d9171" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutTab" ADD CONSTRAINT "FK_2528e67c8c0c953d8303172989e" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutTab" ADD CONSTRAINT "FK_0177b1574efe6e6f24651977340" FOREIGN KEY ("pageLayoutId") REFERENCES "core"."pageLayout"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayout" ADD CONSTRAINT "FK_760ec8b78721991220b76accd55" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayout" ADD CONSTRAINT "FK_dd63ca42614bacf58971aabdcbb" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "FK_0b19dd17369574578bc18c405b2"`,
+ `ALTER TABLE "core"."pageLayout" DROP CONSTRAINT "FK_dd63ca42614bacf58971aabdcbb"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayout" DROP CONSTRAINT "FK_760ec8b78721991220b76accd55"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutTab" DROP CONSTRAINT "FK_0177b1574efe6e6f24651977340"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutTab" DROP CONSTRAINT "FK_2528e67c8c0c953d8303172989e"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_c4dc95034f53a12601e623d9171"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_0659a4d171c93f5c046f18d24cd"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_555948f84165dce1fe1f5f955ce"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."remoteTable" DROP CONSTRAINT "FK_3db5ae954f9197def326053f06a"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."route" DROP CONSTRAINT "FK_c63b1110bbf09051be2f495d0be"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."databaseEventTrigger" DROP CONSTRAINT "FK_7650f1b8b693cde204f44ab0aa4"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."cronTrigger" DROP CONSTRAINT "FK_f70831ec336e0cb42d6a33b80ba"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_7ea2d1182dc5324e7cef9903302"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_020114432e51baf65bbbc46e350"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_7128daa5ac9f787388391b52269"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agent" DROP CONSTRAINT "FK_c4cb56621768a4a325dd772bbe1"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatThread" DROP CONSTRAINT "FK_3bd935d6f8c5ce87194b8db8240"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatThread" DROP CONSTRAINT "FK_d0bdc80c68a48b1f26727aabfe6"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."agentChatMessage" DROP CONSTRAINT "FK_cd5b23d4e471b630137b3017ba6"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."file" DROP CONSTRAINT "FK_a78a68c3f577a485dd4c741909f"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."file" DROP CONSTRAINT "FK_de468b3d8dcf7e94f7074220929"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."webhook" DROP CONSTRAINT "FK_597ab5e7de76f1836b8fd80d6b9"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_c5ab40cd4debb51d588752a4857"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_96158de54c78944b5340b6f708e"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_0a48a0b66daedac1314437be5eb"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."view" DROP CONSTRAINT "FK_580dad12c8b92f3a3c307c4e66d"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."view" DROP CONSTRAINT "FK_3e5ea41c239ef1b75b0d42bef99"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_2b36c6adea4542b4844d9fb1806"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_5f3278d6791aa4c58423e556ae6"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_818522b962a9b756accb5b3149d"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_2d7cfc4748058a0ca648835d046"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_61053f5509cc31e5d7139fba1cb"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_b3aa7ec58cdd9e83729f2232591"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_6aa17342705ae5526de377bf7ed"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_8919a390f4022ab1e40182a5ac3"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_dce74ab06fa7a2effcbf1b98dff"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_b518bd61175e0963370e09ef15e"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_06858adf0fb54ec88fa602198ca"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_32cabc67e40d24acab541c469a8"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_193548db5abc45713087f7d1af6"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_6f6c87ec32cca956d8be321071c"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_47a6c57e1652b6475f8248cff78"`,
);
await queryRunner.query(
`ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_de2a09b9e3e690440480d2dee26"`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b"`,
+ `ALTER TABLE "core"."indexFieldMetadata" DROP CONSTRAINT "FK_be0950612a54b58c72bd62d629e"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."indexFieldMetadata" DROP CONSTRAINT "FK_b20192c432612eb710801dd5664"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."indexMetadata" DROP CONSTRAINT "FK_051487e9b745cb175950130b63f"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "FK_0b19dd17369574578bc18c405b2"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_2763aee5614b54019d692333fe1"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_d5c47a26fe71648894d05da3d3a"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_dc8e552397f5e44d175fedf752a"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_bbf16a91f5a10199e5b18c019ba"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "FK_915c8bcb0f861a56f793a4b8331"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "FK_d5838ba43033ee6266d8928d7d7"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."permissionFlag" DROP CONSTRAINT "FK_13f8ca9c517976733a1ce4c10eb"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "FK_efbcf3528718de2b5c45c0a8a83"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "FK_826052747c82e59f0a006204256"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP CONSTRAINT "FK_bc8d8855198de1fbc32fba8df93"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."postgresCredentials" DROP CONSTRAINT "FK_9494639abc06f9c8c3691bf5d22"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."featureFlag" DROP CONSTRAINT "FK_6be7761fa8453f3a498aab6e72b"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."approvedAccessDomain" DROP CONSTRAINT "FK_73d3e340b6ce0716a25a86361fc"`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_3deb257254145a3bdde9575e7d6"`,
+ `ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772"`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824"`,
+ `ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_8cd4819144baf069777b5729136"`,
);
await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d"`,
+ `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_22f5e76f493c3fb20237cfc48b0"`,
);
+ await queryRunner.query(
+ `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_a2da2ea7d6cd1e5a4c5cb1791f8"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."twoFactorAuthenticationMethod" DROP CONSTRAINT "FK_b0f44ffd7c794beb48cb1e1b1a9"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "FK_c137e3d8b3980901e114941daa2"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "FK_0dae35d1c0fbdda6495be4ae71a"`,
+ );
+ await queryRunner.query(
+ `ALTER TABLE "core"."apiKey" DROP CONSTRAINT "FK_c8b3efa54a29aa873043e72fb1d"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."pageLayout"`);
+ await queryRunner.query(`DROP TYPE "core"."pageLayout_type_enum"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_PAGE_LAYOUT_TAB_WORKSPACE_ID_PAGE_LAYOUT_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."pageLayoutTab"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_PAGE_LAYOUT_WIDGET_WORKSPACE_ID_PAGE_LAYOUT_TAB_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."pageLayoutWidget"`);
+ await queryRunner.query(`DROP TYPE "core"."pageLayoutWidget_type_enum"`);
+ await queryRunner.query(`DROP TABLE "core"."remoteServer"`);
+ await queryRunner.query(`DROP TABLE "core"."remoteTable"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_SERVERLESS_FUNCTION_ID_DELETED_AT"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."serverlessFunction"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_1c39502392dd9cbb186deba158"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."route"`);
+ await queryRunner.query(`DROP TYPE "core"."route_httpmethod_enum"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_DATABASE_EVENT_TRIGGER_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_960465af116edf9ac501bfb3db"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."databaseEventTrigger"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_CRON_TRIGGER_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_8adc1fd6cb0dad2fbfd945954d"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."cronTrigger"`);
await queryRunner.query(`DROP TABLE "core"."workspaceMigration"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_WORKSPACE_ACTIVATION_STATUS"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."workspace"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."workspace_activationStatus_enum"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_AGENT_HANDOFF_ID_DELETED_AT"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_AGENT_HANDOFF_FROM_TO_WORKSPACE_UNIQUE"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."agentHandoff"`);
+ await queryRunner.query(`DROP INDEX "core"."IDX_AGENT_ID_DELETED_AT"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."agent"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_3bd935d6f8c5ce87194b8db824"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_d0bdc80c68a48b1f26727aabfe"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."agentChatThread"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_cd5b23d4e471b630137b3017ba"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."agentChatMessage"`);
+ await queryRunner.query(`DROP TYPE "core"."agentChatMessage_role_enum"`);
+ await queryRunner.query(`DROP INDEX "core"."IDX_FILE_WORKSPACE_ID"`);
+ await queryRunner.query(`DROP TABLE "core"."file"`);
+ await queryRunner.query(`DROP INDEX "core"."IDX_WEBHOOK_WORKSPACE_ID"`);
+ await queryRunner.query(`DROP TABLE "core"."webhook"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FIELD_WORKSPACE_ID_VIEW_ID"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_FIELD_VIEW_ID"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_b86af4ea24cae518dee8eae996"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."viewField"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."viewField_aggregateoperation_enum"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_WORKSPACE_ID_OBJECT_METADATA_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_552aa6908966e980099b3e5ebf"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."view"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."view_kanbanaggregateoperation_enum"`,
+ );
+ await queryRunner.query(`DROP TYPE "core"."view_openrecordin_enum"`);
+ await queryRunner.query(`DROP TYPE "core"."view_key_enum"`);
+ await queryRunner.query(`DROP TYPE "core"."view_type_enum"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_SORT_WORKSPACE_ID_VIEW_ID"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_SORT_VIEW_ID"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_38232fc0c6567ed029c2b1a12c"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."viewSort"`);
+ await queryRunner.query(`DROP TYPE "core"."viewSort_direction_enum"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_GROUP_WORKSPACE_ID_VIEW_ID"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_GROUP_VIEW_ID"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_a44e3b03f0eca32d0504d5ef73"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."viewGroup"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FILTER_GROUP_WORKSPACE_ID_VIEW_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FILTER_GROUP_VIEW_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_e6ed40a61e4584e98584019a47"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."viewFilterGroup"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."viewFilterGroup_logicaloperator_enum"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FILTER_WORKSPACE_ID_VIEW_ID"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_FILTER_VIEW_ID"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_VIEW_FILTER_FIELD_METADATA_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_cd4588bfc9ad73345b3953a039"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."viewFilter"`);
+ await queryRunner.query(`DROP TYPE "core"."viewFilter_operand_enum"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_METADATA_RELATION_TARGET_FIELD_METADATA_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_METADATA_RELATION_TARGET_OBJECT_METADATA_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_METADATA_OBJECT_METADATA_ID_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_METADATA_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_METADATA_OBJECT_METADATA_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."fieldMetadata"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_INDEX_FIELD_METADATA_FIELD_METADATA_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."indexFieldMetadata"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_INDEX_METADATA_WORKSPACE_ID_OBJECT_METADATA_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."indexMetadata"`);
+ await queryRunner.query(`DROP TYPE "core"."indexMetadata_indextype_enum"`);
+ await queryRunner.query(`DROP TABLE "core"."objectMetadata"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_FIELD_PERMISSION_WORKSPACE_ID_ROLE_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."fieldPermission"`);
+ await queryRunner.query(`DROP TABLE "core"."role"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_ROLE_TARGETS_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_ROLE_TARGETS_AGENT_ID"`);
+ await queryRunner.query(`DROP INDEX "core"."IDX_ROLE_TARGETS_API_KEY_ID"`);
+ await queryRunner.query(`DROP TABLE "core"."roleTargets"`);
+ await queryRunner.query(`DROP TABLE "core"."permissionFlag"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_OBJECT_PERMISSION_WORKSPACE_ID_ROLE_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."objectPermission"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_DATA_SOURCE_WORKSPACE_ID_CREATED_AT"`,
+ );
await queryRunner.query(`DROP TABLE "core"."dataSource"`);
await queryRunner.query(`DROP TYPE "core"."dataSource_type_enum"`);
- await queryRunner.query(`DROP TABLE "core"."objectMetadata"`);
- await queryRunner.query(`DROP TABLE "core"."fieldMetadata"`);
- await queryRunner.query(`DROP TABLE "core"."relationMetadata"`);
+ await queryRunner.query(`DROP TABLE "core"."workspaceSSOIdentityProvider"`);
+ await queryRunner.query(
+ `DROP TYPE "core"."workspaceSSOIdentityProvider_type_enum"`,
+ );
+ await queryRunner.query(
+ `DROP TYPE "core"."workspaceSSOIdentityProvider_status_enum"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."postgresCredentials"`);
+ await queryRunner.query(`DROP TABLE "core"."featureFlag"`);
+ await queryRunner.query(`DROP TABLE "core"."approvedAccessDomain"`);
+ await queryRunner.query(`DROP TABLE "core"."appToken"`);
+ await queryRunner.query(`DROP INDEX "core"."UQ_USER_EMAIL"`);
+ await queryRunner.query(`DROP TABLE "core"."user"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE"`,
+ );
+ await queryRunner.query(`DROP INDEX "core"."IDX_USER_WORKSPACE_USER_ID"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_USER_WORKSPACE_WORKSPACE_ID"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."userWorkspace"`);
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_2909f5139c479e4632df03fd5e"`,
+ );
+ await queryRunner.query(
+ `DROP TABLE "core"."twoFactorAuthenticationMethod"`,
+ );
+ await queryRunner.query(
+ `DROP TYPE "core"."twoFactorAuthenticationMethod_strategy_enum"`,
+ );
+ await queryRunner.query(
+ `DROP TYPE "core"."twoFactorAuthenticationMethod_status_enum"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_KEY_VALUE_PAIR_KEY_WORKSPACE_ID_NULL_USER_ID_UNIQUE"`,
+ );
+ await queryRunner.query(
+ `DROP INDEX "core"."IDX_KEY_VALUE_PAIR_KEY_USER_ID_NULL_WORKSPACE_ID_UNIQUE"`,
+ );
+ await queryRunner.query(`DROP TABLE "core"."keyValuePair"`);
+ await queryRunner.query(`DROP TYPE "core"."keyValuePair_type_enum"`);
+ await queryRunner.query(`DROP INDEX "core"."IDX_API_KEY_WORKSPACE_ID"`);
+ await queryRunner.query(`DROP TABLE "core"."apiKey"`);
}
}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700324860820-setupCoreTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700324860820-setupCoreTables.ts
deleted file mode 100644
index 51c8952d10e..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700324860820-setupCoreTables.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class SetupCoreTables implements MigrationInterface {
- name = 'SetupCoreTables1700324860820';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."refreshToken" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "revokedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_7d8bee0204106019488c4c50ffa" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."workspace" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "domainName" character varying, "displayName" character varying, "logo" character varying, "inviteHash" character varying, "deletedAt" TIMESTAMP, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_098656ae401f3e1a4586f47fd8e" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "firstName" character varying NOT NULL DEFAULT '', "lastName" character varying NOT NULL DEFAULT '', "email" character varying NOT NULL, "emailVerified" boolean NOT NULL DEFAULT false, "disabled" boolean NOT NULL DEFAULT false, "passwordHash" character varying, "canImpersonate" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "defaultWorkspaceId" uuid, CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_610102b60fea1455310ccd299de" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_5d77e050eabd28d203b301235a7" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_5d77e050eabd28d203b301235a7"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_610102b60fea1455310ccd299de"`,
- );
- await queryRunner.query(`DROP TABLE "core"."user"`);
- await queryRunner.query(`DROP TABLE "core"."workspace"`);
- await queryRunner.query(`DROP TABLE "core"."refreshToken"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700565712112-addIdentifierFieldToObjectMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700565712112-addIdentifierFieldToObjectMetadata.ts
deleted file mode 100644
index beaa4237514..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700565712112-addIdentifierFieldToObjectMetadata.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIdentifierFieldToObjectMetadata1700565712112
- implements MigrationInterface
-{
- name = 'AddIdentifierFieldToObjectMetadata1700565712112';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "labelIdentifierFieldMetadataId" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "imageIdentifierFieldMetadataId" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "imageIdentifierFieldMetadataId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "labelIdentifierFieldMetadataId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700650554672-addWorkspaceCacheVersion.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700650554672-addWorkspaceCacheVersion.ts
deleted file mode 100644
index 3b6c9c747e4..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700650554672-addWorkspaceCacheVersion.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceCacheVersion1700650554672
- implements MigrationInterface
-{
- name = 'AddWorkspaceCacheVersion1700650554672';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."workspaceCacheVersion" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "workspaceId" uuid NOT NULL, "version" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_1a80ecf2638b477809403cc26ed" UNIQUE ("workspaceId"), CONSTRAINT "PK_5d502f8dbfb5b9a8bf2439320e9" PRIMARY KEY ("id"))`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."workspaceCacheVersion"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700654387203-addAllowImpersonationToWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700654387203-addAllowImpersonationToWorkspace.ts
deleted file mode 100644
index 5dcaebbb36a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700654387203-addAllowImpersonationToWorkspace.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddAllowImpersonationToWorkspace1700654387203
- implements MigrationInterface
-{
- name = 'AddAllowImpersonationToWorkspace1700654387203';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_5d77e050eabd28d203b301235a7"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_610102b60fea1455310ccd299de"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "allowImpersonation" boolean NOT NULL DEFAULT true`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "allowImpersonation"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_610102b60fea1455310ccd299de" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_5d77e050eabd28d203b301235a7" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661180856-addCascadeDeleteOnRefreshTokenUser.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661180856-addCascadeDeleteOnRefreshTokenUser.ts
deleted file mode 100644
index 12cb8025866..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661180856-addCascadeDeleteOnRefreshTokenUser.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddCascadeDeleteOnRefreshTokenUser1700661180856
- implements MigrationInterface
-{
- name = 'AddCascadeDeleteOnRefreshTokenUser1700661180856';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661538754-addCascadeDeleteOnRelationObject.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661538754-addCascadeDeleteOnRelationObject.ts
deleted file mode 100644
index 2a74478e80d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700661538754-addCascadeDeleteOnRelationObject.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddCascadeDeleteOnRelationObject1700661538754
- implements MigrationInterface
-{
- name = 'AddCascadeDeleteOnRelationObject1700661538754';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d" FOREIGN KEY ("fromObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824" FOREIGN KEY ("toObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d" FOREIGN KEY ("fromObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824" FOREIGN KEY ("toObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663611659-addWorkspaceDeleteCascadeSetNullInUser.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663611659-addWorkspaceDeleteCascadeSetNullInUser.ts
deleted file mode 100644
index 6d48d954df6..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663611659-addWorkspaceDeleteCascadeSetNullInUser.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceDeleteCascadeSetNullInUser1700663611659
- implements MigrationInterface
-{
- name = 'AddWorkspaceDeleteCascadeSetNullInUser1700663611659';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663879152-addEnumOptions.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663879152-addEnumOptions.ts
deleted file mode 100644
index f35604f8d04..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1700663879152-addEnumOptions.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddEnumOptions1700663879152 implements MigrationInterface {
- name = 'AddEnumOptions1700663879152';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" RENAME COLUMN "enums" TO "options"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "options"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "options" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "options"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "options" text array`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" RENAME COLUMN "options" TO "enums"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1701194529853-addFeatureFlags.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1701194529853-addFeatureFlags.ts
deleted file mode 100644
index 26d7e761a52..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1701194529853-addFeatureFlags.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddFeatureFlags1701194529853 implements MigrationInterface {
- name = 'AddFeatureFlags1701194529853';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."featureFlag" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" text NOT NULL, "workspaceId" uuid NOT NULL, "value" boolean NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnKeyAndWorkspaceIdUnique" UNIQUE ("key", "workspaceId"), CONSTRAINT "PK_894efa1b1822de801f3b9e04069" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ADD CONSTRAINT "FK_6be7761fa8453f3a498aab6e72b" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" DROP CONSTRAINT "FK_6be7761fa8453f3a498aab6e72b"`,
- );
- await queryRunner.query(`DROP TABLE "core"."featureFlag"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1702479005171-addSubscriptionStatusOnWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1702479005171-addSubscriptionStatusOnWorkspace.ts
deleted file mode 100644
index d7ff4b34c6d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1702479005171-addSubscriptionStatusOnWorkspace.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSubscriptionStatusOnWorkspace1702479005171
- implements MigrationInterface
-{
- name = 'AddSubscriptionStatusOnWorkspace1702479005171';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "subscriptionStatus" character varying NOT NULL DEFAULT 'incomplete'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "subscriptionStatus"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1704825571702-addPasswordResetToken.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1704825571702-addPasswordResetToken.ts
deleted file mode 100644
index e193a0211d3..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1704825571702-addPasswordResetToken.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddPasswordResetToken1704825571702 implements MigrationInterface {
- name = 'AddPasswordResetToken1704825571702';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "passwordResetToken" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "passwordResetTokenExpiresAt" TIMESTAMP`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "passwordResetTokenExpiresAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "passwordResetToken"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1706613419989-addDefaultAvatarUrlToUser.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1706613419989-addDefaultAvatarUrlToUser.ts
deleted file mode 100644
index dbff1fceca5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1706613419989-addDefaultAvatarUrlToUser.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDefaultAvatarUrlToUser1706613419989
- implements MigrationInterface
-{
- name = 'AddDefaultAvatarUrlToUser1706613419989';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "defaultAvatarUrl" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "defaultAvatarUrl"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1707778127558-addUserWorkspaces.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1707778127558-addUserWorkspaces.ts
deleted file mode 100644
index c544d3ecc3e..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1707778127558-addUserWorkspaces.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUserWorkspaces1707778127558 implements MigrationInterface {
- name = 'AddUserWorkspaces1707778127558';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."userWorkspace" (
- "id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
- "userId" uuid NOT NULL REFERENCES core.user(id),
- "workspaceId" uuid NOT NULL REFERENCES core.workspace(id),
- "createdAt" TIMESTAMP NOT NULL DEFAULT now(),
- "updatedAt" TIMESTAMP NOT NULL DEFAULT now(),
- "deletedAt" TIMESTAMP
- )`,
- );
- }
-
- public async down(): Promise<void> {}
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1708449210922-addOnDeleteActionToRelationMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1708449210922-addOnDeleteActionToRelationMetadata.ts
deleted file mode 100644
index 01b77c8e413..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1708449210922-addOnDeleteActionToRelationMetadata.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddOnDeleteActionToRelationMetadata1708449210922
- implements MigrationInterface
-{
- name = 'AddOnDeleteActionToRelationMetadata1708449210922';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."relationMetadata_ondeleteaction_enum" AS ENUM('CASCADE', 'RESTRICT', 'SET_NULL')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ADD "onDeleteAction" "core"."relationMetadata_ondeleteaction_enum" NOT NULL DEFAULT 'SET_NULL'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP COLUMN "onDeleteAction"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."relationMetadata_ondeleteaction_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709314035408-updateUserWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1709314035408-updateUserWorkspace.ts
deleted file mode 100644
index 5aa7a7204be..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709314035408-updateUserWorkspace.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateUserWorkspace1709314035408 implements MigrationInterface {
- name = 'UpdateUserWorkspace1709314035408';
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- ALTER TABLE "core"."userWorkspace"
- ADD CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6"
- FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id")
- ON DELETE CASCADE ON UPDATE NO ACTION
- `);
- await queryRunner.query(`
- ALTER TABLE "core"."userWorkspace"
- ADD CONSTRAINT "FK_cb488f32c6a0827b938edadf221"
- FOREIGN KEY ("userId") REFERENCES "core"."user"("id")
- ON DELETE CASCADE ON UPDATE NO ACTION
- `);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_cb488f32c6a0827b938edadf221"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709680520888-updateUserWorkspaceColumnConstraints.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1709680520888-updateUserWorkspaceColumnConstraints.ts
deleted file mode 100644
index e7c32dc94e6..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709680520888-updateUserWorkspaceColumnConstraints.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class updateUserWorkspaceColumnConstraints1709680520888
- implements MigrationInterface
-{
- name = 'updateUserWorkspaceColumnConstraints1709680520888';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- // ----------------- WARNING ------------------------
- // Dropping constraints and adding them back is NOT a recommended and should be AVOIDED,
- // since it can affect data integrity and cause downtime and unintentional data loss.
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "userWorkspace_userId_fkey"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "userWorkspace_workspaceId_fkey"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_cb488f32c6a0827b938edadf221"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6"`,
- );
-
- await queryRunner.query(`
- ALTER TABLE "core"."userWorkspace"
- ADD CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6"
- FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id")
- ON DELETE CASCADE ON UPDATE NO ACTION
- `);
-
- await queryRunner.query(`
- ALTER TABLE "core"."userWorkspace"
- ADD CONSTRAINT "FK_cb488f32c6a0827b938edadf221"
- FOREIGN KEY ("userId") REFERENCES "core"."user"("id")
- ON DELETE CASCADE ON UPDATE NO ACTION
- `);
- }
-
- public async down(): Promise<void> {}
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709894431938-addStandardId.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1709894431938-addStandardId.ts
deleted file mode 100644
index a43cc64e101..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1709894431938-addStandardId.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddStandardId1709894431938 implements MigrationInterface {
- name = 'AddStandardId1709894431938';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "standardId" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "standardId" uuid`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "standardId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "standardId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711374137222-addRemoteServerTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711374137222-addRemoteServerTable.ts
deleted file mode 100644
index 68d7d18342d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711374137222-addRemoteServerTable.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRemoteServerTable1711374137222 implements MigrationInterface {
- name = 'AddRemoteServerTable1711374137222';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."remoteServer" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "foreignDataWrapperId" uuid NOT NULL DEFAULT uuid_generate_v4(), "foreignDataWrapperType" character varying, "foreignDataWrapperOptions" jsonb, "userMappingOptions" jsonb, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_8e5d208498fa2c9710bb934023a" PRIMARY KEY ("id"))`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."remoteServer"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711459912762-dropTargetColumnMap.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711459912762-dropTargetColumnMap.ts
deleted file mode 100644
index ff017f370a0..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711459912762-dropTargetColumnMap.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class DropTargetColumnMap1711459912762 implements MigrationInterface {
- name = 'DropTargetColumnMap1711459912762';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "targetColumnMap"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "targetColumnMap" jsonb NOT NULL`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711466822763-addIsRemoteField.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711466822763-addIsRemoteField.ts
deleted file mode 100644
index d251ff6570a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711466822763-addIsRemoteField.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsRemoteField1711466822763 implements MigrationInterface {
- name = 'AddIsRemoteField1711466822763';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isRemote" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isRemote"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711557405330-addMissingMigration.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711557405330-addMissingMigration.ts
deleted file mode 100644
index 5157812441b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711557405330-addMissingMigration.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddMissingMigration1711557405330 implements MigrationInterface {
- name = 'AddMissingMigration1711557405330';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_cb488f32c6a0827b938edadf221"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt"::TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "createdAt" SET DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "createdAt" SET NOT NULL;`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt"::TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "updatedAt" SET DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "updatedAt" SET NOT NULL;`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt"::TIMESTAMP WITH TIME ZONE`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "defaultWorkspaceId" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "IndexOnUserIdAndWorkspaceIdUnique" UNIQUE ("userId", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_a2da2ea7d6cd1e5a4c5cb1791f8" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_22f5e76f493c3fb20237cfc48b0" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_22f5e76f493c3fb20237cfc48b0"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "FK_a2da2ea7d6cd1e5a4c5cb1791f8"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "IndexOnUserIdAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "defaultWorkspaceId" DROP NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP COLUMN "deletedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD "deletedAt" TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP COLUMN "updatedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP COLUMN "createdAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_cb488f32c6a0827b938edadf221" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "FK_37fdc7357af701e595c5c3a9bd6" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711619086385-useTimestampWithTZ.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711619086385-useTimestampWithTZ.ts
deleted file mode 100644
index 75729a443e1..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711619086385-useTimestampWithTZ.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UseTimestampWithTZ1711619086385 implements MigrationInterface {
- name = 'UseTimestampWithTZ1711619086385';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "appliedAt" TYPE TIMESTAMP WITH TIME ZONE USING "appliedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceCacheVersion" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceCacheVersion" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."dataSource" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."dataSource" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "appliedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceCacheVersion" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceCacheVersion" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."dataSource" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."dataSource" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711624086253-updateRefreshTokenTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711624086253-updateRefreshTokenTable.ts
deleted file mode 100644
index 181abea0ee5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711624086253-updateRefreshTokenTable.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateRefreshTokenTable1711624086253
- implements MigrationInterface
-{
- name = 'UpdateRefreshTokenTable1711624086253';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."refreshToken" RENAME TO "appToken"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD "workspaceId" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD "type" text NOT NULL DEFAULT 'REFRESH_TOKEN'`,
- );
- await queryRunner.query(`ALTER TABLE "core"."appToken" ADD "value" text`);
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_8cd4819144baf069777b5729136" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD CONSTRAINT "FK_7008a2b0fb083127f60b5f4448e" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_8cd4819144baf069777b5729136"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP CONSTRAINT "FK_d6ae19a7aa2bbd4919053257772"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP COLUMN "value"`,
- );
- await queryRunner.query(`ALTER TABLE "core"."appToken" DROP COLUMN "type"`);
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP COLUMN "workspaceId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" RENAME TO "refreshToken"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711633823798-useTimestampWithTZ.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1711633823798-useTimestampWithTZ.ts
deleted file mode 100644
index eec3e3d82fb..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1711633823798-useTimestampWithTZ.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UseTimestampWithTZ1711633823798 implements MigrationInterface {
- name = 'UseTimestampWithTZ1711633823798';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "passwordResetTokenExpiresAt" TYPE TIMESTAMP WITH TIME ZONE USING "passwordResetTokenExpiresAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE USING "createdAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "updatedAt" TYPE TIMESTAMP WITH TIME ZONE USING "updatedAt" AT TIME ZONE 'UTC'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "deletedAt" TYPE TIMESTAMP WITH TIME ZONE USING "deletedAt" AT TIME ZONE 'UTC'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "deletedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "deletedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ALTER COLUMN "passwordResetTokenExpiresAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "updatedAt" TYPE TIMESTAMP`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ALTER COLUMN "deletedAt" TYPE TIMESTAMP`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1712923480448-addIsAuditLogged.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1712923480448-addIsAuditLogged.ts
deleted file mode 100644
index 0a34d1fafc7..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1712923480448-addIsAuditLogged.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsAuditLogged1712923480448 implements MigrationInterface {
- name = 'AddIsAuditLogged1712923480448';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isAuditLogged" boolean NOT NULL DEFAULT true`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isAuditLogged"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1713270565699-createRemoteTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1713270565699-createRemoteTable.ts
deleted file mode 100644
index 66ef6b7f11f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1713270565699-createRemoteTable.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateRemoteTable1713270565699 implements MigrationInterface {
- name = 'CreateRemoteTable1713270565699';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."remoteTable" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "distantTableName" character varying NOT NULL, "localTableName" character varying NOT NULL, "workspaceId" uuid NOT NULL, "remoteServerId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_632b3858de52c8c2eb00c709b52" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteTable" ADD CONSTRAINT "FK_3db5ae954f9197def326053f06a" FOREIGN KEY ("remoteServerId") REFERENCES "core"."remoteServer"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteTable" DROP CONSTRAINT "FK_3db5ae954f9197def326053f06a"`,
- );
- await queryRunner.query(`DROP TABLE "core"."remoteTable"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1713793656356-addSettingsColumnToFieldMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1713793656356-addSettingsColumnToFieldMetadata.ts
deleted file mode 100644
index 40598b75b16..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1713793656356-addSettingsColumnToFieldMetadata.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSettingsColumnToFieldMetadata1713793656356
- implements MigrationInterface
-{
- name = 'AddSettingsColumnToFieldMetadata1713793656356';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "settings" jsonb`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "foreignDataWrapperType"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "foreignDataWrapperType" text`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "foreignDataWrapperType"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "foreignDataWrapperType" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "settings"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1714382420165-addSchemaAndAvailableTablesToServer.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1714382420165-addSchemaAndAvailableTablesToServer.ts
deleted file mode 100644
index 78ce1f8fa53..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1714382420165-addSchemaAndAvailableTablesToServer.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSchemaAndAvailableTablesToServer1714382420165
- implements MigrationInterface
-{
- name = 'AddSchemaAndAvailableTablesToServer1714382420165';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "schema" text`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "availableTables" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "availableTables"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "schema"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1715593226719-updateInconsistentUserConstraint.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1715593226719-updateInconsistentUserConstraint.ts
deleted file mode 100644
index 9d43bd56975..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1715593226719-updateInconsistentUserConstraint.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateInconsistentUserConstraint1715593226719
- implements MigrationInterface
-{
- name = 'UpdateInconsistentUserConstraint1715593226719';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" TYPE text`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE RESTRICT ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" TYPE character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1716310822694-removeAvailableTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1716310822694-removeAvailableTables.ts
deleted file mode 100644
index 0ab4109f7ab..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1716310822694-removeAvailableTables.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveAvailableTables1716310822694 implements MigrationInterface {
- name = 'RemoveAvailableTables1716310822694';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "availableTables"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "availableTables" jsonb`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1716890009820-addRemoteServerLabel.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1716890009820-addRemoteServerLabel.ts
deleted file mode 100644
index a0b83fe186c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1716890009820-addRemoteServerLabel.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRemoteServerLabel1716890009820 implements MigrationInterface {
- name = 'AddRemoteServerLabel1716890009820';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" ADD "label" text`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."remoteServer" DROP COLUMN "label"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717425967770-addKeyValuePairTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1717425967770-addKeyValuePairTable.ts
deleted file mode 100644
index 647b0687870..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717425967770-addKeyValuePairTable.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddKeyValuePairTable1717425967770 implements MigrationInterface {
- name = 'AddKeyValuePairTable1717425967770';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."keyValuePair" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid, "workspaceId" uuid, "key" text NOT NULL, "value" text, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IndexOnKeyUserIdWorkspaceIdUnique" UNIQUE ("key", "userId", "workspaceId"), CONSTRAINT "PK_c5a1ca828435d3eaf8f9361ed4b" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "FK_0dae35d1c0fbdda6495be4ae71a" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "FK_c137e3d8b3980901e114941daa2" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "FK_c137e3d8b3980901e114941daa2"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "FK_0dae35d1c0fbdda6495be4ae71a"`,
- );
- await queryRunner.query(`DROP TABLE "core"."keyValuePair"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717688588972-addKeyValuePairTableUniqueContraints.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1717688588972-addKeyValuePairTableUniqueContraints.ts
deleted file mode 100644
index a88fedc6e60..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717688588972-addKeyValuePairTableUniqueContraints.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddKeyValuePairTableUniqueContraints1717688588972
- implements MigrationInterface
-{
- name = 'AddKeyValuePairTableUniqueContraints1717688588972';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IndexOnKeyUserIdAndNullWorkspaceIdUnique" ON "core"."keyValuePair" ("key", "userId") WHERE "workspaceId" is NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IndexOnKeyWorkspaceIdAndNullUserIdUnique" ON "core"."keyValuePair" ("key", "workspaceId") WHERE "userId" is NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnKeyWorkspaceIdAndNullUserIdUnique"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnKeyUserIdAndNullWorkspaceIdUnique"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717751631669-addPostgresCredentials.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1717751631669-addPostgresCredentials.ts
deleted file mode 100644
index 56eb47e5f4b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1717751631669-addPostgresCredentials.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddPostgresCredentials1717751631669 implements MigrationInterface {
- name = 'AddPostgresCredentials1717751631669';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."postgresCredentials" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "user" character varying NOT NULL, "passwordHash" character varying NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "workspaceId" uuid NOT NULL, CONSTRAINT "PK_3f9c4cdf895bfea0a6ea15bdd81" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."postgresCredentials" ADD CONSTRAINT "FK_9494639abc06f9c8c3691bf5d22" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."postgresCredentials" DROP CONSTRAINT "FK_9494639abc06f9c8c3691bf5d22"`,
- );
- await queryRunner.query(`DROP TABLE "core"."postgresCredentials"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1718985664968-addIndexMetadataTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1718985664968-addIndexMetadataTable.ts
deleted file mode 100644
index bc33b5c0fd5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1718985664968-addIndexMetadataTable.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexMetadataTable1718985664968 implements MigrationInterface {
- name = 'AddIndexMetadataTable1718985664968';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."indexMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "workspaceId" character varying, "objectMetadataId" uuid NOT NULL, CONSTRAINT "PK_f73bb3c3678aee204e341f0ca4e" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."indexFieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "indexMetadataId" uuid NOT NULL, "fieldMetadataId" uuid NOT NULL, "order" integer NOT NULL, CONSTRAINT "PK_5928f67e43eff7d95aa79fd96fd" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD CONSTRAINT "FK_051487e9b745cb175950130b63f" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" ADD CONSTRAINT "FK_b20192c432612eb710801dd5664" FOREIGN KEY ("indexMetadataId") REFERENCES "core"."indexMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" ADD CONSTRAINT "FK_be0950612a54b58c72bd62d629e" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."indexFieldMetadata"`);
- await queryRunner.query(`DROP TABLE "core"."indexMetadata"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1719327438923-useEnumForSubscriptionStatusInterval.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1719327438923-useEnumForSubscriptionStatusInterval.ts
deleted file mode 100644
index a9cc2c217b7..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1719327438923-useEnumForSubscriptionStatusInterval.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UseEnumForSubscriptionStatusInterval1719327438923
- implements MigrationInterface
-{
- name = 'UseEnumForSubscriptionStatusInterval1719327438923';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_subscriptionstatus_enum" AS ENUM('active', 'canceled', 'incomplete', 'incomplete_expired', 'past_due', 'paused', 'trialing', 'unpaid')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" TYPE "core"."workspace_subscriptionstatus_enum" USING "subscriptionStatus"::"core"."workspace_subscriptionstatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" SET DEFAULT 'incomplete'::"core"."workspace_subscriptionstatus_enum"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subscriptionStatus" TYPE text`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_subscriptionstatus_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1719494707738-removeSubscriptionStatusFromCoreWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1719494707738-removeSubscriptionStatusFromCoreWorkspace.ts
deleted file mode 100644
index 68739d0ee02..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1719494707738-removeSubscriptionStatusFromCoreWorkspace.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveSubscriptionStatusFromCoreWorkspace1719494707738
- implements MigrationInterface
-{
- name = 'RemoveSubscriptionStatusFromCoreWorkspace1719494707738';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "subscriptionStatus"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_subscriptionstatus_enum"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_subscriptionstatus_enum" AS ENUM('active', 'canceled', 'incomplete', 'incomplete_expired', 'past_due', 'paused', 'trialing', 'unpaid')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "subscriptionStatus" "core"."workspace_subscriptionstatus_enum" NOT NULL DEFAULT 'incomplete'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1720524654925-addDateColumnsToIndexMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1720524654925-addDateColumnsToIndexMetadata.ts
deleted file mode 100644
index 6ee9c3ea1cd..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1720524654925-addDateColumnsToIndexMetadata.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDateColumnsToIndexMetadata1720524654925
- implements MigrationInterface
-{
- name = 'AddDateColumnsToIndexMetadata1720524654925';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" ADD "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" DROP COLUMN "updatedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexFieldMetadata" DROP COLUMN "createdAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP COLUMN "updatedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP COLUMN "createdAt"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721057142509-fixIdentifierTypes.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721057142509-fixIdentifierTypes.ts
deleted file mode 100644
index db04e8de682..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721057142509-fixIdentifierTypes.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixIdentifierTypes1721057142509 implements MigrationInterface {
- name = 'FixIdentifierTypes1721057142509';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "labelIdentifierFieldMetadataId" TYPE uuid USING "labelIdentifierFieldMetadataId"::uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "imageIdentifierFieldMetadataId" TYPE uuid USING "imageIdentifierFieldMetadataId"::uuid`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "labelIdentifierFieldMetadataId" TYPE text USING "labelIdentifierFieldMetadataId"::text`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ALTER COLUMN "imageIdentifierFieldMetadataId" TYPE text USING "imageIdentifierFieldMetadataId"::text`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721139150487-addKeyValuePairType.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721139150487-addKeyValuePairType.ts
deleted file mode 100644
index 72f3e190d8f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721139150487-addKeyValuePairType.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddKeyValuePairType1721139150487 implements MigrationInterface {
- name = 'AddKeyValuePairType1721139150487';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."keyValuePair_type_enum" AS ENUM('USER_VAR', 'FEATURE_FLAG', 'SYSTEM_VAR')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD "type" "core"."keyValuePair_type_enum" NOT NULL DEFAULT 'USER_VAR'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP COLUMN "type"`,
- );
- await queryRunner.query(`DROP TYPE "core"."keyValuePair_type_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721210534680-createServerlessFunctionTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721210534680-createServerlessFunctionTable.ts
deleted file mode 100644
index 2ec4f0c7b9d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721210534680-createServerlessFunctionTable.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateServerlessFunctionTable1721210534680
- implements MigrationInterface
-{
- name = 'CreateServerlessFunctionTable1721210534680';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."serverlessFunction_syncstatus_enum" AS ENUM('NOT_READY', 'READY')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."serverlessFunction" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "sourceCodeHash" character varying NOT NULL, "syncStatus" "core"."serverlessFunction_syncstatus_enum" NOT NULL DEFAULT 'NOT_READY', "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNameAndWorkspaceIdUnique" UNIQUE ("name", "workspaceId"), CONSTRAINT "PK_49bfacee064bee9d0d486483b60" PRIMARY KEY ("id"))`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."serverlessFunction"`);
- await queryRunner.query(
- `DROP TYPE "core"."serverlessFunction_syncstatus_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721309629608-addRuntimeColumnToServerlessFunction.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721309629608-addRuntimeColumnToServerlessFunction.ts
deleted file mode 100644
index 27adafe126c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721309629608-addRuntimeColumnToServerlessFunction.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRuntimeColumnToServerlessFunction1721309629608
- implements MigrationInterface
-{
- name = 'AddRuntimeColumnToServerlessFunction1721309629608';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "runtime" character varying NOT NULL DEFAULT 'nodejs18.x'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "description" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "sourceCodeFullPath" character varying NOT NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "runtime"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "description"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "sourceCodeFullPath"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721656106498-migrateKeyValueTypeToJsonb.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721656106498-migrateKeyValueTypeToJsonb.ts
deleted file mode 100644
index ff78440a2ed..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721656106498-migrateKeyValueTypeToJsonb.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MigrateKeyValueTypeToJsonb1721656106498
- implements MigrationInterface
-{
- name = 'MigrateKeyValueTypeToJsonb1721656106498';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" RENAME COLUMN "value" TO "textValueDeprecated"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD "value" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP COLUMN "value"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" RENAME COLUMN "textValueDeprecated" TO "value"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721738579379-DeletePasswordResetToken.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1721738579379-DeletePasswordResetToken.ts
deleted file mode 100644
index 6fb97d01bdd..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1721738579379-DeletePasswordResetToken.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class DeletePasswordResetToken1721738579379
- implements MigrationInterface
-{
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "passwordResetToken"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "passwordResetTokenExpiresAt"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "passwordResetToken" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "passwordResetTokenExpiresAt" TIMESTAMP`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203539-addActivationStatus.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203539-addActivationStatus.ts
deleted file mode 100644
index cef9ee148ca..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203539-addActivationStatus.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddActivationStatus1722256203539 implements MigrationInterface {
- name = 'AddActivationStatus1722256203539';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationstatus_enum" AS ENUM('ACTIVE', 'INACTIVE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "activationStatus" "core"."workspace_activationstatus_enum" NOT NULL DEFAULT 'INACTIVE'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "activationStatus"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationstatus_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203540-updateActivationStatusEnum copy.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203540-updateActivationStatusEnum copy.ts
deleted file mode 100644
index a7bfa1b9565..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203540-updateActivationStatusEnum copy.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateActivationStatus1722256203540 implements MigrationInterface {
- name = 'UpdateActivationStatus1722256203540';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- // Set current column as text
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE text USING "activationStatus"::text`,
- );
-
- // Drop default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
-
- // Drop the old enum type
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationstatus_enum"`,
- );
-
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationStatus_enum" AS ENUM('PENDING_CREATION', 'ACTIVE', 'INACTIVE')`,
- );
-
- // Re-apply the enum type
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE "core"."workspace_activationStatus_enum" USING "activationStatus"::"core"."workspace_activationStatus_enum"`,
- );
-
- // Update default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- // Set current column as text
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE text USING "activationStatus"::text`,
- );
-
- // Drop default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
-
- // Drop the old enum type
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationStatus_enum"`,
- );
-
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationstatus_enum" AS ENUM('ACTIVE', 'INACTIVE')`,
- );
-
- // Re-apply the enum type
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE "core"."workspace_activationstatus_enum" USING "activationStatus"::"core"."workspace_activationstatus_enum"`,
- );
-
- // Update default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203541-updateActivationStatusEnumPendingCreation.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203541-updateActivationStatusEnumPendingCreation.ts
deleted file mode 100644
index 9d769266bde..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1722256203541-updateActivationStatusEnumPendingCreation.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateActivationStatusEnumPendingCreationStatus1722256203541
- implements MigrationInterface
-{
- name = 'UpdateActivationStatusEnumPendingCreationStatus1722256203541';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- // Set current column as text
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE text USING "activationStatus"::text`,
- );
-
- // Drop default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
-
- // Drop the old enum type
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationStatus_enum"`,
- );
-
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationStatus_enum" AS ENUM('PENDING_CREATION', 'ONGOING_CREATION', 'ACTIVE', 'INACTIVE')`,
- );
-
- // Re-apply the enum type
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE "core"."workspace_activationStatus_enum" USING "activationStatus"::"core"."workspace_activationStatus_enum"`,
- );
-
- // Update default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- // Set current column as text
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE text USING "activationStatus"::text`,
- );
-
- // Drop default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
-
- // Drop the old enum type
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationStatus_enum"`,
- );
-
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationStatus_enum" AS ENUM('PENDING_CREATION', 'ACTIVE', 'INACTIVE')`,
- );
-
- // Re-apply the enum type
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DATA TYPE "core"."workspace_activationStatus_enum" USING "activationStatus"::"core"."workspace_activationStatus_enum"`,
- );
-
- // Update default value
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1723038077987-addSoftDelete.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1723038077987-addSoftDelete.ts
deleted file mode 100644
index 1cf2fdf0d6f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1723038077987-addSoftDelete.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSoftDelete1723038077987 implements MigrationInterface {
- name = 'AddSoftDelete1723038077987';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isSoftDeletable" boolean`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isSoftDeletable"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724056827317-addInvitation.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724056827317-addInvitation.ts
deleted file mode 100644
index 0074234ef55..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724056827317-addInvitation.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddInvitation1724056827317 implements MigrationInterface {
- name = 'AddInvitation1724056827317';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- 'ALTER TABLE core."appToken" ALTER COLUMN "userId" DROP NOT NULL',
- );
-
- await queryRunner.query(
- `ALTER TABLE core."appToken" ADD CONSTRAINT "userIdIsNullWhenTypeIsInvitation" CHECK ("appToken".type != 'INVITATION_TOKEN' OR "appToken"."userId" IS NULL)`,
- );
-
- await queryRunner.query(
- `ALTER TABLE core."appToken" ADD CONSTRAINT "userIdNotNullWhenTypeIsNotInvitation" CHECK ("appToken".type = 'INVITATION_TOKEN' OR "appToken"."userId" NOTNULL)`,
- );
-
- await queryRunner.query('ALTER TABLE core."appToken" ADD "context" jsonb');
-
- await queryRunner.query(
- 'CREATE UNIQUE INDEX apptoken_unique_invitation_by_user_workspace ON core."appToken" ("workspaceId", ("context" ->> \'email\')) WHERE type = \'INVITATION_TOKEN\';',
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX core.apptoken_unique_invitation_by_user_workspace;`,
- );
-
- await queryRunner.query(
- 'DELETE FROM "core"."appToken" WHERE "userId" IS NULL',
- );
-
- await queryRunner.query(
- 'ALTER TABLE core."appToken" DROP CONSTRAINT "userIdIsNullWhenTypeIsInvitation"',
- );
-
- await queryRunner.query(
- 'ALTER TABLE core."appToken" DROP CONSTRAINT "userIdNotNullWhenTypeIsNotInvitation"',
- );
-
- await queryRunner.query(
- 'ALTER TABLE core."appToken" DROP COLUMN "context"',
- );
-
- await queryRunner.query(
- 'ALTER TABLE core."appToken" ALTER COLUMN "userId" SET NOT NULL',
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724171584314-updateServerlessFunction.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724171584314-updateServerlessFunction.ts
deleted file mode 100644
index a34c1e9fd7f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724171584314-updateServerlessFunction.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateServerlessFunction1724171584314
- implements MigrationInterface
-{
- name = 'UpdateServerlessFunction1724171584314';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "sourceCodeFullPath"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "latestVersion" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "latestVersion"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "sourceCodeFullPath" character varying NOT NULL`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173061204-deprecateCacheVersion.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173061204-deprecateCacheVersion.ts
deleted file mode 100644
index a9a9618380c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173061204-deprecateCacheVersion.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class DeprecateCacheVersion1724173061204 implements MigrationInterface {
- name = 'DeprecateCacheVersion1724173061204';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."workspaceCacheVersion"`);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."workspaceCacheVersion" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "workspaceId" uuid NOT NULL, "version" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_1a80ecf2638b477809403cc26ed" UNIQUE ("workspaceId"), CONSTRAINT "PK_5d502f8dbfb5b9a8bf2439320e9" PRIMARY KEY ("id"))`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173430043-introduceMetadataVersionAndDatasourceOnWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173430043-introduceMetadataVersionAndDatasourceOnWorkspace.ts
deleted file mode 100644
index 073c9ce9bb8..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724173430043-introduceMetadataVersionAndDatasourceOnWorkspace.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class IntroduceMetadataVersionAndDatasourceOnWorkspace1724173430043
- implements MigrationInterface
-{
- name = 'IntroduceMetadataVersionAndDatasourceOnWorkspace1724173430043';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "metadataVersion" integer NOT NULL DEFAULT '1'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "databaseUrl" character varying NOT NULL DEFAULT ''`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "databaseSchema" character varying NOT NULL DEFAULT ''`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "databaseSchema"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "databaseUrl"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "metadataVersion"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724423248330-removeServerlessFunctionUniqueConstraint.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724423248330-removeServerlessFunctionUniqueConstraint.ts
deleted file mode 100644
index 0575e414d76..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724423248330-removeServerlessFunctionUniqueConstraint.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveServerlessFunctionUniqueConstraint1724423248330
- implements MigrationInterface
-{
- name = 'RemoveServerlessFunctionUniqueConstraint1724423248330';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP CONSTRAINT "IndexOnNameAndWorkspaceIdUnique"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD CONSTRAINT "IndexOnNameAndWorkspaceIdUnique" UNIQUE ("name", "workspaceId")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724946099627-addServerlessFunctionLayerVersionColumn.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1724946099627-addServerlessFunctionLayerVersionColumn.ts
deleted file mode 100644
index c8d0df97c6b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1724946099627-addServerlessFunctionLayerVersionColumn.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddServerlessFunctionLayerVersionColumn1724946099627
- implements MigrationInterface
-{
- name = 'AddServerlessFunctionLayerVersionColumn1724946099627';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "layerVersion" integer`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "layerVersion"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1725893697807-addIndexType.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1725893697807-addIndexType.ts
deleted file mode 100644
index 7498f99749b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1725893697807-addIndexType.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexType1725893697807 implements MigrationInterface {
- name = 'AddIndexType1725893697807';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."indexMetadata_indextype_enum" AS ENUM('BTREE', 'GIN')`,
- );
-
- await queryRunner.query(`
- ALTER TABLE "core"."indexMetadata"
- ADD COLUMN "indexType" "core"."indexMetadata_indextype_enum" NOT NULL DEFAULT 'BTREE';
- `);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- ALTER TABLE "core"."indexMetadata" DROP COLUMN "indexType"
- `);
-
- await queryRunner.query(`DROP TYPE "core"."indexMetadata_indextype_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726240847733-removeServerlessSourceCodeHashColumn.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726240847733-removeServerlessSourceCodeHashColumn.ts
deleted file mode 100644
index e4af1968cda..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726240847733-removeServerlessSourceCodeHashColumn.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveServerlessSourceCodeHashColumn1726240847733
- implements MigrationInterface
-{
- name = 'RemoveServerlessSourceCodeHashColumn1726240847733';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "sourceCodeHash"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "sourceCodeHash" character varying NOT NULL`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726486735275-removeObjectMetadataIsSoftDeletable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726486735275-removeObjectMetadataIsSoftDeletable.ts
deleted file mode 100644
index 9cbbfaf6a06..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726486735275-removeObjectMetadataIsSoftDeletable.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveObjectMetadataIsSoftDeletable1726486735275
- implements MigrationInterface
-{
- name = 'RemoveObjectMetadataIsSoftDeletable1726486735275';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isSoftDeletable"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isSoftDeletable" boolean`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368824-migrationDebt.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368824-migrationDebt.ts
deleted file mode 100644
index 68bf6b9dcab..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368824-migrationDebt.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MigrationDebt1726757368824 implements MigrationInterface {
- name = 'MigrationDebt1726757368824';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TYPE "core"."relationMetadata_ondeleteaction_enum" RENAME TO "relationMetadata_ondeleteaction_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."relationMetadata_ondeleteaction_enum" AS ENUM('CASCADE', 'RESTRICT', 'SET_NULL', 'NO_ACTION')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" TYPE "core"."relationMetadata_ondeleteaction_enum" USING "onDeleteAction"::"text"::"core"."relationMetadata_ondeleteaction_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" SET DEFAULT 'SET_NULL'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."relationMetadata_ondeleteaction_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "name" SET NOT NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceMigration" ALTER COLUMN "name" DROP NOT NULL`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."relationMetadata_ondeleteaction_enum_old" AS ENUM('CASCADE', 'RESTRICT', 'SET_NULL')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" TYPE "core"."relationMetadata_ondeleteaction_enum_old" USING "onDeleteAction"::"text"::"core"."relationMetadata_ondeleteaction_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" ALTER COLUMN "onDeleteAction" SET DEFAULT 'SET_NULL'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."relationMetadata_ondeleteaction_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."relationMetadata_ondeleteaction_enum_old" RENAME TO "relationMetadata_ondeleteaction_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368825-addIsUniqueToIndexMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368825-addIsUniqueToIndexMetadata.ts
deleted file mode 100644
index 2e39bebef0f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726757368825-addIsUniqueToIndexMetadata.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsUniqueToIndexMetadata1726757368825
- implements MigrationInterface
-{
- name = 'AddIsUniqueToIndexMetadata1726757368825';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD "isUnique" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP COLUMN "isUnique"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726766871572-addWhereToIndexMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726766871572-addWhereToIndexMetadata.ts
deleted file mode 100644
index 81e8a72a026..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726766871572-addWhereToIndexMetadata.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWhereToIndexMetadata1726766871572
- implements MigrationInterface
-{
- name = 'AddWhereToIndexMetadata1726766871572';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD "indexWhereClause" text`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP COLUMN "indexWhereClause"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726849473832-addUniqueConstraintOnUsers.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1726849473832-addUniqueConstraintOnUsers.ts
deleted file mode 100644
index 463cb1dd914..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1726849473832-addUniqueConstraintOnUsers.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUniqueConstraintOnUsers1726849473832
- implements MigrationInterface
-{
- name = 'AddUniqueConstraintOnUsers1726849473832';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "UQ_USER_EMAIL" UNIQUE ("email", "deletedAt")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "UQ_USER_EMAIL"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1727181198403-addWorkspaceSSOIdentityProvider.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1727181198403-addWorkspaceSSOIdentityProvider.ts
deleted file mode 100644
index eb5c4e24c23..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1727181198403-addWorkspaceSSOIdentityProvider.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-/* @license Enterprise */
-
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceSSOIdentityProvider1727181198403
- implements MigrationInterface
-{
- name = 'AddWorkspaceSSOIdentityProvider1727181198403';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- CREATE TYPE "core"."idp_type_enum" AS ENUM('OIDC', 'SAML');
- `);
-
- await queryRunner.query(`
- CREATE TABLE "core"."workspaceSSOIdentityProvider" (
- "id" uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
- "name" varchar NULL,
- "workspaceId" uuid NOT NULL,
- "createdAt" timestamptz DEFAULT now() NOT NULL,
- "updatedAt" timestamptz DEFAULT now() NOT NULL,
- "type" "core"."idp_type_enum" DEFAULT 'OIDC' NOT NULL,
- "issuer" varchar NOT NULL,
- "ssoURL" varchar NULL,
- "clientID" varchar NULL,
- "clientSecret" varchar NULL,
- "certificate" varchar NULL,
- "fingerprint" varchar NULL,
- "status" varchar DEFAULT 'Active' NOT NULL
- );
- `);
-
- await queryRunner.query(`
- ALTER TABLE "core"."workspaceSSOIdentityProvider"
- ADD CONSTRAINT "FK_workspaceId"
- FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id")
- ON DELETE CASCADE;
- `);
-
- await queryRunner.query(`
- ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "CHK_OIDC" CHECK (
- ("type" = 'OIDC' AND "clientID" IS NOT NULL AND "clientSecret" IS NOT NULL) OR "type" = 'SAML'
- )
- `);
- await queryRunner.query(`
- ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "CHK_SAML" CHECK (
- ("type" = 'SAML' AND "ssoURL" IS NOT NULL AND "certificate" IS NOT NULL) OR "type" = 'OIDC'
- )
- `);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- ALTER TABLE "core"."workspaceSSOIdentityProvider"
- DROP CONSTRAINT "FK_workspaceId";
- `);
-
- await queryRunner.query(`
- DROP TABLE "core"."workspaceSSOIdentityProvider";
- `);
-
- await queryRunner.query(`
- DROP TYPE "core"."idp_type_enum";
- `);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1727699709905-addIsCustomColumnToIndexMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1727699709905-addIsCustomColumnToIndexMetadata.ts
deleted file mode 100644
index e5934267ff3..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1727699709905-addIsCustomColumnToIndexMetadata.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsCustomColumnToIndexMetadata1727699709905
- implements MigrationInterface
-{
- name = 'AddIsCustomColumnToIndexMetadata1727699709905';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- ALTER TABLE "core"."indexMetadata"
- ADD COLUMN "isCustom" BOOLEAN
- NOT NULL
- DEFAULT FALSE;
- `);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- ALTER TABLE "core"."indexMetadata"
- DROP COLUMN "isCustom"
- `);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728314605995-add_typeormGeneratedColumnsAndMaterializedViews.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1728314605995-add_typeormGeneratedColumnsAndMaterializedViews.ts
deleted file mode 100644
index 3cce215eb39..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728314605995-add_typeormGeneratedColumnsAndMaterializedViews.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddTypeormGeneratedColumns1728314605995
- implements MigrationInterface
-{
- name = 'AddTypeormGeneratedColumnsAndMaterializedViews1728314605995';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`
- CREATE TABLE "core"."_typeorm_generated_columns_and_materialized_views" (
- "type" character varying NOT NULL,
- "database" character varying,
- "schema" character varying,
- "table" character varying,
- "name" character varying,
- "value" text
- )
- `);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP TABLE "core"."_typeorm_generated_columns_and_materialized_views"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728563893694-addIsUniqueToFields.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1728563893694-addIsUniqueToFields.ts
deleted file mode 100644
index 3460c482471..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728563893694-addIsUniqueToFields.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsUniqueToFields1728563893694 implements MigrationInterface {
- name = 'AddIsUniqueToFields1728563893694';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "isUnique" boolean DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP COLUMN "indexWhereClause"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728579416430-addIsLabelSyncedWithName.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1728579416430-addIsLabelSyncedWithName.ts
deleted file mode 100644
index c5a1d7b47f0..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728579416430-addIsLabelSyncedWithName.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsLabelSyncedWithName1728579416430
- implements MigrationInterface
-{
- name = 'AddIsLabelSyncedWithName1728579416430';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isLabelSyncedWithName" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isLabelSyncedWithName"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728986317196-addIsPublicInviteLinkEnabledOnWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1728986317196-addIsPublicInviteLinkEnabledOnWorkspace.ts
deleted file mode 100644
index de30457ed05..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728986317196-addIsPublicInviteLinkEnabledOnWorkspace.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsPublicInviteLinkEnabledOnWorkspace1728986317196
- implements MigrationInterface
-{
- name = 'AddIsPublicInviteLinkEnabledOnWorkspace1728986317196';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isPublicInviteLinkEnabled" boolean NOT NULL DEFAULT true`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isPublicInviteLinkEnabled"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728999374151-addConstraintOnIndexMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1728999374151-addConstraintOnIndexMetadata.ts
deleted file mode 100644
index 21c0bd666aa..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1728999374151-addConstraintOnIndexMetadata.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddConstraintOnIndex1728999374151 implements MigrationInterface {
- name = 'AddConstraintOnIndexMetadata1728999374151';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD CONSTRAINT "IndexOnNameAndWorkspaceIdAndObjectMetadataUnique" UNIQUE ("name", "workspaceId", "objectMetadataId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP CONSTRAINT "IndexOnNameAndWorkspaceIdAndObjectMetadataUnique"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1729162426186-updateServerlessFunctionColumns.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1729162426186-updateServerlessFunctionColumns.ts
deleted file mode 100644
index 4a5e92030b8..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1729162426186-updateServerlessFunctionColumns.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateServerlessFunctionColumns1729162426186
- implements MigrationInterface
-{
- name = 'UpdateServerlessFunctionColumns1729162426186';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "publishedVersions" jsonb NOT NULL DEFAULT '[]'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "publishedVersions"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1729676165199-add-object-shortcut.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1729676165199-add-object-shortcut.ts
deleted file mode 100644
index 33da26421f1..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1729676165199-add-object-shortcut.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddObjectShortcut1729676165199 implements MigrationInterface {
- name = 'AddObjectShortcut1729676165199';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "shortcut" character varying`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_objectMetadata_shortcut_upper_workspace" ON "core"."objectMetadata" (UPPER("shortcut"), "workspaceId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_objectMetadata_shortcut_upper_workspace"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "shortcut"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730137590546-addSubdomainToWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1730137590546-addSubdomainToWorkspace.ts
deleted file mode 100644
index 5f535fd7c9f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730137590546-addSubdomainToWorkspace.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSubdomainToWorkspace1730137590546
- implements MigrationInterface
-{
- name = 'AddSubdomainToWorkspace1730137590546';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "subdomain" varchar NULL`,
- );
- await queryRunner.query(`UPDATE "core"."workspace" SET "subdomain" = "id"`);
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "subdomain" SET NOT NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX workspace_subdomain_unique_index ON "core"."workspace" (subdomain)`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "subdomain"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730298416367-addAuthProvidersColumnsToWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1730298416367-addAuthProvidersColumnsToWorkspace.ts
deleted file mode 100644
index 54fa574d539..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730298416367-addAuthProvidersColumnsToWorkspace.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddAuthProvidersColumnsToWorkspace1730298416367
- implements MigrationInterface
-{
- name = 'AddAuthProvidersColumnsToWorkspace1730298416367';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isMicrosoftAuthEnabled" BOOLEAN DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isGoogleAuthEnabled" BOOLEAN DEFAULT true`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isPasswordAuthEnabled" BOOLEAN DEFAULT true`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isMicrosoftAuthEnabled"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isGoogleAuthEnabled"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isPasswordAuthEnabled"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730803174864-addInputSchemaToFunction.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1730803174864-addInputSchemaToFunction.ts
deleted file mode 100644
index 994f368c0f1..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1730803174864-addInputSchemaToFunction.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddInputSchemaToFunction1730803174864
- implements MigrationInterface
-{
- name = 'AddInputSchemaToFunction1730803174864';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "latestVersionInputSchema" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "latestVersionInputSchema"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733153195498-addIsLabelSyncedWithNameToFieldMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1733153195498-addIsLabelSyncedWithNameToFieldMetadata.ts
deleted file mode 100644
index 74df705fbe5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733153195498-addIsLabelSyncedWithNameToFieldMetadata.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsLabelSyncedWithNameToFieldMetadata1733153195498
- implements MigrationInterface
-{
- name = 'AddIsLabelSyncedWithNameToFieldMetadata1733153195498';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "isLabelSyncedWithName" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "isLabelSyncedWithName"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318004066-missing-shortcut-migration.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318004066-missing-shortcut-migration.ts
deleted file mode 100644
index 7033a2efd97..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318004066-missing-shortcut-migration.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MissingShortcutMigration1733318004066
- implements MigrationInterface
-{
- name = 'MissingShortcutMigration1733318004066';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_objectMetadata_shortcut_upper_workspace"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_objectMetadata_shortcut_upper_workspace" ON "core"."objectMetadata" ("workspaceId") `,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318043626-sso-missing-migration.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318043626-sso-missing-migration.ts
deleted file mode 100644
index 143d3a9e143..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733318043626-sso-missing-migration.ts
+++ /dev/null
@@ -1,171 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class SsoMissingMigration1733318043626 implements MigrationInterface {
- name = 'SsoMissingMigration1733318043626';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP CONSTRAINT "FK_workspaceId"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."apptoken_unique_invitation_by_user_workspace"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."workspace_subdomain_unique_index"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP CONSTRAINT "userIdIsNullWhenTypeIsInvitation"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" DROP CONSTRAINT "userIdNotNullWhenTypeIsNotInvitation"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP CONSTRAINT "CHK_OIDC"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP CONSTRAINT "CHK_SAML"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "name" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP COLUMN "status"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."workspaceSSOIdentityProvider_status_enum" AS ENUM('Active', 'Inactive', 'Error')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD "status" "core"."workspaceSSOIdentityProvider_status_enum" NOT NULL DEFAULT 'Active'`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."idp_type_enum" RENAME TO "idp_type_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."workspaceSSOIdentityProvider_type_enum" AS ENUM('OIDC', 'SAML')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" TYPE "core"."workspaceSSOIdentityProvider_type_enum" USING "type"::"text"::"core"."workspaceSSOIdentityProvider_type_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" SET DEFAULT 'OIDC'`,
- );
- await queryRunner.query(`DROP TYPE "core"."idp_type_enum_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."workspace_activationStatus_enum" RENAME TO "workspace_activationStatus_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationstatus_enum" AS ENUM('ONGOING_CREATION', 'PENDING_CREATION', 'ACTIVE', 'INACTIVE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" TYPE "core"."workspace_activationstatus_enum" USING "activationStatus"::"text"::"core"."workspace_activationstatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationStatus_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isGoogleAuthEnabled" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isPasswordAuthEnabled" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isMicrosoftAuthEnabled" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "FK_bc8d8855198de1fbc32fba8df93" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP CONSTRAINT "FK_bc8d8855198de1fbc32fba8df93"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isMicrosoftAuthEnabled" DROP NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isPasswordAuthEnabled" DROP NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isGoogleAuthEnabled" DROP NOT NULL`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationStatus_enum_old" AS ENUM('PENDING_CREATION', 'ONGOING_CREATION', 'ACTIVE', 'INACTIVE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" TYPE "core"."workspace_activationStatus_enum_old" USING "activationStatus"::"text"::"core"."workspace_activationStatus_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationstatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."workspace_activationStatus_enum_old" RENAME TO "workspace_activationStatus_enum"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."idp_type_enum_old" AS ENUM('OIDC', 'SAML')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" TYPE "core"."idp_type_enum_old" USING "type"::"text"::"core"."idp_type_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "type" SET DEFAULT 'OIDC'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspaceSSOIdentityProvider_type_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."idp_type_enum_old" RENAME TO "idp_type_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" DROP COLUMN "status"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspaceSSOIdentityProvider_status_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD "status" character varying NOT NULL DEFAULT 'Active'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ALTER COLUMN "name" DROP NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "CHK_SAML" CHECK ((((type = 'SAML'::core.idp_type_enum) AND ("ssoURL" IS NOT NULL) AND (certificate IS NOT NULL)) OR (type = 'OIDC'::core.idp_type_enum)))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "CHK_OIDC" CHECK ((((type = 'OIDC'::core.idp_type_enum) AND ("clientID" IS NOT NULL) AND ("clientSecret" IS NOT NULL)) OR (type = 'SAML'::core.idp_type_enum)))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD CONSTRAINT "userIdNotNullWhenTypeIsNotInvitation" CHECK (((type = 'INVITATION_TOKEN'::text) OR ("userId" IS NOT NULL)))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."appToken" ADD CONSTRAINT "userIdIsNullWhenTypeIsInvitation" CHECK (((type <> 'INVITATION_TOKEN'::text) OR ("userId" IS NULL)))`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "workspace_subdomain_unique_index" ON "core"."workspace" ("subdomain") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "apptoken_unique_invitation_by_user_workspace" ON "core"."appToken" ("workspaceId") WHERE (type = 'INVITATION_TOKEN'::text)`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspaceSSOIdentityProvider" ADD CONSTRAINT "FK_workspaceId" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733408604468-fixUserEmailUniqueConstraint.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1733408604468-fixUserEmailUniqueConstraint.ts
deleted file mode 100644
index 74e141e3ce9..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1733408604468-fixUserEmailUniqueConstraint.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixUserEmailUniqueConstraint1733408604468
- implements MigrationInterface
-{
- name = 'FixUserEmailUniqueConstraint1733408604468';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "UQ_USER_EMAIL"`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "UQ_USER_EMAIL" ON "core"."user" ("email") WHERE "deletedAt" IS NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP INDEX "core"."UQ_USER_EMAIL"`);
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "UQ_USER_EMAIL" UNIQUE ("email", "deletedAt")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1734355945585-add-unique-index-on-subdomain.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1734355945585-add-unique-index-on-subdomain.ts
deleted file mode 100644
index cb777c9d0b1..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1734355945585-add-unique-index-on-subdomain.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUniqueIndexOnSubdomain1734355945585
- implements MigrationInterface
-{
- name = 'AddUniqueIndexOnSubdomain1734355945585';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD CONSTRAINT "UQ_cba6255a24deb1fff07dd7351b8" UNIQUE ("subdomain")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP CONSTRAINT "UQ_cba6255a24deb1fff07dd7351b8"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1734544295083-remove-default-workspace-id.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1734544295083-remove-default-workspace-id.ts
deleted file mode 100644
index f724370c755..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1734544295083-remove-default-workspace-id.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveDefaultWorkspaceId1734544295083
- implements MigrationInterface
-{
- name = 'RemoveDefaultWorkspaceId1734544295083';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_2ec910029395fa7655621c88908"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "defaultWorkspaceId"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "defaultWorkspaceId" uuid NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_2ec910029395fa7655621c88908" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE RESTRICT ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1736050161854-renameEmailVerifiedColumn.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1736050161854-renameEmailVerifiedColumn.ts
deleted file mode 100644
index 984e3f0106b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1736050161854-renameEmailVerifiedColumn.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenameEmailVerifiedColumn1736050161854
- implements MigrationInterface
-{
- name = 'RenameEmailVerifiedColumn1736050161854';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" RENAME COLUMN "emailVerified" TO "isEmailVerified"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" RENAME COLUMN "isEmailVerified" TO "emailVerified"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1736861823893-updateWorkspaceStatusEnum.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1736861823893-updateWorkspaceStatusEnum.ts
deleted file mode 100644
index 0983f825b11..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1736861823893-updateWorkspaceStatusEnum.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateWorkspaceStatusEnum1736861823893
- implements MigrationInterface
-{
- name = 'UpdateWorkspaceStatusEnum1736861823893';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TYPE "core"."workspace_activationstatus_enum" RENAME TO "workspace_activationstatus_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationStatus_enum" AS ENUM('ONGOING_CREATION', 'PENDING_CREATION', 'ACTIVE', 'INACTIVE', 'SUSPENDED')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" TYPE "core"."workspace_activationStatus_enum" USING "activationStatus"::"text"::"core"."workspace_activationStatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationstatus_enum_old"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."workspace_activationstatus_enum_old" AS ENUM('ACTIVE', 'INACTIVE', 'ONGOING_CREATION', 'PENDING_CREATION')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" TYPE "core"."workspace_activationstatus_enum_old" USING "activationStatus"::"text"::"core"."workspace_activationstatus_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "activationStatus" SET DEFAULT 'INACTIVE'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."workspace_activationStatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."workspace_activationstatus_enum_old" RENAME TO "workspace_activationstatus_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737033794408-two-factor-method.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737033794408-two-factor-method.ts
deleted file mode 100644
index d0222078a15..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737033794408-two-factor-method.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class TwoFactorMethod1737033794408 implements MigrationInterface {
- name = 'TwoFactorMethod1737033794408';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."twoFactorMethod" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userWorkspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_752f0250dd6824289ceddd8b054" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorMethod" ADD CONSTRAINT "FK_c1044145be65a4ee65c07e0a658" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorMethod" DROP CONSTRAINT "FK_c1044145be65a4ee65c07e0a658"`,
- );
- await queryRunner.query(`DROP TABLE "core"."twoFactorMethod"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737047131108-addTimeoutSecondsColumnToServerless.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737047131108-addTimeoutSecondsColumnToServerless.ts
deleted file mode 100644
index 76ee93092de..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737047131108-addTimeoutSecondsColumnToServerless.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddTimeoutSecondsColumnToServerless1737047131108
- implements MigrationInterface
-{
- name = 'AddTimeoutSecondsColumnToServerless1737047131108';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "timeoutSeconds" integer NOT NULL DEFAULT '300'`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD CONSTRAINT "CHK_4a5179975ee017934a91703247" CHECK ("timeoutSeconds" >= 1 AND "timeoutSeconds" <= 900)`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP CONSTRAINT "CHK_4a5179975ee017934a91703247"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "timeoutSeconds"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737561084251-addRelationTargetFieldAndObjectToFieldMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737561084251-addRelationTargetFieldAndObjectToFieldMetadata.ts
deleted file mode 100644
index 27c3eab5d61..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737561084251-addRelationTargetFieldAndObjectToFieldMetadata.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRelationTargetFieldAndObjectToFieldMetadata1737561084251
- implements MigrationInterface
-{
- name = 'AddRelationTargetFieldAndObjectToFieldMetadata1737561084251';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "relationTargetFieldMetadataId" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "UQ_47a6c57e1652b6475f8248cff78" UNIQUE ("relationTargetFieldMetadataId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "relationTargetObjectMetadataId" uuid`,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnRelationTargetObjectMetadataId" ON "core"."fieldMetadata" ("relationTargetObjectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnRelationTargetFieldMetadataId" ON "core"."fieldMetadata" ("relationTargetFieldMetadataId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_47a6c57e1652b6475f8248cff78" FOREIGN KEY ("relationTargetFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_6f6c87ec32cca956d8be321071c" FOREIGN KEY ("relationTargetObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_6f6c87ec32cca956d8be321071c"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_47a6c57e1652b6475f8248cff78"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnRelationTargetFieldMetadataId"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnRelationTargetObjectMetadataId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "relationTargetObjectMetadataId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "UQ_47a6c57e1652b6475f8248cff78"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "relationTargetFieldMetadataId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737630672873-workspace-entity-default-microsoft-auth-enabled.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737630672873-workspace-entity-default-microsoft-auth-enabled.ts
deleted file mode 100644
index d8437f9f7ea..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737630672873-workspace-entity-default-microsoft-auth-enabled.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class WorkspaceEntityDefaultMicrosoftAuthEnabled1737630672873
- implements MigrationInterface
-{
- name = 'WorkspaceEntityDefaultMicrosoftAuthEnabled1737630672873';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isMicrosoftAuthEnabled" SET DEFAULT true`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ALTER COLUMN "isMicrosoftAuthEnabled" SET DEFAULT false`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737996712702-remove-domainName-from-workspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737996712702-remove-domainName-from-workspace.ts
deleted file mode 100644
index d3e215091ad..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737996712702-remove-domainName-from-workspace.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveDomainNameFromWorkspace1737996712702
- implements MigrationInterface
-{
- name = 'RemoveDomainNameFromWorkspace1737996712702';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "domainName"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "domainName" character varying`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737997028359-add-hostname-to-workspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1737997028359-add-hostname-to-workspace.ts
deleted file mode 100644
index 52aa21318c6..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1737997028359-add-hostname-to-workspace.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddHostnameToWorkspace1737997028359 implements MigrationInterface {
- name = 'AddHostnameToWorkspace1737997028359';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "hostname" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0" UNIQUE ("hostname")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "hostname"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738233783889-addNewSyncStatusToServerless.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1738233783889-addNewSyncStatusToServerless.ts
deleted file mode 100644
index 45ceabed775..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738233783889-addNewSyncStatusToServerless.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddNewSyncStatusToServerless1738233783889
- implements MigrationInterface
-{
- name = 'AddNewSyncStatusToServerless1738233783889';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TYPE "core"."serverlessFunction_syncstatus_enum" RENAME TO "serverlessFunction_syncstatus_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."serverlessFunction_syncstatus_enum" AS ENUM('NOT_READY', 'BUILDING', 'READY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" TYPE "core"."serverlessFunction_syncstatus_enum" USING "syncStatus"::"text"::"core"."serverlessFunction_syncstatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" SET DEFAULT 'NOT_READY'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."serverlessFunction_syncstatus_enum_old"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."serverlessFunction_syncstatus_enum_old" AS ENUM('NOT_READY', 'READY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" TYPE "core"."serverlessFunction_syncstatus_enum_old" USING "syncStatus"::"text"::"core"."serverlessFunction_syncstatus_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "syncStatus" SET DEFAULT 'NOT_READY'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."serverlessFunction_syncstatus_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."serverlessFunction_syncstatus_enum_old" RENAME TO "serverlessFunction_syncstatus_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738248281689-createPermissionsTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1738248281689-createPermissionsTable.ts
deleted file mode 100644
index 82c3348828e..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738248281689-createPermissionsTable.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreatePermissionsTable1738248281689 implements MigrationInterface {
- name = 'CreatePermissionsTable1738248281689';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."role" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "label" character varying NOT NULL, "canUpdateAllSettings" boolean NOT NULL DEFAULT false, "description" text, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "isEditable" boolean NOT NULL DEFAULT true, CONSTRAINT "PK_b36bcfe02fc8de3c57a8b2391c2" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."userWorkspaceRole" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "workspaceId" uuid NOT NULL, "roleId" uuid NOT NULL, "userWorkspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnUserWorkspaceRoleUnique" UNIQUE ("userWorkspaceId", "roleId"), CONSTRAINT "PK_9c02cbdd9053fbb6791e21b7146" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD CONSTRAINT "FK_0b70755f23a3705f1bea0ddc7d4" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" DROP CONSTRAINT "FK_0b70755f23a3705f1bea0ddc7d4"`,
- );
- await queryRunner.query(`DROP TABLE "core"."userWorkspaceRole"`);
- await queryRunner.query(`DROP TABLE "core"."role"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738853620654-addDuplicateCriteriaColumnInObjectMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1738853620654-addDuplicateCriteriaColumnInObjectMetadata.ts
deleted file mode 100644
index 01c33f67c2a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1738853620654-addDuplicateCriteriaColumnInObjectMetadata.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDuplicateCriteriaColumnInObjectMetadata1738853620654
- implements MigrationInterface
-{
- name = 'AddDuplicateCriteriaColumnInObjectMetadata1738853620654';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "duplicateCriteria" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "duplicateCriteria"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739022118023-addLocaleToUser.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1739022118023-addLocaleToUser.ts
deleted file mode 100644
index c5b41e0ff84..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739022118023-addLocaleToUser.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddLocaleToUser1739022118023 implements MigrationInterface {
- name = 'AddLocaleToUser1739022118023';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "locale" character varying NOT NULL DEFAULT 'en'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."user" DROP COLUMN "locale"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739178177820-rename-hostname-to-custom-domain.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1739178177820-rename-hostname-to-custom-domain.ts
deleted file mode 100644
index 59c052fc665..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739178177820-rename-hostname-to-custom-domain.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenameHostnameToCustomDomain1739178177820
- implements MigrationInterface
-{
- name = 'RenameHostnameToCustomDomain1739178177820';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" RENAME COLUMN "hostname" TO "customDomain"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" RENAME CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0" TO "UQ_900f0a3eb789159c26c8bcb39cd"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" RENAME CONSTRAINT "UQ_900f0a3eb789159c26c8bcb39cd" TO "UQ_e6fa363bdaf45cbf8ce97bcebf0"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" RENAME COLUMN "customDomain" TO "hostname"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203087254-add-is-custom-domain-enable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203087254-add-is-custom-domain-enable.ts
deleted file mode 100644
index edd404606c7..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203087254-add-is-custom-domain-enable.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsCustomDomainEnable1739203087254
- implements MigrationInterface
-{
- name = 'AddIsCustomDomainEnable1739203087254';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isCustomDomainEnabled" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isCustomDomainEnabled"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203246456-addIndexesOnFieldMetadataAndIndexFieldMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203246456-addIndexesOnFieldMetadataAndIndexFieldMetadata.ts
deleted file mode 100644
index 6a50a10cd4d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739203246456-addIndexesOnFieldMetadataAndIndexFieldMetadata.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexesOnFieldMetadataAndIndexFieldMetadata1739203246456
- implements MigrationInterface
-{
- name = 'AddIndexesOnFieldMetadataAndIndexMetadata1739203246456';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IndexOnFieldMetadataId" ON "core"."indexFieldMetadata" ("fieldMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnObjectMetadataId" ON "core"."fieldMetadata" ("objectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnWorkspaceId" ON "core"."fieldMetadata" ("workspaceId") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP INDEX "core"."IndexOnWorkspaceId"`);
- await queryRunner.query(`DROP INDEX "core"."IndexOnObjectMetadataId"`);
- await queryRunner.query(`DROP INDEX "core"."IndexOnFieldMetadataId"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739795699972-updateRoleTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1739795699972-updateRoleTable.ts
deleted file mode 100644
index d72264ba9a9..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1739795699972-updateRoleTable.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateRoleTable1739795699972 implements MigrationInterface {
- name = 'UpdateRoleTable1739795699972';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canReadAllObjectRecords" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canUpdateAllObjectRecords" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canSoftDeleteAllObjectRecords" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canDestroyAllObjectRecords" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canDestroyAllObjectRecords"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canSoftDeleteAllObjectRecords"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canUpdateAllObjectRecords"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canReadAllObjectRecords"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740048555744-add-approved-access-domain.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1740048555744-add-approved-access-domain.ts
deleted file mode 100644
index eef49fa61ac..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740048555744-add-approved-access-domain.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddApprovedAccessDomain1740048555744
- implements MigrationInterface
-{
- name = 'AddApprovedAccessDomain1740048555744';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."approvedAccessDomain" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "domain" character varying NOT NULL, "isValidated" boolean NOT NULL DEFAULT false, "workspaceId" uuid NOT NULL, CONSTRAINT "IndexOnDomainAndWorkspaceId" UNIQUE ("domain", "workspaceId"), CONSTRAINT "PK_523281ce57c84e1a039f4538c19" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" ADD CONSTRAINT "FK_73d3e340b6ce0716a25a86361fc" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" DROP CONSTRAINT "FK_73d3e340b6ce0716a25a86361fc"`,
- );
- await queryRunner.query(`DROP TABLE "core"."approvedAccessDomain"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740390801418-addDefaultRoleToWorkspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1740390801418-addDefaultRoleToWorkspace.ts
deleted file mode 100644
index bbdf4e85443..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740390801418-addDefaultRoleToWorkspace.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDefaultRoleToWorkspace1740390801418
- implements MigrationInterface
-{
- name = 'AddDefaultRoleToWorkspace1740390801418';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "defaultRoleId" uuid`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "defaultRoleId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740415309924-addAccessToFullAdminAndWorkspaceVersion.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1740415309924-addAccessToFullAdminAndWorkspaceVersion.ts
deleted file mode 100644
index bdf788e80be..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740415309924-addAccessToFullAdminAndWorkspaceVersion.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddAccessToFullAdminAndWorkspaceVersion1740415309924
- implements MigrationInterface
-{
- name = 'AddAccessToFullAdminAndWorkspaceVersion1740415309924';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."user" ADD "canAccessFullAdminPanel" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "version" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "version"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."user" DROP COLUMN "canAccessFullAdminPanel"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740478150675-addIsSearchableColumnInObjectMetadataTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1740478150675-addIsSearchableColumnInObjectMetadataTable.ts
deleted file mode 100644
index e6c256c7db9..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1740478150675-addIsSearchableColumnInObjectMetadataTable.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsSearchableColumnInObjectMetadataTable1740478150675
- implements MigrationInterface
-{
- name = 'AddIsSearchableColumnInObjectMetadataTable1740478150675';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isSearchable" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isSearchable"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1741859116265-addIconToRole.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1741859116265-addIconToRole.ts
deleted file mode 100644
index b2faecb952d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1741859116265-addIconToRole.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIconToRole1741859116265 implements MigrationInterface {
- name = 'AddIconToRole1741859116265';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "icon" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."role" DROP COLUMN "icon"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742232505943-generatePermissionsV2Tables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1742232505943-generatePermissionsV2Tables.ts
deleted file mode 100644
index 0f1125af553..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742232505943-generatePermissionsV2Tables.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class GeneratePermissionsV2Tables1742232505943
- implements MigrationInterface
-{
- name = 'GeneratePermissionsV2Tables1742232505943';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."objectPermissions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "objectMetadataId" uuid NOT NULL, "canReadObjectRecords" boolean, "canUpdateObjectRecords" boolean, "canSoftDeleteObjectRecords" boolean, "canDestroyObjectRecords" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnObjectPermissionsUnique" UNIQUE ("objectMetadataId", "roleId"), CONSTRAINT "PK_ea2c5c9a2dfa3d674da8b1350cd" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."settingsPermissions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "setting" character varying NOT NULL, "canUpdateSetting" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnSettingsPermissionsUnique" UNIQUE ("setting", "roleId"), CONSTRAINT "PK_44f120f1e527e62efa3fec8a846" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermissions" ADD CONSTRAINT "FK_770297c03e386df4c9fa4986ee1" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermissions" ADD CONSTRAINT "FK_ddad09b4fdf32c88283ae815074" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."settingsPermissions" ADD CONSTRAINT "FK_712bf97e56c4040026dd887ed4a" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingsPermissions" DROP CONSTRAINT "FK_712bf97e56c4040026dd887ed4a"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermissions" DROP CONSTRAINT "FK_ddad09b4fdf32c88283ae815074"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermissions" DROP CONSTRAINT "FK_770297c03e386df4c9fa4986ee1"`,
- );
- await queryRunner.query(`DROP TABLE "core"."settingsPermissions"`);
- await queryRunner.query(`DROP TABLE "core"."objectPermissions"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742316060157-addIndexOnRoleLabelAndWorkspaceId.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1742316060157-addIndexOnRoleLabelAndWorkspaceId.ts
deleted file mode 100644
index d3760ce849c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742316060157-addIndexOnRoleLabelAndWorkspaceId.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexOnRoleLabelAndWorkspaceId1742316060157
- implements MigrationInterface
-{
- name = 'AddIndexOnRoleLabelAndWorkspaceId1742316060157';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD CONSTRAINT "IndexOnRoleUnique" UNIQUE ("label", "workspaceId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP CONSTRAINT "IndexOnRoleUnique"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742488572894-renamePermissionTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1742488572894-renamePermissionTables.ts
deleted file mode 100644
index 7d811f3e812..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742488572894-renamePermissionTables.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenamePermissionTables1742488572894 implements MigrationInterface {
- name = 'RenamePermissionTables1742488572894';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP TABLE "core"."settingsPermissions"`);
- await queryRunner.query(`DROP TABLE "core"."objectPermissions"`);
- await queryRunner.query(
- `CREATE TABLE "core"."objectPermission" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "objectMetadataId" uuid NOT NULL, "canReadObjectRecords" boolean, "canUpdateObjectRecords" boolean, "canSoftDeleteObjectRecords" boolean, "canDestroyObjectRecords" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnObjectPermissionUnique" UNIQUE ("objectMetadataId", "roleId"), CONSTRAINT "PK_23a4033c1aa380d0d1431731add" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."settingPermission" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "setting" character varying NOT NULL, "canUpdateSetting" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IndexOnSettingPermissionUnique" UNIQUE ("setting", "roleId"), CONSTRAINT "PK_8c144a021030d7e3326835a04c8" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "FK_826052747c82e59f0a006204256" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "FK_efbcf3528718de2b5c45c0a8a83" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" ADD CONSTRAINT "FK_b327aadd9fd189f33d2c5237833" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" DROP CONSTRAINT "FK_b327aadd9fd189f33d2c5237833"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "FK_efbcf3528718de2b5c45c0a8a83"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "FK_826052747c82e59f0a006204256"`,
- );
- await queryRunner.query(`DROP TABLE "core"."settingPermission"`);
- await queryRunner.query(`DROP TABLE "core"."objectPermission"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742736630054-standardObjectOverwrite.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1742736630054-standardObjectOverwrite.ts
deleted file mode 100644
index bf68eb92587..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742736630054-standardObjectOverwrite.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class StandardObjectOverwrite1742736630054
- implements MigrationInterface
-{
- name = 'StandardObjectOverwrite1742736630054';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "standardOverrides" jsonb`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "standardOverrides" jsonb`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "standardOverrides"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "standardOverrides"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742998832316-addWorkspaceConstraint.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1742998832316-addWorkspaceConstraint.ts
deleted file mode 100644
index efdc11ab77d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1742998832316-addWorkspaceConstraint.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceConstraint1742998832316 implements MigrationInterface {
- name = 'AddWorkspaceConstraint1742998832316';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD CONSTRAINT "onboarded_workspace_requires_default_role" CHECK ("activationStatus" IN ('PENDING_CREATION', 'ONGOING_CREATION') OR "defaultRoleId" IS NOT NULL)`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP CONSTRAINT "onboarded_workspace_requires_default_role"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000787-updateKeyValuePairTypeEnum.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000787-updateKeyValuePairTypeEnum.ts
deleted file mode 100644
index ab81b9761c0..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000787-updateKeyValuePairTypeEnum.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateKeyValuePairTypeEnum1743085000787
- implements MigrationInterface
-{
- name = 'UpdateKeyValuePairTypeEnum1743085000787';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" DROP DEFAULT`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" TYPE text USING "type"::text`,
- );
-
- await queryRunner.query(
- `UPDATE "core"."keyValuePair" SET "type" = 'USER_VARIABLE' WHERE "type" = 'USER_VAR'`,
- );
- await queryRunner.query(
- `UPDATE "core"."keyValuePair" SET "type" = 'CONFIG_VARIABLE' WHERE "type" = 'SYSTEM_VAR'`,
- );
-
- await queryRunner.query(`DROP TYPE "core"."keyValuePair_type_enum"`);
-
- await queryRunner.query(
- `CREATE TYPE "core"."keyValuePair_type_enum" AS ENUM('USER_VARIABLE', 'FEATURE_FLAG', 'CONFIG_VARIABLE')`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" TYPE "core"."keyValuePair_type_enum" USING "type"::"core"."keyValuePair_type_enum"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" SET DEFAULT 'USER_VARIABLE'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" DROP DEFAULT`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" TYPE text USING "type"::text`,
- );
-
- await queryRunner.query(
- `UPDATE "core"."keyValuePair" SET "type" = 'USER_VAR' WHERE "type" = 'USER_VARIABLE'`,
- );
- await queryRunner.query(
- `UPDATE "core"."keyValuePair" SET "type" = 'SYSTEM_VAR' WHERE "type" = 'CONFIG_VARIABLE'`,
- );
-
- await queryRunner.query(`DROP TYPE "core"."keyValuePair_type_enum"`);
-
- await queryRunner.query(
- `CREATE TYPE "core"."keyValuePair_type_enum" AS ENUM('USER_VAR', 'FEATURE_FLAG', 'SYSTEM_VAR')`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" TYPE "core"."keyValuePair_type_enum" USING "type"::"core"."keyValuePair_type_enum"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ALTER COLUMN "type" SET DEFAULT 'USER_VAR'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000788-transferMetadataToCore.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000788-transferMetadataToCore.ts
deleted file mode 100644
index bf8ba1e03fc..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743085000788-transferMetadataToCore.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class TransferMetadataToCore1743085000788 implements MigrationInterface {
- name = 'TransferMetadataToCore1743085000788';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- const schemaExists = await queryRunner.query(
- `SELECT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = 'metadata')`,
- );
-
- if (!schemaExists[0].exists) {
- return;
- }
-
- const tables = await queryRunner.query(
- `SELECT table_name FROM information_schema.tables
- WHERE table_schema = 'metadata' AND table_name != '_typeorm_migrations'`,
- );
-
- if (tables.length === 0) {
- return;
- }
-
- for (const table of tables) {
- const tableName = table.table_name;
-
- const tableExistsInCore = await queryRunner.query(
- `SELECT EXISTS(
- SELECT 1 FROM information_schema.tables
- WHERE table_schema = 'core' AND table_name = '${tableName}'
- )`,
- );
-
- if (tableExistsInCore[0].exists) {
- continue;
- }
-
- // Move the table from metadata schema to core schema
- // This preserves all data, constraints, indexes, etc.
- await queryRunner.query(
- `ALTER TABLE "metadata"."${tableName}" SET SCHEMA "core"`,
- );
- }
- }
-
- public async down(): Promise<void> {
- // This migration is irreversible
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743605310126-removeCanUpdateSettingFromSettingPermission.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1743605310126-removeCanUpdateSettingFromSettingPermission.ts
deleted file mode 100644
index 7b37aa9cec7..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1743605310126-removeCanUpdateSettingFromSettingPermission.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveCanUpdateSettingFromSettingPermission1743605310126
- implements MigrationInterface
-{
- name = 'RemoveCanUpdateSettingFromSettingPermission1743605310126';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" DROP COLUMN "canUpdateSetting"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" ADD "canUpdateSetting" boolean`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747062634513-addCascadeDeleteOnFieldMetadataRelationTargetObject.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1747062634513-addCascadeDeleteOnFieldMetadataRelationTargetObject.ts
deleted file mode 100644
index 65abe57b2d5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747062634513-addCascadeDeleteOnFieldMetadataRelationTargetObject.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddCascadeDeleteOnFieldMetadataRelationTargetObject1747062634513
- implements MigrationInterface
-{
- name = 'AddCascadeDeleteOnFieldMetadataRelationTargetObject1747062634513';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT IF EXISTS "FK_6f6c87ec32cca956d8be321071c"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_6f6c87ec32cca956d8be321071c" FOREIGN KEY ("relationTargetObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_6f6c87ec32cca956d8be321071c"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_6f6c87ec32cca956d8be321071c" FOREIGN KEY ("relationTargetObjectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483135-addDefaultAvatarUrlColumnInUserWorkspaceTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483135-addDefaultAvatarUrlColumnInUserWorkspaceTable.ts
deleted file mode 100644
index ea14e7872ef..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483135-addDefaultAvatarUrlColumnInUserWorkspaceTable.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDefaultAvatarUrlColumnInUserWorkspaceTable1747401483135
- implements MigrationInterface
-{
- name = 'AddDefaultAvatarUrlColumnInUserWorkspaceTable1747401483135';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD "defaultAvatarUrl" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP COLUMN "defaultAvatarUrl"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483136-createAgentTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483136-createAgentTable.ts
deleted file mode 100644
index e6b67ff4548..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1747401483136-createAgentTable.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateAgentTable1747401483136 implements MigrationInterface {
- name = 'CreateAgentTable1747401483136';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."agent" (
- "id" uuid NOT NULL DEFAULT uuid_generate_v4(),
- "name" character varying NOT NULL,
- "description" character varying,
- "prompt" text NOT NULL,
- "modelId" character varying NOT NULL,
- "responseFormat" jsonb,
- "workspaceId" uuid NOT NULL,
- "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
- "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
- "deletedAt" TIMESTAMP WITH TIME ZONE,
- CONSTRAINT "PK_agent" PRIMARY KEY ("id")
- )`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_AGENT_ID_DELETED_AT" ON "core"."agent" ("id", "deletedAt")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD CONSTRAINT "FK_c4cb56621768a4a325dd772bbe1" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agent" DROP CONSTRAINT "FK_c4cb56621768a4a325dd772bbe1"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_AGENT_ID_DELETED_AT"`);
- await queryRunner.query(`DROP TABLE "core"."agent"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843737248-add-user-workspace-role-composite-index.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843737248-add-user-workspace-role-composite-index.ts
deleted file mode 100644
index ef1bfed0146..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843737248-add-user-workspace-role-composite-index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUserWorkspaceRoleCompositeIndex1748843737248
- implements MigrationInterface
-{
- name = 'AddUserWorkspaceRoleCompositeIndex1748843737248';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_WORKSPACE_ID" ON "core"."userWorkspaceRole" ("userWorkspaceId", "workspaceId") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_WORKSPACE_ID"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843862307-add-index-metadata-workspace-object-composite-index.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843862307-add-index-metadata-workspace-object-composite-index.ts
deleted file mode 100644
index 47d8d4abb00..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748843862307-add-index-metadata-workspace-object-composite-index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexMetadataWorkspaceObjectCompositeIndex1748843862307
- implements MigrationInterface
-{
- name = 'AddIndexMetadataWorkspaceObjectCompositeIndex1748843862307';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_INDEX_METADATA_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."indexMetadata" ("workspaceId", "objectMetadataId") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_INDEX_METADATA_WORKSPACE_ID_OBJECT_METADATA_ID"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748844710107-addSoftDeleteIndexes.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748844710107-addSoftDeleteIndexes.ts
deleted file mode 100644
index f07abf1a308..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748844710107-addSoftDeleteIndexes.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddSoftDeleteIndexes1748844710107 implements MigrationInterface {
- name = 'AddSoftDeleteIndexes1748844710107';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_USER_WORKSPACE_WORKSPACE_ID" ON "core"."userWorkspace" ("workspaceId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_USER_WORKSPACE_USER_ID" ON "core"."userWorkspace" ("userId") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP INDEX "core"."IDX_USER_WORKSPACE_USER_ID"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_USER_WORKSPACE_WORKSPACE_ID"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846032709-fixMetadataIndexes.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846032709-fixMetadataIndexes.ts
deleted file mode 100644
index 8623856c806..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846032709-fixMetadataIndexes.ts
+++ /dev/null
@@ -1,169 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixMetadataIndexes1748846032709 implements MigrationInterface {
- name = 'FixMetadataIndexes1748846032709';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP INDEX "core"."IndexOnFieldMetadataId"`);
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnRelationTargetObjectMetadataId"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnRelationTargetFieldMetadataId"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IndexOnObjectMetadataId"`);
- await queryRunner.query(`DROP INDEX "core"."IndexOnWorkspaceId"`);
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP CONSTRAINT "IndexOnNameAndWorkspaceIdAndObjectMetadataUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "IndexOnNamePluralAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "IndexOnNameSingularAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "IndexOnObjectPermissionUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" DROP CONSTRAINT "IndexOnUserWorkspaceRoleUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP CONSTRAINT "IndexOnRoleUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" DROP CONSTRAINT "IndexOnSettingPermissionUnique"`,
- );
-
- await queryRunner.query(
- `CREATE INDEX "IDX_INDEX_FIELD_METADATA_FIELD_METADATA_ID" ON "core"."indexFieldMetadata" ("fieldMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_METADATA_OBJECT_METADATA_ID" ON "core"."fieldMetadata" ("objectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_METADATA_WORKSPACE_ID" ON "core"."fieldMetadata" ("workspaceId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_METADATA_OBJECT_METADATA_ID_WORKSPACE_ID" ON "core"."fieldMetadata" ("objectMetadataId", "workspaceId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_METADATA_RELATION_TARGET_OBJECT_METADATA_ID" ON "core"."fieldMetadata" ("relationTargetObjectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_METADATA_RELATION_TARGET_FIELD_METADATA_ID" ON "core"."fieldMetadata" ("relationTargetFieldMetadataId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD CONSTRAINT "IDX_INDEX_METADATA_NAME_WORKSPACE_ID_OBJECT_METADATA_ID_UNIQUE" UNIQUE ("name", "workspaceId", "objectMetadataId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "IDX_FIELD_METADATA_NAME_OBJECT_METADATA_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("name", "objectMetadataId", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "IDX_OBJECT_METADATA_NAME_PLURAL_WORKSPACE_ID_UNIQUE" UNIQUE ("namePlural", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "IDX_OBJECT_METADATA_NAME_SINGULAR_WORKSPACE_ID_UNIQUE" UNIQUE ("nameSingular", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "IDX_OBJECT_PERMISSION_OBJECT_METADATA_ID_ROLE_ID_UNIQUE" UNIQUE ("objectMetadataId", "roleId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD CONSTRAINT "IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_ROLE_ID_UNIQUE" UNIQUE ("userWorkspaceId", "roleId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD CONSTRAINT "IDX_ROLE_LABEL_WORKSPACE_ID_UNIQUE" UNIQUE ("label", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" ADD CONSTRAINT "IDX_SETTING_PERMISSION_SETTING_ROLE_ID_UNIQUE" UNIQUE ("setting", "roleId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" DROP CONSTRAINT "IDX_SETTING_PERMISSION_SETTING_ROLE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP CONSTRAINT "IDX_ROLE_LABEL_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" DROP CONSTRAINT "IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_ROLE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" DROP CONSTRAINT "IDX_OBJECT_PERMISSION_OBJECT_METADATA_ID_ROLE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "IDX_OBJECT_METADATA_NAME_SINGULAR_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP CONSTRAINT "IDX_OBJECT_METADATA_NAME_PLURAL_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "IDX_FIELD_METADATA_NAME_OBJECT_METADATA_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" DROP CONSTRAINT "IDX_INDEX_METADATA_NAME_WORKSPACE_ID_OBJECT_METADATA_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_RELATION_TARGET_FIELD_METADATA_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_RELATION_TARGET_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_OBJECT_METADATA_ID_WORKSPACE_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_WORKSPACE_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_INDEX_FIELD_METADATA_FIELD_METADATA_ID"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" ADD CONSTRAINT "IndexOnSettingPermissionUnique" UNIQUE ("roleId", "setting")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD CONSTRAINT "IndexOnRoleUnique" UNIQUE ("label", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD CONSTRAINT "IndexOnUserWorkspaceRoleUnique" UNIQUE ("roleId", "userWorkspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectPermission" ADD CONSTRAINT "IndexOnObjectPermissionUnique" UNIQUE ("roleId", "objectMetadataId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "IndexOnNameSingularAndWorkspaceIdUnique" UNIQUE ("nameSingular", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD CONSTRAINT "IndexOnNamePluralAndWorkspaceIdUnique" UNIQUE ("namePlural", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique" UNIQUE ("objectMetadataId", "name", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."indexMetadata" ADD CONSTRAINT "IndexOnNameAndWorkspaceIdAndObjectMetadataUnique" UNIQUE ("name", "workspaceId", "objectMetadataId")`,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnWorkspaceId" ON "core"."fieldMetadata" ("workspaceId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnObjectMetadataId" ON "core"."fieldMetadata" ("objectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnRelationTargetFieldMetadataId" ON "core"."fieldMetadata" ("relationTargetFieldMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnRelationTargetObjectMetadataId" ON "core"."fieldMetadata" ("relationTargetObjectMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IndexOnFieldMetadataId" ON "core"."indexFieldMetadata" ("fieldMetadataId") `,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846118238-fixCoreIndexes.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846118238-fixCoreIndexes.ts
deleted file mode 100644
index 6742911e83e..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748846118238-fixCoreIndexes.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixCoreIndexes1748846118238 implements MigrationInterface {
- name = 'FixCoreIndexes1748846118238';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnKeyUserIdAndNullWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IndexOnKeyWorkspaceIdAndNullUserIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "IndexOnKeyUserIdWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" DROP CONSTRAINT "IndexOnDomainAndWorkspaceId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" DROP CONSTRAINT "IndexOnKeyAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_KEY_VALUE_PAIR_KEY_USER_ID_NULL_WORKSPACE_ID_UNIQUE" ON "core"."keyValuePair" ("key", "userId") WHERE "workspaceId" is NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_KEY_VALUE_PAIR_KEY_WORKSPACE_ID_NULL_USER_ID_UNIQUE" ON "core"."keyValuePair" ("key", "workspaceId") WHERE "userId" is NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "IDX_KEY_VALUE_PAIR_KEY_USER_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("key", "userId", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" ADD CONSTRAINT "IDX_APPROVED_ACCESS_DOMAIN_DOMAIN_WORKSPACE_ID_UNIQUE" UNIQUE ("domain", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ADD CONSTRAINT "IDX_FEATURE_FLAG_KEY_WORKSPACE_ID_UNIQUE" UNIQUE ("key", "workspaceId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" DROP CONSTRAINT "IDX_FEATURE_FLAG_KEY_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" DROP CONSTRAINT "IDX_APPROVED_ACCESS_DOMAIN_DOMAIN_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" DROP CONSTRAINT "IDX_KEY_VALUE_PAIR_KEY_USER_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_KEY_VALUE_PAIR_KEY_WORKSPACE_ID_NULL_USER_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_KEY_VALUE_PAIR_KEY_USER_ID_NULL_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."featureFlag" ADD CONSTRAINT "IndexOnKeyAndWorkspaceIdUnique" UNIQUE ("key", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."approvedAccessDomain" ADD CONSTRAINT "IndexOnDomainAndWorkspaceId" UNIQUE ("domain", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."keyValuePair" ADD CONSTRAINT "IndexOnKeyUserIdWorkspaceIdUnique" UNIQUE ("userId", "workspaceId", "key")`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IndexOnKeyWorkspaceIdAndNullUserIdUnique" ON "core"."keyValuePair" ("workspaceId", "key") WHERE ("userId" IS NULL)`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IndexOnKeyUserIdAndNullWorkspaceIdUnique" ON "core"."keyValuePair" ("userId", "key") WHERE ("workspaceId" IS NULL)`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748849487789-fixCoreIndexes2.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748849487789-fixCoreIndexes2.ts
deleted file mode 100644
index 748d087c93f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748849487789-fixCoreIndexes2.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixCoreIndexes21748849487789 implements MigrationInterface {
- name = 'FixCoreIndexes21748849487789';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "IndexOnUserIdAndWorkspaceIdUnique"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("userId", "workspaceId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "IndexOnUserIdAndWorkspaceIdUnique" UNIQUE ("userId", "workspaceId")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748875812894-addDeletedAtToServerlessFunction.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748875812894-addDeletedAtToServerlessFunction.ts
deleted file mode 100644
index 0ca34ef520a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748875812894-addDeletedAtToServerlessFunction.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDeletedAtToServerlessFunction1748875812894
- implements MigrationInterface
-{
- name = 'AddDeletedAtToServerlessFunction1748875812894';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "deletedAt" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_SERVERLESS_FUNCTION_ID_DELETED_AT" ON "core"."serverlessFunction" ("id", "deletedAt") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_SERVERLESS_FUNCTION_ID_DELETED_AT"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "deletedAt"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748942397538-removeUselessServerlessFunctionColumn.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1748942397538-removeUselessServerlessFunctionColumn.ts
deleted file mode 100644
index 63e73932e14..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1748942397538-removeUselessServerlessFunctionColumn.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveUselessServerlessFunctionColumn1748942397538
- implements MigrationInterface
-{
- name = 'RemoveUselessServerlessFunctionColumn1748942397538';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" DROP COLUMN "syncStatus"`,
- );
-
- const metadataSchemaExists = await queryRunner.query(
- `SELECT 1 FROM information_schema.schemata WHERE schema_name = 'metadata';`,
- );
-
- if (metadataSchemaExists && metadataSchemaExists.length > 0) {
- const potentialTypeNameToMigrate = [
- 'dataSource_type_enum',
- 'indexMetadata_indextype_enum',
- 'relationMetadata_ondeleteaction_enum',
- 'serverlessFunction_syncstatus_enum',
- ] as const;
-
- for (const typeName of potentialTypeNameToMigrate) {
- const selectResult = await queryRunner.query(
- `SELECT true FROM pg_type WHERE typname = '${typeName}' AND typnamespace = 'metadata'::regnamespace`,
- );
- const typeNameExists = selectResult && selectResult.length > 0;
-
- if (!typeNameExists) {
- continue;
- }
-
- await queryRunner.query(
- `ALTER TYPE "metadata"."${typeName}" SET SCHEMA "core";`,
- );
- }
- }
- await queryRunner.query(
- `DROP TYPE "core"."serverlessFunction_syncstatus_enum"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."serverlessFunction_syncstatus_enum" AS ENUM('BUILDING', 'NOT_READY', 'READY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ADD "syncStatus" "core"."serverlessFunction_syncstatus_enum" NOT NULL DEFAULT 'NOT_READY'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1749000000000-rename-user-workspace-role-to-role-targets.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1749000000000-rename-user-workspace-role-to-role-targets.ts
deleted file mode 100644
index 4d979aba017..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1749000000000-rename-user-workspace-role-to-role-targets.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenameUserWorkspaceRoleToRoleTargets1749000000000
- implements MigrationInterface
-{
- name = 'RenameUserWorkspaceRoleToRoleTargets1749000000000';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD "agentId" uuid`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ALTER COLUMN "userWorkspaceId" DROP NOT NULL`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD CONSTRAINT "CHK_role_targets_either_agent_or_user" CHECK (((("agentId" IS NOT NULL) AND ("userWorkspaceId" IS NULL)) OR (("agentId" IS NULL) AND ("userWorkspaceId" IS NOT NULL))))`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" RENAME TO "roleTargets"`,
- );
-
- await queryRunner.query(
- `ALTER INDEX "core"."IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_ROLE_ID_UNIQUE" RENAME TO "IDX_ROLE_TARGETS_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER INDEX "core"."IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_WORKSPACE_ID" RENAME TO "IDX_ROLE_TARGETS_WORKSPACE_ID"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "FK_0b70755f23a3705f1bea0ddc7d4"`,
- );
-
- await queryRunner.query(
- `CREATE INDEX "IDX_ROLE_TARGETS_AGENT_ID" ON "core"."roleTargets" ("agentId")`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "FK_d5838ba43033ee6266d8928d7d7" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "FK_d5838ba43033ee6266d8928d7d7"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_ROLE_TARGETS_AGENT_ID"`);
-
- await queryRunner.query(
- `ALTER INDEX "core"."IDX_ROLE_TARGETS_UNIQUE" RENAME TO "IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_ROLE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER INDEX "core"."IDX_ROLE_TARGETS_WORKSPACE_ID" RENAME TO "IDX_USER_WORKSPACE_ROLE_USER_WORKSPACE_ID_WORKSPACE_ID"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" RENAME TO "userWorkspaceRole"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ADD CONSTRAINT "FK_0b70755f23a3705f1bea0ddc7d4" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" DROP CONSTRAINT "CHK_role_targets_either_agent_or_user"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" ALTER COLUMN "userWorkspaceId" SET NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspaceRole" DROP COLUMN "agentId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1749205425841-UpdateServerlessFunctionDefaultRuntimeToNode22.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1749205425841-UpdateServerlessFunctionDefaultRuntimeToNode22.ts
deleted file mode 100644
index da02af1c71c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1749205425841-UpdateServerlessFunctionDefaultRuntimeToNode22.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateServerlessFunctionDefaultRuntimeToNode221749205425841
- implements MigrationInterface
-{
- name = 'UpdateServerlessFunctionDefaultRuntimeToNode221749205425841';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- // Update the default value for the runtime column to nodejs22.x
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "runtime" SET DEFAULT 'nodejs22.x'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- // Revert the default value back to nodejs18.x
- await queryRunner.query(
- `ALTER TABLE "core"."serverlessFunction" ALTER COLUMN "runtime" SET DEFAULT 'nodejs18.x'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1750673748111-remove-relation-metadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1750673748111-remove-relation-metadata.ts
deleted file mode 100644
index fd48c3a6c7f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1750673748111-remove-relation-metadata.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveRelationMetadata1750673748111 implements MigrationInterface {
- name = 'RemoveRelationMetadata1750673748111';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_DATA_SOURCE_WORKSPACE_ID_CREATED_AT" ON "core"."dataSource" ("workspaceId", "createdAt") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT IF EXISTS "FK_9dea8f90d04edbbf9c541a95c3b"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT IF EXISTS "FK_3deb257254145a3bdde9575e7d6"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT IF EXISTS "FK_0f781f589e5a527b8f3d3a4b824"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."relationMetadata" DROP CONSTRAINT IF EXISTS "FK_f2a0acd3a548ee446a1a35df44d"`,
- );
- await queryRunner.query(`DROP TABLE IF EXISTS "core"."relationMetadata"`);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_DATA_SOURCE_WORKSPACE_ID_CREATED_AT"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751467467020-AddAgentChatMessageAndThreadTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751467467020-AddAgentChatMessageAndThreadTable.ts
deleted file mode 100644
index 18dfbe3c2a6..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751467467020-AddAgentChatMessageAndThreadTable.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddAgentChatMessageAndThreadTable1751467467020
- implements MigrationInterface
-{
- name = 'AddAgentChatMessageAndThreadTable1751467467020';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."agentChatMessage_role_enum" AS ENUM('user', 'assistant')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."agentChatMessage" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "threadId" uuid NOT NULL, "role" "core"."agentChatMessage_role_enum" NOT NULL, "content" text NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f54a95b34e98d94251bce37a180" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_cd5b23d4e471b630137b3017ba" ON "core"."agentChatMessage" ("threadId") `,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."agentChatThread" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "agentId" uuid NOT NULL, "userWorkspaceId" uuid NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_a53b1d75d11ec67d13590cfa627" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_d0bdc80c68a48b1f26727aabfe" ON "core"."agentChatThread" ("agentId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_3bd935d6f8c5ce87194b8db824" ON "core"."agentChatThread" ("userWorkspaceId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatMessage" ADD CONSTRAINT "FK_cd5b23d4e471b630137b3017ba6" FOREIGN KEY ("threadId") REFERENCES "core"."agentChatThread"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" ADD CONSTRAINT "FK_d0bdc80c68a48b1f26727aabfe6" FOREIGN KEY ("agentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" ADD CONSTRAINT "FK_3bd935d6f8c5ce87194b8db8240" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" DROP CONSTRAINT "FK_3bd935d6f8c5ce87194b8db8240"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" DROP CONSTRAINT "FK_d0bdc80c68a48b1f26727aabfe6"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatMessage" DROP CONSTRAINT "FK_cd5b23d4e471b630137b3017ba6"`,
- );
- await queryRunner.query(`DROP TABLE "core"."agentChatThread"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_cd5b23d4e471b630137b3017ba"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_d0bdc80c68a48b1f26727aabfe"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_3bd935d6f8c5ce87194b8db824"`,
- );
- await queryRunner.query(`DROP TABLE "core"."agentChatMessage"`);
- await queryRunner.query(`DROP TYPE "core"."agentChatMessage_role_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751558024634-morph-index-update.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751558024634-morph-index-update.ts
deleted file mode 100644
index 2017e9ad593..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751558024634-morph-index-update.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MorphIndexUpdate1751558024634 implements MigrationInterface {
- name = 'MorphIndexUpdate1751558024634';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "IDX_FIELD_METADATA_NAME_OBJECT_METADATA_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_FIELD_METADATA_NAME_OBJMID_WORKSPACE_ID_EXCEPT_MORPH_UNIQUE" ON "core"."fieldMetadata" ("name", "objectMetadataId", "workspaceId") WHERE "type" <> 'MORPH_RELATION'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_NAME_OBJMID_WORKSPACE_ID_EXCEPT_MORPH_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "IDX_FIELD_METADATA_NAME_OBJECT_METADATA_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("name", "objectMetadataId", "workspaceId")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751690946522-add-api-keys-and-webhook-to-core.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751690946522-add-api-keys-and-webhook-to-core.ts
deleted file mode 100644
index 4c62e1a5083..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751690946522-add-api-keys-and-webhook-to-core.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddApiKeysAndWebhookToCore1751690946522
- implements MigrationInterface
-{
- name = 'AddApiKeysAndWebhookToCore1751690946522';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."apiKey" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "revokedAt" TIMESTAMP WITH TIME ZONE, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_2ae3a5e8e04fb402b2dc8d6ce4b" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_API_KEY_WORKSPACE_ID" ON "core"."apiKey" ("workspaceId") `,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."webhook" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "targetUrl" character varying NOT NULL, "operations" text array NOT NULL DEFAULT '{*.*}', "description" character varying, "secret" character varying NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_e6765510c2d078db49632b59020" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_WEBHOOK_WORKSPACE_ID" ON "core"."webhook" ("workspaceId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."apiKey" ADD CONSTRAINT "FK_c8b3efa54a29aa873043e72fb1d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."webhook" ADD CONSTRAINT "FK_597ab5e7de76f1836b8fd80d6b9" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."webhook" DROP CONSTRAINT "FK_597ab5e7de76f1836b8fd80d6b9"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."apiKey" DROP CONSTRAINT "FK_c8b3efa54a29aa873043e72fb1d"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_WEBHOOK_WORKSPACE_ID"`);
- await queryRunner.query(`DROP TABLE "core"."webhook"`);
- await queryRunner.query(`DROP INDEX "core"."IDX_API_KEY_WORKSPACE_ID"`);
- await queryRunner.query(`DROP TABLE "core"."apiKey"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751700932529-add-locale-to-user-workspace.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751700932529-add-locale-to-user-workspace.ts
deleted file mode 100644
index 454e9635f48..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751700932529-add-locale-to-user-workspace.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddLocaleToUserWorkspace1751700932529
- implements MigrationInterface
-{
- name = 'AddLocaleToUserWorkspace1751700932529';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD "locale" character varying NOT NULL DEFAULT 'en'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP COLUMN "locale"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751890088507-addIndexOnObjectPermission.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751890088507-addIndexOnObjectPermission.ts
deleted file mode 100644
index 8b4e0efc85c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751890088507-addIndexOnObjectPermission.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIndexOnObjectPermission1751890088507
- implements MigrationInterface
-{
- name = 'AddIndexOnObjectPermission1751890088507';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_OBJECT_PERMISSION_WORKSPACE_ID_ROLE_ID" ON "core"."objectPermission" ("workspaceId", "roleId") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_OBJECT_PERMISSION_WORKSPACE_ID_ROLE_ID"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751993324990-addFieldPermission.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1751993324990-addFieldPermission.ts
deleted file mode 100644
index 38934c58f14..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1751993324990-addFieldPermission.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddFieldPermission1751993324990 implements MigrationInterface {
- name = 'AddFieldPermission1751993324990';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."fieldPermission" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "roleId" uuid NOT NULL, "objectMetadataId" uuid NOT NULL, "fieldMetadataId" uuid NOT NULL, "canReadFieldValue" boolean, "canUpdateFieldValue" boolean, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "IDX_FIELD_PERMISSION_FIELD_METADATA_ID_ROLE_ID_UNIQUE" UNIQUE ("fieldMetadataId", "roleId"), CONSTRAINT "PK_d7bb911e4f9b1b5e3bfcfdd1c4b" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FIELD_PERMISSION_WORKSPACE_ID_ROLE_ID" ON "core"."fieldPermission" ("workspaceId", "roleId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_bbf16a91f5a10199e5b18c019ba" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_dc8e552397f5e44d175fedf752a" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_d5c47a26fe71648894d05da3d3a" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" ADD CONSTRAINT "FK_2763aee5614b54019d692333fe1" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_2763aee5614b54019d692333fe1"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_d5c47a26fe71648894d05da3d3a"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_dc8e552397f5e44d175fedf752a"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldPermission" DROP CONSTRAINT "FK_bbf16a91f5a10199e5b18c019ba"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_PERMISSION_WORKSPACE_ID_ROLE_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."fieldPermission"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752070094777-add-default-agent-id.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752070094777-add-default-agent-id.ts
deleted file mode 100644
index eceb60bd43b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752070094777-add-default-agent-id.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDefaultAgentId1752070094777 implements MigrationInterface {
- name = 'AddDefaultAgentId1752070094777';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "defaultAgentId" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ALTER COLUMN "modelId" SET DEFAULT 'auto'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ALTER COLUMN "modelId" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "defaultAgentId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752088464449-agent-as-standard-metadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752088464449-agent-as-standard-metadata.ts
deleted file mode 100644
index 36453ea25fc..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752088464449-agent-as-standard-metadata.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AgentAsStandardMetadata1752088464449
- implements MigrationInterface
-{
- name = 'AgentAsStandardMetadata1752088464449';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD "label" character varying NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD "icon" character varying`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD "isCustom" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD CONSTRAINT "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE" UNIQUE ("name", "workspaceId")`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agent" DROP CONSTRAINT "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" DROP COLUMN "isCustom"`,
- );
- await queryRunner.query(`ALTER TABLE "core"."agent" DROP COLUMN "icon"`);
- await queryRunner.query(`ALTER TABLE "core"."agent" DROP COLUMN "label"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752170600000-drop-two-factor-method.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752170600000-drop-two-factor-method.ts
deleted file mode 100644
index c45e5819278..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752170600000-drop-two-factor-method.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class DropOldTwoFactorMethodTable1752170600000
- implements MigrationInterface
-{
- name = 'DropOldTwoFactorMethodTable1752170600000';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorMethod" DROP CONSTRAINT "FK_c1044145be65a4ee65c07e0a658"`,
- );
- await queryRunner.query(`DROP TABLE "core"."twoFactorMethod"`);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."twoFactorMethod" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userWorkspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_752f0250dd6824289ceddd8b054" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorMethod" ADD CONSTRAINT "FK_c1044145be65a4ee65c07e0a658" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752207396042-create-file-table.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752207396042-create-file-table.ts
deleted file mode 100644
index 806d6973906..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752207396042-create-file-table.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateFileTable1752207396042 implements MigrationInterface {
- name = 'CreateFileTable1752207396042';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."file" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "fullPath" character varying NOT NULL, "size" bigint NOT NULL, "type" character varying NOT NULL, "workspaceId" uuid NOT NULL, "messageId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_36b46d232307066b3a2c9ea3a1d" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_FILE_WORKSPACE_ID" ON "core"."file" ("workspaceId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."file" ADD CONSTRAINT "FK_de468b3d8dcf7e94f7074220929" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."file" ADD CONSTRAINT "FK_a78a68c3f577a485dd4c741909f" FOREIGN KEY ("messageId") REFERENCES "core"."agentChatMessage"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."file" DROP CONSTRAINT "FK_a78a68c3f577a485dd4c741909f"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."file" DROP CONSTRAINT "FK_de468b3d8dcf7e94f7074220929"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_FILE_WORKSPACE_ID"`);
- await queryRunner.query(`DROP TABLE "core"."file"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752543000368-add-title-to-agent-chat-thread.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752543000368-add-title-to-agent-chat-thread.ts
deleted file mode 100644
index 598a7ea112a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752543000368-add-title-to-agent-chat-thread.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddTitleToAgentChatThread1752543000368
- implements MigrationInterface
-{
- name = 'AddTitleToAgentChatThread1752543000368';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" ADD "title" character varying`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agentChatThread" DROP COLUMN "title"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752839063082-two-factor-authentication.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752839063082-two-factor-authentication.ts
deleted file mode 100644
index baeafe23ec8..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752839063082-two-factor-authentication.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class TwoFactorAuthentication1752839063082
- implements MigrationInterface
-{
- name = 'TwoFactorAuthentication1752839063082';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."twoFactorAuthenticationMethod_strategy_enum" AS ENUM('TOTP')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."twoFactorAuthenticationMethod_status_enum" AS ENUM('PENDING', 'VERIFIED')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."twoFactorAuthenticationMethod" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userWorkspaceId" uuid NOT NULL, "secret" text NOT NULL, "status" "core"."twoFactorAuthenticationMethod_status_enum" NOT NULL, "strategy" "core"."twoFactorAuthenticationMethod_strategy_enum" NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_c455f6a499e7110fc95e4bea540" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_2909f5139c479e4632df03fd5e" ON "core"."twoFactorAuthenticationMethod" ("userWorkspaceId", "strategy") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" ADD "isTwoFactorAuthenticationEnforced" boolean NOT NULL DEFAULT false`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorAuthenticationMethod" ADD CONSTRAINT "FK_b0f44ffd7c794beb48cb1e1b1a9" FOREIGN KEY ("userWorkspaceId") REFERENCES "core"."userWorkspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."twoFactorAuthenticationMethod" DROP CONSTRAINT "FK_b0f44ffd7c794beb48cb1e1b1a9"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."workspace" DROP COLUMN "isTwoFactorAuthenticationEnforced"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_2909f5139c479e4632df03fd5e"`,
- );
- await queryRunner.query(
- `DROP TABLE "core"."twoFactorAuthenticationMethod"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."twoFactorAuthenticationMethod_status_enum"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."twoFactorAuthenticationMethod_strategy_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752993324991-makeFieldMetadataRelationConstraintDeferrable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1752993324991-makeFieldMetadataRelationConstraintDeferrable.ts
deleted file mode 100644
index cbf57252e57..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1752993324991-makeFieldMetadataRelationConstraintDeferrable.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MakeFieldMetadataRelationConstraintDeferrable1752993324991
- implements MigrationInterface
-{
- name = 'MakeFieldMetadataRelationConstraintDeferrable1752993324991';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- // Drop the existing constraint
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_47a6c57e1652b6475f8248cff78"`,
- );
-
- // Recreate it as deferrable and initially deferred
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_47a6c57e1652b6475f8248cff78" FOREIGN KEY ("relationTargetFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") DEFERRABLE INITIALLY DEFERRED`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- // Drop the deferrable constraint
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "FK_47a6c57e1652b6475f8248cff78"`,
- );
-
- // Recreate it as non-deferrable
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "FK_47a6c57e1652b6475f8248cff78" FOREIGN KEY ("relationTargetFieldMetadataId") REFERENCES "core"."fieldMetadata"("id")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753089620981-add-apikeyId-to-role-targets.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753089620981-add-apikeyId-to-role-targets.ts
deleted file mode 100644
index e4cefec3b0b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753089620981-add-apikeyId-to-role-targets.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddApikeyIdToRoleTargets1753089620981
- implements MigrationInterface
-{
- name = 'AddApikeyIdToRoleTargets1753089620981';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "CHK_role_targets_either_agent_or_user"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" ADD "apiKeyId" uuid`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_ROLE_TARGETS_API_KEY_ID" ON "core"."roleTargets" ("apiKeyId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "CHK_role_targets_single_entity" CHECK (("agentId" IS NOT NULL AND "userWorkspaceId" IS NULL AND "apiKeyId" IS NULL) OR ("agentId" IS NULL AND "userWorkspaceId" IS NOT NULL AND "apiKeyId" IS NULL) OR ("agentId" IS NULL AND "userWorkspaceId" IS NULL AND "apiKeyId" IS NOT NULL))`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "FK_915c8bcb0f861a56f793a4b8331" FOREIGN KEY ("apiKeyId") REFERENCES "core"."apiKey"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "FK_915c8bcb0f861a56f793a4b8331"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP CONSTRAINT "CHK_role_targets_single_entity"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_ROLE_TARGETS_API_KEY_ID"`);
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" DROP COLUMN "apiKeyId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."roleTargets" ADD CONSTRAINT "CHK_role_targets_either_agent_or_user" CHECK (((("agentId" IS NOT NULL) AND ("userWorkspaceId" IS NULL)) OR (("agentId" IS NULL) AND ("userWorkspaceId" IS NOT NULL))))`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753104458798-createViewTablesInCoreSchema.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753104458798-createViewTablesInCoreSchema.ts
deleted file mode 100644
index f9c74cb7fca..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753104458798-createViewTablesInCoreSchema.ts
+++ /dev/null
@@ -1,171 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateViewTablesInCoreSchema1753104458798
- implements MigrationInterface
-{
- name = 'CreateViewTablesInCoreSchema1753104458798';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."viewField_aggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."viewField" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "isVisible" boolean NOT NULL DEFAULT true, "size" integer NOT NULL DEFAULT '0', "position" integer NOT NULL DEFAULT '0', "aggregateOperation" "core"."viewField_aggregateoperation_enum", "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE" UNIQUE ("fieldMetadataId", "viewId"), CONSTRAINT "PK_ba2a5aa5f0bd7ac82788fae921e" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FIELD_WORKSPACE_ID_VIEW_ID" ON "core"."viewField" ("workspaceId", "viewId") `,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewFilterGroup_logicaloperator_enum" AS ENUM('AND', 'OR', 'NOT')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."viewFilterGroup" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "parentViewFilterGroupId" uuid, "logicalOperator" "core"."viewFilterGroup_logicaloperator_enum" NOT NULL DEFAULT 'NOT', "positionInViewFilterGroup" integer, "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_16f55359d609168b826405ed307" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FILTER_GROUP_WORKSPACE_ID_VIEW_ID" ON "core"."viewFilterGroup" ("workspaceId", "viewId") `,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."viewFilter" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "operand" character varying NOT NULL DEFAULT 'Contains', "value" jsonb NOT NULL, "viewFilterGroupId" uuid, "positionInViewFilterGroup" integer, "subFieldName" text, "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_09f9ffa2f66263b9eb301460137" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FILTER_FIELD_METADATA_ID" ON "core"."viewFilter" ("fieldMetadataId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FILTER_WORKSPACE_ID_VIEW_ID" ON "core"."viewFilter" ("workspaceId", "viewId") `,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."viewGroup" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "isVisible" boolean NOT NULL DEFAULT true, "fieldValue" text NOT NULL, "position" integer NOT NULL DEFAULT '0', "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_d2aa8cad01e9d5e99c23f9ccec3" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_GROUP_WORKSPACE_ID_VIEW_ID" ON "core"."viewGroup" ("workspaceId", "viewId") `,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewSort_direction_enum" AS ENUM('ASC', 'DESC')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."viewSort" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fieldMetadataId" uuid NOT NULL, "direction" "core"."viewSort_direction_enum" NOT NULL DEFAULT 'ASC', "viewId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE" UNIQUE ("fieldMetadataId", "viewId"), CONSTRAINT "PK_eceb74d297f926313af6463d496" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_SORT_WORKSPACE_ID_VIEW_ID" ON "core"."viewSort" ("workspaceId", "viewId") `,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_openrecordin_enum" AS ENUM('SIDE_PANEL', 'RECORD_PAGE')`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_kanbanaggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."view" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" text NOT NULL DEFAULT '', "objectMetadataId" uuid NOT NULL, "type" character varying NOT NULL DEFAULT 'table', "key" text DEFAULT 'INDEX', "icon" text NOT NULL, "position" integer NOT NULL DEFAULT '0', "isCompact" boolean NOT NULL DEFAULT false, "openRecordIn" "core"."view_openrecordin_enum" NOT NULL DEFAULT 'SIDE_PANEL', "kanbanAggregateOperation" "core"."view_kanbanaggregateoperation_enum", "kanbanAggregateOperationFieldMetadataId" uuid, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_86cfb9e426c77d60b900fe2b543" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."view" ("workspaceId", "objectMetadataId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_96158de54c78944b5340b6f708e" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_c5ab40cd4debb51d588752a4857" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_dce74ab06fa7a2effcbf1b98dff" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_8919a390f4022ab1e40182a5ac3" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_32cabc67e40d24acab541c469a8" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_06858adf0fb54ec88fa602198ca" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_61053f5509cc31e5d7139fba1cb" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_2d7cfc4748058a0ca648835d046" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_5f3278d6791aa4c58423e556ae6" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_2b36c6adea4542b4844d9fb1806" FOREIGN KEY ("viewId") REFERENCES "core"."view"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD CONSTRAINT "FK_580dad12c8b92f3a3c307c4e66d" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."view" DROP CONSTRAINT "FK_580dad12c8b92f3a3c307c4e66d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_2b36c6adea4542b4844d9fb1806"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_5f3278d6791aa4c58423e556ae6"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_2d7cfc4748058a0ca648835d046"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_61053f5509cc31e5d7139fba1cb"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_06858adf0fb54ec88fa602198ca"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_32cabc67e40d24acab541c469a8"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_8919a390f4022ab1e40182a5ac3"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_dce74ab06fa7a2effcbf1b98dff"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_c5ab40cd4debb51d588752a4857"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_96158de54c78944b5340b6f708e"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_WORKSPACE_ID_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."view"`);
- await queryRunner.query(
- `DROP TYPE "core"."view_kanbanaggregateoperation_enum"`,
- );
- await queryRunner.query(`DROP TYPE "core"."view_openrecordin_enum"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_SORT_WORKSPACE_ID_VIEW_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."viewSort"`);
- await queryRunner.query(`DROP TYPE "core"."viewSort_direction_enum"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_GROUP_WORKSPACE_ID_VIEW_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."viewGroup"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FILTER_WORKSPACE_ID_VIEW_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FILTER_FIELD_METADATA_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."viewFilter"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FILTER_GROUP_WORKSPACE_ID_VIEW_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."viewFilterGroup"`);
- await queryRunner.query(
- `DROP TYPE "core"."viewFilterGroup_logicaloperator_enum"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FIELD_WORKSPACE_ID_VIEW_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."viewField"`);
- await queryRunner.query(
- `DROP TYPE "core"."viewField_aggregateoperation_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753149175945-renameSettingPermissionToPermissionFlag.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753149175945-renameSettingPermissionToPermissionFlag.ts
deleted file mode 100644
index 3aa75117674..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753149175945-renameSettingPermissionToPermissionFlag.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenameSettingPermissionToPermissionFlag1753149175945
- implements MigrationInterface
-{
- name = 'RenameSettingPermissionToPermissionFlag1753149175945';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."settingPermission" RENAME TO "permissionFlag"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" RENAME COLUMN "setting" TO "flag"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" RENAME CONSTRAINT "IDX_SETTING_PERMISSION_SETTING_ROLE_ID_UNIQUE" TO "IDX_PERMISSION_FLAG_FLAG_ROLE_ID_UNIQUE"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" DROP CONSTRAINT "FK_b327aadd9fd189f33d2c5237833"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" ADD CONSTRAINT "FK_13f8ca9c517976733a1ce4c10eb" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" RENAME COLUMN "flag" TO "setting"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" RENAME TO "settingPermission"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" DROP CONSTRAINT "FK_13f8ca9c517976733a1ce4c10eb"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."permissionFlag" ADD CONSTRAINT "FK_b327aadd9fd189f33d2c5237833" FOREIGN KEY ("roleId") REFERENCES "core"."role"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977613-AddCanAccessAllToolsColumnToRole.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977613-AddCanAccessAllToolsColumnToRole.ts
deleted file mode 100644
index 14bd9951261..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977613-AddCanAccessAllToolsColumnToRole.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddCanAccessAllToolsColumnToRole1753318977613
- implements MigrationInterface
-{
- name = 'AddCanAccessAllToolsColumnToRole1753318977613';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canAccessAllTools" boolean NOT NULL DEFAULT false`,
- );
-
- await queryRunner.query(
- `UPDATE "core"."role" SET "canAccessAllTools" = true WHERE "label" = 'Admin'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canAccessAllTools"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977614-update-member-role-can-access-all-tools.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977614-update-member-role-can-access-all-tools.ts
deleted file mode 100644
index a383cb9bc04..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753318977614-update-member-role-can-access-all-tools.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateMemberRoleCanAccessAllTools1753318977614
- implements MigrationInterface
-{
- name = 'UpdateMemberRoleCanAccessAllTools1753318977614';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `UPDATE "core"."role" SET "canAccessAllTools" = true WHERE "label" = 'Member'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `UPDATE "core"."role" SET "canAccessAllTools" = false WHERE "label" = 'Member'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753349164408-createAnyFieldFilterValueColumnOnView.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753349164408-createAnyFieldFilterValueColumnOnView.ts
deleted file mode 100644
index 0829a686648..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753349164408-createAnyFieldFilterValueColumnOnView.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreateAnyFieldFilterValueColumnOnView1753349164408
- implements MigrationInterface
-{
- name = 'CreateAnyFieldFilterValueColumnOnView1753349164408';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "anyFieldFilterValue" text`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."view" DROP COLUMN "anyFieldFilterValue"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753709914396-AddAgentHandoffTable.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1753709914396-AddAgentHandoffTable.ts
deleted file mode 100644
index 04173d75052..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1753709914396-AddAgentHandoffTable.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddAgentHandoffTable1753709914396 implements MigrationInterface {
- name = 'AddAgentHandoffTable1753709914396';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."agentHandoff" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "fromAgentId" uuid NOT NULL, "toAgentId" uuid NOT NULL, "workspaceId" uuid NOT NULL, "description" text, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_44aad35fb18ea2696f242d3fd76" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_AGENT_HANDOFF_FROM_TO_WORKSPACE_UNIQUE" ON "core"."agentHandoff" ("fromAgentId", "toAgentId", "workspaceId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_AGENT_HANDOFF_ID_DELETED_AT" ON "core"."agentHandoff" ("id", "deletedAt") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_7128daa5ac9f787388391b52269" FOREIGN KEY ("fromAgentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_020114432e51baf65bbbc46e350" FOREIGN KEY ("toAgentId") REFERENCES "core"."agent"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" ADD CONSTRAINT "FK_7ea2d1182dc5324e7cef9903302" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_7ea2d1182dc5324e7cef9903302"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_020114432e51baf65bbbc46e350"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agentHandoff" DROP CONSTRAINT "FK_7128daa5ac9f787388391b52269"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_AGENT_HANDOFF_ID_DELETED_AT"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_AGENT_HANDOFF_FROM_TO_WORKSPACE_UNIQUE"`,
- );
- await queryRunner.query(`DROP TABLE "core"."agentHandoff"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754043158752-AddWorkspaceActivationStatusIndex.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754043158752-AddWorkspaceActivationStatusIndex.ts
deleted file mode 100644
index 7b68067ff95..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754043158752-AddWorkspaceActivationStatusIndex.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceActivationStatusIndex1754043158752
- implements MigrationInterface
-{
- name = 'AddWorkspaceActivationStatusIndex1754043158752';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_WORKSPACE_ACTIVATION_STATUS" ON "core"."workspace" ("activationStatus") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_WORKSPACE_ACTIVATION_STATUS"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754371805617-fixSoftDeleteUniqueConstraints.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754371805617-fixSoftDeleteUniqueConstraints.ts
deleted file mode 100644
index e4ef8cd55c2..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754371805617-fixSoftDeleteUniqueConstraints.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class FixSoftDeleteUniqueConstraints1754371805617
- implements MigrationInterface
-{
- name = 'FixSoftDeleteUniqueConstraints1754371805617';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" DROP CONSTRAINT "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" DROP CONSTRAINT "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" DROP CONSTRAINT "IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE" ON "core"."userWorkspace" ("userId", "workspaceId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE" ON "core"."agent" ("name", "workspaceId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE" ON "core"."viewField" ("fieldMetadataId", "viewId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE" ON "core"."viewSort" ("fieldMetadataId", "viewId") WHERE "deletedAt" IS NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "IDX_VIEW_SORT_FIELD_METADATA_ID_VIEW_ID_UNIQUE" UNIQUE ("fieldMetadataId", "viewId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ADD CONSTRAINT "IDX_VIEW_FIELD_FIELD_METADATA_ID_VIEW_ID_UNIQUE" UNIQUE ("fieldMetadataId", "viewId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."agent" ADD CONSTRAINT "IDX_AGENT_NAME_WORKSPACE_ID_UNIQUE" UNIQUE ("name", "workspaceId")`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."userWorkspace" ADD CONSTRAINT "IDX_USER_WORKSPACE_USER_ID_WORKSPACE_ID_UNIQUE" UNIQUE ("userId", "workspaceId")`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754480368129-addStandardIdToRole.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754480368129-addStandardIdToRole.ts
deleted file mode 100644
index 727682a29fe..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754480368129-addStandardIdToRole.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-import { ADMIN_ROLE } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-roles/roles/admin-role';
-
-export class AddStandardIdToRole1754480368129 implements MigrationInterface {
- name = 'AddStandardIdToRole1754480368129';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."role" ADD "standardId" uuid`);
-
- await queryRunner.query(
- `UPDATE "core"."role" SET "standardId" = '${ADMIN_ROLE.standardId}' WHERE "label" = 'Admin'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`UPDATE "core"."role" SET "standardId" = NULL`);
-
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "standardId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754578392938-updateCoreViewDataModel.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754578392938-updateCoreViewDataModel.ts
deleted file mode 100644
index 1678eaa16ed..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754578392938-updateCoreViewDataModel.ts
+++ /dev/null
@@ -1,197 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateCoreViewDataModel1754578392938
- implements MigrationInterface
-{
- name = 'UpdateCoreViewDataModel1754578392938';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TYPE "core"."viewField_aggregateoperation_enum" RENAME TO "viewField_aggregateoperation_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."AggregateOperations" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "aggregateOperation" TYPE "core"."AggregateOperations" USING "aggregateOperation"::"text"::"core"."AggregateOperations"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."viewField_aggregateoperation_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP COLUMN "operand"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewFilterOperand" AS ENUM('IS', 'IS_NOT_NULL', 'IS_NOT', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN_OR_EQUAL', 'IS_BEFORE', 'IS_AFTER', 'CONTAINS', 'DOES_NOT_CONTAIN', 'IS_EMPTY', 'IS_NOT_EMPTY', 'IS_RELATIVE', 'IS_IN_PAST', 'IS_IN_FUTURE', 'IS_TODAY', 'VECTOR_SEARCH')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD "operand" "core"."ViewFilterOperand" NOT NULL DEFAULT 'CONTAINS'`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."viewFilterGroup_logicaloperator_enum" RENAME TO "viewFilterGroup_logicaloperator_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewFilterGroupLogicalOperator" AS ENUM('AND', 'OR', 'NOT')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" TYPE "core"."ViewFilterGroupLogicalOperator" USING "logicalOperator"::"text"::"core"."ViewFilterGroupLogicalOperator"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" SET DEFAULT 'NOT'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."viewFilterGroup_logicaloperator_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."viewSort_direction_enum" RENAME TO "viewSort_direction_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewSortDirection" AS ENUM('ASC', 'DESC')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" TYPE "core"."ViewSortDirection" USING "direction"::"text"::"core"."ViewSortDirection"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" SET DEFAULT 'ASC'`,
- );
- await queryRunner.query(`DROP TYPE "core"."viewSort_direction_enum_old"`);
- await queryRunner.query(`ALTER TABLE "core"."view" DROP COLUMN "type"`);
- await queryRunner.query(
- `CREATE TYPE "core"."ViewType" AS ENUM('TABLE', 'KANBAN')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "type" "core"."ViewType" NOT NULL DEFAULT 'TABLE'`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."view_openrecordin_enum" RENAME TO "view_openrecordin_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewOpenRecordIn" AS ENUM('SIDE_PANEL', 'RECORD_PAGE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" TYPE "core"."ViewOpenRecordIn" USING "openRecordIn"::"text"::"core"."ViewOpenRecordIn"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" SET DEFAULT 'SIDE_PANEL'`,
- );
- await queryRunner.query(`DROP TYPE "core"."view_openrecordin_enum_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."view_kanbanaggregateoperation_enum" RENAME TO "view_kanbanaggregateoperation_enum_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."KanbanAggregateOperations" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "kanbanAggregateOperation" TYPE "core"."KanbanAggregateOperations" USING "kanbanAggregateOperation"::"text"::"core"."KanbanAggregateOperations"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."view_kanbanaggregateoperation_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_b518bd61175e0963370e09ef15e" FOREIGN KEY ("viewFilterGroupId") REFERENCES "core"."viewFilterGroup"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ADD CONSTRAINT "FK_6aa17342705ae5526de377bf7ed" FOREIGN KEY ("parentViewFilterGroupId") REFERENCES "core"."viewFilterGroup"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" DROP CONSTRAINT "FK_6aa17342705ae5526de377bf7ed"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_b518bd61175e0963370e09ef15e"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_kanbanaggregateoperation_enum_old" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "kanbanAggregateOperation" TYPE "core"."view_kanbanaggregateoperation_enum_old" USING "kanbanAggregateOperation"::"text"::"core"."view_kanbanaggregateoperation_enum_old"`,
- );
- await queryRunner.query(`DROP TYPE "core"."KanbanAggregateOperations"`);
- await queryRunner.query(
- `ALTER TYPE "core"."view_kanbanaggregateoperation_enum_old" RENAME TO "view_kanbanaggregateoperation_enum"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_openrecordin_enum_old" AS ENUM('SIDE_PANEL', 'RECORD_PAGE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" TYPE "core"."view_openrecordin_enum_old" USING "openRecordIn"::"text"::"core"."view_openrecordin_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" SET DEFAULT 'SIDE_PANEL'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewOpenRecordIn"`);
- await queryRunner.query(
- `ALTER TYPE "core"."view_openrecordin_enum_old" RENAME TO "view_openrecordin_enum"`,
- );
- await queryRunner.query(`ALTER TABLE "core"."view" DROP COLUMN "type"`);
- await queryRunner.query(`DROP TYPE "core"."ViewType"`);
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "type" character varying NOT NULL DEFAULT 'table'`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewSort_direction_enum_old" AS ENUM('ASC', 'DESC')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" TYPE "core"."viewSort_direction_enum_old" USING "direction"::"text"::"core"."viewSort_direction_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" SET DEFAULT 'ASC'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewSortDirection"`);
- await queryRunner.query(
- `ALTER TYPE "core"."viewSort_direction_enum_old" RENAME TO "viewSort_direction_enum"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewFilterGroup_logicaloperator_enum_old" AS ENUM('AND', 'OR', 'NOT')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" TYPE "core"."viewFilterGroup_logicaloperator_enum_old" USING "logicalOperator"::"text"::"core"."viewFilterGroup_logicaloperator_enum_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" SET DEFAULT 'NOT'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."ViewFilterGroupLogicalOperator"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."viewFilterGroup_logicaloperator_enum_old" RENAME TO "viewFilterGroup_logicaloperator_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP COLUMN "operand"`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewFilterOperand"`);
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD "operand" character varying NOT NULL DEFAULT 'Contains'`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewField_aggregateoperation_enum_old" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "aggregateOperation" TYPE "core"."viewField_aggregateoperation_enum_old" USING "aggregateOperation"::"text"::"core"."viewField_aggregateoperation_enum_old"`,
- );
- await queryRunner.query(`DROP TYPE "core"."AggregateOperations"`);
- await queryRunner.query(
- `ALTER TYPE "core"."viewField_aggregateoperation_enum_old" RENAME TO "viewField_aggregateoperation_enum"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754904779527-renameCoreViewEnums.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754904779527-renameCoreViewEnums.ts
deleted file mode 100644
index 671722dc4b7..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754904779527-renameCoreViewEnums.ts
+++ /dev/null
@@ -1,219 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RenameCoreViewEnums1754904779527 implements MigrationInterface {
- name = 'RenameCoreViewEnums1754904779527';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TYPE "core"."AggregateOperations" RENAME TO "AggregateOperations_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewField_aggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "aggregateOperation" TYPE "core"."viewField_aggregateoperation_enum" USING "aggregateOperation"::"text"::"core"."viewField_aggregateoperation_enum"`,
- );
- await queryRunner.query(`DROP TYPE "core"."AggregateOperations_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewFilterOperand" RENAME TO "ViewFilterOperand_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewFilter_operand_enum" AS ENUM('IS', 'IS_NOT_NULL', 'IS_NOT', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN_OR_EQUAL', 'IS_BEFORE', 'IS_AFTER', 'CONTAINS', 'DOES_NOT_CONTAIN', 'IS_EMPTY', 'IS_NOT_EMPTY', 'IS_RELATIVE', 'IS_IN_PAST', 'IS_IN_FUTURE', 'IS_TODAY', 'VECTOR_SEARCH')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" TYPE "core"."viewFilter_operand_enum" USING "operand"::"text"::"core"."viewFilter_operand_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" SET DEFAULT 'CONTAINS'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewFilterOperand_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewFilterGroupLogicalOperator" RENAME TO "ViewFilterGroupLogicalOperator_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewFilterGroup_logicaloperator_enum" AS ENUM('AND', 'OR', 'NOT')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" TYPE "core"."viewFilterGroup_logicaloperator_enum" USING "logicalOperator"::"text"::"core"."viewFilterGroup_logicaloperator_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" SET DEFAULT 'AND'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."ViewFilterGroupLogicalOperator_old"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."ViewSortDirection" RENAME TO "ViewSortDirection_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."viewSort_direction_enum" AS ENUM('ASC', 'DESC')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" TYPE "core"."viewSort_direction_enum" USING "direction"::"text"::"core"."viewSort_direction_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" SET DEFAULT 'ASC'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewSortDirection_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewType" RENAME TO "ViewType_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_type_enum" AS ENUM('TABLE', 'KANBAN')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" TYPE "core"."view_type_enum" USING "type"::"text"::"core"."view_type_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" SET DEFAULT 'TABLE'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewType_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewOpenRecordIn" RENAME TO "ViewOpenRecordIn_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_openrecordin_enum" AS ENUM('SIDE_PANEL', 'RECORD_PAGE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" TYPE "core"."view_openrecordin_enum" USING "openRecordIn"::"text"::"core"."view_openrecordin_enum"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" SET DEFAULT 'SIDE_PANEL'`,
- );
- await queryRunner.query(`DROP TYPE "core"."ViewOpenRecordIn_old"`);
- await queryRunner.query(
- `ALTER TYPE "core"."KanbanAggregateOperations" RENAME TO "KanbanAggregateOperations_old"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."view_kanbanaggregateoperation_enum" AS ENUM('MIN', 'MAX', 'AVG', 'SUM', 'COUNT', 'COUNT_UNIQUE_VALUES', 'COUNT_EMPTY', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_FALSE', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "kanbanAggregateOperation" TYPE "core"."view_kanbanaggregateoperation_enum" USING "kanbanAggregateOperation"::"text"::"core"."view_kanbanaggregateoperation_enum"`,
- );
- await queryRunner.query(`DROP TYPE "core"."KanbanAggregateOperations_old"`);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."KanbanAggregateOperations_old" AS ENUM('AVG', 'COUNT', 'COUNT_EMPTY', 'COUNT_FALSE', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_UNIQUE_VALUES', 'MAX', 'MIN', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY', 'SUM')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "kanbanAggregateOperation" TYPE "core"."KanbanAggregateOperations_old" USING "kanbanAggregateOperation"::"text"::"core"."KanbanAggregateOperations_old"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."view_kanbanaggregateoperation_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."KanbanAggregateOperations_old" RENAME TO "KanbanAggregateOperations"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewOpenRecordIn_old" AS ENUM('RECORD_PAGE', 'SIDE_PANEL')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" TYPE "core"."ViewOpenRecordIn_old" USING "openRecordIn"::"text"::"core"."ViewOpenRecordIn_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "openRecordIn" SET DEFAULT 'SIDE_PANEL'`,
- );
- await queryRunner.query(`DROP TYPE "core"."view_openrecordin_enum"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewOpenRecordIn_old" RENAME TO "ViewOpenRecordIn"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewType_old" AS ENUM('KANBAN', 'TABLE')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" TYPE "core"."ViewType_old" USING "type"::"text"::"core"."ViewType_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "type" SET DEFAULT 'TABLE'`,
- );
- await queryRunner.query(`DROP TYPE "core"."view_type_enum"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewType_old" RENAME TO "ViewType"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewSortDirection_old" AS ENUM('ASC', 'DESC')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" TYPE "core"."ViewSortDirection_old" USING "direction"::"text"::"core"."ViewSortDirection_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ALTER COLUMN "direction" SET DEFAULT 'ASC'`,
- );
- await queryRunner.query(`DROP TYPE "core"."viewSort_direction_enum"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewSortDirection_old" RENAME TO "ViewSortDirection"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewFilterGroupLogicalOperator_old" AS ENUM('AND', 'NOT', 'OR')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" TYPE "core"."ViewFilterGroupLogicalOperator_old" USING "logicalOperator"::"text"::"core"."ViewFilterGroupLogicalOperator_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "logicalOperator" SET DEFAULT 'NOT'`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."viewFilterGroup_logicaloperator_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."ViewFilterGroupLogicalOperator_old" RENAME TO "ViewFilterGroupLogicalOperator"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."ViewFilterOperand_old" AS ENUM('CONTAINS', 'DOES_NOT_CONTAIN', 'GREATER_THAN_OR_EQUAL', 'IS', 'IS_AFTER', 'IS_BEFORE', 'IS_EMPTY', 'IS_IN_FUTURE', 'IS_IN_PAST', 'IS_NOT', 'IS_NOT_EMPTY', 'IS_NOT_NULL', 'IS_RELATIVE', 'IS_TODAY', 'LESS_THAN_OR_EQUAL', 'VECTOR_SEARCH')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" DROP DEFAULT`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" TYPE "core"."ViewFilterOperand_old" USING "operand"::"text"::"core"."ViewFilterOperand_old"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "operand" SET DEFAULT 'CONTAINS'`,
- );
- await queryRunner.query(`DROP TYPE "core"."viewFilter_operand_enum"`);
- await queryRunner.query(
- `ALTER TYPE "core"."ViewFilterOperand_old" RENAME TO "ViewFilterOperand"`,
- );
- await queryRunner.query(
- `CREATE TYPE "core"."AggregateOperations_old" AS ENUM('AVG', 'COUNT', 'COUNT_EMPTY', 'COUNT_FALSE', 'COUNT_NOT_EMPTY', 'COUNT_TRUE', 'COUNT_UNIQUE_VALUES', 'MAX', 'MIN', 'PERCENTAGE_EMPTY', 'PERCENTAGE_NOT_EMPTY', 'SUM')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "aggregateOperation" TYPE "core"."AggregateOperations_old" USING "aggregateOperation"::"text"::"core"."AggregateOperations_old"`,
- );
- await queryRunner.query(
- `DROP TYPE "core"."viewField_aggregateoperation_enum"`,
- );
- await queryRunner.query(
- `ALTER TYPE "core"."AggregateOperations_old" RENAME TO "AggregateOperations"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754923039348-AddStandardIdToAgent.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1754923039348-AddStandardIdToAgent.ts
deleted file mode 100644
index 68af0ee2668..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1754923039348-AddStandardIdToAgent.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddStandardIdToAgent1754923039348 implements MigrationInterface {
- name = 'AddStandardIdToAgent1754923039348';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."agent" ADD "standardId" uuid`);
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."agent" DROP COLUMN "standardId"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755000000000-addIsUIReadOnlyToFieldMetadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1755000000000-addIsUIReadOnlyToFieldMetadata.ts
deleted file mode 100644
index f8d21750d1b..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755000000000-addIsUIReadOnlyToFieldMetadata.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsUIReadOnlyToFieldMetadata1755000000000
- implements MigrationInterface
-{
- name = 'AddIsUIReadOnlyToFieldMetadata1755000000000';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "isUIReadOnly" boolean NOT NULL DEFAULT false`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" ADD "isUIReadOnly" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "isUIReadOnly"`,
- );
-
- await queryRunner.query(
- `ALTER TABLE "core"."objectMetadata" DROP COLUMN "isUIReadOnly"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755075898674-AddIsCustomToView.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1755075898674-AddIsCustomToView.ts
deleted file mode 100644
index e29fb94f792..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755075898674-AddIsCustomToView.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddIsCustomToView1755075898674 implements MigrationInterface {
- name = 'AddIsCustomToView1755075898674';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "isCustom" boolean NOT NULL DEFAULT false`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."view" DROP COLUMN "isCustom"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755189372929-migrateViewKeyFromStringToEnum.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1755189372929-migrateViewKeyFromStringToEnum.ts
deleted file mode 100644
index 9c794cba1ab..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1755189372929-migrateViewKeyFromStringToEnum.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class MigrateViewKeyFromStringToEnum1755189372929
- implements MigrationInterface
-{
- name = 'MigrateViewKeyFromStringToEnum1755189372929';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."view" DROP COLUMN "key"`);
- await queryRunner.query(
- `CREATE TYPE "core"."view_key_enum" AS ENUM('INDEX')`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "key" "core"."view_key_enum"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`ALTER TABLE "core"."view" DROP COLUMN "key"`);
- await queryRunner.query(`DROP TYPE "core"."view_key_enum"`);
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "key" text DEFAULT 'INDEX'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756209145695-addMissingFkOnViewTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756209145695-addMissingFkOnViewTables.ts
deleted file mode 100644
index aa440dbb491..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756209145695-addMissingFkOnViewTables.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddMissingFkOnViewTables1756209145695
- implements MigrationInterface
-{
- name = 'AddMissingFkOnViewTables1756209145695';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD CONSTRAINT "FK_193548db5abc45713087f7d1af6" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ADD CONSTRAINT "FK_b3aa7ec58cdd9e83729f2232591" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ADD CONSTRAINT "FK_818522b962a9b756accb5b3149d" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD CONSTRAINT "FK_3e5ea41c239ef1b75b0d42bef99" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ADD CONSTRAINT "FK_0a48a0b66daedac1314437be5eb" FOREIGN KEY ("fieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" DROP CONSTRAINT "FK_0a48a0b66daedac1314437be5eb"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" DROP CONSTRAINT "FK_3e5ea41c239ef1b75b0d42bef99"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" DROP CONSTRAINT "FK_818522b962a9b756accb5b3149d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" DROP CONSTRAINT "FK_b3aa7ec58cdd9e83729f2232591"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP CONSTRAINT "FK_193548db5abc45713087f7d1af6"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756289507594-createPageLayoutEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756289507594-createPageLayoutEntity.ts
deleted file mode 100644
index adf6ccee315..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756289507594-createPageLayoutEntity.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreatePageLayoutEntity1756289507594 implements MigrationInterface {
- name = 'CreatePageLayoutEntity1756289507594';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."pageLayout_type_enum" AS ENUM('RECORD_INDEX', 'RECORD_PAGE', 'DASHBOARD')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."pageLayout" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "workspaceId" uuid NOT NULL, "type" "core"."pageLayout_type_enum" NOT NULL DEFAULT 'RECORD_PAGE', "objectMetadataId" uuid, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_5028ccb46ffa0c945d2f9246dfa" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."pageLayout" ("workspaceId", "objectMetadataId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayout" ADD CONSTRAINT "FK_760ec8b78721991220b76accd55" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayout" ADD CONSTRAINT "FK_dd63ca42614bacf58971aabdcbb" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayout" DROP CONSTRAINT "FK_dd63ca42614bacf58971aabdcbb"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayout" DROP CONSTRAINT "FK_760ec8b78721991220b76accd55"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."pageLayout"`);
- await queryRunner.query(`DROP TYPE "core"."pageLayout_type_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756300002120-createPageLayoutTabEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756300002120-createPageLayoutTabEntity.ts
deleted file mode 100644
index bb087884cf5..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756300002120-createPageLayoutTabEntity.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreatePageLayoutTabEntity1756300002120
- implements MigrationInterface
-{
- name = 'CreatePageLayoutTabEntity1756300002120';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."pageLayoutTab" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "title" character varying NOT NULL, "position" integer NOT NULL DEFAULT '0', "pageLayoutId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_f1327f6ea950cdc59fe17569c5c" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_TAB_PAGE_LAYOUT_ID" ON "core"."pageLayoutTab" ("pageLayoutId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" ADD CONSTRAINT "FK_0177b1574efe6e6f24651977340" FOREIGN KEY ("pageLayoutId") REFERENCES "core"."pageLayout"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" DROP CONSTRAINT "FK_0177b1574efe6e6f24651977340"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_TAB_PAGE_LAYOUT_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."pageLayoutTab"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756302117195-createPageWidgetLayoutEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756302117195-createPageWidgetLayoutEntity.ts
deleted file mode 100644
index de424cafec8..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756302117195-createPageWidgetLayoutEntity.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreatePageWidgetLayoutEntity1756302117195
- implements MigrationInterface
-{
- name = 'CreatePageWidgetLayoutEntity1756302117195';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."pageLayoutWidget_type_enum" AS ENUM('VIEW', 'IFRAME', 'FIELDS', 'GRAPH')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."pageLayoutWidget" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "pageLayoutTabId" uuid NOT NULL, "title" character varying NOT NULL, "type" "core"."pageLayoutWidget_type_enum" NOT NULL DEFAULT 'VIEW', "objectMetadataId" uuid, "gridPosition" jsonb NOT NULL, "configuration" jsonb, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_2f997489b8b15cb26a0b9d4220b" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WIDGET_PAGE_LAYOUT_TAB_ID" ON "core"."pageLayoutWidget" ("pageLayoutTabId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_0659a4d171c93f5c046f18d24cd" FOREIGN KEY ("pageLayoutTabId") REFERENCES "core"."pageLayoutTab"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_c4dc95034f53a12601e623d9171" FOREIGN KEY ("objectMetadataId") REFERENCES "core"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_c4dc95034f53a12601e623d9171"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_0659a4d171c93f5c046f18d24cd"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WIDGET_PAGE_LAYOUT_TAB_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."pageLayoutWidget"`);
- await queryRunner.query(`DROP TYPE "core"."pageLayoutWidget_type_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756373902817-addCronTriggerEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756373902817-addCronTriggerEntity.ts
deleted file mode 100644
index 8e74d658e2c..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756373902817-addCronTriggerEntity.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddCronTriggerEntity1756373902817 implements MigrationInterface {
- name = 'AddCronTriggerEntity1756373902817';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."cronTrigger" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "settings" jsonb NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "serverlessFunctionId" uuid, CONSTRAINT "PK_153e054abdb2663942d4661e3bb" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_CRON_TRIGGER_WORKSPACE_ID" ON "core"."cronTrigger" ("workspaceId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" ADD CONSTRAINT "FK_f70831ec336e0cb42d6a33b80ba" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" DROP CONSTRAINT "FK_f70831ec336e0cb42d6a33b80ba"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_CRON_TRIGGER_WORKSPACE_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."cronTrigger"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756385539610-addDatabaseEventTriggerEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756385539610-addDatabaseEventTriggerEntity.ts
deleted file mode 100644
index ac492452289..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756385539610-addDatabaseEventTriggerEntity.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddDatabaseEventTriggerEntity1756385539610
- implements MigrationInterface
-{
- name = 'AddDatabaseEventTriggerEntity1756385539610';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TABLE "core"."databaseEventTrigger" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "settings" jsonb NOT NULL, "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "serverlessFunctionId" uuid, CONSTRAINT "PK_b3e1ceba9d36f8b5aac6342a267" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_DATABASE_EVENT_TRIGGER_WORKSPACE_ID" ON "core"."databaseEventTrigger" ("workspaceId") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" ADD CONSTRAINT "FK_fe492f1ecc81621b6d7cee1775b" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" DROP CONSTRAINT "FK_fe492f1ecc81621b6d7cee1775b"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_DATABASE_EVENT_TRIGGER_WORKSPACE_ID"`,
- );
- await queryRunner.query(`DROP TABLE "core"."databaseEventTrigger"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756393721720-addUniversalIdentifierToViewTables.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756393721720-addUniversalIdentifierToViewTables.ts
deleted file mode 100644
index 00ba7fa6e60..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756393721720-addUniversalIdentifierToViewTables.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUniversalIdentifierToViewTables1756393721720
- implements MigrationInterface
-{
- name = 'AddUniversalIdentifierToViewTables1756393721720';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_cd4588bfc9ad73345b3953a039" ON "core"."viewFilter" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_e6ed40a61e4584e98584019a47" ON "core"."viewFilterGroup" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_a44e3b03f0eca32d0504d5ef73" ON "core"."viewGroup" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_38232fc0c6567ed029c2b1a12c" ON "core"."viewSort" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_552aa6908966e980099b3e5ebf" ON "core"."view" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_b86af4ea24cae518dee8eae996" ON "core"."viewField" ("workspaceId", "universalIdentifier") `,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_b86af4ea24cae518dee8eae996"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_552aa6908966e980099b3e5ebf"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_38232fc0c6567ed029c2b1a12c"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_a44e3b03f0eca32d0504d5ef73"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_e6ed40a61e4584e98584019a47"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_cd4588bfc9ad73345b3953a039"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewSort" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" DROP COLUMN "universalIdentifier"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756434280823-AddRoleApplicabilityFields.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756434280823-AddRoleApplicabilityFields.ts
deleted file mode 100644
index e30763a33f9..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756434280823-AddRoleApplicabilityFields.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRoleApplicabilityFields1756434280823
- implements MigrationInterface
-{
- name = 'AddRoleApplicabilityFields1756434280823';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canBeAssignedToUsers" boolean NOT NULL DEFAULT true`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canBeAssignedToAgents" boolean NOT NULL DEFAULT true`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" ADD "canBeAssignedToApiKeys" boolean NOT NULL DEFAULT true`,
- );
-
- await queryRunner.query(
- `UPDATE "core"."role" SET "canBeAssignedToUsers" = true, "canBeAssignedToAgents" = true, "canBeAssignedToApiKeys" = true`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canBeAssignedToApiKeys"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canBeAssignedToAgents"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."role" DROP COLUMN "canBeAssignedToUsers"`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756447211845-addUniqueIdentifierToTriggerEntities.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756447211845-addUniqueIdentifierToTriggerEntities.ts
deleted file mode 100644
index 574043daa9a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756447211845-addUniqueIdentifierToTriggerEntities.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddUniqueIdentifierToTriggerEntities1756447211845
- implements MigrationInterface
-{
- name = 'AddUniqueIdentifierToTriggerEntities1756447211845';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" DROP CONSTRAINT "FK_fe492f1ecc81621b6d7cee1775b"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" ADD "universalIdentifier" uuid`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_8adc1fd6cb0dad2fbfd945954d" ON "core"."cronTrigger" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_960465af116edf9ac501bfb3db" ON "core"."databaseEventTrigger" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" ADD CONSTRAINT "FK_7650f1b8b693cde204f44ab0aa4" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" DROP CONSTRAINT "FK_7650f1b8b693cde204f44ab0aa4"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_960465af116edf9ac501bfb3db"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_8adc1fd6cb0dad2fbfd945954d"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" DROP COLUMN "universalIdentifier"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" ADD CONSTRAINT "FK_fe492f1ecc81621b6d7cee1775b" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756476065711-removeUselessDeletedAt.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756476065711-removeUselessDeletedAt.ts
deleted file mode 100644
index 395fdd98679..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756476065711-removeUselessDeletedAt.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class RemoveUselessDeletedAt1756476065711 implements MigrationInterface {
- name = 'RemoveUselessDeletedAt1756476065711';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" DROP COLUMN "deletedAt"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" DROP COLUMN "deletedAt"`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."databaseEventTrigger" ADD "deletedAt" TIMESTAMP WITH TIME ZONE`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."cronTrigger" ADD "deletedAt" TIMESTAMP WITH TIME ZONE`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756483901854-updateViewsPositionsToDouble.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756483901854-updateViewsPositionsToDouble.ts
deleted file mode 100644
index dae0551842a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756483901854-updateViewsPositionsToDouble.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class UpdateViewsPositionsToDouble1756483901854
- implements MigrationInterface
-{
- name = 'UpdateViewsPositionsToDouble1756483901854';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "positionInViewFilterGroup" TYPE double precision`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "positionInViewFilterGroup" TYPE double precision`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ALTER COLUMN "position" TYPE double precision`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "position" TYPE double precision`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "position" TYPE double precision`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."viewField" ALTER COLUMN "position" TYPE integer`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."view" ALTER COLUMN "position" TYPE integer`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewGroup" ALTER COLUMN "position" TYPE integer`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "positionInViewFilterGroup" TYPE integer`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."viewFilter" ALTER COLUMN "positionInViewFilterGroup" TYPE integer`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756732238898-addViewIndexes.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756732238898-addViewIndexes.ts
deleted file mode 100644
index 846e7983e41..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756732238898-addViewIndexes.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddViewIndexes1756732238898 implements MigrationInterface {
- name = 'AddViewIndexes1756732238898';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FILTER_VIEW_ID" ON "core"."viewFilter" ("viewId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FILTER_GROUP_VIEW_ID" ON "core"."viewFilterGroup" ("viewId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_GROUP_VIEW_ID" ON "core"."viewGroup" ("viewId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_SORT_VIEW_ID" ON "core"."viewSort" ("viewId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_VIEW_FIELD_VIEW_ID" ON "core"."viewField" ("viewId") WHERE "deletedAt" IS NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_FIELD_VIEW_ID"`);
- await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_SORT_VIEW_ID"`);
- await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_GROUP_VIEW_ID"`);
- await queryRunner.query(
- `DROP INDEX "core"."IDX_VIEW_FILTER_GROUP_VIEW_ID"`,
- );
- await queryRunner.query(`DROP INDEX "core"."IDX_VIEW_FILTER_VIEW_ID"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756803679889-addRouteEntity.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756803679889-addRouteEntity.ts
deleted file mode 100644
index 832213c84fa..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756803679889-addRouteEntity.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddRouteEntity1756803679889 implements MigrationInterface {
- name = 'AddRouteEntity1756803679889';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `CREATE TYPE "core"."route_httpmethod_enum" AS ENUM('GET', 'POST', 'PUT', 'PATCH', 'DELETE')`,
- );
- await queryRunner.query(
- `CREATE TABLE "core"."route" ("universalIdentifier" uuid, "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "path" character varying NOT NULL, "isAuthRequired" boolean NOT NULL DEFAULT true, "httpMethod" "core"."route_httpmethod_enum" NOT NULL DEFAULT 'GET', "workspaceId" uuid NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "serverlessFunctionId" uuid, CONSTRAINT "IDX_ROUTE_PATH_HTTP_METHOD_WORKSPACE_ID_UNIQUE" UNIQUE ("path", "httpMethod", "workspaceId"), CONSTRAINT "PK_08affcd076e46415e5821acf52d" PRIMARY KEY ("id"))`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_1c39502392dd9cbb186deba158" ON "core"."route" ("workspaceId", "universalIdentifier") `,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."route" ADD CONSTRAINT "FK_c63b1110bbf09051be2f495d0be" FOREIGN KEY ("serverlessFunctionId") REFERENCES "core"."serverlessFunction"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."route" DROP CONSTRAINT "FK_c63b1110bbf09051be2f495d0be"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_1c39502392dd9cbb186deba158"`,
- );
- await queryRunner.query(`DROP TABLE "core"."route"`);
- await queryRunner.query(`DROP TYPE "core"."route_httpmethod_enum"`);
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756816245841-createPartialIndexForPageLayout.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756816245841-createPartialIndexForPageLayout.ts
deleted file mode 100644
index f72b3808d7f..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756816245841-createPartialIndexForPageLayout.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class CreatePartialIndexForPageLayout1756816245841
- implements MigrationInterface
-{
- name = 'CreatePartialIndexForPageLayout1756816245841';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."pageLayout" ("workspaceId", "objectMetadataId") WHERE "deletedAt" IS NULL`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID"`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WORKSPACE_ID_OBJECT_METADATA_ID" ON "core"."pageLayout" ("workspaceId", "objectMetadataId") `,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756910835948-add-morph-id-to-field-metadata.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756910835948-add-morph-id-to-field-metadata.ts
deleted file mode 100644
index 03bd586af9a..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756910835948-add-morph-id-to-field-metadata.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddMorphIdToFieldMetadata1756910835948
- implements MigrationInterface
-{
- name = 'AddMorphIdToFieldMetadata1756910835948';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_FIELD_METADATA_NAME_OBJMID_WORKSPACE_ID_EXCEPT_MORPH_UNIQUE"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD "morphId" uuid`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" ADD CONSTRAINT "CHK_FIELD_METADATA_MORPH_RELATION_REQUIRES_MORPH_ID" CHECK (("type" != 'MORPH_RELATION') OR ("type" = 'MORPH_RELATION' AND "morphId" IS NOT NULL))`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP CONSTRAINT "CHK_FIELD_METADATA_MORPH_RELATION_REQUIRES_MORPH_ID"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "morphId"`,
- );
- await queryRunner.query(
- `CREATE UNIQUE INDEX "IDX_FIELD_METADATA_NAME_OBJMID_WORKSPACE_ID_EXCEPT_MORPH_UNIQUE" ON "core"."fieldMetadata" ("objectMetadataId", "name", "workspaceId") WHERE ((type)::text <> 'MORPH_RELATION'::text)`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756977847652-changePageLayoutTabPositionToFloat.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756977847652-changePageLayoutTabPositionToFloat.ts
deleted file mode 100644
index 79ebab9b46d..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756977847652-changePageLayoutTabPositionToFloat.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class ChangePageLayoutTabPositionToFloat1756977847652
- implements MigrationInterface
-{
- name = 'ChangePageLayoutTabPositionToFloat1756977847652';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" DROP COLUMN "position"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" ADD "position" double precision NOT NULL DEFAULT '0'`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" DROP COLUMN "position"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" ADD "position" integer NOT NULL DEFAULT '0'`,
- );
- }
-}
diff --git a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756997911163-addWorkspaceIdToPageLayoutTabAndPageLayoutWidget.ts b/packages/twenty-server/src/database/typeorm/core/migrations/common/1756997911163-addWorkspaceIdToPageLayoutTabAndPageLayoutWidget.ts
deleted file mode 100644
index 910a4c9ed03..00000000000
--- a/packages/twenty-server/src/database/typeorm/core/migrations/common/1756997911163-addWorkspaceIdToPageLayoutTabAndPageLayoutWidget.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { type MigrationInterface, type QueryRunner } from 'typeorm';
-
-export class AddWorkspaceIdToPageLayoutTabAndPageLayoutWidget1756997911163
- implements MigrationInterface
-{
- name = 'AddWorkspaceIdToPageLayoutTabAndPageLayoutWidget1756997911163';
-
- public async up(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WIDGET_PAGE_LAYOUT_TAB_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_TAB_PAGE_LAYOUT_ID"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" ADD "workspaceId" uuid NOT NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" ADD "workspaceId" uuid NOT NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WIDGET_WORKSPACE_ID_PAGE_LAYOUT_TAB_ID" ON "core"."pageLayoutWidget" ("workspaceId", "pageLayoutTabId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_TAB_WORKSPACE_ID_PAGE_LAYOUT_ID" ON "core"."pageLayoutTab" ("workspaceId", "pageLayoutId") WHERE "deletedAt" IS NULL`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" ADD CONSTRAINT "FK_555948f84165dce1fe1f5f955ce" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" ADD CONSTRAINT "FK_2528e67c8c0c953d8303172989e" FOREIGN KEY ("workspaceId") REFERENCES "core"."workspace"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
- );
- }
-
- public async down(queryRunner: QueryRunner): Promise<void> {
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" DROP CONSTRAINT "FK_2528e67c8c0c953d8303172989e"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" DROP CONSTRAINT "FK_555948f84165dce1fe1f5f955ce"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_TAB_WORKSPACE_ID_PAGE_LAYOUT_ID"`,
- );
- await queryRunner.query(
- `DROP INDEX "core"."IDX_PAGE_LAYOUT_WIDGET_WORKSPACE_ID_PAGE_LAYOUT_TAB_ID"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutTab" DROP COLUMN "workspaceId"`,
- );
- await queryRunner.query(
- `ALTER TABLE "core"."pageLayoutWidget" DROP COLUMN "workspaceId"`,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_TAB_PAGE_LAYOUT_ID" ON "core"."pageLayoutTab" ("pageLayoutId") `,
- );
- await queryRunner.query(
- `CREATE INDEX "IDX_PAGE_LAYOUT_WIDGET_PAGE_LAYOUT_TAB_ID" ON "core"."pageLayoutWidget" ("pageLayoutTabId") `,
- );
- }
-}