@@ -32,11 +32,20 @@ To apply your migrations, run:
3232bin/postgres migrate
3333```
3434
35+ This command will:
36+ Apply new migrations – runs any migration files (in filename order) that haven’t been applied yet.
37+ Record applied migrations – logs each successfully applied migration in a .applied_migrations file so it won’t run again.
38+ Persist migration history with your database – the .applied_migrations file lives inside the postgres_data Docker volume alongside the database files.
39+ If the postgres_data volume is deleted or recreated, both the database and the migration history are reset, so migrations will run again from scratch.
40+
3541This will:
3642
37- 1 . Run any migration files that haven’t been applied yet (in filename order)
38- 2 . Record each successfully applied file in ` .applied_migrations ` (this
39- file lives in the postgres data volume)
43+ 1 . ** Apply new migrations,** in filename order.
44+ 2 . ** Record applied migrations** in a file named ` .applied_migrations ` . This
45+ plain-text file keeps a record of successfully applied migrations so they
46+ aren't applied again next time. It lives in the same volume as the database
47+ files, so when that volume is removed or recreated, the
48+ ` .applied_migrations ` file goes with it and you start over.
4049
4150Already-applied scripts are skipped on subsequent runs.
4251
@@ -63,9 +72,9 @@ commit;
6372
6473## 🔁 Transactions
6574
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.
75+ Use ` begin; ` and ` commit; ` to wrap statements in a transaction. This ensures
76+ that all changes are applied atomically. Any statements outside of transactions
77+ will be auto-committed.
6978
7079Avoid wrapping non-transactional operations in a transaction — these will
7180cause errors if used inside ` begin ... commit ` . Examples of
0 commit comments