Add prisma DB model

This commit is contained in:
Sacha Weatherstone 2021-12-21 22:28:51 +11:00
parent 417b8fd2be
commit 180e7f2060
6 changed files with 1233 additions and 853 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ node_modules/
build build
.vercel .vercel
.DS_Store .DS_Store
.env

1
prisma/.env.example Normal file
View file

@ -0,0 +1 @@
DATABASE_URL=postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=SCHEMA

61
prisma/schema.prisma Normal file
View file

@ -0,0 +1,61 @@
datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model Author {
id String @id @default(cuid())
githubUsername String
bio String
showcase Showcase[]
}
model Showcase {
id String @id @default(cuid())
title String
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tags ShowcaseTag[]
nodes Node[]
materials Material[]
author Author @relation(fields: [authorId], references: [id])
authorId String
}
model Material {
id String @id @default(cuid())
name String
details String
image String
url String
showcases Showcase[]
}
model Node {
id String @id @default(cuid())
latitude String
longitude String
showcase Showcase @relation(fields: [showcaseId], references: [id])
showcaseId String
}
model ShowcaseTag {
id String @id @default(cuid())
label String
description String
color String
showcase Showcase @relation(fields: [showcaseId], references: [id])
showcaseId String
}

View file

@ -12,15 +12,19 @@
}, },
"dependencies": { "dependencies": {
"@algolia/client-search": "^4.11.0", "@algolia/client-search": "^4.11.0",
"@docusaurus/core": "^2.0.0-beta.9", "@docusaurus/core": "^2.0.0-beta.13",
"@docusaurus/plugin-ideal-image": "^2.0.0-beta.9", "@docusaurus/plugin-ideal-image": "^2.0.0-beta.13",
"@docusaurus/preset-classic": "^2.0.0-beta.9", "@docusaurus/preset-classic": "^2.0.0-beta.13",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^1.6.22",
"esbuild-loader": "^2.16.0", "@prisma/client": "^3.6.0",
"@supabase/supabase-js": "^1.28.6",
"esp-web-flasher": "^4.0.0",
"prisma": "^3.6.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-icons": "^4.3.1", "react-icons": "^4.3.1",
"swr": "^1.1.0", "react-json-pretty": "^2.2.0",
"swr": "^1.1.1",
"url-search-params-polyfill": "^8.1.1" "url-search-params-polyfill": "^8.1.1"
}, },
"browserslist": { "browserslist": {
@ -36,9 +40,10 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^2.0.0-beta.9", "@docusaurus/module-type-aliases": "^2.0.0-beta.13",
"@tsconfig/docusaurus": "^1.0.4", "@tsconfig/docusaurus": "^1.0.4",
"@types/node": "^16.11.12", "@types/node": "^17.0.2",
"typescript": "^4.5.2" "@types/w3c-web-serial": "^1.0.2",
"typescript": "^4.5.4"
} }
} }

View file

@ -0,0 +1,3 @@
import { PrismaClient } from '@prisma/client';
export const prisma = new PrismaClient();

File diff suppressed because it is too large Load diff