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


Python command.merge方法代码示例

本文整理汇总了Python中alembic.command.merge方法的典型用法代码示例。如果您正苦于以下问题:Python command.merge方法的具体用法?Python command.merge怎么用?Python command.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在alembic.command的用法示例。


在下文中一共展示了command.merge方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def merge(
    config,
    revisions: str,
    message: Optional[str],
    branch_label=Optional[str],
    rev_id=Optional[str],
):
    """Merge two revisions together.  Creates a new migration file."""
    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.merge(
        c, revisions, message=message, branch_label=branch_label, rev_id=rev_id
    ) 
开发者ID:item4,项目名称:yui,代码行数:21,代码来源:cli.py

示例2: test_create_rev_plain_db_not_up_to_date_multi_heads

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_create_rev_plain_db_not_up_to_date_multi_heads(self):
        self._env_fixture()
        command.revision(self.cfg)
        rev2 = command.revision(self.cfg)
        rev3a = command.revision(self.cfg)
        command.revision(self.cfg, head=rev2.revision, splice=True)
        command.upgrade(self.cfg, "heads")
        command.revision(self.cfg, head=rev3a.revision)

        assert_raises_message(
            util.CommandError,
            "Multiple heads are present; please specify the head revision "
            "on which the new revision should be based, or perform a merge.",
            command.revision,
            self.cfg,
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:18,代码来源:test_command.py

示例3: test_create_rev_autogen_need_to_select_head

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_create_rev_autogen_need_to_select_head(self):
        self._env_fixture()
        command.revision(self.cfg)
        rev2 = command.revision(self.cfg)
        command.revision(self.cfg)
        command.revision(self.cfg, head=rev2.revision, splice=True)
        command.upgrade(self.cfg, "heads")
        # there's multiple heads present
        assert_raises_message(
            util.CommandError,
            "Multiple heads are present; please specify the head revision "
            "on which the new revision should be based, or perform a merge.",
            command.revision,
            self.cfg,
            autogenerate=True,
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:18,代码来源:test_command.py

示例4: merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def merge(directory=None, revisions='', message=None, branch_label=None,
          rev_id=None):
    """Merge two revisions together.  Creates a new migration file"""
    if alembic_version >= (0, 7, 0):
        config = current_app.extensions['migrate'].migrate.get_config(
            directory)
        command.merge(config, revisions, message=message,
                      branch_label=branch_label, rev_id=rev_id)
    else:
        raise RuntimeError('Alembic 0.7.0 or greater is required') 
开发者ID:jpush,项目名称:jbox,代码行数:12,代码来源:__init__.py

示例5: merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def merge(context, directory='migrations', revisions='', message=None, branch_label=None,
          rev_id=None):
    """Merge two revisions together.  Creates a new migration file"""
    if alembic_version >= (0, 7, 0):
        config = _get_config(directory)
        command.merge(config, revisions, message=message,
                      branch_label=branch_label, rev_id=rev_id)
    else:
        raise RuntimeError('Alembic 0.7.0 or greater is required') 
开发者ID:frol,项目名称:flask-restplus-server-example,代码行数:11,代码来源:db.py

示例6: test_create_rev_plain_need_to_select_head

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_create_rev_plain_need_to_select_head(self):
        self._env_fixture()
        command.revision(self.cfg)
        rev2 = command.revision(self.cfg)
        command.revision(self.cfg)
        command.revision(self.cfg, head=rev2.revision, splice=True)
        command.upgrade(self.cfg, "heads")
        # there's multiple heads present
        assert_raises_message(
            util.CommandError,
            "Multiple heads are present; please specify the head revision "
            "on which the new revision should be based, or perform a merge.",
            command.revision,
            self.cfg,
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:17,代码来源:test_command.py

示例7: test_create_rev_plain_post_merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_create_rev_plain_post_merge(self):
        self._env_fixture()
        command.revision(self.cfg)
        rev2 = command.revision(self.cfg)
        command.revision(self.cfg)
        command.revision(self.cfg, head=rev2.revision, splice=True)
        command.merge(self.cfg, "heads")
        command.revision(self.cfg) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:10,代码来源:test_command.py

示例8: test_create_rev_autogenerate_post_merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_create_rev_autogenerate_post_merge(self):
        self._env_fixture()
        command.revision(self.cfg)
        rev2 = command.revision(self.cfg)
        command.revision(self.cfg)
        command.revision(self.cfg, head=rev2.revision, splice=True)
        command.merge(self.cfg, "heads")
        command.upgrade(self.cfg, "heads")
        command.revision(self.cfg, autogenerate=True) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:11,代码来源:test_command.py

示例9: test_help_text

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def test_help_text(self):
        commands = {
            fn.__name__
            for fn in [getattr(command, n) for n in dir(command)]
            if inspect.isfunction(fn)
            and fn.__name__[0] != "_"
            and fn.__module__ == "alembic.command"
        }
        # make sure we found them
        assert commands.intersection(
            {"upgrade", "downgrade", "merge", "revision"}
        )

        # catch help text coming intersection
        with mock.patch("alembic.config.ArgumentParser") as argparse:
            config.CommandLine()
            for kall in argparse().add_subparsers().mock_calls:
                for sub_kall in kall.call_list():
                    if sub_kall[0] == "add_parser":
                        cmdname = sub_kall[1][0]
                        help_text = sub_kall[2]["help"]
                        if help_text:
                            commands.remove(cmdname)
                            # more than two spaces
                            assert not re.search(r"   ", help_text)

                            # no markup stuff
                            assert ":" not in help_text

                            # no newlines
                            assert "\n" not in help_text

                            # ends with a period
                            assert help_text.endswith(".")

                            # not too long
                            assert len(help_text) < 80
        assert not commands, "Commands without help text: %s" % commands 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:40,代码来源:test_command.py

示例10: merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def merge(self, message, branch_label=None, rev_id=None, revisions=None):
        alembic_cmd.merge(self.cfg, message=message,
                          branch_label=branch_label,
                          rev_id=rev_id, revisions=revisions) 
开发者ID:quantmind,项目名称:lux,代码行数:6,代码来源:migrations.py

示例11: make_parser

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def make_parser(self, subparsers):
        parser = subparsers.add_parser('merge', help=self.merge.__doc__)
        parser.add_argument('--rev-id', dest='rev_id', default=None,
                            help=('Specify a hardcoded revision id instead of '
                                  'generating one'))
        parser.add_argument('--branch-label', dest='branch_label', default=None,
                            help=('Specify a branch label to apply to the new '
                                  'revision'))
        parser.add_argument('-m', '--message', dest='message', default=None)
        parser.add_argument('revisions',
                            help='one or more revisions, or "heads" for all heads')
        parser.add_argument('-d', '--directory', dest='directory', default=None,
                            help=("migration script directory (default is "
                                  "'migrations')"))
        return parser 
开发者ID:mozilla,项目名称:build-relengapi,代码行数:17,代码来源:alembic_wrapper.py

示例12: run

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def run(self, parser, args):
        self.merge(**vars(args)) 
开发者ID:mozilla,项目名称:build-relengapi,代码行数:4,代码来源:alembic_wrapper.py

示例13: merge

# 需要导入模块: from alembic import command [as 别名]
# 或者: from alembic.command import merge [as 别名]
def merge(self, directory=None, revisions='', message=None, branch_label=None,
              rev_id=None, **kwargs):  # pragma: no cover
        """Merge two revisions together.  Creates a new migration file"""
        config = _get_config(directory)
        command.merge(config, revisions, message=message,
                      branch_label=branch_label, rev_id=rev_id) 
开发者ID:mozilla,项目名称:build-relengapi,代码行数:8,代码来源:alembic_wrapper.py


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