mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #14661 -- Clarified the handling of initial data injected via custom SQL.
This is BACKWARDS INCOMPATIBLE CHANGE for anyone relying on SQL-injected initial data in a test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5502fa5980
commit
b31a1b9926
7 changed files with 81 additions and 6 deletions
|
@ -121,6 +121,17 @@ the order in which they're executed. The only thing you can assume is
|
|||
that, by the time your custom data files are executed, all the
|
||||
database tables already will have been created.
|
||||
|
||||
.. admonition:: Initial SQL data and testing
|
||||
|
||||
This technique *cannot* be used to provide initial data for
|
||||
testing purposes. Django's test framework flushes the contents of
|
||||
the test database after each test; as a result, any data added
|
||||
using the custom SQL hook will be lost.
|
||||
|
||||
If you require data for a test case, you should add it using
|
||||
either a :ref:`test fixture <topics-testing-fixtures>`, or
|
||||
programatically add it during the ``setUp()`` of your test case.
|
||||
|
||||
Database-backend-specific SQL data
|
||||
----------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue