¡@

Home 

OpenStack Study: 1c33fa3cd1a1_extra_route_config.py

OpenStack Index

**** CubicPower OpenStack Study ****

def upgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.rename_table(

        'routes',

        'subnetroutes',

    )

    op.create_table(

        'routerroutes',

        sa.Column('destination', sa.String(length=64), nullable=False),

        sa.Column(

            'nexthop', sa.String(length=64), nullable=False),

        sa.Column('router_id', sa.String(length=36), nullable=False),

        sa.ForeignKeyConstraint(

            ['router_id'], ['routers.id'], ondelete='CASCADE'),

        sa.PrimaryKeyConstraint('destination', 'nexthop', 'router_id')

    )

**** CubicPower OpenStack Study ****

def downgrade(active_plugins=None, options=None):

    if not migration.should_run(active_plugins, migration_for_plugins):

        return

    op.rename_table(

        'subnetroutes',

        'routes',

    )

    op.drop_table('routerroutes')