Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • open-source/challenges/nextjs-prisma-graphql-todolist
1 result
Show changes
Commits on Source (2)
......@@ -25,7 +25,19 @@ This is a [nextjs](https://nextjs.org/) project with
- [nexus-plugin-prisma](https://nexusjs.org/docs/plugins/prisma/overview) to derive graphql types from the prisma schema
- [styled-components](https://github.com/styled-components/styled-components) for styling
### getting started
### Requirements
- [Node](https://nodejs.org/en/)
- [yarn](https://yarnpkg.com/)
- [Docker](https://www.docker.com/)
### Getting started
run `yarn` to install all deps
run `docker-compose up` to start up the postgre db
run `yarn prisma migrate up` to apply the migrations
run `yarn dev` to run it locally on [localhost:3000](http://localhost:3000)
......@@ -36,7 +48,7 @@ You need to define some env vars, see [.env.template](.env.template).
You additionaly need to create oauth credentials to signin with google (https://console.cloud.google.com/apis/dashboard)
You can also replace
### db schema changes
### DB schema changes
edit [schema.prisma](prisma/schema.prisma) to adjust the schema.
Make sure to use the Prisma vscode extension for formatting, syntax highlighting
......
version: "3.1"
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: my-first-starter-project
ports:
- "5432:5432"
adminer:
image: adminer
ports:
- 8080:8080
\ No newline at end of file
......@@ -15,7 +15,7 @@ CREATE TABLE "Account" (
"oauth_token_secret" TEXT,
"oauth_token" TEXT,
PRIMARY KEY ("id")
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
);
-- CreateTable
......@@ -25,7 +25,7 @@ CREATE TABLE "Session" (
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);
-- CreateTable
......@@ -36,7 +36,7 @@ CREATE TABLE "User" (
"emailVerified" TIMESTAMP(3),
"image" TEXT,
PRIMARY KEY ("id")
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
......@@ -47,22 +47,22 @@ CREATE TABLE "VerificationToken" (
);
-- CreateIndex
CREATE UNIQUE INDEX "Account.provider_providerAccountId_unique" ON "Account"("provider", "providerAccountId");
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
-- CreateIndex
CREATE UNIQUE INDEX "Session.sessionToken_unique" ON "Session"("sessionToken");
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken.token_unique" ON "VerificationToken"("token");
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken.identifier_token_unique" ON "VerificationToken"("identifier", "token");
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- AddForeignKey
ALTER TABLE "Account" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
import { extendType, objectType, queryType } from "nexus";
import { extendType, objectType } from "nexus";
export const User = objectType({
name: "User",
......