]> review.fuel-infra Code Review - openstack-build/neutron-build.git/blob
1a00de50031af8b9c0cb9c64628e076e9afe1188
[openstack-build/neutron-build.git] /
1 # Copyright 2014 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 """add_uniqueconstraint_ipavailability_ranges
17
18 Revision ID: 44621190bc02
19 Revises: juno
20 Create Date: 2014-09-23 15:14:15.051921
21
22 """
23
24 # revision identifiers, used by Alembic.
25 revision = '44621190bc02'
26 down_revision = 'juno'
27
28 from alembic import op
29
30
31 TABLE_NAME = 'ipavailabilityranges'
32 UC_1_NAME = 'uniq_ipavailabilityranges0first_ip0allocation_pool_id'
33 UC_2_NAME = 'uniq_ipavailabilityranges0last_ip0allocation_pool_id'
34
35
36 def upgrade():
37     op.create_unique_constraint(
38         name=UC_1_NAME,
39         source=TABLE_NAME,
40         local_cols=['first_ip', 'allocation_pool_id']
41     )
42
43     op.create_unique_constraint(
44         name=UC_2_NAME,
45         source=TABLE_NAME,
46         local_cols=['last_ip', 'allocation_pool_id']
47     )