diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-22 12:29:01 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-22 12:29:43 -0500 |
| commit | ca910b0c5a7d2e2d09a131a901abaa2db383f443 (patch) | |
| tree | 444f956293d745f7c8e6b869307c305eb9e60b9a /docs/intro/tutorial01.txt | |
| parent | 2a28606b15070677f9d4aa3cc61a939d9fc501fa (diff) | |
[1.7.x] Corrected sqlmigrate output in tutorial 1.
Backport of ff5e47e7a4a638a30424331222e0abdb60842ddd from master
Diffstat (limited to 'docs/intro/tutorial01.txt')
| -rw-r--r-- | docs/intro/tutorial01.txt | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index d995fa6a96..0a80c84bd3 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -477,35 +477,32 @@ moment - but first, let's see what SQL that migration would run. The $ python manage.py sqlmigrate polls 0001 - You should see something similar to the following (we've reformatted it for readability): .. code-block:: sql BEGIN; - CREATE TABLE polls_question ( + CREATE TABLE "polls_choice" ( "id" serial NOT NULL PRIMARY KEY, - "question_text" varchar(200) NOT NULL, - "pub_date" timestamp with time zone NOT NULL - ); - - CREATE TABLE polls_choice ( - "id" serial NOT NULL PRIMARY KEY, - "question_id" integer NOT NULL, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL ); - - CREATE INDEX polls_choice_7aa0f6ee ON "polls_choice" ("question_id"); - + CREATE TABLE "polls_question" ( + "id" serial NOT NULL PRIMARY KEY, + "question_text" varchar(200) NOT NULL, + "pub_date" timestamp with time zone NOT NULL + ); + ALTER TABLE "polls_choice" ADD COLUMN "question_id" integer NOT NULL; + ALTER TABLE "polls_choice" ALTER COLUMN "question_id" DROP DEFAULT; + CREATE INDEX "polls_choice_7aa0f6ee" ON "polls_choice" ("question_id"); ALTER TABLE "polls_choice" - ADD CONSTRAINT polls_choice_question_id_246c99a640fbbd72_fk_polls_question_id + ADD CONSTRAINT "polls_choice_question_id_246c99a640fbbd72_fk_polls_question_id" FOREIGN KEY ("question_id") REFERENCES "polls_question" ("id") DEFERRABLE INITIALLY DEFERRED; - COMMIT; + COMMIT; Note the following: |
