當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。