Coverage for manila/db/migrations/alembic/versions/3a482171410f_add_drivers_private_data_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# Copyright 2015 Mirantis inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
16"""add_driver_private_data_table
18Revision ID: 3a482171410f
19Revises: 56cdbe267881
20Create Date: 2015-04-21 14:47:38.201658
22"""
24# revision identifiers, used by Alembic.
25revision = '3a482171410f'
26down_revision = '56cdbe267881'
28from alembic import op
29from oslo_log import log
30import sqlalchemy as sql
32LOG = log.getLogger(__name__)
34drivers_private_data_table_name = 'drivers_private_data'
37def upgrade():
38 try:
39 op.create_table(
40 drivers_private_data_table_name,
41 sql.Column('created_at', sql.DateTime),
42 sql.Column('updated_at', sql.DateTime),
43 sql.Column('deleted_at', sql.DateTime),
44 sql.Column('deleted', sql.Integer, default=0),
45 sql.Column('host', sql.String(255),
46 nullable=False, primary_key=True),
47 sql.Column('entity_uuid', sql.String(36),
48 nullable=False, primary_key=True),
49 sql.Column('key', sql.String(255),
50 nullable=False, primary_key=True),
51 sql.Column('value', sql.String(1023), nullable=False),
52 mysql_engine='InnoDB',
53 mysql_charset='utf8',
54 )
55 except Exception:
56 LOG.error("Table |%s| not created!",
57 drivers_private_data_table_name)
58 raise
61def downgrade():
62 try:
63 op.drop_table(drivers_private_data_table_name)
64 except Exception:
65 LOG.error("%s table not dropped", drivers_private_data_table_name)
66 raise