Skip to content

Commit

Permalink
Docs: Extensions should not automatically alter the database structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
torfsen committed Jun 13, 2016
1 parent 997b06c commit fde822f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions doc/extensions/best-practices.rst
Expand Up @@ -67,12 +67,28 @@ adding them to ``setup.py``, they should be added
to ``requirements.txt``, which can be installed with::

pip install -r requirements.txt

To prevent accidental breakage of your extension through backwards-incompatible
behaviour of newer versions of your dependencies, their versions should be pinned,
such as::

requests==2.7.0

On the flip side, be mindful that this could also create version conflicts with
requirements of considerably newer or older extensions.


--------------------------------------------------
Do not automatically modify the database structure
--------------------------------------------------

If your extension uses custom database tables then it needs to modify the
database structure, for example to add the tables after its installation or to
migrate them after an update. These modifications should not be performed
automatically when the extension is loaded, since this can lead to `dead-locks
and other problems`_.

Instead, create a :doc:`paster command </maintaining/paster>` which can be run separately.

.. _dead-locks and other problems: https://github.com/ckan/ideas-and-roadmap/issues/164

0 comments on commit fde822f

Please sign in to comment.