-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from joshxfi/feat/migrate-db
feat: migrate db
- Loading branch information
Showing
8 changed files
with
192 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
dev.* |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT, | ||
"email" TEXT, | ||
"emailVerified" DATETIME, | ||
"image" TEXT, | ||
"username" TEXT, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME, | ||
"bio" TEXT | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Account" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"userId" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"provider" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"refresh_token" TEXT, | ||
"access_token" TEXT, | ||
"expires_at" INTEGER, | ||
"token_type" TEXT, | ||
"scope" TEXT, | ||
"id_token" TEXT, | ||
"session_state" TEXT | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Organization" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"image" TEXT, | ||
"bio" TEXT NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"isApproved" BOOLEAN NOT NULL DEFAULT false, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME, | ||
"ownerId" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Donation" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"amount" INTEGER NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME, | ||
"orgId" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Session" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"sessionToken" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VerificationToken" ( | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Post" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"imgUrl" TEXT, | ||
"sdg" TEXT, | ||
"authorId" TEXT, | ||
"orgId" TEXT, | ||
"parentId" TEXT | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Upvote" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"userId" TEXT NOT NULL, | ||
"postId" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Tag" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_PostToTag" ( | ||
"A" TEXT NOT NULL, | ||
"B" TEXT NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Account_userId_idx" ON "Account"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Organization_username_key" ON "Organization"("username"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Organization_ownerId_idx" ON "Organization"("ownerId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Donation_orgId_idx" ON "Donation"("orgId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Donation_userId_idx" ON "Donation"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Session_userId_idx" ON "Session"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Post_parentId_createdAt_idx" ON "Post"("parentId", "createdAt" DESC); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Post_orgId_parentId_createdAt_idx" ON "Post"("orgId", "parentId", "createdAt" DESC); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Post_authorId_parentId_createdAt_idx" ON "Post"("authorId", "parentId", "createdAt" DESC); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Upvote_postId_idx" ON "Upvote"("postId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Tag_name_key" ON "Tag"("name"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_PostToTag_AB_unique" ON "_PostToTag"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_PostToTag_B_index" ON "_PostToTag"("B"); |
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,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
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