Don't change existing nullable property

Regarding why we should do the way in this patch, please see
bug report.

exsiting_nullable=False seemingly failed on mysql 5.5,
so use nullable=False.

Author:    gong yong sheng <gong.yongsheng@99cloud.net>

Change-Id: Idb7ba72a6273e03f73a28f8b0054ca39ab02c8bc
Closes-bug: #1603109
This commit is contained in:
gong yong sheng 2016-07-14 22:52:18 +08:00
parent a58cb32eff
commit 5b0492b1a1
2 changed files with 12 additions and 8 deletions

View File

@ -33,22 +33,22 @@ def upgrade(active_plugins=None, options=None):
for table in ['devices', 'devicetemplates', 'vims', 'servicetypes']:
op.alter_column(table,
'tenant_id',
type_=sa.String(64))
type_=sa.String(64), nullable=False)
op.alter_column('vims',
'type',
type_=sa.String(64))
op.alter_column('devices',
'instance_id',
type_=sa.String(64))
type_=sa.String(64), nullable=True)
op.alter_column('devices',
'status',
type_=sa.String(64))
op.alter_column('proxymgmtports',
'device_id',
type_=sa.String(64))
type_=sa.String(64), nullable=False)
op.alter_column('proxyserviceports',
'service_instance_id',
type_=sa.String(64))
type_=sa.String(64), nullable=False)
op.alter_column('servicetypes',
'service_type',
type_=sa.String(64))

View File

@ -43,20 +43,24 @@ def upgrade(active_plugins=None, options=None):
'devicetemplateattributes')
for table in pk_id_tables:
with migration.modify_foreign_keys_constraint(FK_MAP.get(table, [])):
op.alter_column(table, 'id', type_=types.Uuid)
op.alter_column(table, 'id', type_=types.Uuid,
nullable=False)
fk_template_id_tables = ('devices', 'servicetypes',
'devicetemplateattributes')
for table in fk_template_id_tables:
with migration.modify_foreign_keys_constraint(fk_template_id_tables):
op.alter_column(table, 'template_id', type_=types.Uuid)
op.alter_column(table, 'template_id', type_=types.Uuid,
nullable=False)
fk_vim_id_tables = ('devices', 'vimauths')
for table in fk_vim_id_tables:
with migration.modify_foreign_keys_constraint(fk_vim_id_tables):
op.alter_column(table, 'vim_id', type_=types.Uuid)
op.alter_column(table, 'vim_id', type_=types.Uuid,
nullable=False)
fk_device_id_tables = ('deviceattributes', 'proxymgmtports')
for table in fk_device_id_tables:
with migration.modify_foreign_keys_constraint(fk_device_id_tables):
op.alter_column(table, 'device_id', type_=types.Uuid)
op.alter_column(table, 'device_id', type_=types.Uuid,
nullable=False)