django-celery-beat icon indicating copy to clipboard operation
django-celery-beat copied to clipboard

missing migration in pypi release

Open rsichnyi opened this issue 8 years ago • 30 comments

  1. create clean django2.0 project
  2. pip install django-celery-beat
  3. add django_celery_beat to installed_apps
  4. run python manage.py migrate

Actual result: the warning appears:

  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

Expected: no warnings

The reason is missing migration in pypi release

rsichnyi avatar Jan 11 '18 11:01 rsichnyi

Just execute:

python manage.py makemigrations
python manage.py migrate

DEKHTIARJonathan avatar Jan 12 '18 16:01 DEKHTIARJonathan

@DEKHTIARJonathan it works for development, but i don't feel like changing the code of library in the process of prod deployment...

rsichnyi avatar Jan 12 '18 17:01 rsichnyi

It doesn't feel abnormal for me that you have to perform "makemigrations" in the prod deployment. To be honest, I don't really know if there is any best practice (well argumented) that in favor or against this practice.

DEKHTIARJonathan avatar Jan 13 '18 12:01 DEKHTIARJonathan

The problem comes if you run "makemigrations" in production and the same migration appears in an update later on. This will cause "migrate" to fail due to a conflict, if the migration is identical to the one already applied then you could get away with running "--fake" on the updated version.

Personally I think the correct migrations should come from the library and you should not need to run "makemigrations" when using a 3rd party library. A minor update would be really helpful.

BITSOLVER avatar Jan 13 '18 13:01 BITSOLVER

It seems your explanation to be coherent up to me. I then agree that the migrations should be included in the package.

DEKHTIARJonathan avatar Jan 13 '18 13:01 DEKHTIARJonathan

Just worked on my project too (Python 3.6, Django==1.11.9, djangorestframework==3.7.7, pip 9.0.1 from /usr/local/lib/python3.6/site-packages) As @DEKHTIARJonathan stated,

python manage.py makemigrations
python manage.py migrate

ilhnctn avatar Jan 15 '18 08:01 ilhnctn

Personally I think the correct migrations should come from the library and you should not need to run "makemigrations" when using a 3rd party library. A minor update would be really helpful.

This is what i'm talking about

rsichnyi avatar Jan 16 '18 10:01 rsichnyi

This issue probably is a duplicate of https://github.com/celery/django-celery-beat/issues/90.

mbaechtold avatar Jan 21 '18 14:01 mbaechtold

Seconding the request for a release. 1.1.0 is broken (not only a migration file is missing, but it's impossible to provide a correct one yourself due to https://github.com/celery/django-celery-beat/commit/5bccc2dd9f5dd30f19cff30ffcf449c5fca91897) and blocks us from upgrading to Django 2.0.

pwmarcz avatar Jan 22 '18 17:01 pwmarcz

Can't we just have a bug release (v1.1.1) for this issue. We enabled migration tests and now they are all failing because of missing migration. We can't just make migration and create migration file in dependency folder. We don't have permission which is very good practice.

muhtarc4n avatar Jan 23 '18 22:01 muhtarc4n

I support this @thedrow

DEKHTIARJonathan avatar Jan 23 '18 23:01 DEKHTIARJonathan

And I think fix is already in master branch. I can see 5th migration in migrations folder.

muhtarc4n avatar Jan 23 '18 23:01 muhtarc4n

Until there is a new release, you can still pip install the package directly from GitHub. You can even specify a specific commit hash while doing so, no need to install from the master branch:

pip install git+https://github.com/celery/django-celery-beat@ba48402770eead01f059cb364fd522996761d003#egg=django-celery-beat

mbaechtold avatar Jan 24 '18 07:01 mbaechtold

Come on, everything would be so much easier if we could have a minor release. Why would it be a problem to just deploy a small patch.

Additionnally the existing version is not working properly: #113 #117

DEKHTIARJonathan avatar Jan 24 '18 15:01 DEKHTIARJonathan

@mbaechtold it is impossible to install this dependency this way in our company. We put dependency in requirements file and it pulls version from pypi repository.

There is a bug and project needs bug fix version.

muhtarc4n avatar Jan 24 '18 19:01 muhtarc4n

@muhtarc4n, you can install packages from GitHub by specifying them in your requirements.txt too. See the docs of pip, especially the part about Requirements Files:

For example, suppose a dependency, SomeDependency from PyPI has a bug, and you can't wait for an upstream fix. [..]

You might also have a look at the supported forms when installing from Git.

mbaechtold avatar Jan 25 '18 07:01 mbaechtold

I guess what @muhtarc4n say, is that it is not authorized to do such a thing in his company. Which is, by the way, my situation. Only official versions available through PyPI are authorized.

DEKHTIARJonathan avatar Jan 25 '18 09:01 DEKHTIARJonathan

This was caused by a Solar.event CharField with choices get from an unordered set which causes the new migration every time you run makemigrations. (same choices but different order every time)

It's seems that it's already fixed here: https://github.com/celery/django-celery-beat/pull/92/files but it's not released yet

Ivo-Donchev avatar Jan 26 '18 14:01 Ivo-Donchev

Absolutely, but that's a very good reason to release a small patch that fixes the problem.

DEKHTIARJonathan avatar Jan 26 '18 14:01 DEKHTIARJonathan

@mbaechtold Is there a chance for a bugfix release soon :) ?

Ivo-Donchev avatar Jan 26 '18 15:01 Ivo-Donchev