[ADD] restore-sql
This commit is contained in:
parent
1498148d65
commit
7dcf456525
|
|
@ -0,0 +1 @@
|
|||
Add option ``p`` (SQL format) allowing use from ``--database-format`` CLI. This allows you to restore database in SQL format (used by odoo full backup)
|
||||
|
|
@ -18,11 +18,11 @@ from odoo_openupgrade_wizard.tools.tools_system import restore_filestore
|
|||
@click.option(
|
||||
"--database-format",
|
||||
required=True,
|
||||
type=click.Choice(("c", "d", "t")),
|
||||
type=click.Choice(("c", "d", "t", "p")),
|
||||
default="c",
|
||||
help="Database format (see pg_dump options): "
|
||||
"custom format compressed (c), directory (d), tar file (t)."
|
||||
"plain sql text (p) is not implemented",
|
||||
"custom format compressed (c), directory (d), tar file (t),"
|
||||
" plain sql text (p).",
|
||||
)
|
||||
@click.option(
|
||||
"--filestore-path",
|
||||
|
|
|
|||
|
|
@ -250,6 +250,14 @@ def execute_pg_restore(
|
|||
container = get_postgres_container(ctx)
|
||||
ensure_database(ctx, database, "absent")
|
||||
ensure_database(ctx, database, "present")
|
||||
if database_format == "p":
|
||||
command = (
|
||||
"psql"
|
||||
f" --file='{Path('/env') / filepath}'"
|
||||
" --username odoo"
|
||||
f" --dbname={database}"
|
||||
)
|
||||
else:
|
||||
command = (
|
||||
"pg_restore"
|
||||
f" {Path('/env') / filepath}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user