Skip to content

Conversation

@mkoistinen
Copy link
Contributor

The 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 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] --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.

…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.
@mkoistinen
Copy link
Contributor Author

@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.

@mkoistinen
Copy link
Contributor Author

...and it looks like there's a Python 3.x issue...

@yakky
Copy link
Member

yakky commented Nov 26, 2014

Really nice addition
@mkoistinen get StringIO from the six package bundled in Django

@yakky yakky modified the milestones: 3.0.X, 3.0.8 Nov 27, 2014
develop.py Outdated
Copy link
Contributor

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
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Member

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)

mkoistinen added a commit to mkoistinen/django-cms that referenced this pull request Jan 11, 2015
@coveralls
Copy link

coveralls commented Jan 11, 2015

Coverage Status

Coverage increased (+0.09%) to 87.493% when pulling aca1cc5 on mkoistinen:fix_migrations_in_develop into 0b6c0a3 on divio:support/3.0.x.

yakky added a commit that referenced this pull request Jan 11, 2015
Fix makemigrations in develop.py and let it make initial migrations as required
@yakky yakky merged commit 03fa2ef into django-cms:support/3.0.x Jan 11, 2015
mkoistinen added a commit to mkoistinen/django-cms that referenced this pull request Jan 11, 2015
@mkoistinen mkoistinen deleted the fix_migrations_in_develop branch August 12, 2015 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants