Modify

Ticket #337 (closed defect: worksforme)

Opened 4 years ago

Last modified 4 years ago

Fails to Alter Table when also adding a geometry

Reported by: barnaby@… Owned by: andrew
Priority: minor Milestone: 0.7
Component: migrations Version: 0.6.2
Keywords: geoDjango, Cc:

Description

Migration cannot alter table in regular way while adding geography field. It falsely claims that it ran the ALTER TABLE command for the non-geographic field, but the table is not altered to include it, only the geographic field.

How to duplicate this bug:

1) add 3 fields:

state = models.CharField?(_('State'), max_length=11)
point = models.PointField?(null=True)
objects = models.GeoManager?()

(P.S. don't forget to change import statement to "from django.contrib.gis.db import models")

3) run ./manage.py startmigration and observe which commands it claims to have ran, it includes an ALTER TABLE command for the "state" column

4) go into database and inspect which columns were added, and notice that only the geography was added, the state column was not actually added

psql myDB
\d myModelsTable

5) just to be sure, roll back the migration (may involve manually altering the table so that backwards() works) and in its place create 2 separate migrations, one for the geographic field, and one for the CharField? (e.g. the "state" column). They work individually, but not together.

Attachments

commandline_history.txt (6.3 KB) - added by barnaby@… 4 years ago.
Commandline History of how I discovered bug #337

Change History

Changed 4 years ago by barnaby@…

Commandline History of how I discovered bug #337

comment:1 Changed 4 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7

Alright, I'll try and replicate and fix this locally.

comment:2 Changed 4 years ago by andrew

I can't seem to make this happen on 0.7; could you confirm it's gone in the latest trunk versions for you?

comment:3 Changed 4 years ago by andrew

  • Status changed from assigned to infoneeded

comment:4 Changed 4 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to worksforme
View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.