@@ -240,10 +240,9 @@ You should see something similar to the following:
240
240
.. code-block:: text
241
241
242
242
Migrations for 'polls':
243
- polls/migrations/0001_initial.py:
244
- - Create model Choice
243
+ polls/migrations/0001_initial.py
245
244
- Create model Question
246
- - Add field question to choice
245
+ - Create model Choice
247
246
248
247
By running ``makemigrations``, you're telling Django that you've made
249
248
some changes to your models (in this case, you've made new ones) and that
@@ -272,14 +271,6 @@ readability):
272
271
273
272
BEGIN;
274
273
--
275
- -- Create model Choice
276
- --
277
- CREATE TABLE "polls_choice" (
278
- "id" serial NOT NULL PRIMARY KEY,
279
- "choice_text" varchar(200) NOT NULL,
280
- "votes" integer NOT NULL
281
- );
282
- --
283
274
-- Create model Question
284
275
--
285
276
CREATE TABLE "polls_question" (
@@ -288,16 +279,20 @@ readability):
288
279
"pub_date" timestamp with time zone NOT NULL
289
280
);
290
281
--
291
- -- Add field question to choice
282
+ -- Create model Choice
292
283
--
293
- ALTER TABLE "polls_choice" ADD COLUMN "question_id" integer NOT NULL;
294
- ALTER TABLE "polls_choice" ALTER COLUMN "question_id" DROP DEFAULT;
295
- CREATE INDEX "polls_choice_7aa0f6ee" ON "polls_choice" ("question_id");
284
+ CREATE TABLE "polls_choice" (
285
+ "id" serial NOT NULL PRIMARY KEY,
286
+ "choice_text" varchar(200) NOT NULL,
287
+ "votes" integer NOT NULL,
288
+ "question_id" integer NOT NULL
289
+ );
296
290
ALTER TABLE "polls_choice"
297
- ADD CONSTRAINT "polls_choice_question_id_246c99a640fbbd72_fk_polls_question_id "
291
+ ADD CONSTRAINT "polls_choice_question_id_c5b4b260_fk_polls_question_id "
298
292
FOREIGN KEY ("question_id")
299
293
REFERENCES "polls_question" ("id")
300
294
DEFERRABLE INITIALLY DEFERRED;
295
+ CREATE INDEX "polls_choice_question_id_c5b4b260" ON "polls_choice" ("question_id");
301
296
302
297
COMMIT;
303
298
0 commit comments