Skip to content

Commit

Permalink
Add PrismaJS
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-m-2983 committed Jul 10, 2024
1 parent a144a56 commit c0194f7
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ next-env.d.ts

# Diagrams and Drawings
*.xcf
*.png
*.png

# Prisma Database
prisma/dev*
84 changes: 82 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/notifications": "^7.6.2",
"@mantine/nprogress": "^7.6.2",
"@mantine/tiptap": "^7.6.2",
"@prisma/client": "^5.16.2",
"@tabler/icons-react": "^3.1.0",
"@tiptap/extension-link": "^2.2.4",
"@tiptap/react": "^2.2.4",
Expand All @@ -47,6 +48,7 @@
"postcss": "^8.4.35",
"postcss-preset-mantine": "^1.13.0",
"postcss-simple-vars": "^7.0.1",
"prisma": "^5.16.2",
"typescript": "^5",
"webpack": "^5.91.0"
}
Expand Down
29 changes: 29 additions & 0 deletions prisma/migrations/20240710193430_initial_migration/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- CreateTable
CREATE TABLE "Team" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL
);

-- CreateTable
CREATE TABLE "Entry" (
"id" TEXT NOT NULL PRIMARY KEY,
"type" TEXT NOT NULL,
"teamNumber" INTEGER NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Entry_teamNumber_fkey" FOREIGN KEY ("teamNumber") REFERENCES "Team" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "Image" (
"id" TEXT NOT NULL PRIMARY KEY,
"uploadedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

-- CreateIndex
CREATE UNIQUE INDEX "Team_id_key" ON "Team"("id");

-- CreateIndex
CREATE UNIQUE INDEX "Entry_id_key" ON "Entry"("id");

-- CreateIndex
CREATE UNIQUE INDEX "Image_id_key" ON "Image"("id");
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
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"
31 changes: 31 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "sqlite"
url = "file:./dev.db"
}

model Team {
id Int @id @unique
name String
entries Entry[]
}

model Entry {
id String @id @unique @default(cuid())
type String
teamNumber Int
team Team @relation(fields: [teamNumber], references: [id], onUpdate: Cascade, onDelete: Cascade)
createdAt DateTime @default(now())
}

model Image {
id String @id @unique @default(cuid())
uploadedAt DateTime @default(now())
}

0 comments on commit c0194f7

Please sign in to comment.