Skip to content

Commit

Permalink
docs: explain django-admin migrate --fake-initial and --run-syncdb
Browse files Browse the repository at this point in the history
  • Loading branch information
ploxiln committed Feb 8, 2019
1 parent 6b0c9ae commit 3e8b8eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/config-database-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ To set up a new database and create the initial schema, run:
PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings
.. note ::
In Graphite-Web 1.0 and earlier, if using Django 1.9 or later, the ``--run-syncdb`` option is needed for migrate to create tables for models without migrations (and Django 1.8 or earlier did not have this option but always exhibited this behavior). In Graphite-Web 1.1 and later all models have migrations, so ``--run-syncdb`` is no longer needed. If upgrading a database created by Graphite-Web 1.0 or earlier, you need to use the ``--fake-initial`` option for migrate: it considers an initial migration to already be applied if the tables it creates already exist.
If you are experiencing problems, uncomment the following line in /opt/graphite/webapp/graphite/local_settings.py:

.. code-block:: none
Expand Down
2 changes: 2 additions & 0 deletions docs/releases/1_1_1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ If you're not already running from the *master* branch, Graphite-Web's applicati
sudo PYTHONPATH=/opt/graphite/webapp django-admin.py migrate \
--noinput --settings=graphite.settings --fake-initial
In this release of Graphite-Web, migrations have been added for any Django models that did not have them. Previously, if using Django 1.9 or later, one needed the ``--run-syncdb`` option for migrate to create tables for Graphite-Web models without migrations (and Django 1.8 or earlier did not have this option but always exhibited this behavior). Django keeps track of which migrations have been applied and attempts to run any that have not, and these new initial migrations try to create tables that already exist from previous versions of Graphite-Web, and fail. This common Django situation is resolved by the ``--fake-initial`` option for migrate: it considers an initial migration to already be applied if the tables it creates already exist.


Other Changes
-------------
Expand Down

0 comments on commit 3e8b8eb

Please sign in to comment.