-
-
Couldn't load subscription status.
- Fork 3.2k
Fix makemigrations in develop.py and let it make initial migrations as required #3613
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
Fix makemigrations in develop.py and let it make initial migrations as required #3613
Conversation
…s required
call_command('schemamigration'…) returns a SystemExit when it is complete. Without a try/except block around it, this will cause a loop to prematurely terminate in a seemingly normal way. This is what was happening before this fix, and this effectively caused `develop.py makemigrations` to only ever make migrations for cms, which is the first appliation in the list.
Also, I've added code that will first check to see if an app already has migrations and if not, it will run the equivalent of `manage.py schemamigration [app] --initial` and emit a notice of the same.
Finally, this now detects if an application in the list if not found, and emits a notice of this too.
|
@yakky, can you review this? Also, this probably needs to be updated with Django 1.7 support, which, I don't trust myself to get right. |
|
...and it looks like there's a Python 3.x issue... |
|
Really nice addition |
develop.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have something very similar in cms.test_utils.util.context_managers.StdOverride, maybe re-use that?
develop.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkoistinen why do we need to swallow the output here?
We are going to miss messages and requests for input from schemamigration (like missing defaults etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was attempting to avoid a lot of clutter. I don't think there's any input prompts, but there will be a lot of noise and developers will miss what they need to see, which is provided by the print() lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schemamigration requests for input in different cases (e.g. if default is not defined)
These will be in django-cms#3613
Fix makemigrations in develop.py and let it make initial migrations as required
These will be in django-cms#3613
The
call_command('schemamigration'…)returns aSystemExitwhen it is complete. Without a try/except block around it, this will cause a loop to prematurely terminate in a seemingly normal way. This is what was happening before this fix, and this effectively causeddevelop.py makemigrationsto only ever make migrations for cms, which happens to be the first appliation in the list it works with.Also, I've added code that will first check to see if an app already has migrations and if not, it will run the equivalent of
manage.py schemamigration [app] --initialand emit a notice of the same.Finally, this now detects if an application in the list if not found, and emits a notice of this too.