Refs #29722 -- Added introspection of partitions for PostgreSQL.

This commit is contained in:
Nick Pope 2018-09-12 21:53:24 +01:00 committed by Tim Graham
parent 0607699902
commit ebd270627c
6 changed files with 77 additions and 18 deletions

View file

@ -352,7 +352,8 @@ file) to standard output.
You may choose what tables or views to inspect by passing their names as
arguments. If no arguments are provided, models are created for views only if
the :option:`--include-views` option is used.
the :option:`--include-views` option is used. Models for partition tables are
created on PostgreSQL if the :option:`--include-partitions` option is used.
Use this if you have a legacy database with which you'd like to use Django.
The script will inspect the database and create a model for each table within
@ -404,6 +405,8 @@ PostgreSQL
* Models are created for foreign tables.
* Models are created for materialized views if
:option:`--include-views` is used.
* Models are created for partition tables if
:option:`--include-partitions` is used.
.. versionchanged:: 2.2
@ -413,6 +416,14 @@ PostgreSQL
Specifies the database to introspect. Defaults to ``default``.
.. django-admin-option:: --include-partitions
.. versionadded:: 2.2
If this option is provided, models are also created for partitions.
Only support for PostgreSQL is implemented.
.. django-admin-option:: --include-views
.. versionadded:: 2.1

View file

@ -183,6 +183,10 @@ Management Commands
* :option:`inspectdb --include-views` now creates models for materialized views
on PostgreSQL.
* The new :option:`inspectdb --include-partitions` option allows creating
models for partition tables on PostgreSQL. In older versions, models are
created child tables instead the parent.
* :djadmin:`inspectdb` now introspects :class:`~django.db.models.DurationField`
for Oracle and PostgreSQL.