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

« back to all changes in this revision

Viewing changes to cinder/db/sqlalchemy/migrate_repo/versions/037_instances_drop_admin_pass.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 2011 OpenStack LLC.
 
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 Column, MetaData, Table, String
 
16
 
 
17
 
 
18
def upgrade(migrate_engine):
 
19
    meta = MetaData()
 
20
    meta.bind = migrate_engine
 
21
 
 
22
    instances = Table('instances', meta, autoload=True)
 
23
 
 
24
    instances.drop_column('admin_pass')
 
25
 
 
26
 
 
27
def downgrade(migrate_engine):
 
28
    meta = MetaData()
 
29
    meta.bind = migrate_engine
 
30
 
 
31
    instances = Table('instances', meta, autoload=True)
 
32
 
 
33
    #
 
34
    # New Columns
 
35
    #
 
36
    admin_pass = Column(
 
37
        'admin_pass',
 
38
        String(length=255, convert_unicode=False, assert_unicode=None,
 
39
               unicode_error=None, _warn_on_bytestring=False),
 
40
        nullable=True)
 
41
 
 
42
    instances.create_column(admin_pass)