From 3e8b8ebb631d6e78cfcbcb250da5bf46251e2063 Mon Sep 17 00:00:00 2001 From: Pierce Lopez Date: Fri, 8 Feb 2019 00:48:33 -0500 Subject: [PATCH] docs: explain django-admin migrate --fake-initial and --run-syncdb --- docs/config-database-setup.rst | 3 +++ docs/releases/1_1_1.rst | 2 ++ 2 files changed, 5 insertions(+) diff --git a/docs/config-database-setup.rst b/docs/config-database-setup.rst index 72798c49ae..40374c6b7a 100644 --- a/docs/config-database-setup.rst +++ b/docs/config-database-setup.rst @@ -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 diff --git a/docs/releases/1_1_1.rst b/docs/releases/1_1_1.rst index c693e6c572..66a1393fca 100644 --- a/docs/releases/1_1_1.rst +++ b/docs/releases/1_1_1.rst @@ -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 -------------