[migration] add a migration script for 4.0.0 draft
authorDavid Douard <david.douard@logilab.fr>
Sun, 09 Nov 2014 20:07:45 +0100
changeset 1773 35a2edaa84e5
parent 1772 139e0c756385
child 1774 873c8740c429
[migration] add a migration script for 4.0.0
migration/4.0.0_Any.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/migration/4.0.0_Any.py	Sun Nov 09 20:07:45 2014 +0100
@@ -0,0 +1,22 @@
+from itertools import chain
+
+drop_attribute('ProjectEnvironment', 'vcs_path')
+
+add_relation_definition('Repository', 'checkout_recipe', 'Recipe')
+add_relation_definition('ProjectEnvironment', 'setup_recipe', 'Recipe')
+
+
+sync_schema_props_perms(schema['TestExecution'].rdef('branch'))
+
+# rename apycot recipes
+for oldname, newname in ((u'apycot.recipe.full', u'apycot.python.full'),
+                         (u'apycot.recipe.quick', u'apycot.python.quick'),
+                         ):
+    rql('SET R name %(newname)s WHERE R is Recipe, R name %(oldname)s',
+        {'newname': newname, 'oldname': oldname})
+commit()
+
+# add new or update basic recipes
+from cubes.apycot import recipes
+recipes.create_recipes(session, update=True)
+