~ubuntu-branches/ubuntu/trusty/cinder/trusty

« back to all changes in this revision

Viewing changes to cinder/db/sqlalchemy/migrate_repo/versions/085_add_index_to_fixed_ips_by_address.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-22 09:57:46 UTC
  • Revision ID: package-import@ubuntu.com-20120522095746-9lm71yvzltjybk4b
Tags: upstream-2012.2~f1~20120503.2
ImportĀ upstreamĀ versionĀ 2012.2~f1~20120503.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2012 IBM
 
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
from sqlalchemy import Index, MetaData, Table
 
16
 
 
17
 
 
18
def upgrade(migrate_engine):
 
19
    meta = MetaData()
 
20
    meta.bind = migrate_engine
 
21
    instances = Table('fixed_ips', meta, autoload=True)
 
22
    index = Index('address', instances.c.address)
 
23
    index.create(migrate_engine)
 
24
 
 
25
 
 
26
def downgrade(migrate_engine):
 
27
    meta = MetaData()
 
28
    meta.bind = migrate_engine
 
29
    instances = Table('fixed_ips', meta, autoload=True)
 
30
    index = Index('address', instances.c.address)
 
31
    index.drop(migrate_engine)