Python alembic.command.history() Examples

The following are 20 code examples of alembic.command.history(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module alembic.command , or try the search function .
Example #1
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_relative_to_num(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, "-2:%s" % (self.c), verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a]) 
Example #2
Source File: alembic_wrapper.py    From build-relengapi with Mozilla Public License 2.0 5 votes vote down vote up
def history(self, directory=None, rev_range=None, verbose=False, **kwargs):  # pragma: no cover
        """List changeset scripts in chronological order."""
        config = _get_config(directory)
        command.history(config, rev_range, verbose=verbose) 
Example #3
Source File: alembic_wrapper.py    From build-relengapi with Mozilla Public License 2.0 5 votes vote down vote up
def run(self, parser, args):
        self.history(**vars(args)) 
Example #4
Source File: alembic_wrapper.py    From build-relengapi with Mozilla Public License 2.0 5 votes vote down vote up
def make_parser(self, subparsers):
        parser = subparsers.add_parser('history', help=self.history.__doc__)
        parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
                            default=False, help='Use more verbose output')
        parser.add_argument('-r', '--rev-range', dest='rev_range', default=None,
                            help='Specify a revision range; format is [start]:[end]')
        parser.add_argument('-d', '--directory', dest='directory', default=None,
                            help=("migration script directory (default is "
                                  "'migrations')"))
        return parser 
Example #5
Source File: commands.py    From barbican with Apache License 2.0 5 votes vote down vote up
def history(verbose, sql_url=None):
    alembic_cfg = init_config(sql_url)
    alembic_command.history(alembic_cfg, verbose=verbose) 
Example #6
Source File: commands.py    From sgx-kms with Apache License 2.0 5 votes vote down vote up
def history(verbose, sql_url=None):
    alembic_cfg = init_config(sql_url)
    alembic_command.history(alembic_cfg, verbose=verbose) 
Example #7
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_indicate_current(self):
        command.stamp(self.cfg, (self.b,))
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, indicate_current=True, verbose=True)
        self._eq_cmd_output(
            buf, [self.c, self.b, self.a], currents=(self.b,), env_token=True
        ) 
Example #8
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_include_env(self):
        self.cfg.stdout = buf = self._buf_fixture()
        self.cfg.set_main_option("revision_environment", "true")
        command.history(self.cfg, verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a], env_token=True) 
Example #9
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_current_to_head_as_b(self):
        command.stamp(self.cfg, self.b)
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, "current:", verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b], env_token=True) 
Example #10
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_too_large_relative_to_num(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, "-5:%s" % (self.c), verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a]) 
Example #11
Source File: __init__.py    From jbox with MIT License 5 votes vote down vote up
def history(directory=None, rev_range=None, verbose=False):
    """List changeset scripts in chronological order."""
    config = current_app.extensions['migrate'].migrate.get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.history(config, rev_range, verbose=verbose)
    else:
        command.history(config, rev_range) 
Example #12
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_num_plus_relative(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, "%s:+2" % (self.a), verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a]) 
Example #13
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_num_to_head_environment(self):
        self.cfg.stdout = buf = self._buf_fixture()
        self.cfg.set_main_option("revision_environment", "true")
        command.history(self.cfg, "%s:" % (self.a), verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a], env_token=True) 
Example #14
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_base_to_num(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, ":%s" % (self.b), verbose=True)
        self._eq_cmd_output(buf, [self.b, self.a]) 
Example #15
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_num_range_environment(self):
        self.cfg.stdout = buf = self._buf_fixture()
        self.cfg.set_main_option("revision_environment", "true")
        command.history(self.cfg, "%s:%s" % (self.a, self.b), verbose=True)
        self._eq_cmd_output(buf, [self.b, self.a], env_token=True) 
Example #16
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_num_range(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, "%s:%s" % (self.a, self.b), verbose=True)
        self._eq_cmd_output(buf, [self.b, self.a]) 
Example #17
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_full_environment(self):
        self.cfg.stdout = buf = self._buf_fixture()
        self.cfg.set_main_option("revision_environment", "true")
        command.history(self.cfg, verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a], env_token=True) 
Example #18
Source File: test_command.py    From alembic with MIT License 5 votes vote down vote up
def test_history_full(self):
        self.cfg.stdout = buf = self._buf_fixture()
        command.history(self.cfg, verbose=True)
        self._eq_cmd_output(buf, [self.c, self.b, self.a]) 
Example #19
Source File: db.py    From flask-restplus-server-example with MIT License 5 votes vote down vote up
def history(context, directory='migrations', rev_range=None, verbose=False):
    """List changeset scripts in chronological order."""
    config = _get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.history(config, rev_range, verbose=verbose)
    else:
        command.history(config, rev_range) 
Example #20
Source File: cli.py    From yui with GNU Affero General Public License v3.0 5 votes vote down vote up
def history(config, verbose: bool, rev_range: Optional[str]):
    """List changeset scripts in chronological order."""

    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.history(c, rev_range, verbose=verbose)