Django Migrations?

32 views
Skip to first unread message

Ed Sutherland

unread,
Mar 1, 2017, 7:44:06 PM3/1/17
to django-users
I am a relatively new Django coder. I'm building a small custom CMS. Whenever I get deep into development, I run into a migration problem: an old error keeps halting newer migrations. I long ago fixed the original error, but the migration continues to stop due to a now non-existent error. I know I can rollback the migration to the last successful attempt, but how do I prevent this in the first place? Thanks.



Melvyn Sopacua

unread,
Mar 1, 2017, 8:51:41 PM3/1/17
to django...@googlegroups.com

Rolling back is destructive, so never a solution for production. How you can eliminate the error is largely depending on the error.

--

Melvyn Sopacua

Ed Sutherland

unread,
Mar 2, 2017, 12:46:21 AM3/2/17
to django-users, django-users
The problem surrounded a textfield that had no default. I added the default string and migrate complained it was an int. I changed the string and migrate still complains of the int default that no longer exists.





---- On Wed, 01 Mar 2017 15:50:07 -0500 Melvyn Sopacua<m.r.s...@gmail.com> wrote ----

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1571910.2OvDCcMPjQ%40devstation.
For more options, visit https://groups.google.com/d/optout.

Michal Petrucha

unread,
Mar 2, 2017, 9:46:47 AM3/2/17
to django-users
On Wed, Mar 01, 2017 at 07:45:24PM -0500, Ed Sutherland wrote:
> The problem surrounded a textfield that had no default. I added the
> default string and migrate complained it was an int. I changed the
> string and migrate still complains of the int default that no longer
> exists.

Hi Ed,

When trying to get help with an error, it's usually helpful to post
the full traceback that you get when it happens. Otherwise people have
to do a lot of guessing as to what could have gone wrong, and it just
takes longer to get all the relevant information out of the question
asker.

In this case (and now I'm just guessing, because you haven't provided
a lot of detail in your problem description), it might be that you
have a broken migration in your repository that you'll need to fix. If
that is the case, could you also post the code of the migration file
that is failing?

Cheers,

Michal
signature.asc

Melvyn Sopacua

unread,
Mar 2, 2017, 12:13:05 PM3/2/17
to django-users

On Thursday 02 March 2017 10:45:50 Michal Petrucha wrote:

> On Wed, Mar 01, 2017 at 07:45:24PM -0500, Ed Sutherland wrote:

> > The problem surrounded a textfield that had no default. I added the

> > default string and migrate complained it was an int. I changed the

> > string and migrate still complains of the int default that no longer

> > exists.

>

> Hi Ed,

>

> When trying to get help with an error, it's usually helpful to post

> the full traceback that you get when it happens. Otherwise people have

> to do a lot of guessing as to what could have gone wrong, and it just

> takes longer to get all the relevant information out of the question

> asker.

 

+1. If you've corrected the error and migrations have been applied, I can't begin to guess why it's still bothering you.

 

It also matters how you corrected it. If you:

- ran migrate --fake

- created a new migration fixing the error

 

Then yes, it will still bother you when deploying a new instance. Don't see how that could bother you on a database that is already migrated though.

--

Melvyn Sopacua

Reply all
Reply to author
Forward
0 new messages