1
# Copyright (c) 2012 OpenStack, LLC.
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
16
from sqlalchemy import Boolean, Column, DateTime, Integer
17
from sqlalchemy import Index, MetaData, String, Table
18
from nova.openstack.common import log as logging
20
LOG = logging.getLogger(__name__)
23
def upgrade(migrate_engine):
25
meta.bind = migrate_engine
28
compute_nodes = Table('compute_nodes', meta, autoload=True)
31
compute_node_stats = Table('compute_node_stats', meta,
32
Column('created_at', DateTime(timezone=False)),
33
Column('updated_at', DateTime(timezone=False)),
34
Column('deleted_at', DateTime(timezone=False)),
35
Column('deleted', Boolean(create_constraint=True, name=None)),
36
Column('id', Integer(), primary_key=True, nullable=False,
38
Column('compute_node_id', Integer, index=True, nullable=False),
39
Column('key', String(length=255, convert_unicode=True,
40
assert_unicode=None, unicode_error=None,
41
_warn_on_bytestring=False), nullable=False),
42
Column('value', String(length=255, convert_unicode=True,
43
assert_unicode=None, unicode_error=None,
44
_warn_on_bytestring=False)),
45
mysql_engine='InnoDB')
47
compute_node_stats.create()
49
LOG.exception("Exception while creating table 'compute_node_stats'")
53
def downgrade(migrate_engine):
55
meta.bind = migrate_engine
58
compute_nodes = Table('compute_nodes', meta, autoload=True)
60
compute_node_stats = Table('compute_node_stats', meta, autoload=True)
61
compute_node_stats.drop()