| | 1667 | |
|---|
| | 1668 | Database-backend-specific SQL data |
|---|
| | 1669 | ---------------------------------- |
|---|
| | 1670 | |
|---|
| | 1671 | There's also a hook for backend-specific SQL data. For example, you can have |
|---|
| | 1672 | separate initial-data files for PostgreSQL and MySQL. For each app, Django |
|---|
| | 1673 | looks for a file called ``<appname>/sql/<modelname>.<backend>.sql``, where |
|---|
| | 1674 | ``<appname>`` is your app directory, ``<modelname>`` is the model's name in |
|---|
| | 1675 | lowercase and ``<backend>`` is the value of ``DATABASE_ENGINE`` in your |
|---|
| | 1676 | settings file (e.g., ``postgresql``, ``mysql``). |
|---|
| | 1677 | |
|---|
| | 1678 | Backend-specific SQL data is executed before non-backend-specific SQL data. For |
|---|
| | 1679 | example, if your app contains the files ``sql/person.sql`` and |
|---|
| | 1680 | ``sql/person.postgresql.sql`` and you're installing the app on PostgreSQL, |
|---|
| | 1681 | Django will execute the contents of ``sql/person.postgresql.sql`` first, then |
|---|
| | 1682 | ``sql/person.sql``. |
|---|