1

I came across the Prompt Migrations concept — treating prompts like DB migrations, versioned and rollable — and it clicked immediately. But the implementation is where I’m stuck. My App\Services are a mess of heredoc strings right now.

The tension I keep running into: if I store prompts in the database, I get instant rollbacks and A/B testing, but my pull requests become meaningless for reviewing prompt changes. Nobody’s going to catch a bad system instruction in a migration file. On the other hand, keeping everything in Git means a full deployment to fix a single hallucination in production. That’s a painful loop when you’re iterating on prompts daily.
I tried a PromptMigration class that seeds the DB on deploy, but it felt like I was just duplicating the problem. Specifically around this pattern from the article:
return Prompt::get('translator')->version('v2')->execute($data);
Two things I can’t settle on:

Should the version string be hardcoded in the Service layer, or should the Service just request the “active” version and let the DB decide? Hardcoding feels brittle; letting the DB decide feels like hidden state.
Local dev is a nightmare with this. If a teammate changes a prompt in their local DB, my environment doesn’t have that version and things break silently. Is there a sane way to sync these — something like php artisan migrate but for prompts?

I want prompts in Git for the PR process, but I need the app to hot-swap versions in production without a merge. Is that achievable cleanly, or am I asking for two things that fundamentally conflict?

Dewald Hugo Answered question