fix clean/create in pgdump/restore (#1457)
This commit is contained in:
parent
4771d04a9d
commit
0f7f21a7db
|
@ -329,6 +329,9 @@ You can however easily test with a different engine.
|
||||||
|
|
||||||
Run Postgres somewhere, version 10 or above - easy to do in a docker container.
|
Run Postgres somewhere, version 10 or above - easy to do in a docker container.
|
||||||
|
|
||||||
|
You also need to install a postgresql-client package or equivalent, to provide
|
||||||
|
recent pg_dump and pg_restore executables (not older than the PG version in the docker container).
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo docker run --detach --name=postgres -p 5432:5432 --env="POSTGRES_PASSWORD=postgres" postgres:latest
|
$ sudo docker run --detach --name=postgres -p 5432:5432 --env="POSTGRES_PASSWORD=postgres" postgres:latest
|
||||||
```
|
```
|
||||||
|
@ -373,6 +376,8 @@ or for MariaDB
|
||||||
$ sudo docker run --cap-add=sys_nice --detach --name=mariadb -p 3306:3306 --env="MYSQL_ROOT_PASSWORD=password" mariadb
|
$ sudo docker run --cap-add=sys_nice --detach --name=mariadb -p 3306:3306 --env="MYSQL_ROOT_PASSWORD=password" mariadb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A mysql-client package is required as well.
|
||||||
|
|
||||||
## gotchas
|
## gotchas
|
||||||
|
|
||||||
- Testing with Postgres or MySQL/MariaDB leads to (unpredictably) failing
|
- Testing with Postgres or MySQL/MariaDB leads to (unpredictably) failing
|
||||||
|
|
|
@ -50,7 +50,7 @@ setup() {
|
||||||
|
|
||||||
dump() {
|
dump() {
|
||||||
backup_file="${1?Missing file to backup database to}"
|
backup_file="${1?Missing file to backup database to}"
|
||||||
pg_dump -Ft --dbname crowdsec_test --file "$backup_file"
|
pg_dump -Ft --dbname crowdsec_test --clean --create --file "$backup_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
restore() {
|
restore() {
|
||||||
|
|
Loading…
Reference in a new issue