@@ -23,8 +23,8 @@ Each file should be:
2323When the Postgres container starts with no existing data, SuperStack will
2424automatically run migrations once.
2525
26- After the first ` docker compose up ` , migrations will only run if you
27- manually apply them.
26+ After the first startup , migrations will only run if you manually apply
27+ them.
2828
2929To apply your migrations, run:
3030
@@ -35,21 +35,16 @@ bin/postgres migrate
3535This will:
3636
37371 . Run any migration files that haven’t been applied yet (in filename order)
38- 2 . Record each successfully applied file in ` .applied_migrations `
38+ 2 . Record each successfully applied file in ` .applied_migrations ` (this
39+ file lives in the postgres data volume)
3940
4041Already-applied scripts are skipped on subsequent runs.
4142
42- > 💡 ` bin/postgres ` is short for ` docker compose exec postgres `
43+ > 💡 ` bin/postgres ` is a small script that basically aliases ` docker compose exec postgres `
4344
44- ## 🔁 Transactions
45-
46- Use ` BEGIN; ` and ` COMMIT; ` to wrap migration files when all included
47- statements are transactional. This ensures that all changes are applied
48- atomically.
49-
50- For example:
45+ Here's an example migration script:
5146
52- ``` sql title="postgres/migrations/03 -create_table_example.sql"
47+ ``` sql title="postgres/migrations/02 -create_table_example.sql"
5348begin ;
5449
5550create table director (
@@ -66,13 +61,15 @@ create table movie (
6661commit ;
6762```
6863
69- > 💡 If your migration script only contains one statement, there's no need
70- > to use a transaction, the statement will be auto-committed.
64+ ## 🔁 Transactions
7165
72- Avoid wrapping non-transactional operations in a transaction — these will
73- cause errors if used inside ` BEGIN ... COMMIT ` .
66+ Use ` begin; ` and ` commit; ` to wrap statements in a transaction. This
67+ ensures that all changes are applied atomically. Any statements outside of
68+ transactions will be auto-committed.
7469
75- Examples of non-transactional statements include:
70+ Avoid wrapping non-transactional operations in a transaction — these will
71+ cause errors if used inside ` begin ... commit ` . Examples of
72+ non-transactional statements include:
7673
7774``` sql
7875CREATE EXTENSION
0 commit comments