[migration] new migration command to change fti weight for an entity t ype cubicweb-version-3.9.0
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 07 Jul 2010 14:21:52 +0200
changeset 5928 d9936c39d478
parent 5927 654a34e4eb2e
child 5930 23c23d7b5d6b
child 5931 eda4940ffef8
[migration] new migration command to change fti weight for an entity t ype
server/migractions.py
--- a/server/migractions.py	Wed Jul 07 14:18:28 2010 +0200
+++ b/server/migractions.py	Wed Jul 07 14:21:52 2010 +0200
@@ -1246,6 +1246,13 @@
             self.commit()
         return entity
 
+    def cmd_update_etype_fti_weight(self, etype, weight):
+        if self.repo.system_source.dbdriver == 'postgres':
+            self.sqlexec('UPDATE appears SET weight=%(weight)s '
+                         'FROM entities as X '
+                         'WHERE X.eid=appears.uid AND X.type=%(type)s',
+                         {'type': etype, 'weight': weight}, ask_confirm=False)
+
     def cmd_reindex_entities(self, etypes=None):
         """force reindexaction of entities of the given types or of all
         indexable entity types