Skip to content

Commit

Permalink
Breaking 1.0.0 release: non-backwards compatible schema change.
Browse files Browse the repository at this point in the history
  • Loading branch information
RickCarlino committed Jun 7, 2023
1 parent 8acbf7a commit c40385b
Show file tree
Hide file tree
Showing 7 changed files with 10,725 additions and 10,764 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "temp-prisma",
"version": "0.2.0-alpha",
"version": "1.0.0-alpha",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"build": "next build",
"dev": "next dev",
Expand Down
35 changes: 0 additions & 35 deletions prisma/migrations/20230312002211_init/migration.sql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
-- CreateTable
CREATE TABLE "Phrase" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"ko" TEXT NOT NULL,
"en" TEXT NOT NULL,
"next_quiz_type" TEXT,
"last_win_at" DATETIME,
"total_attempts" INTEGER NOT NULL DEFAULT 0,
"loss_count" INTEGER NOT NULL DEFAULT 0,
"win_count" INTEGER NOT NULL DEFAULT 0,
"win_percentage" REAL NOT NULL DEFAULT 0,
"flagged" BOOLEAN NOT NULL DEFAULT false,
"userId" TEXT NOT NULL,
CONSTRAINT "Phrase_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL PRIMARY KEY,
Expand Down Expand Up @@ -40,6 +56,9 @@ CREATE TABLE "VerificationToken" (
"expires" DATETIME NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "Phrase_ko_key" ON "Phrase"("ko");

-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");

Expand Down
18 changes: 3 additions & 15 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ datasource db {
url = env("DATABASE_URL")
}

model Word {
id Int @id @default(autoincrement())
ko String @unique
en String
known Boolean @default(false)
reviewed Boolean @default(false)
}

model Phrase {
id Int @id @default(autoincrement())
ko String @unique
Expand All @@ -29,13 +21,8 @@ model Phrase {
win_count Int @default(0)
win_percentage Float @default(0)
flagged Boolean @default(false)
}

model Note {
id Int @id @default(autoincrement())
value String
sourceTable String
sourceId Int
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model Account {
Expand Down Expand Up @@ -73,6 +60,7 @@ model User {
image String?
accounts Account[]
sessions Session[]
phrases Phrase[]
}

model VerificationToken {
Expand Down
Loading

0 comments on commit c40385b

Please sign in to comment.