-
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.
- Loading branch information
1 parent
7f90c23
commit 5b13898
Showing
4 changed files
with
125 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
-- 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 "Session" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"sessionToken" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"emailVerified" DATETIME, | ||
"image" TEXT, | ||
"theme" TEXT NOT NULL DEFAULT 'default', | ||
"lightTheme" TEXT NOT NULL DEFAULT 'dark', | ||
"timezone" TEXT NOT NULL DEFAULT 'America/New_York', | ||
"notionToken" TEXT | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VerificationToken" ( | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Habit" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"emoji" TEXT NOT NULL DEFAULT '🔥', | ||
"userId" TEXT NOT NULL, | ||
"frequency" INTEGER NOT NULL DEFAULT 1, | ||
"goal" INTEGER NOT NULL DEFAULT 1, | ||
"inversedGoal" BOOLEAN NOT NULL DEFAULT false, | ||
"order" INTEGER NOT NULL DEFAULT 0, | ||
"archived" BOOLEAN NOT NULL DEFAULT false | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "HabitLog" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"habitId" TEXT NOT NULL, | ||
"date" DATETIME NOT NULL, | ||
"completed" BOOLEAN NOT NULL DEFAULT false, | ||
"weekKey" TEXT NOT NULL DEFAULT '' | ||
); | ||
|
||
-- 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 "Session_sessionToken_key" ON "Session"("sessionToken"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Session_userId_idx" ON "Session"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- 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 "Habit_userId_idx" ON "Habit"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "HabitLog_habitId_idx" ON "HabitLog"("habitId"); |
18 changes: 18 additions & 0 deletions
18
prisma/migrations/20240413234119_add_created_at_v2_to_habit_logs/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,18 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_HabitLog" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"createdAtV2" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL, | ||
"habitId" TEXT NOT NULL, | ||
"date" DATETIME NOT NULL, | ||
"completed" BOOLEAN NOT NULL DEFAULT false, | ||
"weekKey" TEXT NOT NULL DEFAULT '' | ||
); | ||
INSERT INTO "new_HabitLog" ("completed", "createdAt", "date", "habitId", "id", "updatedAt", "weekKey") SELECT "completed", "createdAt", "date", "habitId", "id", "updatedAt", "weekKey" FROM "HabitLog"; | ||
DROP TABLE "HabitLog"; | ||
ALTER TABLE "new_HabitLog" RENAME TO "HabitLog"; | ||
CREATE INDEX "HabitLog_habitId_idx" ON "HabitLog"("habitId"); | ||
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