Thursday, August 1, 2013

Re: South with MySQL?

On Thu, Aug 1, 2013 at 10:56 AM, Nigel Legg <nigel.legg@gmail.com> wrote:
> So is it something I have done wrong? From what you are saying it has run
> the migration but I am not seeing that - still getting errors when I try to
> access the page. If I do manag.py sql myapp I see the schema including the
> new fields, but if I go into the shell, import the view, and do
> DataTable.objects.all() I get "Unknown column 'myapp_datatable.type2stub' in
> 'field list'".
> So is there a way to resolve this without deleting the database and starting
> again with one that does not have so many issues working with South?

What South is telling you is that it has not successfully applied the
migration, that something went wrong, and because you chose to use
MySQL, it has no way of reverting it to a sane, known state.
Therefore, that's up to you.

South may have been able to apply some of the migration, and not other
parts. Look at the migration, what models does it change, what changes
are necessary, then look at the database and see what has been
changed. At this point, you have two choices, you can revert the
changes that south made and attempt to fix and re-run the migration,
or you can manually apply the migration.

If you were preparing a migration for production, you would definitely
do the former, as the end result you want is a migration that will run
perfectly on your production system.

The 'sql' and 'sqlall' commands only represent translating your models
in to SQL, they have nothing to do with what the table structure in
your database is.

Cheers

Tom

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment