You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anyway, I think I know why this happens. This commit was merged just before 1.1.0 - d1912d4 - and it added migrations for existing django app models. Previously, tables were created for these models due to the option --run-syncdb, which according to django docs:
Allows creating tables for apps without migrations. While this isn’t recommended ...
... but now there are un-applied migrations, which conflict with tables already in the database. I think this would happen to anyone who initialized the db before 1.1 and then followed the upgrade instructions in 1.1.1.
Luckily, django-admin migrate has another relevant option --fake-initial:
Allows Django to skip an app’s initial migration if all database tables with the names of all models created by all CreateModel operations in that migration already exist. This option is intended for use when first running migrations against a database that preexisted the use of migrations. This option does not, however, check for matching database schema beyond matching table names ...
So it seems to me that the release notes should recommend using --fake-initial to migrate from 1.0, and --run-syncdb should no longer be used for migrating from 1.0 nor for new databases.
The text was updated successfully, but these errors were encountered:
Thanks for finally sorting this, @ploxiln !
We'll need to fix docs. Unfortunately, it's not easy for already released versions, but at least, we can do that in master
I initially created the sqlite database for graphite-web 1.0.2 according to the documentation recommendation:
https://graphite.readthedocs.io/en/latest/config-database-setup.html#webapp-database-setup
Recently I attempted to upgrade to graphite-web 1.1.5, and followed the documented command in the 1.1.1 release notes:
https://graphite.readthedocs.io/en/latest/releases/1_1_1.html#upgrading
which resulted in failure:
I found another that hit this too, and didn't seem to solve it directly:
graphite-project/docker-graphite-statsd#32
Anyway, I think I know why this happens. This commit was merged just before 1.1.0 - d1912d4 - and it added migrations for existing django app models. Previously, tables were created for these models due to the option
--run-syncdb
, which according to django docs:... but now there are un-applied migrations, which conflict with tables already in the database. I think this would happen to anyone who initialized the db before 1.1 and then followed the upgrade instructions in 1.1.1.
Luckily,
django-admin migrate
has another relevant option--fake-initial
:Running migrate with
--fake-initial
I get:So it seems to me that the release notes should recommend using
--fake-initial
to migrate from 1.0, and--run-syncdb
should no longer be used for migrating from 1.0 nor for new databases.The text was updated successfully, but these errors were encountered: