From 971747a161f9167c4a18b70ec841b1db61070e50 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Mon, 1 Apr 2024 11:12:24 -0400 Subject: [PATCH] =?UTF-8?q?goodbye=20planetscale=20=F0=9F=AA=A6=20hello=20?= =?UTF-8?q?turso=20=F0=9F=91=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 10 +- .gitignore | 4 + README.md | 2 +- lib/helpers/prisma.ts | 12 +- next.config.mjs | 2 +- package.json | 3 + pages/privacy.tsx | 5 +- pnpm-lock.yaml | 216 ++++++++++++++++++ .../20240401150601_init/migration.sql | 5 + prisma/migrations/migration_lock.toml | 3 + prisma/schema.prisma | 10 +- public/humans.txt | 2 +- 12 files changed, 256 insertions(+), 18 deletions(-) create mode 100644 prisma/migrations/20240401150601_init/migration.sql create mode 100644 prisma/migrations/migration_lock.toml diff --git a/.env.example b/.env.example index 788bbc15..7df36c57 100644 --- a/.env.example +++ b/.env.example @@ -3,12 +3,10 @@ NEXT_PUBLIC_BASE_URL= # required. storage for hit counter endpoints at /api/count and /api/hits. -# currently uses MySQL, but this can be changed to use Postgres, SQLite, etc in prisma/schema.prisma. -# https://www.prisma.io/docs/orm/reference/connection-urls#examples -# https://planetscale.com/docs/concepts/connection-strings -# note: this might be automatically provided by a Vercel integration; see: https://vercel.com/integrations#databases -# vercel env pull .env.local --environment=production -DATABASE_URL= +# currently uses SQLite via Turso, but this can be changed to use MySQL, Postgres, etc in prisma/schema.prisma. +# https://docs.turso.tech/sdk/ts/orm/prisma +TURSO_DATABASE_URL= +TURSO_AUTH_TOKEN= # requred. used for /projects grid, built with SSG. only needs the "public_repo" scope since we don't need/want to # showcase any private repositories, obviously. diff --git a/.gitignore b/.gitignore index 852c823a..44dc23ff 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,9 @@ yarn.lock *.icloud .nosync +# development database +*.db +*.db-journal + # vercel .vercel diff --git a/README.md b/README.md index 9deb6727..455c334b 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/), [Prisma](https://www.prisma.io/), [Vercel](https://vercel.com/), [PlanetScale](https://planetscale.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/), [Turso](https://turso.tech/), [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/lib/helpers/prisma.ts b/lib/helpers/prisma.ts index 0c176fde..34095124 100644 --- a/lib/helpers/prisma.ts +++ b/lib/helpers/prisma.ts @@ -1,11 +1,21 @@ import { PrismaClient } from "@prisma/client"; +import { PrismaLibSQL } from "@prisma/adapter-libsql"; +import { createClient } from "@libsql/client"; // creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the // number of connection pools available (especially when hot reloading from `next dev`). // https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices const prismaClientSingleton = () => { - return new PrismaClient(); + const libsql = createClient({ + // TODO: use a local .db file for development. https://www.prisma.io/docs/orm/overview/databases/sqlite#connection-url + url: `${process.env.TURSO_DATABASE_URL}`, + authToken: `${process.env.TURSO_AUTH_TOKEN}`, + }); + + const adapter = new PrismaLibSQL(libsql); + + return new PrismaClient({ adapter }); }; declare global { diff --git a/next.config.mjs b/next.config.mjs index 38ca1238..8946d923 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,5 @@ // @ts-check -// eslint-disable import/no-anonymous-default-export +/* eslint-disable import/no-anonymous-default-export */ import config from "./lib/config/index.js"; diff --git a/package.json b/package.json index 8de37d73..d2591d14 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,17 @@ "build": "next build", "start": "next start", "lint": "next lint", + "typecheck": "tsc", "postinstall": "prisma generate" }, "dependencies": { "@giscus/react": "^3.0.0", "@hcaptcha/react-hcaptcha": "^1.10.1", + "@libsql/client": "^0.6.0", "@novnc/novnc": "1.4.0", "@octokit/graphql": "^8.0.1", "@octokit/graphql-schema": "^15.3.0", + "@prisma/adapter-libsql": "^5.11.0", "@prisma/client": "^5.11.0", "@react-spring/web": "^9.7.3", "@stitches/react": "1.3.1-1", diff --git a/pages/privacy.tsx b/pages/privacy.tsx index aa84c851..93cdc926 100644 --- a/pages/privacy.tsx +++ b/pages/privacy.tsx @@ -48,9 +48,8 @@ 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{" "} - database. Individual views and identifying (or non-identifying) details are{" "} - never stored or logged. + hits = hits + 1) in a Turso SQLite database. + Individual views and identifying (or non-identifying) details are never stored or logged.

diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74a5d3ab..fc9d1ed7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ dependencies: '@hcaptcha/react-hcaptcha': specifier: ^1.10.1 version: 1.10.1(react-dom@18.2.0)(react@18.2.0) + '@libsql/client': + specifier: ^0.6.0 + version: 0.6.0 '@novnc/novnc': specifier: 1.4.0 version: 1.4.0 @@ -20,6 +23,9 @@ dependencies: '@octokit/graphql-schema': specifier: ^15.3.0 version: 15.3.0 + '@prisma/adapter-libsql': + specifier: ^5.11.0 + version: 5.11.0(@libsql/client@0.6.0) '@prisma/client': specifier: ^5.11.0 version: 5.11.0(prisma@5.11.0) @@ -576,6 +582,106 @@ packages: eslint: 8.57.0 dev: true + /@libsql/client@0.6.0: + resolution: {integrity: sha512-qhQzTG/y2IEVbL3+9PULDvlQFWJ/RnjFXECr/Nc3nRngGiiMysDaOV5VUzYk7DulUX98EA4wi+z3FspKrUplUA==} + dependencies: + '@libsql/core': 0.6.0 + '@libsql/hrana-client': 0.6.0 + js-base64: 3.7.7 + libsql: 0.3.10 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@libsql/core@0.6.0: + resolution: {integrity: sha512-affAB8vSqQwqI9NBDJ5uJCVaHoOAS2pOpbv1kWConh1SBbmJBnHHd4KG73RAJ2sgd2+NbT9WA+XJBqxgp28YSw==} + dependencies: + js-base64: 3.7.7 + dev: false + + /@libsql/darwin-arm64@0.3.10: + resolution: {integrity: sha512-RaexEFfPAFogd6dJlqkpCkTxdr6K14Z0286lodIJ8Ny77mWuWyBkWKxf70OYWXXAMxMJFUW+6al1F3/Osf/pTg==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@libsql/darwin-x64@0.3.10: + resolution: {integrity: sha512-SNVN6n4qNUdMW1fJMFmx4qn4n5RnXsxjFbczpkzG/V7m/5VeTFt1chhGcrahTHCr3+K6eRJWJUEQHRGqjBwPkw==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@libsql/hrana-client@0.6.0: + resolution: {integrity: sha512-k+fqzdjqg3IvWfKmVJK5StsbjeTcyNAXFelUbXbGNz3yH1gEVT9mZ6kmhsIXP30ZSyVV0AE1Gi25p82mxC9hwg==} + dependencies: + '@libsql/isomorphic-fetch': 0.2.1 + '@libsql/isomorphic-ws': 0.1.5 + js-base64: 3.7.7 + node-fetch: 3.3.2 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@libsql/isomorphic-fetch@0.2.1: + resolution: {integrity: sha512-Sv07QP1Aw8A5OOrmKgRUBKe2fFhF2hpGJhtHe3d1aRnTESZCGkn//0zDycMKTGamVWb3oLYRroOsCV8Ukes9GA==} + dev: false + + /@libsql/isomorphic-ws@0.1.5: + resolution: {integrity: sha512-DtLWIH29onUYR00i0GlQ3UdcTRC6EP4u9w/h9LxpUZJWRMARk6dQwZ6Jkd+QdwVpuAOrdxt18v0K2uIYR3fwFg==} + dependencies: + '@types/ws': 8.5.10 + ws: 8.16.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@libsql/linux-arm64-gnu@0.3.10: + resolution: {integrity: sha512-2uXpi9d8qtyIOr7pyG4a88j6YXgemyIHEs2Wbp+PPletlCIPsFS+E7IQHbz8VwTohchOzcokGUm1Bc5QC+A7wg==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@libsql/linux-arm64-musl@0.3.10: + resolution: {integrity: sha512-72SN1FUavLvzHddCS861ynSpQndcW5oLGKA3U8CyMfgIZIwJAPc7+48Uj1plW00htXBx4GBpcntFp68KKIx3YQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@libsql/linux-x64-gnu@0.3.10: + resolution: {integrity: sha512-hXyNqVRi7ONuyWZ1SX6setxL0QaQ7InyS3bHLupsi9s7NpOGD5vcpTaYicJOqmIIm+6kt8vJfmo7ZxlarIHy7Q==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@libsql/linux-x64-musl@0.3.10: + resolution: {integrity: sha512-kNmIRxomVwt9S+cLyYS497F/3gXFF4r8wW12YSBQgxG75JYft07AHVd8J7HINg+oqRkLzT0s+mVX5dM6nk68EQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@libsql/win32-x64-msvc@0.3.10: + resolution: {integrity: sha512-c/6rjdtGULKrJkLgfLobFefObfOtxjXGmCfPxv6pr0epPCeUEssfDbDIeEH9fQUgzogIMWEHwT8so52UJ/iT1Q==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true + /@lit-labs/ssr-dom-shim@1.2.0: resolution: {integrity: sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==} dev: false @@ -620,6 +726,10 @@ packages: react: 18.2.0 dev: false + /@neon-rs/load@0.0.4: + resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==} + dev: false + /@next/env@14.1.3: resolution: {integrity: sha512-VhgXTvrgeBRxNPjyfBsDIMvgsKDxjlpw4IAUsHCX8Gjl1vtHUYRT3+xfQ/wwvLPDd/6kqfLqk9Pt4+7gysuCKQ==} dev: false @@ -825,6 +935,16 @@ packages: engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} dev: true + /@prisma/adapter-libsql@5.11.0(@libsql/client@0.6.0): + resolution: {integrity: sha512-Q2GxamPew8AviqO/6kQskqvuh4Y0bGj8hbMefjD2+3Q3geNfE/W6XbfH0tHLOK6gQgawoAONrRgbRfoJPzUvQA==} + peerDependencies: + '@libsql/client': ^0.3.5 || ^0.4.0 || ^0.5.0 + dependencies: + '@libsql/client': 0.6.0 + '@prisma/driver-adapter-utils': 5.11.0 + async-mutex: 0.4.1 + dev: false + /@prisma/client@5.11.0(prisma@5.11.0): resolution: {integrity: sha512-SWshvS5FDXvgJKM/a0y9nDC1rqd7KG0Q6ZVzd+U7ZXK5soe73DJxJJgbNBt2GNXOa+ysWB4suTpdK5zfFPhwiw==} engines: {node: '>=16.13'} @@ -841,6 +961,12 @@ packages: /@prisma/debug@5.11.0: resolution: {integrity: sha512-N6yYr3AbQqaiUg+OgjkdPp3KPW1vMTAgtKX6+BiB/qB2i1TjLYCrweKcUjzOoRM5BriA4idrkTej9A9QqTfl3A==} + /@prisma/driver-adapter-utils@5.11.0: + resolution: {integrity: sha512-C2Qa/HZXZNwDBZCHJxlV4eibqXakbOBLd+mUeNCxSfaM8yi8Qi8zToN8Kb3M60Kr1ymr+tzzw/wVqYIfIfUiXw==} + dependencies: + '@prisma/debug': 5.11.0 + dev: false + /@prisma/engines-version@5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102: resolution: {integrity: sha512-WXCuyoymvrS4zLz4wQagSsc3/nE6CHy8znyiMv8RKazKymOMd5o9FP5RGwGHAtgoxd+aB/BWqxuP/Ckfu7/3MA==} @@ -1094,6 +1220,12 @@ packages: /@types/unist@3.0.2: resolution: {integrity: sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==} + /@types/ws@8.5.10: + resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} + dependencies: + '@types/node': 20.12.2 + dev: false + /@typescript-eslint/eslint-plugin@7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-yHMQ/oFaM7HZdVrVm/M2WHaNPgyuJH4WelkSVEWSSsir34kxW2kDJCxlXRhhGWEsMN0WAW/vLpKfKVcm8k+MPw==} engines: {node: ^18.18.0 || >=20.0.0} @@ -1464,6 +1596,12 @@ packages: hasBin: true dev: false + /async-mutex@0.4.1: + resolution: {integrity: sha512-WfoBo4E/TbCX1G95XTjbWTE3X2XLG0m1Xbv2cwOtuPdyH9CZvnaA5nCt1ucjaKEgW2A5IF71hxrRhr83Je5xjA==} + dependencies: + tslib: 2.6.2 + dev: false + /asynciterator.prototype@1.0.0: resolution: {integrity: sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==} dependencies: @@ -1717,6 +1855,11 @@ packages: resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} dev: true + /data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + dev: false + /date-fns@2.30.0: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} @@ -1796,6 +1939,11 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + /detect-libc@2.0.2: + resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} + engines: {node: '>=8'} + dev: false + /detect-libc@2.0.3: resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} engines: {node: '>=8'} @@ -2488,6 +2636,14 @@ packages: xml-js: 1.6.11 dev: false + /fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + dev: false + /file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -2541,6 +2697,13 @@ packages: signal-exit: 4.1.0 dev: true + /formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + dependencies: + fetch-blob: 3.2.0 + dev: false + /formik@2.4.5(react@18.2.0): resolution: {integrity: sha512-Gxlht0TD3vVdzMDHwkiNZqJ7Mvg77xQNfmBRrNtvzcHZs72TJppSTDKHpImCMJZwcWPBJ8jSQQ95GJzXFf1nAQ==} peerDependencies: @@ -3261,6 +3424,10 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /js-base64@3.7.7: + resolution: {integrity: sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==} + dev: false + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -3345,6 +3512,23 @@ packages: type-check: 0.4.0 dev: true + /libsql@0.3.10: + resolution: {integrity: sha512-/8YMTbwWFPmrDWY+YFK3kYqVPFkMgQre0DGmBaOmjogMdSe+7GHm1/q9AZ61AWkEub/vHmi+bA4tqIzVhKnqzg==} + cpu: [x64, arm64, wasm32] + os: [darwin, linux, win32] + dependencies: + '@neon-rs/load': 0.0.4 + detect-libc: 2.0.2 + optionalDependencies: + '@libsql/darwin-arm64': 0.3.10 + '@libsql/darwin-x64': 0.3.10 + '@libsql/linux-arm64-gnu': 0.3.10 + '@libsql/linux-arm64-musl': 0.3.10 + '@libsql/linux-x64-gnu': 0.3.10 + '@libsql/linux-x64-musl': 0.3.10 + '@libsql/win32-x64-msvc': 0.3.10 + dev: false + /lilconfig@3.0.0: resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==} engines: {node: '>=14'} @@ -4524,6 +4708,20 @@ packages: '@types/nlcst': 1.0.4 dev: false + /node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + dev: false + + /node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + dev: false + /nodemailer@6.9.13: resolution: {integrity: sha512-7o38Yogx6krdoBf3jCAqnIN4oSQFx+fMa0I7dK1D+me9kBxx12D+/33wSb+fhOCtIxvYJ+4x4IMEhmhCKfAiOA==} engines: {node: '>=6.0.0'} @@ -6153,6 +6351,11 @@ packages: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} dev: false + /web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + dev: false + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -6240,6 +6443,19 @@ packages: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true + /ws@8.16.0: + resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /xml-js@1.6.11: resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==} hasBin: true diff --git a/prisma/migrations/20240401150601_init/migration.sql b/prisma/migrations/20240401150601_init/migration.sql new file mode 100644 index 00000000..a11efc3c --- /dev/null +++ b/prisma/migrations/20240401150601_init/migration.sql @@ -0,0 +1,5 @@ +-- CreateTable +CREATE TABLE "hits" ( + "slug" TEXT NOT NULL PRIMARY KEY, + "hits" INTEGER NOT NULL DEFAULT 1 +); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 00000000..e5e5c470 --- /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 = "sqlite" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index afbdb51a..455cfa9d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,14 +1,14 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] } datasource db { - provider = "mysql" - url = env("DATABASE_URL") - relationMode = "prisma" + provider = "sqlite" + url = env("TURSO_DATABASE_URL") } model hits { - slug String @id @db.VarChar(128) + slug String @id hits Int @default(1) } diff --git a/public/humans.txt b/public/humans.txt index 2b0a9d99..363ea2d1 100644 --- a/public/humans.txt +++ b/public/humans.txt @@ -32,7 +32,7 @@ - Vercel - Stitches - Prisma - - PlanetScale + - Turso - Giscus - Resend - Fathom Analytics