BuidlGuidl / hackathon-starter-kit

https://extensions-hackathon.vercel.app
MIT License
6 stars 1 forks source link

Switch to migrations #58

Closed carletex closed 2 months ago

carletex commented 2 months ago

No rush on this, just want to open the conversation... Thinking about future projects.


Now that we have a live database, just wanted to see what it looked like to switch to a migration model (instead of just drizzle-kit push which is meant for prototyping).

A few nice to haves (ToDO for future PRs?):

One thing that I don't like is that you always get this message after drizzle-kit migrate

image

Doesn't show which migrations were applied and/or if there is no pending migrations. I think Prisma does this better.

vercel[bot] commented 2 months ago

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

Name Status Preview Comments Updated (UTC)
extensions-hackathon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 11:00am
damianmarti commented 2 months ago

No rush on this, just want to open the conversation... Thinking about future projects.

Now that we have a live database, just wanted to see what it looked like to switch to a migration model (instead of just drizzle-kit push which is meant for prototyping).

A few nice to haves (ToDO for future PRs?):

  • Seed: don't run if it's a PROD database (to avoid deleting tables). Maybe we can have a --force flag. I believe Shiv implemented this on grants.
  • Integrate this on the Vercel CI/CD workflow (run migrations on deploy for the main branch). We might need a staging database? So the preview deployments don't run the migrations on the live database.

One thing that I don't like is that you always get this message after drizzle-kit migrate

image

Doesn't show which migrations were applied and/or if there is no pending migrations. I think Prisma does this better.

Now the seed script is using the config from development https://github.com/BuidlGuidl/extensions-hackathon/blob/main/packages/nextjs/services/database/seed.ts#L8

A staging server will be useful but for now, we can test locally.