summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorTrey Morris <treyemorris@gmail.com>2011-12-02 17:53:34 -0600
committerTrey Morris <treyemorris@gmail.com>2011-12-05 12:38:23 -0600
commit2e000f35023dfe096e94e95b0673e209d93acef9 (patch)
tree53b76eec1be57ef70bdae6419965ceda329ba896 /nova
parent022295ecc2a936eab98b8a1900690ac0cd87b134 (diff)
add index to instance_uuid column in instances
Change-Id: I4d5313cfbd97eba7bd755567a0bed9b65adb14dc
Diffstat (limited to 'nova')
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/061_add_index_to_instance_uuid.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/061_add_index_to_instance_uuid.py b/nova/db/sqlalchemy/migrate_repo/versions/061_add_index_to_instance_uuid.py
new file mode 100644
index 000000000..0ec06b66d
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/061_add_index_to_instance_uuid.py
@@ -0,0 +1,29 @@
+# Copyright 2011 OpenStack LLC.
+#
+# 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 Index, MetaData, Table
+
+meta = MetaData()
+
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ instances = Table('instances', meta, autoload=True)
+ Index('uuid', instances.c.uuid, unique=True).create(migrate_engine)
+
+
+def downgrade(migrate_engine):
+ meta.bind = migrate_engine
+ instances = Table('instances', meta, autoload=True)
+ Index('uuid', instances.c.uuid, unique=True).drop(migrate_engine)