beatonma / django-wm

Automatic Webmention functionality for Django models
https://beatonma.org/webmentions_tester/
GNU General Public License v3.0
12 stars 2 forks source link

Running makemigrations creates migration files in installed package directory #19

Closed GriceTurrble closed 2 years ago

GriceTurrble commented 2 years ago

django-wm includes concrete models that require database migrations, but no migration files have been included in the package. Running makemigrations generates at least one new migration file inside the package directory (in site-packages or wherever django-wm is installed).

If these concrete models are altered in a later update, upgrading django-wm may start to get painful for downstream users. Even if a user creates the initial migration for the mentions app, upgrading to a new version may actually remove that file, as the full source of the package is replaced with the newer version. At that point, running makemigrations would again create a 0001_initial migration file.

Because a migration with the matching filename would already be tagged in the database as "completed", the changes from the new version would not be migrated at all. Users may start to experience errors due to a mismatch between schema and models that can only be resolved with some manual intervention.

Recommendations:

GriceTurrble commented 2 years ago

Just want to mention this comes from a post on Reddit asking about the potential problem, and I did notice the discussion in #17 regarding the same. Not trying to call out the maintainer for past mistakes, just want to offer to help correct it. :)

beatonma commented 2 years ago

Thank you! I appreciate the advice as (as you saw in #17) I was a little unsure on how best to proceed with potentially breaking changes of this sort. Will get this fixed asap.