Coverage for manila/db/migrations/alembic/versions/0d8c8f6d54a4_modify_share_servers_table.py: 68%
19 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# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
13"""modify_share_servers_table
15Revision ID: 0d8c8f6d54a4
16Revises: cdefa6287df8
17Create Date: 2024-11-15 09:25:25.957286
19"""
21# revision identifiers, used by Alembic.
22revision = '0d8c8f6d54a4'
23down_revision = 'cdefa6287df8'
25from alembic import op
26from oslo_log import log
27import sqlalchemy as sa
30SHARE_SERVERS_TABLE = 'share_servers'
31LOG = log.getLogger(__name__)
34def upgrade():
35 # add a new column to share_servers.
36 try:
37 op.add_column(
38 SHARE_SERVERS_TABLE,
39 sa.Column('share_replicas_migration_support', sa.Boolean,
40 nullable=False, server_default=sa.sql.false()))
41 except Exception:
42 LOG.error("Table %s could not add column "
43 "'share_replicas_migration_support'.",
44 SHARE_SERVERS_TABLE)
45 raise
48def downgrade():
49 try:
50 op.drop_column(SHARE_SERVERS_TABLE,
51 'share_replicas_migration_support')
52 except Exception:
53 LOG.error("Table %s failed to drop the column "
54 "'share_replicas_migration_support'.", SHARE_SERVERS_TABLE)
55 raise