Ticket #401 (closed defect: duplicate)
Rename of primary key on sqlite generates invalid SQL
| Reported by: | anonymous | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | migrations | Version: | mercurial |
| Keywords: | Cc: |
Description
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")
to:
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)

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