add "reject" action to firewall rule doesn't work for postgresql
The original migration script use 'alter_column' to add 'reject' action to firewall rule, but postgresql have a builtin ENUM type, so just altering the column won't works, according to https://bitbucket.org/zzzeek/alembic/issues/270/altering-enum-type. 'alter_enum' was already invented for such case in neutron, https://github.com/openstack/neutron/blob/master/neutron/db/migration/__init__.py. So use 'alter_enum' instead of 'alter_column' to resolve this problem. Closes-Bug:#1596158 Change-Id: I504de48d8926c88cae63ad984b489a6636eb0bd5
This commit is contained in:
parent
3f6777d5b8
commit
c113550f38
@ -20,7 +20,6 @@ Create Date: 2015-04-15 04:19:57.324584
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.db import migration
|
||||
@ -38,4 +37,11 @@ new_action = sa.Enum('allow', 'deny', 'reject', name='firewallrules_action')
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.alter_column('firewall_rules', 'action', type_=new_action)
|
||||
# NOTE: postgresql have a builtin ENUM type, so just altering the
|
||||
# column won't works
|
||||
# https://bitbucket.org/zzzeek/alembic/issues/270/altering-enum-type
|
||||
# alter_enum that was already invented for such case in neutron
|
||||
# https://github.com/openstack/neutron/blob/master/neutron/db/migration/__init__.py
|
||||
|
||||
migration.alter_enum(
|
||||
'firewall_rules', 'action', enum_type=new_action, nullable=True)
|
||||
|
Loading…
Reference in New Issue
Block a user