Merge "Add automated_clean field"

This commit is contained in:
Zuul 2018-08-25 13:18:42 +00:00 committed by Gerrit Code Review
commit 91f0e41c7b
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Add automated_clean field
Revision ID: d2b036ae9378
Revises: 664f85c2f622
Create Date: 2018-07-25 15:30:20.860792
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd2b036ae9378'
down_revision = '664f85c2f622'
def upgrade():
op.add_column('nodes', sa.Column('automated_clean', sa.Boolean(),
nullable=True))

View File

@ -175,6 +175,7 @@ class Node(Base):
inspection_finished_at = Column(DateTime, nullable=True)
inspection_started_at = Column(DateTime, nullable=True)
extra = Column(db_types.JsonEncodedDict)
automated_clean = Column(Boolean, nullable=True)
bios_interface = Column(String(255), nullable=True)
boot_interface = Column(String(255), nullable=True)

View File

@ -760,6 +760,11 @@ class MigrationCheckersMixin(object):
conductors_tbl.c.id == data['conductor_id']).execute().first()
self.assertEqual(conductor['conductor_group'], "")
def _check_d2b036ae9378(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
col_names = [column.name for column in nodes.c]
self.assertIn('automated_clean', col_names)
def test_upgrade_and_version(self):
with patch_with_engine(self.engine):
self.migration_api.upgrade('head')