mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 13:56:05 +03:00
This commit is contained in:
parent
83727fa36b
commit
0c6145174e
@ -47,6 +47,13 @@ def parse_args(args):
|
||||
default=False,
|
||||
help="Also output privilege differences (ie. grant/revoke statements)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--encode-utf8",
|
||||
dest="encode_utf8",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Use UTF-8 encoding for output",
|
||||
)
|
||||
parser.add_argument("dburl_from", help="The database you want to migrate.")
|
||||
parser.add_argument(
|
||||
"dburl_target", help="The database you want to use as the target."
|
||||
@ -70,7 +77,10 @@ def run(args, out=None, err=None):
|
||||
m.add_all_changes(privileges=args.with_privileges)
|
||||
try:
|
||||
if m.statements:
|
||||
print(m.sql.encode('utf8'), file=out)
|
||||
if args.encode_utf8:
|
||||
print(m.sql.encode('utf8'), file=out)
|
||||
else:
|
||||
print(m.sql, file=out)
|
||||
except UnsafeMigrationException:
|
||||
print(
|
||||
"-- ERROR: destructive statements generated. Use the --unsafe flag to suppress this error.",
|
||||
|
Loading…
Reference in New Issue
Block a user