Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema syncing across Neon DB branches #413

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gt-codes
Copy link

@gt-codes gt-codes commented Jan 21, 2025

Description

Currently things in next-forge are set to yolo push which doesn't really align with the recommended approach. Here, we take advantage of GitHub Actions to sync changes across newly created Neon branches (thanks to the ▲Vercel <> Neon Marketplace Integration). The flow is simple:

  • Make your schema changes and run pnpm migrate
    • This will create a new migration in packages/database/prisma/migrations
  • Push your changes and create a PR
  • An action will run to find the Neon preview db that matches your current feature branch and apply any new migrations
  • Merge your PR and 2 things will happen:
    • A cleanup action will delete the preview db for the PR that was just closed
    • An action will apply schema migrations to your production Neon db. This action will also check if there is a _prisma_migrations table (you won't have this if you created a new project) and properly initialize or update your production db.

Related Issues

Closes #382

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation, if necessary.
  • I have added tests that prove my fix is effective or my feature works.
  • New and existing tests pass locally with my changes.

Screenshots (if applicable)

Copy link

vercel bot commented Jan 21, 2025

@gt-codes is attempting to deploy a commit to the Hayden Bleasel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-forge ❌ Failed (Inspect) Jan 21, 2025 9:59pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npx prisma db push -> dangerous
1 participant