Exemple #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)
Exemple #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')
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')
Exemple #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')
Exemple #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')
Exemple #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")
Exemple #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")
Exemple #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)
Exemple #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)
Exemple #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')
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')
Exemple #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)
 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')
Exemple #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)
Exemple #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)
    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)
Exemple #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)
Exemple #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)
Exemple #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')
def edit(app, rev):
    """Edit revision script(s) using $EDITOR."""
    alembic.edit(_get_config(app), rev=rev)
Exemple #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')
Exemple #22
0
def edit(context, revision="current", directory="migrations"):
    """编辑一个迁移脚本"""
    config = _get_config(directory)
    command.edit(config, revision)
def edit(app, rev):
    """Edit revision script(s) using $EDITOR."""
    alembic.edit(_get_config(app), rev=rev)
Exemple #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')