Friday, July 29, 2016

Re: django 1.9, migrations SUCK

On Fri, Jul 29, 2016 at 07:02:44AM -0700, Jorge Cadena wrote:
> Hi,
>
> I am dev in django at last 4 years, i missed ./manage.py syncdb,
>
> Delete all tables from databases (MariaDB, PostgreSQL) command line from
> DB, and run python manage.py migrate always same error
>
> *python manage.py migrate*
> django.db.utils.ProgrammingError: (1146, "Table
> 'dashaboard_web.did_didcountry' doesn't exist")
>
> *python manage.py migrate did*
> django.db.utils.ProgrammingError: (1146, "Table
> 'dashaboard_web.did_didcountry' doesn't exist")
>
> *python manage.py makemigrations*
> django.db.utils.ProgrammingError: (1146, "Table
> 'dashaboard_web.did_didcountry' doesn't exist")
>
> *python manage.py sqlmigrate did 0001*
> django.db.utils.ProgrammingError: (1146, "Table
> 'dashaboard_web.did_didcountry' doesn't exist")
>
> *python manage.py migrate --run-syncdb*
> django.db.utils.ProgrammingError: (1146, "Table
> 'dashaboard_web.did_didcountry' doesn't exist")
>
>
> if the tables doesn't exist, why create table new ???
> as, create new tables run command python manage.py migrate ??

If you're getting errors about missing database tables even when you
run manage.py makemigrations, then that would mean you'll get that
same error every time you run manage.py, regardless of what command
you run. makemigrations does not access the database, it only inspects
existing migration files, and compares them to the current model
definitions.

The error you are getting is most likely because you're accessing the
database on import (i.e. somewhere at module level you are making
database queries). If that is indeed the case, then you would get the
exact same error even with the old syncdb. However, it is hard to tell
for sure, since you have not provided the full traceback.

Cheers,

Michal

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160729142428.GX16002%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment