Add zodbupdate doc doc-dc
authorDamien Correia
Mon, 11 Jun 2018 18:22:01 +0200
branchdoc-dc
changeset 89 d018bfffa7ca
parent 88 4b0edce1d63c
child 90 06915aa059c5
child 92 7fc18ab1b5b4
Add zodbupdate doc
requirements.txt
src/source/appextend.rst
src/source/howto-rename.rst
src/source/package_layout.rst
src/source/scripts.rst
--- a/requirements.txt	Mon Jun 11 14:50:38 2018 +0200
+++ b/requirements.txt	Mon Jun 11 18:22:01 2018 +0200
@@ -12,7 +12,7 @@
 pyams-default-theme==0.1.5
 pyams-file==0.1.15
 pyams-form==0.1.13
-pyams-gis==0.1.8
+#pyams-gis==0.1.8
 pyams-i18n==0.1.13
 pyams-ldap==0.1.6
 pyams-mail==0.1.1
--- a/src/source/appextend.rst	Mon Jun 11 14:50:38 2018 +0200
+++ b/src/source/appextend.rst	Mon Jun 11 18:22:01 2018 +0200
@@ -13,4 +13,5 @@
     howto-paragraph
     howto-portlet
     howto-renderer
+    howto-rename
     howto-skin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/source/howto-rename.rst	Mon Jun 11 18:22:01 2018 +0200
@@ -0,0 +1,66 @@
+.. _renamehowto:
+
+
+How to rename classes of existing objects
+=========================================
+
+
+When you develop new features to PyAMS we sometimes have to rename or modify classes of already stored objects if you do
+that you will never access yours objects. But PyAMS provides `zodbupdate` script to update easily update the change in ZODB.
+
+
+**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.
--- a/src/source/package_layout.rst	Mon Jun 11 14:50:38 2018 +0200
+++ b/src/source/package_layout.rst	Mon Jun 11 18:22:01 2018 +0200
@@ -6,6 +6,7 @@
 
     ├── pyams_<package>/
     │   ├── doctests/       <- Documentation for the package
+    |   ├── generation/     <- ZODB Migration directives
     │   ├── interfaces/     <- Interfaces definition
     │   ├── locales/        <- Store source code translation files (.mo .pot)
     │   ├── tests/          <- Contains python scripts for running tests including test runners, unit test
--- a/src/source/scripts.rst	Mon Jun 11 14:50:38 2018 +0200
+++ b/src/source/scripts.rst	Mon Jun 11 18:22:01 2018 +0200
@@ -42,3 +42,8 @@
 :py:func:`check_required_utilities <pyams_utils.site.check_required_utilities>` is a PyAMS_utils utility function which
 can to used to verify that a set of local utilities are correctly registered with the given names and interfaces.
 
+
+zodbupdate
+----------
+
+:ref:`renamehowto`