#34665: CreateModel with manually added RenameField crashes on SQLite.
-------------------------------------+-------------------------------------
     Reporter:  Amchii               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  sqlite3              |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 It worked on Django 4.0 because the `person` table was recreated by the
 second migrations (which is no longer necessary in SQLite 3.35.5+, see
 3702819227fd0cdd9b581cd99e11d1561d51cbeb), however in all versions of
 Django index is created on a wrong column:
 {{{
 ALTER TABLE "person" RENAME COLUMN "open_id" TO "open_uid";
 CREATE INDEX "person_open_id_aac92076" ON "person" ("open_id");
 }}}

 > Although I manually added a line instead of using makemigrations when
 renaming the 'open_id' field, it should still work properly?

 In general, you can edit migrations manually, but you do so at your own
 risk. In this case you should update the column name in the `CreateModel`
 operation instead of adding `RenameField`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34665#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070188d27ac1f0-36db43be-a4d5-47eb-a1ec-abf4154a07e6-000000%40eu-central-1.amazonses.com.

Reply via email to