def upgrade(self): try: with contextlib.closing(self._engine.connect()) as conn: migration.db_sync(conn) except sa_exc.SQLAlchemyError as e: raise exc.StorageError("Failed upgrading database version: %s" % e, e)
def upgrade(self): try: with contextlib.closing(self._engine.connect()) as conn: # NOTE(imelnikov): Alembic does not support SQLite, # and we don't recommend to use SQLite in production # deployments, so migrations are rarely needed # for SQLite. So we don't bother about working around # SQLite limitations, and create the database directly from # the tables when it is in use... if 'sqlite' in self._engine.url.drivername: self._metadata.create_all(bind=conn) else: migration.db_sync(conn) except sa_exc.SQLAlchemyError as e: raise exc.StorageFailure("Failed upgrading database version", e)
def upgrade(self): try: with contextlib.closing(self._engine.connect()) as conn: # NOTE(imelnikov): Alembic does not support SQLite, # and we don't recommend to use SQLite in production # deployments, so migrations are rarely needed # for SQLite. So we don't bother about working around # SQLite limitations, and create the database directly from # the tables when it is in use... if 'sqlite' in self._engine.url.drivername: self._metadata.create_all(bind=conn) else: migration.db_sync(conn) except sa_exc.SQLAlchemyError as e: raise exc.StorageFailure("Failed upgrading database version", e)
def upgrade(self): try: with contextlib.closing(self._engine.connect()) as conn: # NOTE(imelnikov): Alembic does not support SQLite, # and we don't recommend to use SQLite in production # deployments, so migrations are rarely needed # for SQLite. So we don't bother about working around # SQLite limitations, and create database from models # when it is in use. if 'sqlite' in self._engine.url.drivername: models.BASE.metadata.create_all(conn) else: migration.db_sync(conn) except sa_exc.SQLAlchemyError as e: LOG.exception('Failed upgrading database version') raise exc.StorageError("Failed upgrading database version: %s" % e, e)
def upgrade(self): try: with contextlib.closing(self._engine.connect()) as conn: # NOTE(imelnikov): Alembic does not support SQLite, # and we don't recommend to use SQLite in production # deployments, so migrations are rarely needed # for SQLite. So we don't bother about working around # SQLite limitations, and create database from models # when it is in use. if 'sqlite' in self._engine.url.drivername: models.BASE.metadata.create_all(conn) else: migration.db_sync(conn) except sa_exc.SQLAlchemyError as e: LOG.exception('Failed upgrading database version') raise exc.StorageError("Failed upgrading database version: %s" % e, e)
def setupDatabase(self): _handle, db_location = tempfile.mkstemp() db_uri = "sqlite:///%s" % (db_location) session.set_defaults(db_uri, db_location) migration.db_sync() return db_location
def setupDatabase(self): _handle, db_location = tempfile.mkstemp() db_uri = "sqlite:///%s" % (db_location) session.set_defaults(db_uri, db_location) migration.db_sync() return db_location