Skip to content

Commit 2f61595

Browse files
ryu25ishgerritforge-ltd
authored andcommitted
Merge "Add port binding table to neutron DB"
2 parents 7bade4a + ffb3dec commit 2f61595

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright 2015 Midokura SARL
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""add binding task
15+
16+
Revision ID: 3fe2bca71c72
17+
Revises: 3404e2c31825
18+
Create Date: 2015-02-16 05:24:01.270141
19+
20+
"""
21+
22+
PORT_BINDING_TABLE_NAME = 'midonet_port_binding'
23+
24+
# revision identifiers, used by Alembic.
25+
revision = '3fe2bca71c72'
26+
down_revision = '3404e2c31825'
27+
28+
from alembic import op
29+
import sqlalchemy as sa
30+
31+
32+
def add_port_binding_table():
33+
op.create_table(
34+
PORT_BINDING_TABLE_NAME,
35+
sa.Column('id', sa.String(length=36), primary_key=True),
36+
sa.Column('port_id', sa.String(length=36), nullable=False),
37+
sa.Column('host_id', sa.String(length=36), nullable=False),
38+
sa.Column('interface_name', sa.String(length=16), nullable=False),
39+
sa.ForeignKeyConstraint(['port_id'], ['ports.id']))
40+
41+
42+
def add_binding_data_type():
43+
op.execute("INSERT INTO midonet_data_types "
44+
"(id, name) ""VALUES (12, 'port_binding')")
45+
46+
47+
def drop_port_binding_table():
48+
op.drop_table(PORT_BINDING_TABLE_NAME)
49+
50+
51+
def remove_binding_data_type():
52+
op.execute("DELETE FROM midonet_data_types WHERE name='port_binding'")
53+
54+
55+
def upgrade():
56+
add_port_binding_table()
57+
add_binding_data_type()
58+
59+
60+
def downgrade():
61+
remove_binding_data_type()
62+
drop_port_binding_table()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3404e2c31825
1+
3fe2bca71c72

0 commit comments

Comments
 (0)