本文整理汇总了Python中alembic.command.current方法的典型用法代码示例。如果您正苦于以下问题:Python command.current方法的具体用法?Python command.current怎么用?Python command.current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic.command
的用法示例。
在下文中一共展示了command.current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def edit(revision='current', directory=None):
"""Edit current revision."""
if alembic_version >= (0, 8, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.edit(config, revision)
else:
raise RuntimeError('Alembic 0.8.0 or greater is required')
示例2: heads
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def heads(directory=None, verbose=False, resolve_dependencies=False):
"""Show current available heads in the script directory"""
if alembic_version >= (0, 7, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.heads(config, verbose=verbose,
resolve_dependencies=resolve_dependencies)
else:
raise RuntimeError('Alembic 0.7.0 or greater is required')
示例3: branches
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def branches(directory=None, verbose=False):
"""Show current branch points"""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.branches(config, verbose=verbose)
else:
command.branches(config)
示例4: current
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def current(directory=None, verbose=False, head_only=False):
"""Display the current revision for each database."""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.current(config, verbose=verbose, head_only=head_only)
else:
command.current(config)
示例5: edit
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def edit(config, revision: str):
"""Edit current revision."""
bot = Bot(config)
directory = os.path.join('yui', 'migrations')
c = Config(os.path.join(directory, 'alembic.ini'))
c.set_main_option('script_location', directory)
c.set_main_option('sqlalchemy.url', bot.config.DATABASE_URL)
c.attributes['Base'] = bot.orm_base
command.edit(c, revision)
示例6: heads
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def heads(config, verbose: bool, resolve_dependencies: bool):
"""Show current available heads in the script directory."""
bot = Bot(config)
directory = os.path.join('yui', 'migrations')
c = Config(os.path.join(directory, 'alembic.ini'))
c.set_main_option('script_location', directory)
c.set_main_option('sqlalchemy.url', bot.config.DATABASE_URL)
c.attributes['Base'] = bot.orm_base
command.heads(
c, verbose=verbose, resolve_dependencies=resolve_dependencies
)
示例7: branches
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def branches(config, verbose: bool):
"""Show current branch points."""
bot = Bot(config)
directory = os.path.join('yui', 'migrations')
c = Config(os.path.join(directory, 'alembic.ini'))
c.set_main_option('script_location', directory)
c.set_main_option('sqlalchemy.url', bot.config.DATABASE_URL)
c.attributes['Base'] = bot.orm_base
command.branches(c, verbose=verbose)
示例8: current
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def current(config, verbose: bool):
"""Display the current revision for each database."""
bot = Bot(config)
directory = os.path.join('yui', 'migrations')
c = Config(os.path.join(directory, 'alembic.ini'))
c.set_main_option('script_location', directory)
c.set_main_option('sqlalchemy.url', bot.config.DATABASE_URL)
c.attributes['Base'] = bot.orm_base
command.current(c, verbose=verbose)
示例9: run
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def run(parser, options, args):
if len(args) not in (0, 1):
parser.error('Bad number of parameters')
# Read the configuration of the application
try:
application = args[0]
except IndexError:
application = 'kansha'
cfg = _build_alembic_config()
_set_sqlalchemy_uri(cfg, application, parser.error)
command.current(cfg, verbose=options.verbose)
示例10: edit
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def edit(context, revision='current', directory='migrations'):
"""Upgrade to a later version"""
if alembic_version >= (0, 8, 0):
config = _get_config(directory)
command.edit(config, revision)
else:
raise RuntimeError('Alembic 0.8.0 or greater is required')
示例11: heads
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def heads(context, directory='migrations', verbose=False, resolve_dependencies=False):
"""Show current available heads in the script directory"""
if alembic_version >= (0, 7, 0):
config = _get_config(directory)
command.heads(config, verbose=verbose,
resolve_dependencies=resolve_dependencies)
else:
raise RuntimeError('Alembic 0.7.0 or greater is required')
示例12: branches
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def branches(context, directory='migrations', verbose=False):
"""Show current branch points"""
config = _get_config(directory)
if alembic_version >= (0, 7, 0):
command.branches(config, verbose=verbose)
else:
command.branches(config)
示例13: current
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def current(context, directory='migrations', verbose=False, head_only=False):
"""Display the current revision for each database."""
config = _get_config(directory)
if alembic_version >= (0, 7, 0):
command.current(config, verbose=verbose, head_only=head_only)
else:
command.current(config)
示例14: test_starting_rev_post_context
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def test_starting_rev_post_context(self):
env_file_fixture(
"""
context.configure(dialect_name='sqlite', starting_rev='x')
assert context.get_starting_revision_argument() == 'x'
"""
)
command.upgrade(self.cfg, a, sql=True)
command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
command.current(self.cfg)
command.stamp(self.cfg, a)
示例15: test_starting_rev_pre_context_cmd_w_no_startrev
# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import current [as 别名]
def test_starting_rev_pre_context_cmd_w_no_startrev(self):
env_file_fixture(
"""
assert context.get_starting_revision_argument() == 'x'
"""
)
assert_raises_message(
util.CommandError,
"No starting revision argument is available.",
command.current,
self.cfg,
)