server/mirrormanager/model.py | 9 +++++++++
server/mirrormanager/schema_updates/__init__.py | 11 +----------
2 files changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 249c59c29ece8f783f6759657f2d61ffa2a9f8e5
Author: Matt Domsch <Matt_Domsch(a)dell.com>
Date: Fri Apr 29 23:55:02 2011 -0500
create HostLocation intermediate table in model
diff --git a/server/mirrormanager/model.py b/server/mirrormanager/model.py
index 8838302..29d2949 100644
--- a/server/mirrormanager/model.py
+++ b/server/mirrormanager/model.py
@@ -899,6 +899,15 @@ class Location(SQLObject):
self.removeHost(h)
SQLObject.destroySelf(self)
+# manual creation of the RelatedJoin table so we can guarantee uniqueness
+class HostLocation(SQLObject):
+ class sqlmeta:
+ table = 'host_location'
+ host = ForeignKey('Host')
+ location = ForeignKey('Location')
+ hlidx = DatabaseIndex('host', 'location', unique=True)
+
+
class FileGroup(SQLObject):
class sqlmeta:
cacheValues = False
diff --git a/server/mirrormanager/schema_updates/__init__.py
b/server/mirrormanager/schema_updates/__init__.py
index 234f188..22dd19d 100644
--- a/server/mirrormanager/schema_updates/__init__.py
+++ b/server/mirrormanager/schema_updates/__init__.py
@@ -11,21 +11,12 @@ __connection__ = hub
changes = {}
-# this class won't appear in the model, it's only used to create the table in the
database
-class NewHostLocation(SQLObject):
- class sqlmeta:
- table = 'host_location'
- host = ForeignKey('Host')
- location = ForeignKey('Location')
- index = DatabaseIndex('host', 'location', unique=True)
-
-
def change_tables():
global changes
Location.createTable(ifNotExists=True)
FileGroup.createTable(ifNotExists=True)
- NewHostLocation.createTable(ifNotExists=True)
+ HostLocation.createTable(ifNotExists=True)
if 'emailOnDrop' not in OldSite.sqlmeta.columns and \
'emailOnAdd' not in OldSite.sqlmeta.columns:
Show replies by date