File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -78,23 +78,31 @@ Additionally, [supabase/postgres](https://github.com/supabase/postgres/blob/deve
78
78
79
79
### Add a Migration
80
80
81
- First, start a local postgres server and apply the migrations
81
+ First, start a local postgres server in another terminal window:
82
82
83
83
``` 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
+ ```
86
87
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://postgres@localhost:5435/postgres?sslmode=disable"
93
+
94
+ # Create a new migration (make sure to specify the migrations directory)
95
+ dbmate --migrations-dir=" migrations/db" new ' <some message>'
90
96
```
91
97
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:
93
99
94
100
``` shell
95
101
dbmate up
96
102
```
97
103
104
+ Note: Migrations are applied using the ` supabase_admin ` superuser role, as specified in the "How it was Created" section above.
105
+
98
106
### Adding a migration with docker-compose
99
107
100
108
dbmate can optionally be run locally using docker:
You can’t perform that action at this time.
0 commit comments