mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2026-02-02 09:25:07 +01:00
Add --wait flag (#112)
✨ When using dbmate as a container, since the base image is distroless, we can't do `dbmate up && dbmate wait`, which makes config a bit more cumbersome (e.g. in kubernetes an extra initContainer). Closes #111 Closes #112
This commit is contained in:
parent
98066fadaa
commit
1e45bd774c
4 changed files with 107 additions and 0 deletions
|
|
@ -271,6 +271,13 @@ Waiting for database....
|
|||
Creating: myapp_development
|
||||
```
|
||||
|
||||
Alternatively you can use the `--wait` flag:
|
||||
```sh
|
||||
$ dbmate --wait up
|
||||
Waiting for database....
|
||||
Creating: myapp_development
|
||||
```
|
||||
|
||||
If the database is still not available after 60 seconds, the command will return an error:
|
||||
|
||||
```sh
|
||||
|
|
@ -289,6 +296,7 @@ The following command line options are available with all commands. You must use
|
|||
* `--migrations-dir, -d "./db/migrations"` - where to keep the migration files.
|
||||
* `--schema-file, -s "./db/schema.sql"` - a path to keep the schema.sql file.
|
||||
* `--no-dump-schema` - don't auto-update the schema.sql file on migrate/rollback
|
||||
* `--wait` - wait for the db to become available before executing the subsequent command
|
||||
|
||||
For example, before running your test suite, you may wish to drop and recreate the test database. One easy way to do this is to store your test database connection URL in the `TEST_DATABASE_URL` environment variable:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue