**** CubicPower OpenStack Study ****
def upgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.create_table('routerrules',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('source', sa.String(length=64), nullable=False),
sa.Column('destination', sa.String(length=64),
nullable=False),
sa.Column('action', sa.String(length=10), nullable=False),
sa.Column('router_id', sa.String(length=36),
nullable=True),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'))
op.create_table('nexthops',
sa.Column('rule_id', sa.Integer(), nullable=False),
sa.Column('nexthop', sa.String(length=64), nullable=False),
sa.ForeignKeyConstraint(['rule_id'], ['routerrules.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('rule_id', 'nexthop'))
**** CubicPower OpenStack Study ****
def downgrade(active_plugins=None, options=None):
if not migration.should_run(active_plugins, migration_for_plugins):
return
op.drop_table('nexthops')
op.drop_table('routerrules')