#24550: Always add description of migration operation to sqlmigrate output
---------------------------------------+-------------------------
Reporter: MarkusH | Owner: MarkusH
Type: New feature | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------
Especially when debugging the SQL code generated from migration files it
can be hard to see where the code of one migration operation ends and
where the next one starts. Instead of only including an operation's
description when the operation
[https://github.com/django/django/blob/75430be86f4c90b7fb8a370d2b080a8a7cc925a0/django/db/migrations/migration.py#L95-L99
cannot be reduced to SQL code] I propose to always output the description:
{{{#!sql
BEGIN;
--
-- Create model Author
--
CREATE TABLE "testapp_author" ("id" serial NOT NULL PRIMARY KEY);
--
-- Create model Publisher
--
CREATE TABLE "testapp_publisher" ("id" serial NOT NULL PRIMARY KEY, "name"
varchar(100) NOT NULL);
--
-- Add field publishers to author
--
CREATE TABLE "testapp_author_publishers" ("id" serial NOT NULL PRIMARY
KEY, "author_id" integer NOT NULL, "publisher_id" integer NOT NULL);
ALTER TABLE "testapp_author_publishers" ADD CONSTRAINT
"testapp_author_publishe_author_id_ab13cccc_fk_testapp_author_id" FOREIGN
KEY ("author_id") REFERENCES "testapp_author" ("id") DEFERRABLE INITIALLY
DEFERRED;
ALTER TABLE "testapp_author_publishers" ADD CONSTRAINT
"testapp_author_pu_publisher_id_60b8aa93_fk_testapp_publisher_id" FOREIGN
KEY ("publisher_id") REFERENCES "testapp_publisher" ("id") DEFERRABLE
INITIALLY DEFERRED;
ALTER TABLE "testapp_author_publishers" ADD CONSTRAINT
"testapp_author_publishers_author_id_6e6ec2f2_uniq" UNIQUE ("author_id",
"publisher_id");
CREATE INDEX "testapp_author_publishers_4f331e2f" ON
"testapp_author_publishers" ("author_id");
CREATE INDEX "testapp_author_publishers_2604cbea" ON
"testapp_author_publishers" ("publisher_id");
COMMIT;
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24550>
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/050.fe5fd0da0a5e39fe9426eeaf9fcea762%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.