@@ -660,22 +660,33 @@ <h2 id="transactions">🔁 Transactions</h2>
660660< span class ="k "> VACUUM</ span >
661661</ code > </ pre > </ div >
662662< h2 id ="suggested-file-layout "> Suggested File Layout</ h2 >
663- < p > SuperStack doesn't require any file names or layout, that's up to you.</ p >
664- < p > But here's one you might use while developing (pre-production):</ p >
663+ < p > SuperStack doesn’t enforce any particular migration file names or layout —
664+ you’re free to organise them however you like.</ p >
665+ < p > Here’s a simple structure you might adopt during development (before
666+ production):</ p >
665667< div class ="highlight "> < pre > < span > </ span > < code > 01-extensions.sql
66666802-create_auth_schema.sql (if using PostgREST for auth)
66766903-create_api_schema.sql
66867004-roles.sql
66967105-grants.sql
670672</ code > </ pre > </ div >
671- < p > During development, make changes and:</ p >
673+ < p > While developing, you can reset and rebuild the database from scratch as often
674+ as needed:</ p >
672675< div class ="highlight "> < pre > < span > </ span > < code > docker< span class ="w "> </ span > compose< span class ="w "> </ span > down< span class ="w "> </ span > --volumes< span class ="p "> ;</ span > < span class ="w "> </ span > docker< span class ="w "> </ span > compose< span class ="w "> </ span > up< span class ="w "> </ span > -d
673676</ code > </ pre > </ div >
674- < p > Once the app's reached production (or some other environment), you can no
675- longer keep recreating the database from scratch. Add smaller migrations from
676- < code > 06-</ code > onwards, and use < code > bin/postgres migrate</ code > (that's a shortcut you can use
677- locally, on other environments the < code > bin/postgres</ code > script isn't there so use
678- < code > docker compose exec postgres migrate</ code > ).</ p >
677+ < p > Once you’ve deployed to production (or another persistent environment), avoid
678+ recreating the database. Instead:</ p >
679+ < ul >
680+ < li > Add new migrations starting from < code > 06-...</ code > onwards.</ li >
681+ < li > Apply them with:</ li >
682+ </ ul >
683+ < div class ="highlight "> < pre > < span > </ span > < code > bin/postgres< span class ="w "> </ span > migrate
684+ </ code > </ pre > </ div >
685+ < p > In other environments where < code > bin/postgres</ code > isn't available:</ p >
686+ < div class ="highlight "> < pre > < span > </ span > < code > docker< span class ="w "> </ span > compose< span class ="w "> </ span > < span class ="nb "> exec</ span > < span class ="w "> </ span > postgres< span class ="w "> </ span > migrate
687+ </ code > </ pre > </ div >
688+ < p > This approach keeps early development simple while providing a clear, ordered
689+ history once the database must be preserved.</ p >
679690< h2 id ="nuke-everything "> 🔄 Nuke Everything</ h2 >
680691< p > If you want to start fresh, wipe your database and re-run all migrations from
681692scratch:</ p >
0 commit comments