You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,30 +31,35 @@ With seamless we mean that any features we add will work truly seamlessly. You s
31
31
32
32
[See the full list](http://django-postgres-extra.readthedocs.io/#features)
33
33
34
-
***Native upserts**
34
+
***Conflict handling (atomic upsert)**
35
35
36
-
* Single query
37
-
* Concurrency safe
38
-
* With bulk support (single query)
36
+
Add support for PostgreSQL's `ON CONFLICT` syntax for inserts. Supports `DO UPDATE` and `DO NOTHING`. Single statement, atomic and concurrency safe upserts. Supports conditional updates as well.
39
37
40
-
***Extended support for HStoreField**
38
+
***Table partitioning**
41
39
42
-
* Unique constraints
43
-
* Null constraints
44
-
* Select individual keys using ``.values()`` or ``.values_list()``
40
+
Add support for PostgreSQL 11.x declarative table partitioning. Fully integrated into Django migrations. Supports all types of partitioning. Includes a command to automatically create time-based partitions.
Copy file name to clipboardExpand all lines: docs/source/hstore.rst
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,10 @@ Constraints
15
15
Unique
16
16
******
17
17
18
+
.. warning::
19
+
20
+
In Django 2.2 or newer, you might want to use :class:`~django.db.models.UniqueConstraint` instead.
21
+
18
22
The ``uniqueness`` constraint can be added on one or more `hstore`_ keys, similar to how a ``UNIQUE`` constraint can be added to a column. Setting this option causes unique indexes to be created on the specified keys.
19
23
20
24
You can specify a ``list`` of strings to specify the keys that must be marked as unique:
@@ -44,6 +48,10 @@ In the example above, ``key1`` and ``key2`` must unique **together**, and ``key3
44
48
Required
45
49
********
46
50
51
+
.. warning::
52
+
53
+
In Django 2.2or newer, you might want to use :class:`~django.db.models.CheckConstraint` instead.
54
+
47
55
The ``required`` option can be added to ensure that the specified `hstore`_ keys are setfor every row. This is similar to a ``NOTNULL`` constraint on a column. You can specify a list of `hstore`_ keys that are required:
Adds support for PostgreSQL's ``ON CONFLICT`` syntax for inserts. Supports for ``DO UPDATE`` and ``DO NOTHING``. In other words; single statement, atomic, concurrency safe upserts.
16
+
Adds support for PostgreSQL's ``ON CONFLICT`` syntax for inserts. Supports for ``DO UPDATE`` and ``DO NOTHING``. Single statement, atomic, concurrency safe upserts. Supports conditional updates as well.
17
17
18
-
* :ref:`HStore <hstore_page>`
19
-
20
-
Built on top Django's built-in support for `hstore`_ fields. Adds support for indices on keys and unique/required constraints. All of these features integrate well with Django's migrations sytem.
* :ref:`Partial unique index <conditional_unique_index_page>`
20
+
Add support for PostgreSQL 11.x declarative table partitioning. Fully integrated into Django migrations. Supports all types of partitioning. Includes a command to automatically create time-based partitions.
23
21
24
-
Partial (unique) index that only applies when a certain condition is true.
25
-
26
-
* :ref:`Case insensitive index <case_insensitive_unique_index_page>`
22
+
* :ref:`Locking models & tables <locking_page>`
27
23
28
-
Case insensitive index, allows searching a column and ignoring the casing.
Copy file name to clipboardExpand all lines: docs/source/indexes.rst
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,11 @@ Indexes
7
7
8
8
Unique Index
9
9
-----------------------------
10
+
11
+
.. warning::
12
+
13
+
In Django 2.2 or newer, you might want to use :class:`~django.db.models.UniqueConstraint` instead.
14
+
10
15
The :class:`~psqlextra.indexes.UniqueIndex` lets you create a unique index. Normally Django only allows you to create unique indexes by specifying ``unique=True`` on the model field.
11
16
12
17
Although it can be used on any Django model, it is most useful on views and materialized views where ``unique=True`` does not work.
@@ -32,13 +37,14 @@ Although it can be used on any Django model, it is most useful on views and mate
32
37
33
38
Conditional Unique Index
34
39
------------------------
35
-
The :class:`~psqlextra.indexes.ConditionalUniqueIndex` lets you create partial unique indexes in case you ever need :attr:`~django:django.db.models.Options.unique_together` constraints
36
-
on nullable columns.
37
40
38
41
.. warning::
39
42
40
43
In Django 3.1 or newer, you might want to use :attr:`~django.db.models.indexes.condition` instead.
41
44
45
+
The :class:`~psqlextra.indexes.ConditionalUniqueIndex` lets you create partial unique indexes in case you ever need :attr:`~django:django.db.models.Options.unique_together` constraints
46
+
on nullable columns.
47
+
42
48
Before:
43
49
44
50
.. code-block:: python
@@ -83,6 +89,11 @@ After:
83
89
84
90
Case Insensitive Unique Index
85
91
-----------------------------
92
+
93
+
.. warning::
94
+
95
+
In Django 3.1 or newer, you might want to use :attr:`~django.db.models.indexes.condition` instead.
96
+
86
97
The :class:`~psqlextra.indexes.CaseInsensitiveUniqueIndex` lets you create an index that ignores the casing for the specified field(s).
87
98
88
99
This makes the field(s) behave more like a text field in MySQL.
0 commit comments