Skip to content

Commit b3010c8

Browse files
samrosekangmingtay
andauthored
docs: update the "new migration create" doc to cover missing steps (#1553)
* docs: update thie new migration create to cover missing steps * Update migrations/README.md Co-authored-by: Kang Ming <kang.ming1996@gmail.com> * Update migrations/README.md Co-authored-by: Kang Ming <kang.ming1996@gmail.com> --------- Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
1 parent a4828c2 commit b3010c8

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

migrations/README.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,31 @@ Additionally, [supabase/postgres](https://github.com/supabase/postgres/blob/deve
7878

7979
### Add a Migration
8080

81-
First, start a local postgres server and apply the migrations
81+
First, start a local postgres server in another terminal window:
8282

8383
```shell
84-
# Start the database server
85-
nix run .#dbmate-tool -- --version 15 --flake-url "."
84+
# Start the database server in another window
85+
nix run .#start-server 15
86+
```
8687

87-
# create a new migration
88-
nix develop
89-
dbmate new '<some message>'
88+
Then, in your main terminal window:
89+
90+
```shell
91+
# Set up the database URL for migrations
92+
export DATABASE_URL="postgres://supabase_admin@localhost:5435/postgres?sslmode=disable"
93+
94+
# Create a new migration (make sure to specify the migrations directory)
95+
dbmate --migrations-dir="migrations/db/migrations" new '<some message>'
9096
```
9197

92-
Then, execute the migration at `./db/migrations/xxxxxxxxx_<some_message>` and make sure it runs sucessfully with
98+
Then, execute the migration at `./migrations/db/xxxxxxxxx_<some_message>` and make sure it runs successfully with:
9399

94100
```shell
95101
dbmate up
96102
```
97103

104+
Note: Migrations are applied using the `supabase_admin` superuser role, as specified in the "How it was Created" section above.
105+
98106
### Adding a migration with docker-compose
99107

100108
dbmate can optionally be run locally using docker:

0 commit comments

Comments
 (0)