Re: sys.exit(1) from makemigrations if no changes found

2014-11-10 Thread Tim Heap
The preference seems to be for option 3, adding a new flag --exit. I have implemented this and updated the pull request at https://github.com/django/django/pull/3441. On Wednesday, October 29, 2014 12:22:42 PM UTC+11, Tim Heap wrote: > > Hi all, > > I have created a ticket for this ( > https://c

Re: sys.exit(1) from makemigrations if no changes found

2014-10-31 Thread Luke Plant
My preference for this would be option 3., on the grounds that: * I'd rule out 1 because of the slight backwards incompatibility (which can affect people - I remember a deploy script failing because of a changed exit code for a Mercurial command). In particular, currently there are other condition

Re: sys.exit(1) from makemigrations if no changes found

2014-10-30 Thread Shai Berger
On Thursday 30 October 2014 15:22:01 Dan Poirier wrote: > Wouldn't enabling this by default cause a problem for any automated > deploys? The discussion is about the makemigrations command, not migrate. The OP wants to use it to find automatically if there are model changes not covered by migrati

Re: sys.exit(1) from makemigrations if no changes found

2014-10-30 Thread Dan Poirier
Wouldn't enabling this by default cause a problem for any automated deploys? Ours typically run the migrate command on every deploy, just in case there are new migrations, and any command that returns a non-0 exit status is going to look like a deploy failure. Having the behavior change with a ne

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Tim Heap
If makemigrations exits with something other than 0, it will not have created any migrations to run anyway, so running the makemigrations & migrate pair here would not be affected. However, a useful one liner that I have been using when developing is: ./manage.py makemigrations && ./manage.py m

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Daryl
I'm +1 on being able to continue using the line ./manage.py makemigrations && ./manage.py migrate I can't see many (any?) situation where someone *wouldn't* run makemigrations & migrate as one logical operation, whether by typing the commands or running a script. What would the workflow be where y

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Tim Heap
I also agree that users should opt-in to enabling the error, using option 2 or 3, but I will implement what ever the popular option is. My argument regarding "As the command is instructed to make migrations, not making any is the error case." was more about when to return the error: either when

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Markus Holtermann
I like the general idea, but I slightly disagree with "As the command is instructed to make migrations, not making any is the error case.". Yes, grep works that way but I thing this are two different use cases. I think makemigrations on a project without any changes in the models' database repr

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Tim Heap
The backwards compatibility issue I was thinking of is for people using `makemigrations` in a script currently, expecting it to exit with 0 unless something very wrong has happened. For example, if `makemigrations` is run in a bash script with `set -e`, and it does not find any migrations, that

Re: sys.exit(1) from makemigrations if no changes found

2014-10-29 Thread Marc Tamlyn
I agree number 1 is fine. For most general interaction with the command users won't notice. Marc On 29 Oct 2014 02:04, "Andrew Godwin" wrote: > I'm actually fine with option 1 - always exiting with a status code if no > migrations are found. Since the status code does nothing useful at the > mom

Re: sys.exit(1) from makemigrations if no changes found

2014-10-28 Thread Andrew Godwin
I'm actually fine with option 1 - always exiting with a status code if no migrations are found. Since the status code does nothing useful at the moment, I don't see any backwards compatibility issues, and as long as it's a suitably small patch, it should be fine. (As for being surprising compared

sys.exit(1) from makemigrations if no changes found

2014-10-28 Thread Tim Heap
Hi all, I have created a ticket for this ( https://code.djangoproject.com/ticket/23728) but I would like some input before I work on it. I will copy the content of the ticket below for ease of reading: It would be very useful for continuous deployment, testing, commit hooks, and other applicat