Set lock_path correctly.
[openstack-build/neutron-build.git] / neutron / db / migration / alembic_migrations / versions / liberty / expand / 599c6a226151_neutrodb_ipam.py
1 # Copyright 2015 OpenStack Foundation
2 #
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
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, WITHOUT
11 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 #    License for the specific language governing permissions and limitations
13 #    under the License.
14 #
15
16 """neutrodb_ipam
17
18 Revision ID: 599c6a226151
19 Revises: 354db87e3225
20 Create Date: 2015-03-08 18:12:08.962378
21
22 """
23
24 # revision identifiers, used by Alembic.
25 revision = '599c6a226151'
26 down_revision = '354db87e3225'
27
28 from alembic import op
29 import sqlalchemy as sa
30
31
32 def upgrade():
33     op.create_table(
34         'ipamsubnets',
35         sa.Column('id', sa.String(length=36), nullable=False),
36         sa.Column('neutron_subnet_id', sa.String(length=36), nullable=True),
37         sa.PrimaryKeyConstraint('id'))
38
39     op.create_table(
40         'ipamallocations',
41         sa.Column('ip_address', sa.String(length=64), nullable=False),
42         sa.Column('status', sa.String(length=36), nullable=True),
43         sa.Column('ipam_subnet_id', sa.String(length=36), nullable=False),
44         sa.ForeignKeyConstraint(['ipam_subnet_id'],
45                                 ['ipamsubnets.id'],
46                                 ondelete='CASCADE'),
47         sa.PrimaryKeyConstraint('ip_address', 'ipam_subnet_id'))
48
49     op.create_table(
50         'ipamallocationpools',
51         sa.Column('id', sa.String(length=36), nullable=False),
52         sa.Column('ipam_subnet_id', sa.String(length=36), nullable=False),
53         sa.Column('first_ip', sa.String(length=64), nullable=False),
54         sa.Column('last_ip', sa.String(length=64), nullable=False),
55         sa.ForeignKeyConstraint(['ipam_subnet_id'],
56                                 ['ipamsubnets.id'],
57                                 ondelete='CASCADE'),
58         sa.PrimaryKeyConstraint('id'))
59
60     op.create_table(
61         'ipamavailabilityranges',
62         sa.Column('allocation_pool_id', sa.String(length=36), nullable=False),
63         sa.Column('first_ip', sa.String(length=64), nullable=False),
64         sa.Column('last_ip', sa.String(length=64), nullable=False),
65         sa.ForeignKeyConstraint(['allocation_pool_id'],
66                                 ['ipamallocationpools.id'],
67                                 ondelete='CASCADE'),
68         sa.PrimaryKeyConstraint('allocation_pool_id', 'first_ip', 'last_ip'),
69         sa.Index('ix_ipamavailabilityranges_first_ip_allocation_pool_id',
70                  'first_ip', 'allocation_pool_id'),
71         sa.Index('ix_ipamavailabilityranges_last_ip_allocation_pool_id',
72                  'last_ip', 'allocation_pool_id'))