Fix argv handling in srht-migrate
This commit is contained in:
parent
8829c41299
commit
2d99452af5
|
@ -2,4 +2,4 @@
|
||||||
import srht.alembic
|
import srht.alembic
|
||||||
import sys
|
import sys
|
||||||
from srht.database import alembic
|
from srht.database import alembic
|
||||||
alembic(sys.argv[1], srht.alembic)
|
alembic(sys.argv[1], srht.alembic, sys.argv[2:])
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DbSession():
|
||||||
def create(self):
|
def create(self):
|
||||||
Base.metadata.create_all(bind=self.engine)
|
Base.metadata.create_all(bind=self.engine)
|
||||||
|
|
||||||
def alembic(site, alembic_module):
|
def alembic(site, alembic_module, argv=None):
|
||||||
"""
|
"""
|
||||||
Automatically rigs up the Alembic config and shells out to it.
|
Automatically rigs up the Alembic config and shells out to it.
|
||||||
"""
|
"""
|
||||||
|
@ -53,7 +53,9 @@ def alembic(site, alembic_module):
|
||||||
help="Specify -a to check config for automatic migrations and abort if "
|
help="Specify -a to check config for automatic migrations and abort if "
|
||||||
"unset (generally only package post-upgrade scripts will specify "
|
"unset (generally only package post-upgrade scripts will specify "
|
||||||
"this)")
|
"this)")
|
||||||
options = cmdline.parser.parse_args(sys.argv[1:])
|
if argv == None:
|
||||||
|
argv = sys.argv[1:]
|
||||||
|
options = cmdline.parser.parse_args(argv)
|
||||||
if options.auto:
|
if options.auto:
|
||||||
if cfg(site, "migrate-on-upgrade", default="no") != "yes":
|
if cfg(site, "migrate-on-upgrade", default="no") != "yes":
|
||||||
print("Skipping automatic database migrations")
|
print("Skipping automatic database migrations")
|
||||||
|
|
Loading…
Reference in New Issue