[Django] #22975: Cannot rename model keeping db table name

12 views
Skip to first unread message

Django

unread,
Jul 7, 2014, 5:08:11 PM7/7/14
to django-...@googlegroups.com
#22975: Cannot rename model keeping db table name
----------------------------+------------------------
Reporter: rhcarvalho | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Keywords: migrations
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------
Django migrations do not work when you rename a model keeping the db table
name. For instance:

# -- models.py --
class Book(models.Model):
name = models.CharField()
class Meta:
db_table = "books"


# -- models.py after renaming model --
class AwesomeBook(models.Model):
name = models.CharField()
class Meta:
db_table = "books"


The migration system ends up making an operational error by trying to
rename the table from `books` to `books`, when the rename is unnecessary.

https://github.com/django/django/commit/fddc5957c53bd654312c4a238a8cdcfe5f4ef4cc#commitcomment-6916125

--
Ticket URL: <https://code.djangoproject.com/ticket/22975>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 18, 2014, 11:45:56 AM7/18/14
to django-...@googlegroups.com
#22975: Cannot rename model keeping db table name
---------------------------------+------------------------------------

Reporter: rhcarvalho | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution:
Keywords: migrations | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by apollo13):

* needs_better_patch: => 0
* needs_docs: => 0
* severity: Normal => Release blocker
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/22975#comment:1>

Django

unread,
Jul 21, 2014, 5:14:56 AM7/21/14
to django-...@googlegroups.com
#22975: Cannot rename model keeping db table name
---------------------------------+------------------------------------
Reporter: rhcarvalho | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Release blocker | Resolution: fixed

Keywords: migrations | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Andrew Godwin <andrew@…>):

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


Comment:

In [changeset:"dcb4ed517082d13ccf7da9bd5d16c77bcecbf139"]:
{{{
#!CommitTicketReference repository=""
revision="dcb4ed517082d13ccf7da9bd5d16c77bcecbf139"
Fixed #22975: Don't call rename SQL if not needed
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22975#comment:2>

Django

unread,
Jul 21, 2014, 5:15:13 AM7/21/14
to django-...@googlegroups.com
#22975: Cannot rename model keeping db table name
---------------------------------+------------------------------------
Reporter: rhcarvalho | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7-rc-1

Severity: Release blocker | Resolution: fixed
Keywords: migrations | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"f57e84392e9aea19f8f9dc31f1e5351de356ce34"]:
{{{
#!CommitTicketReference repository=""
revision="f57e84392e9aea19f8f9dc31f1e5351de356ce34"
[1.7.x] Fixed #22975: Don't call rename SQL if not needed
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22975#comment:3>

Reply all
Reply to author
Forward
0 new messages