Esempio n. 1
0
    def test_load_table(self):
        connection = api.get_engine()
        table_name = 'shares'

        actual_result = utils.load_table(table_name, connection)

        self.assertIsNotNone(actual_result)
        self.assertEqual(table_name, actual_result.name)
Esempio n. 2
0
    def test_load_table(self):
        connection = api.get_engine()
        table_name = 'shares'

        actual_result = utils.load_table(table_name, connection)

        self.assertIsNotNone(actual_result)
        self.assertEqual(table_name, actual_result.name)
Esempio n. 3
0
def version():
    """Current database version.

    :returns: Database version
    :rtype: string
    """
    engine = db_api.get_engine()
    with engine.connect() as conn:
        context = alembic_migration.MigrationContext.configure(conn)
        return context.get_current_revision()
Esempio n. 4
0
File: env.py Progetto: ajarr/manila
def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.
    """
    engine = db_api.get_engine()
    connection = engine.connect()
    target_metadata = db_models.ManilaBase.metadata
    context.configure(connection=connection, target_metadata=target_metadata)  # pylint: disable=E1101
    try:
        with context.begin_transaction():  # pylint: disable=E1101
            context.run_migrations()  # pylint: disable=E1101
    finally:
        connection.close()
Esempio n. 5
0
def run_migrations_online():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.
    """
    engine = db_api.get_engine()
    connection = engine.connect()
    target_metadata = db_models.ManilaBase.metadata
    # pylint: disable=no-member
    context.configure(connection=connection, target_metadata=target_metadata)
    try:
        with context.begin_transaction():
            context.run_migrations()
    finally:
        connection.close()
Esempio n. 6
0
def db_version():
    """Display the current database version."""
    return IMPL.db_version(db_api.get_engine(), MIGRATE_REPO, INIT_VERSION)
Esempio n. 7
0
def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""
    return IMPL.db_sync(db_api.get_engine(),
                        MIGRATE_REPO,
                        version=version,
                        init_version=INIT_VERSION)
Esempio n. 8
0
def db_version():
    """Display the current database version."""
    return IMPL.db_version(db_api.get_engine(), MIGRATE_REPO, INIT_VERSION)
Esempio n. 9
0
def db_sync(version=None):
    """Migrate the database to `version` or the most recent version."""
    return IMPL.db_sync(db_api.get_engine(), MIGRATE_REPO, version=version,
                        init_version=INIT_VERSION)