Skip to content

Commit 01e4087

Browse files
committed
Add suggested migration file layout
1 parent c7bfaa1 commit 01e4087

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/migrations.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,32 @@ REINDEX
8787
VACUUM
8888
```
8989

90+
## Suggested File Layout
91+
92+
SuperStack doesn't require any file names or layout, that's up to you.
93+
94+
But here's one you might use while developing (pre-production):
95+
96+
```
97+
01-extensions.sql
98+
02-create_auth_schema.sql (if using PostgREST for auth)
99+
03-create_api_schema.sql
100+
04-roles.sql
101+
05-grants.sql
102+
```
103+
104+
During development, make changes and:
105+
106+
```sh
107+
docker compose down --volumes; docker compose up -d
108+
```
109+
110+
Once the app's reached production (or some other environment), you can no
111+
longer keep recreating the database from scratch. Add smaller migrations from
112+
`06-` onwards, and use `bin/postgres migrate` (that's a shortcut you can use
113+
locally, on other environments the `bin/postgres` script isn't there so use
114+
`docker compose exec postgres migrate`).
115+
90116
## 🔄 Nuke Everything
91117

92118
If you want to start fresh, wipe your database and re-run all migrations from

0 commit comments

Comments
 (0)