summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/141_update_migrations_instance_uuid.py33
-rw-r--r--nova/db/sqlalchemy/models.py2
2 files changed, 34 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/141_update_migrations_instance_uuid.py b/nova/db/sqlalchemy/migrate_repo/versions/141_update_migrations_instance_uuid.py
new file mode 100644
index 000000000..086435022
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/141_update_migrations_instance_uuid.py
@@ -0,0 +1,33 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2012 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from sqlalchemy import MetaData, String, Table
+
+
+def upgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+
+ migrations = Table('migrations', meta, autoload=True)
+ migrations.c.instance_uuid.alter(String(36))
+
+
+def downgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+
+ migrations = Table('migrations', meta, autoload=True)
+ migrations.c.instance_uuid.alter(String(255))
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index fbcfe7668..5716f9ecd 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -635,7 +635,7 @@ class Migration(BASE, NovaBase):
dest_host = Column(String(255))
old_instance_type_id = Column(Integer())
new_instance_type_id = Column(Integer())
- instance_uuid = Column(String(255), ForeignKey('instances.uuid'),
+ instance_uuid = Column(String(36), ForeignKey('instances.uuid'),
nullable=True)
#TODO(_cerberus_): enum
status = Column(String(255))