db schema improvements: description is set to text

Helps to capture more details about vim, device and its template.

Change-Id: Ic3aa4ad61e4ba9beb2fca63ef722bf30be9e06ba
Closes-bug: #1587579
This commit is contained in:
Kanagaraj Manickam
2016-06-01 11:06:54 +05:30
parent bccb1eb313
commit 320ac44ceb
4 changed files with 45 additions and 4 deletions

View File

@@ -1 +1 @@
6e56d4474b2a
c7cde2f45f82

View File

@@ -0,0 +1,41 @@
# Copyright 2016 OpenStack Foundation
#
# 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.
#
"""set-description-to-text
Revision ID: c7cde2f45f82
Revises: 6e56d4474b2a
Create Date: 2016-06-01 10:58:43.022668
"""
# revision identifiers, used by Alembic.
revision = 'c7cde2f45f82'
down_revision = '6e56d4474b2a'
from alembic import op
import sqlalchemy as sa
def upgrade(active_plugins=None, options=None):
op.alter_column('vims',
'description',
type_=sa.Text)
op.alter_column('devices',
'description',
type_=sa.Text)
op.alter_column('devicetemplates',
'description',
type_=sa.Text)

View File

@@ -39,7 +39,7 @@ VIM_AUTH_ATTRIBUTES = ('auth_url', 'vim_project', 'password', 'auth_cred')
class Vim(model_base.BASE, models_v1.HasId, models_v1.HasTenant):
type = sa.Column(sa.String(255), nullable=False)
name = sa.Column(sa.String(255), nullable=True)
description = sa.Column(sa.String(255), nullable=True)
description = sa.Column(sa.Text, nullable=True)
placement_attr = sa.Column(types.Json, nullable=True)
shared = sa.Column(sa.Boolean, default=True, server_default=sql.true(
), nullable=False)

View File

@@ -47,7 +47,7 @@ class DeviceTemplate(model_base.BASE, models_v1.HasId, models_v1.HasTenant):
# Descriptive name
name = sa.Column(sa.String(255))
description = sa.Column(sa.String(255))
description = sa.Column(sa.Text)
# service type that this service vm provides.
# At first phase, this includes only single service
@@ -99,7 +99,7 @@ class Device(model_base.BASE, models_v1.HasId, models_v1.HasTenant):
template = orm.relationship('DeviceTemplate')
name = sa.Column(sa.String(255), nullable=True)
description = sa.Column(sa.String(255), nullable=True)
description = sa.Column(sa.Text, nullable=True)
# sufficient information to uniquely identify hosting device.
# In case of service VM, it's UUID of nova VM.