This is a Nextjs website for GitAuto. It uses Vercel for deployment.
- Clone this repository
- Run
npm install
to install all the dependencies. Make sure you have Node.js installed. - Run
npm run dev
to start the development server.
- Set DATABASE_URL to production db in prisma/.env file.
- Run
npx prisma db pull
to pull the latest changes from the database. - Run
npx prisma generate
to generate the Prisma Client. This allows type safety when interacting with the database using prisma library. - Set DATABASE_URL to your chosen db to you want to update
- Run
npx prisma db push
to push the changes to the database.
- GRANT USAGE ON SCHEMA public TO service_role;
- GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON ALL TABLES IN SCHEMA public TO service_role;
- GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO service_role;
- Add changes to local prisma/schema.prisma file
- Run
npx prisma generate
to generate the new client - Run
npx prisma migrate dev --name <migration-name>
to create a new migration file - Run
npx prisma migrate dev
to apply the migration to the database in local andnpx prisma migrate deploy
for production.
If resetting db (ex with migrations) run the following to allow Service Role key access to the tables
GRANT USAGE ON SCHEMA public TO service_role;
GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON ALL TABLES IN SCHEMA public TO service_role;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO service_role;