Help with best practices
Hello team, I am new to the concept of branching on DBs and I would appreciate some guidance on guidelines.
In our app, we
- follow a trunk-based approach
- have 2 vercel apps (e.g.
project and project-staging) sharing the same codebase. one is for prod and one for staging/next. (as a reminder, with trunk-based approach you have only one branch + many feature branches, so having a permanent 'staging' branch is not allowed
- currently, I have manually created a DB branch from the root branch called staging and connected it to the staging project, whilst the root branch connects to the prod project.
here are my questions:
- if the staging DB is a clone of the production, then there would be cases where we risk unwanted effects on real users. For example, if I have a marketplace where Alice is selling a hat and I clone the production DB on staging to test by purchasing of that hat, (the real) Alice will receive a email notifying her about the sale of that item, even if that happened only on staging. What are good practices to avoid such cases?
- what is the best way to run a script against a newly branched DB? or every time a child is reset from the parent?
- in general, which are established best practices to better handle branches of production databases?1 Reply
other-emerald•12mo ago
if the staging DB is a clone of the production, then there would be cases where we risk unwanted effects on real users. For example, if I have a marketplace where Alice is selling a hat and I clone the production DB on staging to test by purchasing of that hat, (the real) Alice will receive a email notifying her about the sale of that item, even if that happened only on staging. What are good practices to avoid such cases?You can create a
staging branch from your production database and then modify the data before creating branches from it
what is the best way to run a script against a newly branched DB? or every time a child is reset from the parent?What type of script would you like to run?