START TRANSACTION;

CREATE TABLE "OrganizationDomain" (
    "Id" uuid NOT NULL,
    "OrganizationId" uuid NOT NULL,
    "Txt" text NULL,
    "DomainName" character varying(255) NULL,
    "CreationDate" timestamp with time zone NOT NULL,
    "VerifiedDate" timestamp with time zone NULL,
    "NextRunDate" timestamp with time zone NOT NULL,
    "NextRunCount" integer NOT NULL,
    CONSTRAINT "PK_OrganizationDomain" PRIMARY KEY ("Id"),
    CONSTRAINT "FK_OrganizationDomain_Organization_OrganizationId" FOREIGN KEY ("OrganizationId") REFERENCES "Organization" ("Id") ON DELETE CASCADE
);

CREATE INDEX "IX_OrganizationDomain_OrganizationId" ON "OrganizationDomain" ("OrganizationId");

INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
VALUES ('20221108020928_OrganizationDomainClaim', '6.0.4');

COMMIT;