src/source/dev_guide/adv-features.rst
branchdoc-dc
changeset 122 7e69ecc9fd43
parent 114 8032f81fba95
child 126 e0584f3de3fd
--- a/src/source/dev_guide/adv-features.rst	Fri Dec 14 12:16:12 2018 +0100
+++ b/src/source/dev_guide/adv-features.rst	Mon Dec 17 17:19:35 2018 +0100
@@ -11,6 +11,68 @@
 Renaming persistent classes
 ---------------------------
 
+PyAMS provides `zodbupdate` script to update easily update the change in ZODB. Because, when you develop new features
+to PyAMS we sometimes have to rename or modify classes of already stored objects and if you do that you will never access
+yours objects.
+
+To rename classes of existing objects:
+
+**1) Include you package in the require resource for you webapp**
+
+
+.. code-block:: python
+
+    requires = [
+        'mypackage',
+        ...
+    ]
+
+**2) Add the Entry points**
+
+
+In the `setup.py` file add 'zodbupdate' params into entry_points where is store zodbupdate directives
+
+.. code-block:: python
+
+      entry_points={
+          'zodbupdate': [
+              'renames = mypackage.generations:RENAMED_CLASSES'
+          ]
+      }
+
+
+
+**3) Create a module named** ``generation`` **with the migration directives**
+
+
+.. code-block:: python
+
+    RENAMED_CLASSES = {
+        'mypackage.mymodule MyOldClass': 'mypackage.mymodule MyNewClass'
+    }
+
+
+**4) Run the commands** ``buildout`` .
+
+.. code-block:: console
+
+    $ mypackage/bin/buildout
+    $ webapp/bin/buildout
+
+
+The ``buildout`` command going to install correctly the package and add the new entry_points references in entry_points.txt
+
+**5)  Run the commands** ``zodbupdate``
+
+To finish run `zodbupdate` to apply the changes describe in `RENAMED_CLASSES`
+
+.. code-block:: console
+
+    $   bin/zodbupdate --config etc/zodbupdate-zeo.conf
+
+
+Where `zodbupdate-zeo.conf` is the configuration file to access to the ZODB.
+
 Including SQLAlchemy
 --------------------