1
# Copyright 2011 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 MetaData, String, Table
18
from nova import log as logging
21
LOG = logging.getLogger(__name__)
24
def upgrade(migrate_engine):
25
# Upgrade operations go here. Don't create your own engine;
26
# bind migrate_engine to your metadata
28
meta.bind = migrate_engine
32
builds = Table('agent_builds', meta,
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', Integer(), primary_key=True, nullable=False),
39
String(length=255, convert_unicode=False,
41
unicode_error=None, _warn_on_bytestring=False)),
43
String(length=255, convert_unicode=False,
45
unicode_error=None, _warn_on_bytestring=False)),
46
Column('architecture',
47
String(length=255, convert_unicode=False,
49
unicode_error=None, _warn_on_bytestring=False)),
51
String(length=255, convert_unicode=False,
53
unicode_error=None, _warn_on_bytestring=False)),
55
String(length=255, convert_unicode=False,
57
unicode_error=None, _warn_on_bytestring=False)),
59
String(length=255, convert_unicode=False,
61
unicode_error=None, _warn_on_bytestring=False)),
63
for table in (builds, ):
69
instances = Table('instances', meta, autoload=True)
74
architecture = Column('architecture', String(length=255))
76
# Add columns to existing tables
77
instances.create_column(architecture)
80
def downgrade(migrate_engine):
82
meta.bind = migrate_engine
84
builds = Table('agent_builds', meta, autoload=True)
85
for table in (builds, ):
88
instances = Table('instances', meta, autoload=True)
89
instances.drop_column('architecture')