Last active
February 12, 2022 13:25
-
-
Save igo/db74ddd57edbe6d557eaa5ac8e7b0363 to your computer and use it in GitHub Desktop.
Revisions
-
igo revised this gist
Feb 12, 2022 . 1 changed file with 60 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ -- DropForeignKey ALTER TABLE "Account" DROP CONSTRAINT "Account_userId_fkey"; -- DropForeignKey ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey"; -- DropIndex DROP INDEX "Account_providerId_providerAccountId_key"; -- DropIndex DROP INDEX "Session_accessToken_key"; -- AlterTable ALTER TABLE "Account" ADD COLUMN "expires_at" INTEGER, ADD COLUMN "id_token" TEXT, ADD COLUMN "oauth_token" TEXT, ADD COLUMN "oauth_token_secret" TEXT, ADD COLUMN "scope" TEXT, ADD COLUMN "session_state" TEXT, ADD COLUMN "token_type" TEXT; ALTER TABLE "Account" RENAME COLUMN "accessToken" TO "access_token"; ALTER TABLE "Account" RENAME COLUMN "refreshToken" TO "refresh_token"; ALTER TABLE "Account" RENAME COLUMN "providerType" TO "type"; ALTER TABLE "Account" RENAME COLUMN "providerId" TO "provider"; UPDATE "Account" SET "expires_at" = CAST(EXTRACT (epoch FROM "accessTokenExpires") AS integer); ALTER TABLE "Account" DROP COLUMN "accessTokenExpires"; -- AlterTable ALTER TABLE "Session" DROP COLUMN "accessToken"; -- DropTable DROP TABLE "VerificationRequest"; -- CreateTable CREATE TABLE "VerificationToken" ( "identifier" TEXT NOT NULL, "token" TEXT NOT NULL, "expires" TIMESTAMP(3) NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL ); -- CreateIndex CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); -- CreateIndex CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); -- CreateIndex CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); -- AddForeignKey ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -
igo renamed this gist
Feb 12, 2022 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ /* Warnings: -
igo created this gist
Feb 12, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ -- ORIGINAL MIGRATION /* Warnings: - You are about to drop the column `accessToken` on the `Account` table. All the data in the column will be lost. - You are about to drop the column `accessTokenExpires` on the `Account` table. All the data in the column will be lost. - You are about to drop the column `providerId` on the `Account` table. All the data in the column will be lost. - You are about to drop the column `providerType` on the `Account` table. All the data in the column will be lost. - You are about to drop the column `refreshToken` on the `Account` table. All the data in the column will be lost. - You are about to drop the column `accessToken` on the `Session` table. All the data in the column will be lost. - You are about to drop the `VerificationRequest` table. If the table is not empty, all the data it contains will be lost. - A unique constraint covering the columns `[provider,providerAccountId]` on the table `Account` will be added. If there are existing duplicate values, this will fail. - Added the required column `provider` to the `Account` table without a default value. This is not possible if the table is not empty. - Added the required column `type` to the `Account` table without a default value. This is not possible if the table is not empty. */ -- DropForeignKey ALTER TABLE "Account" DROP CONSTRAINT "Account_userId_fkey"; -- DropForeignKey ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey"; -- DropIndex DROP INDEX "Account_providerId_providerAccountId_key"; -- DropIndex DROP INDEX "Session_accessToken_key"; -- AlterTable ALTER TABLE "Account" DROP COLUMN "accessToken", DROP COLUMN "accessTokenExpires", DROP COLUMN "providerId", DROP COLUMN "providerType", DROP COLUMN "refreshToken", ADD COLUMN "access_token" TEXT, ADD COLUMN "expires_at" INTEGER, ADD COLUMN "id_token" TEXT, ADD COLUMN "oauth_token" TEXT, ADD COLUMN "oauth_token_secret" TEXT, ADD COLUMN "provider" TEXT NOT NULL, ADD COLUMN "refresh_token" TEXT, ADD COLUMN "scope" TEXT, ADD COLUMN "session_state" TEXT, ADD COLUMN "token_type" TEXT, ADD COLUMN "type" TEXT NOT NULL; -- AlterTable ALTER TABLE "Session" DROP COLUMN "accessToken"; -- DropTable DROP TABLE "VerificationRequest"; -- CreateTable CREATE TABLE "VerificationToken" ( "identifier" TEXT NOT NULL, "token" TEXT NOT NULL, "expires" TIMESTAMP(3) NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL ); -- CreateIndex CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); -- CreateIndex CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); -- CreateIndex CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); -- AddForeignKey ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;