From bfd032972b6c6fe9689d9bec8682c3d0a3d94585 Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 25 Sep 2021 07:45:42 +0800 Subject: [PATCH] upgrade to prisma 3 --- .../migration.sql | 92 +++++++++++++++++++ package-lock.json | 34 +++---- package.json | 6 +- 3 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 db/migrations/20210924234526_upgrade_to_prisma_3/migration.sql diff --git a/db/migrations/20210924234526_upgrade_to_prisma_3/migration.sql b/db/migrations/20210924234526_upgrade_to_prisma_3/migration.sql new file mode 100644 index 0000000..775605e --- /dev/null +++ b/db/migrations/20210924234526_upgrade_to_prisma_3/migration.sql @@ -0,0 +1,92 @@ +-- DropForeignKey +ALTER TABLE "Membership" DROP CONSTRAINT "Membership_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "Message" DROP CONSTRAINT "Message_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "Message" DROP CONSTRAINT "Message_phoneNumberId_fkey"; + +-- DropForeignKey +ALTER TABLE "NotificationSubscription" DROP CONSTRAINT "NotificationSubscription_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "NotificationSubscription" DROP CONSTRAINT "NotificationSubscription_phoneNumberId_fkey"; + +-- DropForeignKey +ALTER TABLE "PhoneCall" DROP CONSTRAINT "PhoneCall_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "PhoneCall" DROP CONSTRAINT "PhoneCall_phoneNumberId_fkey"; + +-- DropForeignKey +ALTER TABLE "PhoneNumber" DROP CONSTRAINT "PhoneNumber_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProcessingPhoneNumber" DROP CONSTRAINT "ProcessingPhoneNumber_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "ProcessingPhoneNumber" DROP CONSTRAINT "ProcessingPhoneNumber_phoneNumberId_fkey"; + +-- DropForeignKey +ALTER TABLE "Token" DROP CONSTRAINT "Token_userId_fkey"; + +-- AddForeignKey +ALTER TABLE "Membership" ADD CONSTRAINT "Membership_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Token" ADD CONSTRAINT "Token_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Message" ADD CONSTRAINT "Message_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Message" ADD CONSTRAINT "Message_phoneNumberId_fkey" FOREIGN KEY ("phoneNumberId") REFERENCES "PhoneNumber"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "PhoneCall" ADD CONSTRAINT "PhoneCall_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "PhoneCall" ADD CONSTRAINT "PhoneCall_phoneNumberId_fkey" FOREIGN KEY ("phoneNumberId") REFERENCES "PhoneNumber"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "PhoneNumber" ADD CONSTRAINT "PhoneNumber_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProcessingPhoneNumber" ADD CONSTRAINT "ProcessingPhoneNumber_phoneNumberId_fkey" FOREIGN KEY ("phoneNumberId") REFERENCES "PhoneNumber"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProcessingPhoneNumber" ADD CONSTRAINT "ProcessingPhoneNumber_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "NotificationSubscription" ADD CONSTRAINT "NotificationSubscription_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "NotificationSubscription" ADD CONSTRAINT "NotificationSubscription_phoneNumberId_fkey" FOREIGN KEY ("phoneNumberId") REFERENCES "PhoneNumber"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- RenameIndex +ALTER INDEX "Membership.organizationId_invitedEmail_unique" RENAME TO "Membership_organizationId_invitedEmail_key"; + +-- RenameIndex +ALTER INDEX "Message.organizationId_phoneNumberId_id_unique" RENAME TO "Message_organizationId_phoneNumberId_id_key"; + +-- RenameIndex +ALTER INDEX "NotificationSubscription.endpoint_unique" RENAME TO "NotificationSubscription_endpoint_key"; + +-- RenameIndex +ALTER INDEX "Organization.id_twilioAccountSid_unique" RENAME TO "Organization_id_twilioAccountSid_key"; + +-- RenameIndex +ALTER INDEX "PhoneCall.organizationId_phoneNumberId_id_unique" RENAME TO "PhoneCall_organizationId_phoneNumberId_id_key"; + +-- RenameIndex +ALTER INDEX "PhoneNumber.organizationId_id_unique" RENAME TO "PhoneNumber_organizationId_id_key"; + +-- RenameIndex +ALTER INDEX "Session.handle_unique" RENAME TO "Session_handle_key"; + +-- RenameIndex +ALTER INDEX "Token.hashedToken_type_unique" RENAME TO "Token_hashedToken_type_key"; + +-- RenameIndex +ALTER INDEX "User.email_unique" RENAME TO "User_email_key"; diff --git a/package-lock.json b/package-lock.json index c383d0e..c99981c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3116,11 +3116,11 @@ "integrity": "sha512-eCywM6eTs5OCux8xWrs65zZce4XABugUa6wpKwSSZmhw7JSsxz1Z4v2DRvziyaP9yq1Ygot1zXNSyKcQDb52Mw==" }, "@prisma/client": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.30.0.tgz", - "integrity": "sha512-tjJNHVfgyNOwS2F+AkjMMCJGPnXzHuUCrOnAMJyidAu4aNzxbJ8jWwjt96rRMpyrg9Hwen3xqqQ2oA+ikK7nhQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.1.1.tgz", + "integrity": "sha512-8ud8vVFMIg37yrkZ4wPpjKoMxFbCL0Pesq5eyLnag/s0LTKsVEN7ZBIQq9JzWW+AUqOzGKXr2Jt4Sl8xdGI99w==", "requires": { - "@prisma/engines-version": "2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb" + "@prisma/engines-version": "3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f" } }, "@prisma/debug": { @@ -3279,9 +3279,9 @@ "integrity": "sha512-rEWpaG7wZvPuWJC5SwkBB/Iwue//oC5yv58Mse7r+ibtgkA7vGdWc1bFDQ32DT9tDL5WSC6bBwqEASGV/1Gm1Q==" }, "@prisma/engines-version": { - "version": "2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb.tgz", - "integrity": "sha512-oThNpx7HtJ0eEmnvrWARYcNCs6dqFdAK3Smt2bJVDD6Go4HLuuhjx028osP+rHaFrGOTx7OslLZYtvvFlAXRDA==" + "version": "3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f.tgz", + "integrity": "sha512-EuEMKLuwIcBO7uInZQHeG1yaywcfl32Tq8TDf5tgLvblk+ka70sej7S67lh3BV5gXMLTc3GdthSHPfDqZEK5uA==" }, "@prisma/fetch-engine": { "version": "2.19.0", @@ -16376,9 +16376,9 @@ "dev": true }, "prettier-plugin-prisma": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-prisma/-/prettier-plugin-prisma-2.30.0.tgz", - "integrity": "sha512-T4rIGLojQgYbDIQMO0woq//SozS7dQcvzB6bk0DdDsltnr37BXTvT2ZI9vBu4/n7Eu+93NMc5Ervxb/IwQd0bg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-prisma/-/prettier-plugin-prisma-3.1.1.tgz", + "integrity": "sha512-TKS/GbSHJ+uf/jTfqBqzRfWdXhrj4RHD6m5NEHj/2Brbd/I6PnNY7L6uXOiILOtRzx7fEjZEy6i4cUcwKUAfow==", "dev": true }, "pretty-bytes": { @@ -16674,17 +16674,17 @@ } }, "prisma": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-2.30.0.tgz", - "integrity": "sha512-2XYpSibcVpMd1JDxYypGDU/JKq0W2f/HI1itdddr4Pfg+q6qxt/ItWKcftv4/lqN6u/BVlQ2gDzXVEjpHeO5kQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-3.1.1.tgz", + "integrity": "sha512-+eZtWIL6hnOKUOvqq9WLBzSw2d/EbTmOx1Td1LI8/0XE40ctXMLG2N1p6NK5/+yivGaoNJ9PDpPsPL9lO4nJrQ==", "requires": { - "@prisma/engines": "2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb" + "@prisma/engines": "3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f" }, "dependencies": { "@prisma/engines": { - "version": "2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-2.30.0-28.60b19f4a1de4fe95741da371b4c44a92f4d1adcb.tgz", - "integrity": "sha512-LPKq88lIbYezvX0OOc1PU42hHdTsSMPJWmK8lusaHK7DaLHyXjDp/551LbsVapypbjW6N3Jx/If6GoMDASSMSw==" + "version": "3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f.tgz", + "integrity": "sha512-6NEp0VlLho3hVtIvj2P4h0e19AYqQSXtFGts8gSIXDnV+l5pRFZaDMfGo2RiLMR0Kfrs8c3ZYxYX0sWmVL0tWw==" } } }, diff --git a/package.json b/package.json index 92aa93e..277ef7b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@headlessui/react": "1.4.1", "@hookform/resolvers": "2.8.1", "@panelbear/panelbear-js": "1.3.2", - "@prisma/client": "2.30.0", + "@prisma/client": "3.1.1", "@react-aria/interactions": "3.6.0", "@sentry/browser": "6.13.2", "@sentry/integrations": "6.13.2", @@ -57,7 +57,7 @@ "next-pwa": "5.3.1", "pino": "6.13.2", "pino-pretty": "7.0.1", - "prisma": "2.30.0", + "prisma": "3.1.1", "quirrel": "1.7.1", "react": "18.0.0-alpha-8f96c6b2a-20210909", "react-datocms": "1.6.3", @@ -89,7 +89,7 @@ "lint-staged": "11.1.2", "postcss": "8.3.6", "prettier": "2.4.1", - "prettier-plugin-prisma": "2.30.0", + "prettier-plugin-prisma": "3.1.1", "pretty-quick": "3.1.1", "preview-email": "3.0.5", "test-listen": "1.1.0",