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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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)
예제 #6
0
 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
예제 #7
0
 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