Skip to content

Commit

Permalink
update migrations for hosted postgres db
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0neerpat committed Sep 3, 2021
1 parent fd3caff commit cd09b1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL PRIMARY KEY,
"id" TEXT NOT NULL,
"address" TEXT NOT NULL,
"authDetailId" TEXT NOT NULL,
FOREIGN KEY ("authDetailId") REFERENCES "AuthDetail" ("id") ON DELETE CASCADE ON UPDATE CASCADE

PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "AuthDetail" (
"id" TEXT NOT NULL PRIMARY KEY,
"id" TEXT NOT NULL,
"nonce" TEXT NOT NULL,
"timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User.address_unique" ON "User"("address");

-- CreateIndex
CREATE UNIQUE INDEX "User_authDetailId_unique" ON "User"("authDetailId");

-- AddForeignKey
ALTER TABLE "User" ADD FOREIGN KEY ("authDetailId") REFERENCES "AuthDetail"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"
provider = "postgresql"
1 change: 1 addition & 0 deletions examples/eth-auth-demo/api/db/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
datasource db {
provider = "postgresql"
url = env("DATABASE")
shadowDatabaseUrl = env("SHADOW_DATABASE")
}

generator client {
Expand Down

0 comments on commit cd09b1c

Please sign in to comment.