top | item 36414806

(no title)

swaraj | 2 years ago

I haven't used Codespaces, but how does this work with databases? A common problem we have during onboarding is getting your local database (MySQL) setup properly: run all the migrations => load some sample, de-identified, production-like data => update certain rows to allow for personal development (e.g. for our texting service, make sure you text your own phone number, instead of someone else's).

What's the workflow for this?

A related issue for us is being able to test another developer's pull request with database migrations without wiping out your current database state. Is there a Devpods workflow for this?

discuss

order

pistoriusp|2 years ago

We've built www.snaplet.dev to introduce the exact workflow that you're describing. Unfortunately we're PostgreSQL only at the moment.

We give you a serverless PostgreSQL database per branch in your code. [via Neon.tech] Each time you branch your code we grab the latest snapshot of your production database which is de-identified and transformed [Transformations are via TypeScript] and a subset of the original.

If a coworker and yourself are coding against the same branch you're coding against the same database.

Your devs only run a single command `snaplet dev` and all this happens automatically in the background.

swaraj|2 years ago

This looks amazing, we have written a similar script for both our local dev dbs as well as our staging env. Would love MySQL support

zoomzoom|2 years ago

This exact workflow is why we have integrated Cloud IDE with full-stack branch preview (both of which know about database seed/migrations) at Coherence (withcoherence.com). [disclaimer - I’m a cofounder]. You can also integrate other seeding tools like snaplet, mentioned in a sibling comment here, which is an awesome solution to this problem!

Would be happy to discuss getting a PoC setup to see if it helps in your case, or to answer any questions, feel free to reach out