merged unpushed changes stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Tue, 07 Sep 2010 17:33:33 +0200
branchstable
changeset 6181 b8f8b1236358
parent 6178 9b596b11e375 (current diff)
parent 6179 2506ab5d82d7 (diff)
child 6183 fcb9d90b622e
merged unpushed changes
--- a/__pkginfo__.py	Tue Sep 07 13:20:32 2010 +0200
+++ b/__pkginfo__.py	Tue Sep 07 17:33:33 2010 +0200
@@ -43,7 +43,7 @@
     'logilab-common': '>= 0.51.0',
     'logilab-mtconverter': '>= 0.8.0',
     'rql': '>= 0.26.2',
-    'yams': '>= 0.29.1',
+    'yams': '>= 0.30.0',
     'docutils': '>= 0.6',
     #gettext                    # for xgettext, msgcat, etc...
     # web dependancies
@@ -52,7 +52,7 @@
     'Twisted': '',
     # XXX graphviz
     # server dependencies
-    'logilab-database': '>= 1.1.0',
+    'logilab-database': '>= 1.2.0',
     'pysqlite': '>= 2.5.5', # XXX install pysqlite2
     }
 
--- a/debian/control	Tue Sep 07 13:20:32 2010 +0200
+++ b/debian/control	Tue Sep 07 17:33:33 2010 +0200
@@ -33,7 +33,7 @@
 Conflicts: cubicweb-multisources
 Replaces: cubicweb-multisources
 Provides: cubicweb-multisources
-Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.1.0), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2
+Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.2.0), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2
 Recommends: pyro, cubicweb-documentation (= ${source:Version})
 Description: server part of the CubicWeb framework
  CubicWeb is a semantic web application framework.
@@ -97,7 +97,7 @@
 Package: cubicweb-common
 Architecture: all
 XB-Python-Version: ${python:Versions}
-Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.8.0), python-logilab-common (>= 0.51.0), python-yams (>= 0.29.1), python-rql (>= 0.26.3), python-lxml
+Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.8.0), python-logilab-common (>= 0.51.0), python-yams (>= 0.30.0), python-rql (>= 0.26.3), python-lxml
 Recommends: python-simpletal (>= 4.0), python-crypto
 Conflicts: cubicweb-core
 Replaces: cubicweb-core
--- a/server/migractions.py	Tue Sep 07 13:20:32 2010 +0200
+++ b/server/migractions.py	Tue Sep 07 17:33:33 2010 +0200
@@ -1117,6 +1117,34 @@
         if commit:
             self.commit()
 
+    def cmd_add_unique_together_attrs(self, etype, attrlist, commit=True):
+        """
+        Add a (sql) UNIQUE index on all the underlying columns for the
+        attributes listed in attrlist. That list can also contain
+        inlined relations.
+        """
+        prefix = SQL_PREFIX
+        dbhelper = self.repo.system_source.dbhelper
+        cols  = ['%s%s' % (prefix, col) for col in attrlist]
+        table = '%s%s' % (prefix, etype)
+        sql = dbhelper.sql_create_multicol_unique_index(table, cols)
+        self.sqlexec(sql, ask_confirm=False)
+        if commit:
+            self.commit()
+
+    def cmd_drop_unique_together_attrs(self, etype, attrlist, commit=True):
+        """
+        remove a UNIQUE index created with add_unique_together_attrs
+        """
+        prefix = SQL_PREFIX
+        dbhelper = self.repo.system_source.dbhelper
+        cols  = ['%s%s' % (prefix, col) for col in attrlist]
+        table = '%s%s' % (prefix, etype)
+        sql = dbhelper.sql_drop_multicol_unique_index(table, cols)
+        self.sqlexec(sql, ask_confirm=False)
+        if commit:
+            self.commit()
+
     @deprecated('[3.2] use sync_schema_props_perms(ertype, syncprops=False)')
     def cmd_synchronize_permissions(self, ertype, commit=True):
         self.cmd_sync_schema_props_perms(ertype, syncprops=False, commit=commit)