Ticket #415 (closed defect: fixed)
adding OneToOneFields creates wrong column name
|Reported by:||Alexander Clausen <alex@…>||Owned by:||andrew|
consider the following model:
class A(models.Model): name = models.CharField(max_length=100) class B(models.Model): a_1 = models.OneToOneField(A, related_name="b_1") a_2 = models.OneToOneField(A, related_name="b_2", blank=True, null=True)
- A was created,
- then the app was converted to south (0001),
- B was added in a migration (without a_2, 0002),
- and then a_2 was added (0003)
the resulting schema is:
sqlite> .schema footest_a CREATE TABLE "footest_a" ("id" integer NOT NULL PRIMARY KEY, "name" varchar(100) NOT NULL); sqlite> .schema footest_b CREATE TABLE "footest_b" ("a_1_id" integer UNIQUE, "id" integer PRIMARY KEY, "a_2" integer NULL UNIQUE); sqlite>
note that a_2 is missing the _id suffix, but a_1 is created allright.
Note: See TracTickets for help on using tickets.