forked from chandanck22/100xdevs_2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1263e34
commit e098173
Showing
8 changed files
with
96 additions
and
22 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
node_modules | ||
dist | ||
.wrangler | ||
.dev.vars | ||
.env | ||
wrangler.toml | ||
|
||
# Change them to your taste: | ||
package-lock.json | ||
|
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
26 changes: 26 additions & 0 deletions
26
0-1/week13/blogosphere/backend/prisma/migrations/20240323113632_init_schema/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,26 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"name" TEXT, | ||
"password" TEXT NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Post" ( | ||
"id" TEXT NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"published" BOOLEAN NOT NULL DEFAULT false, | ||
"authorId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Post_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
3 changes: 3 additions & 0 deletions
3
0-1/week13/blogosphere/backend/prisma/migrations/migration_lock.toml
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 = "postgresql" |
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,31 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? | ||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model User { | ||
id String @id @default(uuid()) | ||
email String @unique | ||
name String? | ||
password String | ||
posts Post[] | ||
} | ||
|
||
model Post { | ||
id String @id @default(uuid()) | ||
title String | ||
content String | ||
published Boolean @default(false) | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId String | ||
} |
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 |
---|---|---|
@@ -1,18 +1,5 @@ | ||
name = "backend" | ||
compatibility_date = "2023-12-01" | ||
|
||
# [vars] | ||
# MY_VAR = "my-variable" | ||
|
||
# [[kv_namespaces]] | ||
# binding = "MY_KV_NAMESPACE" | ||
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | ||
|
||
# [[r2_buckets]] | ||
# binding = "MY_BUCKET" | ||
# bucket_name = "my-bucket" | ||
|
||
# [[d1_databases]] | ||
# binding = "DB" | ||
# database_name = "my-database" | ||
# database_id = "" | ||
[vars] | ||
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGlfa2V5IjoiZTYxNDdkZTYtMDBiNi00MmZlLTk2ZGYtOTQ2ZjNkNDM5OGFmIiwidGVuYW50X2lkIjoiOWZlMGJlMjM2ZTk5ZGNjOTRhMzk0ZmI5ZTg2YWZkOTM0N2FjNDAyMjFhYjU1ZDg4NGQwZDgxNGY0ZWM5NGQ4YiIsImludGVybmFsX3NlY3JldCI6IjAwNDNjOGVhLTc0NDQtNDlmZS04OTAwLTMxMzNkNGIwNmY4ZiJ9.nzyOiAlvKo4cu1DamwHJOmKlr_QvQvzHjvrFwES-LnQ" |