Opened 11 years ago
Closed 10 years ago
#22340 closed Bug (fixed)
Legacy Table Creation Methods Not Properly Deprecated
Reported by: | Mark Lavin | Owned by: | Tim Graham |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | mmanfre@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As noted in https://github.com/django/django/commit/1cb6729f58ef14c2042373d8bd61fa264a955705 and https://groups.google.com/d/msg/django-developers/PWPj3etj3-U/vH4DjnVttIUJ the DB backend DatabaseCreation
class and the legacy path for table creating in the migrate
command are being removed. DatabaseCreation
is a documented part of the API in https://docs.djangoproject.com/en/1.6/topics/testing/advanced/#django-db-connection-creation and is still actively used in Django's code and test suite. For this to be deprecated per Django's published policy these should raise a deprecation warning when used prior to removal and currently neither do.
Change History (20)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 11 years ago
Cc: | added |
---|
comment:3 by , 11 years ago
Component: | Database layer (models, ORM) → Migrations |
---|
comment:4 by , 11 years ago
Version: | 1.7-beta-1 → master |
---|
comment:10 by , 11 years ago
The Trac UI isn't very intuitive, but it's a release blocker for 1.8 (currently master) as indicated by the "Version" flag.
comment:11 by , 10 years ago
This pull request is aiming to move more DDL instructions go through schema editors, mainly migrate
in sync_apps
.
We'll also see what's the CI server thinks about that...
https://github.com/django/django/pull/3220
comment:13 by , 10 years ago
The remaining work for this ticket seems to be to replace the documented django.db.connection.creation
methods (create_test_db()
and destroy_test_db()
) with a SchemaEditor
equivalent. I think all of the DatabaseCreation
methods that deal with generating SQL don't need to go through a deprecation cycle as they will be unused in Django 1.9 when support for apps without migrations is removed.
comment:16 by , 10 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
After looking at this some more, I am not sure there is an actual benefit or need to move the code that deals with test database creation and to remove the DatabaseCreation
class. It seems to me to be a clear separation of concerns to keep this code where it is (after all, it deals with database creation).
If that rationale is accepted, the remaining cleanups are:
- Move the
DatabaseCreation.data_types
properties toDatabaseWrapper
as proposed in pull request 3810. - Remove the legacy SQL generation methods when support for apps without migrations is dropped in Django 1.9 (done in the commit "Removed obsolete SQL generation methods." commit of pull request 3791).
- Remove the note about
DatabaseCreation
from the deprecation timeline.
This will leave create_test_db()
, destroy_test_db()
, and their helper methods as the only functionality remaining on the DatabaseCreation
class.
comment:19 by , 10 years ago
OK with the plan. I'm just not sure if we really have to drop support for apps without migrations, but that's not the subject of this ticket.
comment:20 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'm going to change the version of this to master so we don't consider it a release blocker for 1.7. from Andrew in the django-dev thread:
"Yes, the test suite is basically the biggest obstacle to full usage of migrations - I've tried to make it see sense, but given my limited time at the moment and the fact that it's a tortuous mess of hacks in places it means that I can't see that happening before the RC.
I'd like to have started the Creation deprecation cycle this release, but it's probably fine if we let that slip a release (it's going to be harder to remove than many other features). Migrations will hopefully drive the adoption of SchemaEditor by developers and third-party backends anyway."
We'll need to update the deprecation timeline and 1.7 release at some point once this punt is confirmed for sure.