Skip to content

Commit

Permalink
Dev docs: Add guidelines on how to use migrations, upgrade and initdb
Browse files Browse the repository at this point in the history
  • Loading branch information
unho committed Apr 21, 2014
1 parent 0e8db7f commit 0905d24
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/developers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ other way, make sure to read through this part.
hacking
customization
testing
initial_data_and_upgrade
release
glossary
styleguide
Expand Down
19 changes: 19 additions & 0 deletions docs/developers/initial_data_and_upgrade.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. _initial-data-and-upgrade:

Initial data and upgrade
========================

When developing is not uncommon to have to alter the database schema (adding,
changing or removing fields to models), provide new initial data on fresh
installations or alter the data on the database when upgrading.

The following guidelines are meant to make clear where to put the code:

- When altering the database schema, add a migration.
- When adding new initial data, add the code to ``pootle.core.initdb``.
- When altering the data on the database on upgrading, add the code to
``pootle.apps.pootle_misc.upgrade.pootle``.

.. note:: If this upgrade code is going to be used for providing initial data
as well, then it must be placed instead on ``pootle.core.initdb`` and
referenced from ``pootle.apps.pootle_misc.upgrade.pootle``.

0 comments on commit 0905d24

Please sign in to comment.