Пример #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
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')