{"id":15450758,"url":"https://github.com/2color/ama-prisma","last_synced_at":"2025-04-13T11:52:17.405Z","repository":{"id":42885798,"uuid":"414716103","full_name":"2color/ama-prisma","owner":"2color","description":"Voice Ask me anything app. Built with Next.js, Prisma, TypeScript, Tailwind, React Query, MediaRecorder API, and Cloudinary.","archived":false,"fork":false,"pushed_at":"2025-03-24T20:11:08.000Z","size":28522,"stargazers_count":25,"open_issues_count":11,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T16:03:32.712Z","etag":null,"topics":["database","mysql","nextjs","prisma","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2color.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-07T18:32:35.000Z","updated_at":"2024-10-16T08:46:47.000Z","dependencies_parsed_at":"2023-11-21T01:42:55.053Z","dependency_job_id":"2466bab9-1b2c-4c75-8736-1b84586105a2","html_url":"https://github.com/2color/ama-prisma","commit_stats":{"total_commits":2330,"total_committers":23,"mean_commits":"101.30434782608695","dds":0.6927038626609442,"last_synced_commit":"d70d0e3f9880731446313af62cd9eba8bf49b188"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2color%2Fama-prisma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2color%2Fama-prisma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2color%2Fama-prisma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2color%2Fama-prisma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2color","download_url":"https://codeload.github.com/2color/ama-prisma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710438,"owners_count":21149188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","mysql","nextjs","prisma","tailwindcss","typescript"],"created_at":"2024-10-01T21:19:02.144Z","updated_at":"2025-04-13T11:52:17.382Z","avatar_url":"https://github.com/2color.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prisma \u0026 Next.js - Ask Me Anything page\n\n\u003e [!CAUTION]\n\u003e This project hasn't been updated since PlanetScale removed their free plan. Therefore, I no longer host a working version.\n\u003e If time allows in the future, I'll switch this over to use [SQlite on Cloudflare D1](https://www.prisma.io/docs/orm/overview/databases/cloudflare-d1)\n\nAsk Me Anything App!\n\nBuilt with:\n\n- Prisma\n- Next.js\n- Tailwind\n- MySQL\n\nBased on Brian Lovin's old AMA page rebuilt with Prisma, MySQL, and Cloudinary.\n\n## Development\n\nClone the repository:\n\n`git clone git@github.com:2color/prisma-ama.git`\n\n`cd` into the directory:\n`cd prisma-ama`\n\nInstall dependencies:\n`npm i`\n\nStart the client:\n`npm run dev`\n\nOpen the site:\n`localhost:3000`\n\n## Migrating to PlanetScale from AWS RDS\n\n1. [PlanetScale import service](https://docs.planetscale.com/concepts/database-imports) intro\n1. Adjust the Prisma schema (with RDS MySQL) and set referential integrity to prisma\n\n   ```prisma\n   datasource db {\n     provider             = \"mysql\"\n     url                  = env(\"DATABASE_URL\")\n     referentialIntegrity = \"prisma\"\n   }\n\n   generator client {\n     provider        = \"prisma-client-js\"\n     previewFeatures = [\"dataProxy\", \"referentialIntegrity\"]\n   }\n   ```\n\n1. Create a migration (removing the foreign keys) with local DB: `npx prisma migrate dev`\n1. Run the migration against the **RDS MySQL Production DB** removing foreign keys in preparation for the migration\n1. Setup the PlanetScale import\n1. Add the imported PlanetScale DB to the [Prisma Data Platform](https://cloud.prisma.io) and verify using the Data Browser that the data has been successfully replicated.\n1. Switch PlanetScale DB to **primary**\n1. Update the production `DATABASE_URL` env var on Vercel to use the PlanetScale DB\n1. (optional) Add indices for foreign keys ([See comment](https://github.com/prisma/prisma/issues/7292#issuecomment-963118192))\n\n\n\n## Migrations on PlanetScale\n\n### Initial migration\n1. Create a shadow DB branch: `pscale branch create prisma-playground shadow`\n1. Set `SHADOW_DATABASE_URL` in `.env` and configure the Prisma schema\n1. Create migration `npx prisma migrate dev`\n1. Promote branch to be the main `pscale branch promote prisma-playground main`\n\n### Further migrations\n\n1. Create a dev branch `pscale branch create prisma-playground add-subtitle-to-posts`\n1. `pscale connect prisma-playground add-subtitle-to-posts --port 3309`\n1. `pscale connect prisma-playground shadow --port 3310`\n    ```\n    DATABASE_URL=\"mysql://root@127.0.0.1:3309/prisma-playground\"\n    SHADOW_DATABASE_URL=\"mysql://root@127.0.0.1:3310/prisma-playground\"\n    ```\n1. Add changes to Prisma schema\n1. Create migration: `npx prisma migrate dev`\n1. `pscale deploy-request create prisma-playground add-subtitle-to-posts`\n\n\n\n\n\n\n\n\n\n\n## Database commands\n\n### Connect to local mysql\n\n`mysql --protocol TCP -h localhost -P 3306 -u root -p prisma-ama`\n\n### Dump DB\n\n`mysqldump --host eu-central-1.rds.amazonaws.com --user admin -p DB_NAME --no-create-db --set-gtid-purged=OFF \u003e dump-7-12-2021.sql`\n\n### Import DB\n\n`mysql --protocol TCP -h localhost -P 3306 -u root -p prisma-ama \u003c dump-7-12-2021.sql`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2color%2Fama-prisma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2color%2Fama-prisma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2color%2Fama-prisma/lists"}