Ticket #401 (closed defect: duplicate)

Opened 6 years ago

Last modified 16 months ago

Rename of primary key on sqlite generates invalid SQL

Reported by: anonymous Owned by: andrew
Priority: major Milestone:
Component: migrations Version: mercurial
Keywords: Cc:


I'm trying to migrate from a multitable inheritance scheme to abstract inheritance through a series of steps. The first step involves changing the OneToOneField? to be just a primary key.

So I changed:
contentnode = models.IntegerField?(ContentNode?, parent_link=True, related_name="content_post")
contentnode = models.IntegerField?(primary_key=True)

The migration generated automatically is attached. The error is:
"django.db.utils.DatabaseError?: table "_south_new_blog_post" has more than one primary key"

I added a print in south.db.sqlite _remake_table and the sql generated is:
CREATE TABLE "_south_new_blog_post" ("content" text, "content_parsed" text, "contentnode" integer NOT NULL PRIMARY KEY PRIMARY KEY)

Change History

comment:1 Changed 6 years ago by anonymous

Sorry, can't close but it should be. Accidental dupe of #402 due to browser refresh!

comment:2 Changed 6 years ago by andrew

  • Status changed from new to closed
  • Resolution set to duplicate
Note: See TracTickets for help on using tickets.