def configure_parser(parser):
parser.description = "Run a migration script. These can only be run forward, not in reverse."
# Inspect the local directory for which migration modules the user can run.
local_files = os.listdir(
os.path.dirname(
inspect.getfile(
inspect.currentframe()
)))
migration_files = [f for f in local_files if re.match('^\d{4}.*\.py$', f)]
migration_names = [m.rstrip('.py') for m in migration_files]
parser.add_argument(
'migration_name',
choices=migration_names,
help="The name of the migration script you want to run."
)
评论列表
文章目录