#32376: Allow destroy_test_db() not to fail if database doesn't exist
-------------------------------------+-------------------------------------
Reporter: Mateusz Mandera | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Mariusz Felisiak):
* status: new => closed
* resolution: => wontfix
* component: Testing framework => Database layer (models, ORM)
Comment:
> In our test setup we directly call `connection.creation.destroy_test_db`
and the database that's meant to be dropped may or may not exist - the
latter scenario is completely okay and shouldn't fail
It's really unexpected that the database that you want to destroy doesn't
exist, so an exception is desired. You can always handle it in your app,
add a small wrapper, or
[https://docs.djangoproject.com/en/3.1/ref/databases/#subclassing-the-
built-in-database-backends subclass the built-in database backends].
> destroy_test_db could take an additional optional argument, which if
True, would cause IF EXISTS to be used in the query.
This would require a separate logic on SQLite and Oracle, I don't think
it's worth additional complexity. You can start a discussion on
DevelopersMailingList if you don't agree.
--
Ticket URL: <https://code.djangoproject.com/ticket/32376#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/072.9b3863deab33b95029785679255535c5%40djangoproject.com.