From d05827960923dd90bbc957470f51d39611339976 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Sat, 17 Jun 2023 21:24:12 -0400 Subject: [PATCH] point prisma to vercel postgres --- .env.example | 8 +++++++- README.md | 2 +- pages/privacy.tsx | 6 +++--- prisma/migrations/20230618005755_init/migration.sql | 7 +++++++ prisma/migrations/migration_lock.toml | 3 +++ prisma/schema.prisma | 10 ++++++---- public/humans.txt | 1 - 7 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 prisma/migrations/20230618005755_init/migration.sql create mode 100644 prisma/migrations/migration_lock.toml diff --git a/.env.example b/.env.example index d63b8b3e..bee45834 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,15 @@ AIRTABLE_API_KEY= AIRTABLE_BASE= -DATABASE_URL= GH_PUBLIC_TOKEN= HCAPTCHA_SECRET_KEY= NEXT_PUBLIC_HCAPTCHA_SITE_KEY= +POSTGRES_DATABASE= +POSTGRES_HOST= +POSTGRES_PASSWORD= +POSTGRES_PRISMA_URL= +POSTGRES_URL= +POSTGRES_URL_NON_POOLING= +POSTGRES_USER= SENTRY_AUTH_TOKEN= SENTRY_DSN= SPOTIFY_CLIENT_ID= diff --git a/README.md b/README.md index 6474adad..2343dc5d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Licensed under CC-BY-4.0](https://img.shields.io/badge/license-CC--BY--4.0-fb7828?logo=creative-commons&logoColor=white)](LICENSE) [![GitHub repo size](https://img.shields.io/github/repo-size/jakejarvis/jarv.is?color=009cdf&label=repo%20size&logo=git&logoColor=white)](https://github.com/jakejarvis/jarv.is) -My humble abode on the World Wide Web, created and deployed using [Next.js](https://nextjs.org/), [Stitches](https://stitches.dev/), [PlanetScale](https://planetscale.com/), [Vercel](https://vercel.com/), [and more](https://jarv.is/humans.txt). +My humble abode on the World Wide Web, created and deployed using [Next.js](https://nextjs.org/), [Stitches](https://stitches.dev/), [Prisma](https://www.prisma.io/), [Vercel](https://vercel.com/), [and more](https://jarv.is/humans.txt). I keep an ongoing list of [post ideas](https://github.com/jakejarvis/jarv.is/issues/1) and [coding to-dos](https://github.com/jakejarvis/jarv.is/issues/714) as issues in this repo. Outside contributions, improvements, and/or corrections are welcome too! diff --git a/pages/privacy.tsx b/pages/privacy.tsx index 6d84f6d6..5a851e8c 100644 --- a/pages/privacy.tsx +++ b/pages/privacy.tsx @@ -48,9 +48,9 @@ const Privacy = () => {

A very simple hit counter on each blog post tallies an aggregate number of pageviews (i.e.{" "} - hits = hits + 1) in a PlanetScale SQL - database. Individual views and identifying (or non-identifying) details are{" "} - never stored or logged. + hits = hits + 1) in a{" "} + Vercel Postgres database. Individual views and + identifying (or non-identifying) details are never stored or logged.

diff --git a/prisma/migrations/20230618005755_init/migration.sql b/prisma/migrations/20230618005755_init/migration.sql new file mode 100644 index 00000000..9e46d1e5 --- /dev/null +++ b/prisma/migrations/20230618005755_init/migration.sql @@ -0,0 +1,7 @@ +-- CreateTable +CREATE TABLE "hits" ( + "slug" VARCHAR(128) NOT NULL, + "hits" INTEGER NOT NULL DEFAULT 1, + + CONSTRAINT "hits_pkey" PRIMARY KEY ("slug") +); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 00000000..fbffa92c --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -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" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index afbdb51a..b461b6aa 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,11 +1,13 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + previewFeatures = ["jsonProtocol"] } datasource db { - provider = "mysql" - url = env("DATABASE_URL") - relationMode = "prisma" + provider = "postgresql" + url = env("POSTGRES_PRISMA_URL") + directUrl = env("POSTGRES_URL_NON_POOLING") + shadowDatabaseUrl = env("POSTGRES_URL_NON_POOLING") } model hits { diff --git a/public/humans.txt b/public/humans.txt index 683197ed..0106ae38 100644 --- a/public/humans.txt +++ b/public/humans.txt @@ -32,7 +32,6 @@ - Vercel - Stitches - Prisma - - PlanetScale - Giscus - Fathom Analytics - ...and more: https://jarv.is/uses/