How can I use Gitpod workspace snapshots to safely rollback a database schema change?
0 reputation · 28 Sept 2023, 05:38 UTC
I want to experiment with database schema migrations inside a Gitpod workspace that runs a PostgreSQL service defined in my gitpod.yml. Before applying a migration I would like to capture the exact state of the workspace—including the database volume—so that I can revert to that state if the migration introduces errors or leaves the database in an inconsistent condition.
I am unsure whether Gitpod workspace snapshots include attached service volumes by default, or if I need to configure additional settings to persist the database data. I also wonder how to trigger a snapshot automatically before a migration script runs and how to restore it later without manual intervention.
What is the recommended way to ensure a workspace snapshot safely records the database state, and how can I reliably rollback to that snapshot after a schema change?