1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
18
from sqlalchemy import Boolean, Column, DateTime
19
from sqlalchemy import MetaData, Integer, String, Table
21
from cinder.openstack.common import log as logging
23
LOG = logging.getLogger(__name__)
26
def upgrade(migrate_engine):
28
meta.bind = migrate_engine
33
Column('created_at', DateTime(timezone=False)),
34
Column('updated_at', DateTime(timezone=False)),
35
Column('deleted_at', DateTime(timezone=False)),
36
Column('deleted', Boolean(create_constraint=True, name=None)),
37
Column('id', String(36), primary_key=True, nullable=False),
38
Column('volume_id', String(36), nullable=False),
39
Column('user_id', String(length=255, convert_unicode=False,
42
_warn_on_bytestring=False)),
43
Column('project_id', String(length=255, convert_unicode=False,
46
_warn_on_bytestring=False)),
47
Column('host', String(length=255, convert_unicode=False,
50
_warn_on_bytestring=False)),
51
Column('availability_zone', String(length=255,
52
convert_unicode=False,
55
_warn_on_bytestring=False)),
56
Column('display_name', String(length=255, convert_unicode=False,
59
_warn_on_bytestring=False)),
60
Column('display_description', String(length=255,
61
convert_unicode=False,
64
_warn_on_bytestring=False)),
65
Column('container', String(length=255, convert_unicode=False,
68
_warn_on_bytestring=False)),
69
Column('status', String(length=255, convert_unicode=False,
72
_warn_on_bytestring=False)),
73
Column('fail_reason', String(length=255, convert_unicode=False,
76
_warn_on_bytestring=False)),
77
Column('service_metadata', String(length=255, convert_unicode=False,
80
_warn_on_bytestring=False)),
81
Column('service', String(length=255, convert_unicode=False,
84
_warn_on_bytestring=False)),
85
Column('size', Integer()),
86
Column('object_count', Integer()),
93
LOG.error(_("Table |%s| not created!"), repr(backups))
97
def downgrade(migrate_engine):
99
meta.bind = migrate_engine
101
backups = Table('backups', meta, autoload=True)
105
LOG.error(_("backups table not dropped"))