#27267: Renaming a primary key fails with "cannot drop constraint on table
because
other objects depend on it"
--------------------------------+--------------------------------------
Reporter: Melvyn Sopacua | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by Melvyn Sopacua):
And here's the cause:
{{{#!sql
-- % djmanage sqlmigrate dpe 0013_regenerate_primary_key_for_dpe_character
BEGIN;
--
-- Remove field id from dpecharacter
--
ALTER TABLE "dpe_dpecharacter" DROP COLUMN "id" CASCADE;
--
-- Add field character_id to dpecharacter
--
ALTER TABLE "dpe_dpecharacter" ADD COLUMN "character_id" serial NOT NULL
PRIMARY KEY;
ALTER TABLE "dpe_dpecharacter" ALTER COLUMN "character_id" DROP DEFAULT;
COMMIT;
}}}
That's of course the preserve_default=False in the migration.
So that begs the question: Why does Django prompt for a default value for
an AutoField?
--
Ticket URL: <https://code.djangoproject.com/ticket/27267#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/072.79a651da5c28c5eea46de07e6bbd754f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.