@@ -0,0 +1,2563 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A%0A# Copyright 2011 OpenStack LLC.%0A# All Rights Reserved.%0A#%0A#    Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A#    not use this file except in compliance with the License. You may obtain%0A#    a copy of the License at%0A#%0A#         http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#    Unless required by applicable law or agreed to in writing, software%0A#    distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A#    License for the specific language governing permissions and limitations%0A#    under the License.%0A%0Afrom migrate.changeset import *%0Afrom sqlalchemy import *%0Afrom sqlalchemy.sql import and_, not_%0A%0Afrom glance.registry.db.migrate_repo.schema import (%0A    Boolean, DateTime, Integer, String, Text, from_migration_import)%0A%0A%0Adef get_images_table(meta):%0A    %22%22%22%0A    Returns the Table object for the images table that%0A    corresponds to the images table definition of this version.%0A    %22%22%22%0A    images = Table('images', meta,%0A        Column('id', Integer(), primary_key=True, nullable=False),%0A        Column('name', String(255)),%0A        Column('disk_format', String(20)),%0A        Column('container_format', String(20)),%0A        Column('size', Integer()),%0A        Column('status', String(30), nullable=False),%0A        Column('is_public', Boolean(), nullable=False, default=False,%0A               index=True),%0A        Column('location', Text()),%0A        Column('created_at', DateTime(), nullable=False),%0A        Column('updated_at', DateTime()),%0A        Column('deleted_at', DateTime()),%0A        Column('deleted', Boolean(), nullable=False, default=False,%0A               index=True),%0A        Column('checksum', String(32)),%0A        mysql_engine='InnoDB',%0A        useexisting=True)%0A%0A    return images%0A%0A%0Adef get_image_properties_table(meta):%0A    %22%22%22%0A    No changes to the image properties table from 002...%0A    %22%22%22%0A    (define_image_properties_table,) = from_migration_import(%0A        '002_add_image_properties_table', %5B'define_image_properties_table'%5D)%0A%0A    image_properties = define_image_properties_table(meta)%0A    return image_properties%0A%0A%0Adef upgrade(migrate_engine):%0A    meta = MetaData()%0A    meta.bind = migrate_engine%0A%0A    images = get_images_table(meta)%0A%0A    checksum = Column('checksum', String(32))%0A    checksum.create(images)%0A%0A%0Adef downgrade(migrate_engine):%0A    meta = MetaData()%0A    meta.bind = migrate_engine%0A%0A    images = get_images_table(meta)%0A%0A    images.columns%5B'checksum'%5D.drop()%0A

Add migration script for checksum column