/*
  Warnings:

  - The primary key for the `IamRoleIamPolicyAttachment` table will be changed. If it partially fails, the table could be left without primary key constraint.
  - You are about to drop the column `iamPolicyVersion` on the `IamRoleIamPolicyAttachment` table. All the data in the column will be lost.

*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_IamRoleIamPolicyAttachment" (
    "iamRoleId" TEXT NOT NULL,
    "iamPolicyId" TEXT NOT NULL,

    PRIMARY KEY ("iamRoleId", "iamPolicyId"),
    CONSTRAINT "IamRoleIamPolicyAttachment_iamRoleId_fkey" FOREIGN KEY ("iamRoleId") REFERENCES "IamRole" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_IamRoleIamPolicyAttachment" ("iamPolicyId", "iamRoleId") SELECT "iamPolicyId", "iamRoleId" FROM "IamRoleIamPolicyAttachment";
DROP TABLE "IamRoleIamPolicyAttachment";
ALTER TABLE "new_IamRoleIamPolicyAttachment" RENAME TO "IamRoleIamPolicyAttachment";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
