[Django] #22784: Schema migration: rename tables

87 views
Skip to first unread message

Django

unread,
Jun 6, 2014, 4:31:48 PM6/6/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------+------------------------
Reporter: maxi | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------
The alter_db_table method is used to rename table. In my case, Firebird
doesn't allow rename tables because that implies alter related objects
(store procedures, triggers, etc).
Maybe a database feature will needed to point this case.

So test_db_table method fails for me.

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

Django

unread,
Jun 6, 2014, 7:50:22 PM6/6/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------+--------------------------------------

Reporter: maxi | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

The code for SQL operations is specific to the backend engine. I'm
guessing the right place to file this is with the django-firebird project.

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

Django

unread,
Jun 7, 2014, 3:34:56 AM6/7/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------+--------------------------------------

Reporter: maxi | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by aaugustin):

This is the maintainer of the django-firebird project asking ;-)

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

Django

unread,
Jun 13, 2014, 8:53:43 PM6/13/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------+--------------------------------------

Reporter: maxi | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by shai):

Sometimes backends do things that the engine proper doesn't support by
performing extra work -- the Sqlite backend, as a prime example, recreates
tables as an implementation of alter-column; the usually-saner Oracle
backend jumps through hoops to change a column from TextField to CharField
or vice-versa, which isn't supported by the Oracle database.

Introducing the flag as requested here means that table-renaming is an
optional feature of schema editors. That may be acceptable, or not -- I'm
not even sure what I think of it. I think it may be worth a discussion on
the DevelopersMailingList.

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

Django

unread,
Jun 16, 2014, 4:23:37 PM6/16/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------------+-------------------------------------
Reporter: maxi | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version:
Component: Migrations | 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

We've started down the path of adding flags for features not supported by
third-party databases, so let's do this.

--
Ticket URL: <https://code.djangoproject.com/ticket/22784#comment:4>

Django

unread,
Sep 5, 2014, 3:17:26 PM9/5/14
to django-...@googlegroups.com
#22784: Schema migration: rename tables
-------------------------------------+-------------------------------------
Reporter: maxi | Owner: nobody
Type: | Status: closed

Cleanup/optimization | Version:
Component: Migrations | 1.7-beta-2
Severity: Normal | Resolution: wontfix

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

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

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


Comment:

Unfortunately, I think the correct thing for the backend to do here is the
same as the SQLite backend - emulate the rename by making a new table and
copying data across. SQLite also doesn't allow renames, but people expect
certain stuff, so we had to emulate it.

Closing this as WONTFIX for now. If doing that proves unbelievably
difficult, we could reopen and consider not supporting it as a feature
flag, but that would mean that Firebird can't run some migrations (table
rename is assumed to be possible by the autodetector, and as migrations
are baked and shipped we can't have the autodetector change behaviour
based on target database, as it doesn't know what the target is)

--
Ticket URL: <https://code.djangoproject.com/ticket/22784#comment:5>

Reply all
Reply to author
Forward
0 new messages