Merge "Correct some nullable DB columns and make description optional"

This commit is contained in:
Jenkins 2016-10-13 06:12:04 +00:00 committed by Gerrit Code Review
commit ffa8fbd39f
3 changed files with 8 additions and 5 deletions
nimble/db/sqlalchemy

@ -33,9 +33,9 @@ def upgrade():
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('uuid', sa.String(length=36), nullable=True),
sa.Column('uuid', sa.String(length=36), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('description', sa.String(length=255), nullable=False),
sa.Column('description', sa.String(length=255), nullable=True),
sa.Column('is_public', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name', name='uniq_instance_types0name'),
@ -47,7 +47,7 @@ def upgrade():
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('instance_type_id', sa.Integer(), nullable=True),
sa.Column('instance_type_id', sa.Integer(), nullable=False),
sa.Column('key', sa.String(length=255), nullable=False),
sa.Column('value', sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(['instance_type_id'], ['instance_types.id'], ),

@ -93,6 +93,9 @@ class Connection(api.Connection):
if not values.get('uuid'):
values['uuid'] = uuidutils.generate_uuid()
if not values.get('description'):
values['description'] = ""
instance_type = models.InstanceTypes()
instance_type.update(values)

@ -67,9 +67,9 @@ class InstanceTypes(Base):
table_args()
)
id = Column(Integer, primary_key=True)
uuid = Column(String(36), nullable=True)
uuid = Column(String(36), nullable=False)
name = Column(String(255), nullable=False)
description = Column(String(255), nullable=False)
description = Column(String(255), nullable=True)
is_public = Column(Boolean, default=True)