check nosy_list supported before migrating it... stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 23 Sep 2010 16:19:06 +0200
branchstable
changeset 634 8558f1d22394
parent 633 0ea335bc8734
child 635 ab04862016ee
check nosy_list supported before migrating it...
migration/2.0.1_Any.py
--- a/migration/2.0.1_Any.py	Thu Sep 23 16:18:32 2010 +0200
+++ b/migration/2.0.1_Any.py	Thu Sep 23 16:19:06 2010 +0200
@@ -2,8 +2,9 @@
     ask_confirm=True)
 commit()
 
-rql('SET U interested_in PE WHERE TC use_environment PE, '
-    'U interested_in TC, NOT U interested_in PE',
-    ask_confirm=True)
-drop_relation_definition('CWUser', 'interested_in', 'TestConfig')
-drop_relation_definition('TestConfig', 'nosy_list', 'CWUser')
+if 'nosy_list' in schema and ('TestConfig', 'CWUser') in schema['nosy_list'].rdefs:
+    rql('SET U interested_in PE WHERE TC use_environment PE, '
+        'U interested_in TC, NOT U interested_in PE',
+        ask_confirm=True)
+    drop_relation_definition('CWUser', 'interested_in', 'TestConfig')
+    drop_relation_definition('TestConfig', 'nosy_list', 'CWUser')