~ubuntu-branches/ubuntu/wily/heat/wily-proposed

« back to all changes in this revision

Viewing changes to heat/db/sqlalchemy/migrate_repo/versions/053_stack_name_tenant_indexes.py

  • Committer: Package Import Robot
  • Author(s): James Page, Corey Bryant, James Page
  • Date: 2015-03-30 11:11:18 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20150330111118-2qpycylx6swu4yhj
Tags: 2015.1~b3-0ubuntu1
[ Corey Bryant ]
* New upstream milestone release for OpenStack kilo:
  - d/control: Align with upstream dependencies.
  - d/p/sudoers_patch.patch: Rebased.
  - d/p/fix-requirements.patch: Rebased.

[ James Page ]
* d/p/fixup-assert-regex.patch: Tweak test to use assertRegexpMatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
3
#    not use this file except in compliance with the License. You may obtain
 
4
#    a copy of the License at
 
5
#
 
6
#         http://www.apache.org/licenses/LICENSE-2.0
 
7
#
 
8
#    Unless required by applicable law or agreed to in writing, software
 
9
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
10
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
11
#    License for the specific language governing permissions and limitations
 
12
#    under the License.
 
13
 
 
14
import sqlalchemy
 
15
 
 
16
 
 
17
def upgrade(migrate_engine):
 
18
    meta = sqlalchemy.MetaData(bind=migrate_engine)
 
19
    stack = sqlalchemy.Table('stack', meta, autoload=True)
 
20
 
 
21
    name_index = sqlalchemy.Index('ix_stack_name', stack.c.name,
 
22
                                  mysql_length=255)
 
23
    name_index.create(migrate_engine)
 
24
 
 
25
    tenant_index = sqlalchemy.Index('ix_stack_tenant', stack.c.tenant,
 
26
                                    mysql_length=255)
 
27
    tenant_index.create(migrate_engine)
 
28
 
 
29
 
 
30
def downgrade(migrate_engine):
 
31
    meta = sqlalchemy.MetaData(bind=migrate_engine)
 
32
    stack = sqlalchemy.Table('stack', meta, autoload=True)
 
33
 
 
34
    name_index = sqlalchemy.Index('ix_stack_name', stack.c.name,
 
35
                                  mysql_length=255)
 
36
    name_index.drop(migrate_engine)
 
37
 
 
38
    tenant_index = sqlalchemy.Index('ix_stack_tenant', stack.c.tenant,
 
39
                                    mysql_length=255)
 
40
    tenant_index.drop(migrate_engine)