An update: I think this was the clue:

If I try other manage commands like `manage.py runserver` or `manage.py 
test` I get the same error.


There was some code going through all Organisation objects during import - 
and that fails. Got to refactor a bit.
 



On Monday, January 9, 2017 at 11:32:24 PM UTC+1, Joakim Hove wrote:
>
> Hello;
>
> I have a long running Django project; it started on version ~1.0. I have 
> upgraded regularly and I am now on 1.10. I have been using migrations with 
> Django since the became standard (1.8??) and generally been very happy with 
> them. However today I am facing a problem with a migration which I have not 
> been able to solve.
>
> Initially I have a model Organisation:
>
> class Organisation( Model ):
>
>                    field1 = ... DB_COLUMN = "FIELD1")
>                    field2 = ... DB_COLUMN = "FIELD2")
>
>
>            class Meta:
>                   db_table = "ORGANISATIONS"
>
>
> Observe that I have used the 'DB_COLUMN' and 'db_table' attributes to give 
> non-standard names to columns and tables. The database was retrofitted to 
> use Django, this is a relic from that conversion. Then today I added a 
> small new 'model' for organisation type:
>
>
>           class OrganisationType( Modell );
>                 id = ...
>                 description = ...
>
>
> Using makemigrations I first added a migration to create the 
> OrganisationType model, and then subsequently I added empty/data migration 
> to create one instance of the OrganisationType model. I then added a new 
> ForeignKey on the Organisation model:
>
>
>           class Organisation( Model ):
>                 ....
>                 org_type = ForeignKey( OrganisationType ,db_column = 
> "ORGANISATION_TYPE")
>
> Now when I try makemigrations it fails. The end of the traceback is:
>
> django.db.utils.ProgrammingError: column ORGANISATIONS.ORGANISATION_TYPE 
> does not exist
> LINE 1: ...ES_UPDATED_BY", "ORGANISATIONS"."PRICES_UPDATED", "ORGANISAT...
>
>
> So - it seems to be complaining that the 'ORGANISATION_TYPE' column is 
> missing from the ORGANISATIONS table; now that makes sense - this was 
> exactly the change I wanted a migration for! If I try other manage commands 
> like `manage.py runserver` or `manage.py test` I get the same error. 
>
> Any hints?
>
> Joakim
>      
>
>
>

-- 
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+unsubscr...@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/ff1c8a6d-ec60-4e4e-ba60-a792991a1eaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to