summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-03-10 08:53:28 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-03-10 08:54:04 +0100
commitd6e67df4b9a7b16ce1f1f8b70f608efc3e20aabf (patch)
tree1972c6f32f8fee641b7e443287e7f8a425b1a427 /docs
parent2928587694bae5e0e742e9561efdd08ba5c6e5e9 (diff)
[3.0.x] Updated migrations example in tutorial 2.
Follow up to a97845a823c86b1d6e65af70fbce64e6e747e081. Backport of 5da627a58f41d6854342e95a171a82f5b2309d52 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/tutorial02.txt27
1 files changed, 11 insertions, 16 deletions
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt
index 3605f9977d..1831c9c432 100644
--- a/docs/intro/tutorial02.txt
+++ b/docs/intro/tutorial02.txt
@@ -240,10 +240,9 @@ You should see something similar to the following:
.. code-block:: text
Migrations for 'polls':
- polls/migrations/0001_initial.py:
- - Create model Choice
+ polls/migrations/0001_initial.py
- Create model Question
- - Add field question to choice
+ - Create model Choice
By running ``makemigrations``, you're telling Django that you've made
some changes to your models (in this case, you've made new ones) and that
@@ -272,14 +271,6 @@ readability):
BEGIN;
--
- -- Create model Choice
- --
- CREATE TABLE "polls_choice" (
- "id" serial NOT NULL PRIMARY KEY,
- "choice_text" varchar(200) NOT NULL,
- "votes" integer NOT NULL
- );
- --
-- Create model Question
--
CREATE TABLE "polls_question" (
@@ -288,16 +279,20 @@ readability):
"pub_date" timestamp with time zone NOT NULL
);
--
- -- Add field question to choice
+ -- Create model Choice
--
- 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");
+ CREATE TABLE "polls_choice" (
+ "id" serial NOT NULL PRIMARY KEY,
+ "choice_text" varchar(200) NOT NULL,
+ "votes" integer NOT NULL,
+ "question_id" integer NOT NULL
+ );
ALTER TABLE "polls_choice"
- ADD CONSTRAINT "polls_choice_question_id_246c99a640fbbd72_fk_polls_question_id"
+ ADD CONSTRAINT "polls_choice_question_id_c5b4b260_fk_polls_question_id"
FOREIGN KEY ("question_id")
REFERENCES "polls_question" ("id")
DEFERRABLE INITIALLY DEFERRED;
+ CREATE INDEX "polls_choice_question_id_c5b4b260" ON "polls_choice" ("question_id");
COMMIT;