Coverage for manila/db/migrations/alembic/env.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
1# Copyright 2014 Mirantis Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
15from alembic import context
17from manila.db.sqlalchemy import api as db_api
18from manila.db.sqlalchemy import models as db_models
21def run_migrations_online():
22 """Run migrations in 'online' mode.
24 In this scenario we need to create an Engine
25 and associate a connection with the context.
26 """
27 engine = db_api.get_engine()
28 connection = engine.connect()
29 target_metadata = db_models.ManilaBase.metadata
30 # pylint: disable=no-member
31 context.configure(connection=connection,
32 target_metadata=target_metadata)
33 try:
34 with context.begin_transaction():
35 context.run_migrations()
36 finally:
37 connection.close()
40run_migrations_online()