本文整理匯總了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,
)