当前位置: 首页>>代码示例>>Python>>正文


Python command.current方法代码示例

本文整理汇总了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') 
开发者ID:jpush,项目名称:jbox,代码行数:10,代码来源:__init__.py

示例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') 
开发者ID:jpush,项目名称:jbox,代码行数:11,代码来源:__init__.py

示例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) 
开发者ID:jpush,项目名称:jbox,代码行数:9,代码来源:__init__.py

示例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) 
开发者ID:jpush,项目名称:jbox,代码行数:9,代码来源:__init__.py

示例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) 
开发者ID:item4,项目名称:yui,代码行数:14,代码来源:cli.py

示例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
    ) 
开发者ID:item4,项目名称:yui,代码行数:16,代码来源:cli.py

示例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) 
开发者ID:item4,项目名称:yui,代码行数:14,代码来源:cli.py

示例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) 
开发者ID:item4,项目名称:yui,代码行数:14,代码来源:cli.py

示例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) 
开发者ID:Net-ng,项目名称:kansha,代码行数:16,代码来源:admin.py

示例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') 
开发者ID:frol,项目名称:flask-restplus-server-example,代码行数:9,代码来源:db.py

示例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') 
开发者ID:frol,项目名称:flask-restplus-server-example,代码行数:10,代码来源:db.py

示例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) 
开发者ID:frol,项目名称:flask-restplus-server-example,代码行数:9,代码来源:db.py

示例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) 
开发者ID:frol,项目名称:flask-restplus-server-example,代码行数:9,代码来源:db.py

示例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) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:13,代码来源:test_offline_environment.py

示例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,
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:14,代码来源:test_offline_environment.py


注:本文中的alembic.command.current方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。