示例#1
0
    def test_edit_b(self):
        expected_call_arg = '%s/scripts/versions/%s_revision_b.py' % (
            EditTest.cfg.config_args['here'], EditTest.b)

        with mock.patch('alembic.util.edit') as edit:
            command.edit(self.cfg, self.b[0:3])
            edit.assert_called_with(expected_call_arg)
示例#2
0
def edit(revision='current', directory=None):
    """Edit current revision."""
    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')
示例#3
0
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')
示例#4
0
def edit(revision='current', directory=None):
    """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')
示例#5
0
def edit(directory=None, revision='current'):
    """Edit current revision."""
    if alembic_version >= (0, 8, 0):
        config = migrate_manager.migrate_config.migrate.get_config(directory)
        command.edit(config, revision)
    else:
        raise RuntimeError('Alembic 0.8.0 or greater is required')
示例#6
0
def edit(directory=None, revision="current"):
    """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")
示例#7
0
文件: db.py 项目: ssfdust/smorest-sfs
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")
示例#8
0
    def test_edit_head(self):
        expected_call_arg = os.path.normpath(
            "%s/scripts/versions/%s_revision_c.py" %
            (EditTest.cfg.config_args["here"], EditTest.c))

        with mock.patch("alembic.util.edit") as edit:
            command.edit(self.cfg, "head")
            edit.assert_called_with(expected_call_arg)
示例#9
0
    def test_edit_b(self):
        expected_call_arg = os.path.normpath(
            "%s/scripts/versions/%s_revision_b.py" %
            (EditTest.cfg.config_args["here"], EditTest.b))

        with mock.patch("alembic.util.open_in_editor") as edit:
            command.edit(self.cfg, self.b[0:3])
            edit.assert_called_with(expected_call_arg)
示例#10
0
def edit(directory=None, _revision='current'):
    """Edit current revision."""
    if alembic_version >= (0, 8, 0):
        app = current_app()
        config = app.extra['migrate'].migrate.get_config(directory)
        command.edit(config, _revision)
    else:
        raise RuntimeError('Alembic 0.8.0 or greater is required')
示例#11
0
def edit(directory=None, revision='current'):
    """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')
示例#12
0
def cli_db_edit(rev):
    """
    Edit revision script(s) using $EDITOR.
    """
    alembic_cfg = AlembicConfig("alembic.ini")
    alembic_cfg.set_main_option("script_location",
                                str(Path() / "db_migrations"))
    command.edit(config=alembic_cfg, rev=rev)
示例#13
0
 def edit(context, revision='current', directory='migrations'):
     """Upgrade to a later version"""
     from app import create_app
     with create_app().app_context():
         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')
示例#14
0
    def test_edit_b(self):
        expected_call_arg = '%s/scripts/versions/%s_revision_b.py' % (
            EditTest.cfg.config_args['here'],
            EditTest.b
        )

        with mock.patch('alembic.util.edit') as edit:
            command.edit(self.cfg, self.b[0:3])
            edit.assert_called_with(expected_call_arg)
示例#15
0
    def test_edit_head(self):
        expected_call_arg = "%s/scripts/versions/%s_revision_c.py" % (
            EditTest.cfg.config_args["here"],
            EditTest.c,
        )

        with mock.patch("alembic.util.edit") as edit:
            command.edit(self.cfg, "head")
            edit.assert_called_with(expected_call_arg)
示例#16
0
    def test_edit_current(self):
        expected_call_arg = "%s/scripts/versions/%s_revision_b.py" % (
            EditTest.cfg.config_args["here"],
            EditTest.b,
        )

        command.stamp(self.cfg, self.b)
        with mock.patch("alembic.util.edit") as edit:
            command.edit(self.cfg, "current")
            edit.assert_called_with(expected_call_arg)
示例#17
0
    def test_edit_current(self):
        expected_call_arg = "%s/scripts/versions/%s_revision_b.py" % (
            EditTest.cfg.config_args["here"],
            EditTest.b,
        )

        command.stamp(self.cfg, self.b)
        with mock.patch("alembic.util.edit") as edit:
            command.edit(self.cfg, "current")
            edit.assert_called_with(expected_call_arg)
示例#18
0
def edit(config, revision: str):
    """Edit current revision."""

    bot = Bot(config)

    directory = os.path.join('yui', 'models', '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)
示例#19
0
    def edit(self, revision: str = 'current') -> t.Any:
        if alembic_version >= (0, 8, 0):
            config = self.configuration.to_alembic_config()

            return command.edit(config, revision)
        else:
            raise RuntimeError('Alembic 0.8.0 or greater is required')
示例#20
0
def edit(app, rev):
    """Edit revision script(s) using $EDITOR."""
    alembic.edit(_get_config(app), rev=rev)
示例#21
0
def edit(config, revision='current'):
    """Edit current revision."""
    if alembic_version >= (0, 8, 0):
        command.edit(config, revision)
    else:
        raise RuntimeError('Alembic 0.8.0 or greater is required')
示例#22
0
def edit(context, revision="current", directory="migrations"):
    """编辑一个迁移脚本"""
    config = _get_config(directory)
    command.edit(config, revision)
示例#23
0
def edit(app, rev):
    """Edit revision script(s) using $EDITOR."""
    alembic.edit(_get_config(app), rev=rev)
示例#24
0
def edit(config, revision='current'):
    """Edit current revision."""
    if alembic_version >= (0, 8, 0):
        command.edit(config, revision)
    else:
        raise RuntimeError('Alembic 0.8.0 or greater is required')