Skip to content

Commit

Permalink
Merge pull request #8087 from pdekraker-epa/patch-2
Browse files Browse the repository at this point in the history
Update best-practices.rst
  • Loading branch information
wardi committed Feb 27, 2024
2 parents 81db9f6 + aff8e4c commit 1c45951
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions doc/extensions/best-practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ keys against core tables.

.. _extensions db migrations:

--------------------------------------------------
Don't 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`_.

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

------------------------------------------
Use migrations when introducing new models
------------------------------------------
Expand Down Expand Up @@ -208,21 +220,6 @@ such as::
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:`ckan command </maintaining/cli>` which can be run separately.

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

.. _csrf_best_practices:

----------------------------
Expand Down

0 comments on commit 1c45951

Please sign in to comment.