This repository has been archived by the owner on Jul 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prisma): use new Adapter interface (#72)
* feat(prisma): use new Adapter interface * fix(prisma): fix TS errors * fix(prisma): make all ids string * docs(prisma): update README to reflect new schema * fix(core): update next-auth types * chore(prisma): remove comment * chore(prisma): remove unused dependencies * test(prisma): fix tests * fix(prisma): add new db migration * test(prisma): fix tests
- Loading branch information
1 parent
edff780
commit e7a7690
Showing
10 changed files
with
1,817 additions
and
6,206 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
71 changes: 71 additions & 0 deletions
71
packages/prisma/prisma/migrations/20210428211515_/migration.sql
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `Account` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The primary key for the `Session` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- The primary key for the `VerificationRequest` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
*/ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_Account" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"userId" TEXT NOT NULL, | ||
"providerType" TEXT NOT NULL, | ||
"providerId" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"refreshToken" TEXT, | ||
"accessToken" TEXT, | ||
"accessTokenExpires" DATETIME, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_Account" ("id", "userId", "providerType", "providerId", "providerAccountId", "refreshToken", "accessToken", "accessTokenExpires", "createdAt", "updatedAt") SELECT "id", "userId", "providerType", "providerId", "providerAccountId", "refreshToken", "accessToken", "accessTokenExpires", "createdAt", "updatedAt" FROM "Account"; | ||
DROP TABLE "Account"; | ||
ALTER TABLE "new_Account" RENAME TO "Account"; | ||
CREATE UNIQUE INDEX "Account.providerId_providerAccountId_unique" ON "Account"("providerId", "providerAccountId"); | ||
CREATE TABLE "new_Session" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"userId" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL, | ||
"sessionToken" TEXT NOT NULL, | ||
"accessToken" TEXT NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_Session" ("id", "userId", "expires", "sessionToken", "accessToken", "createdAt", "updatedAt") SELECT "id", "userId", "expires", "sessionToken", "accessToken", "createdAt", "updatedAt" FROM "Session"; | ||
DROP TABLE "Session"; | ||
ALTER TABLE "new_Session" RENAME TO "Session"; | ||
CREATE UNIQUE INDEX "Session.sessionToken_unique" ON "Session"("sessionToken"); | ||
CREATE UNIQUE INDEX "Session.accessToken_unique" ON "Session"("accessToken"); | ||
CREATE TABLE "new_User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT, | ||
"email" TEXT, | ||
"emailVerified" DATETIME, | ||
"image" TEXT, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
INSERT INTO "new_User" ("id", "name", "email", "emailVerified", "image", "createdAt", "updatedAt") SELECT "id", "name", "email", "emailVerified", "image", "createdAt", "updatedAt" FROM "User"; | ||
DROP TABLE "User"; | ||
ALTER TABLE "new_User" RENAME TO "User"; | ||
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email"); | ||
CREATE TABLE "new_VerificationRequest" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
INSERT INTO "new_VerificationRequest" ("id", "identifier", "token", "expires", "createdAt", "updatedAt") SELECT "id", "identifier", "token", "expires", "createdAt", "updatedAt" FROM "VerificationRequest"; | ||
DROP TABLE "VerificationRequest"; | ||
ALTER TABLE "new_VerificationRequest" RENAME TO "VerificationRequest"; | ||
CREATE UNIQUE INDEX "VerificationRequest.token_unique" ON "VerificationRequest"("token"); | ||
CREATE UNIQUE INDEX "VerificationRequest.identifier_token_unique" ON "VerificationRequest"("identifier", "token"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "sqlite" |
This file contains 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 characters
Oops, something went wrong.