Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: for sql db migration to 1.1 recommend --fake-initial #2425

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/config-database-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ To set up a new database and create the initial schema, run:

.. code-block:: none
PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb
PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings
.. note ::
Graphite-Web 1.0 and earlier had some models without migrations, and with Django 1.9 or later, the ``--run-syncdb`` option was needed for migrate to create tables for these models. (Django 1.8 and 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:

Expand Down
2 changes: 1 addition & 1 deletion docs/config-local-settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ The following configures the Django database settings. Graphite uses the databas
See the `Django documentation <https://docs.djangoproject.com/en/dev/ref/settings/#databases>`_ for full documentation of the DATABASES setting.

.. note ::
Remember, setting up a new database requires running ``PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb`` to create the initial schema.
Remember, setting up a new database requires running ``PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings`` to create the initial schema.
.. note ::
If you are using a custom database backend (other than SQLite) you must first create a $GRAPHITE_ROOT/webapp/graphite/local_settings.py file that overrides the database related settings from settings.py. Use $GRAPHITE_ROOT/webapp/graphite/local_settings.py.example as a template.
Expand Down
4 changes: 3 additions & 1 deletion docs/releases/1_1_1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ If you're not already running from the *master* branch, Graphite-Web's applicati
sudo cp /opt/graphite/storage/graphite.db \
/opt/graphite/storage/graphite.db.backup-`date +%Y%m%d_%H%M%S`
sudo PYTHONPATH=/opt/graphite/webapp django-admin.py migrate \
--noinput --settings=graphite.settings --run-syncdb
--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