1
# Copyright 2013 OpenStack Foundation
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
18
Revision ID: 3cb5d900c5de
20
Create Date: 2013-01-08 00:13:43.051078
24
# revision identifiers, used by Alembic.
25
revision = '3cb5d900c5de'
26
down_revision = '48b6f43f7471'
28
# Change to ['*'] if this migration applies to all plugins
30
migration_for_plugins = [
31
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
32
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
33
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
34
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
35
'neutron.plugins.nec.nec_plugin.NECPluginV2',
36
'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
37
'neutron.plugins.vmware.plugin.NsxPlugin',
38
'neutron.plugins.vmware.plugin.NsxServicePlugin',
39
'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2',
42
from alembic import op
43
import sqlalchemy as sa
45
from neutron.db import migration
47
securitygrouprules_direction = sa.Enum('ingress', 'egress',
48
name='securitygrouprules_direction')
51
def upgrade(active_plugins=None, options=None):
52
if not migration.should_run(active_plugins, migration_for_plugins):
55
### commands auto generated by Alembic - please adjust! ###
58
sa.Column('tenant_id', sa.String(length=255), nullable=True),
59
sa.Column('id', sa.String(length=36), nullable=False),
60
sa.Column('name', sa.String(length=255), nullable=True),
61
sa.Column('description', sa.String(length=255), nullable=True),
62
sa.PrimaryKeyConstraint('id')
66
sa.Column('tenant_id', sa.String(length=255), nullable=True),
67
sa.Column('id', sa.String(length=36), nullable=False),
68
sa.Column('security_group_id', sa.String(length=36), nullable=False),
69
sa.Column('remote_group_id', sa.String(length=36), nullable=True),
70
sa.Column('direction', securitygrouprules_direction, nullable=True),
71
sa.Column('ethertype', sa.String(length=40), nullable=True),
72
sa.Column('protocol', sa.String(length=40), nullable=True),
73
sa.Column('port_range_min', sa.Integer(), nullable=True),
74
sa.Column('port_range_max', sa.Integer(), nullable=True),
75
sa.Column('remote_ip_prefix', sa.String(length=255), nullable=True),
76
sa.ForeignKeyConstraint(['security_group_id'], ['securitygroups.id'],
78
sa.ForeignKeyConstraint(['remote_group_id'], ['securitygroups.id'],
80
sa.PrimaryKeyConstraint('id')
83
'securitygroupportbindings',
84
sa.Column('port_id', sa.String(length=36), nullable=False),
85
sa.Column('security_group_id', sa.String(length=36), nullable=False),
86
sa.ForeignKeyConstraint(['port_id'], ['ports.id'], ondelete='CASCADE'),
87
sa.ForeignKeyConstraint(['security_group_id'], ['securitygroups.id']),
88
sa.PrimaryKeyConstraint('port_id', 'security_group_id')
90
### end Alembic commands ###
93
def downgrade(active_plugins=None, options=None):
94
if not migration.should_run(active_plugins, migration_for_plugins):
97
### commands auto generated by Alembic - please adjust! ###
98
op.drop_table('securitygroupportbindings')
99
op.drop_table('securitygrouprules')
100
securitygrouprules_direction.drop(op.get_bind(), checkfirst=False)
101
op.drop_table('securitygroups')
102
### end Alembic commands ###