diff --git a/django/contrib/postgres/operations.py b/django/contrib/postgres/operations.py index 5992f00725..6253011217 100644 --- a/django/contrib/postgres/operations.py +++ b/django/contrib/postgres/operations.py @@ -46,3 +46,9 @@ class TrigramExtension(CreateExtension): def __init__(self): self.name = 'pg_trgm' + + +class BtreeGinExtension(CreateExtension): + + def __init__(self): + self.name = 'btree_gin' diff --git a/docs/ref/contrib/postgres/operations.txt b/docs/ref/contrib/postgres/operations.txt index cc2cbe7c51..656be8e976 100644 --- a/docs/ref/contrib/postgres/operations.txt +++ b/docs/ref/contrib/postgres/operations.txt @@ -18,6 +18,15 @@ the ``django.contrib.postgres.operations`` module. This is a required argument. The name of the extension to be installed. +``BtreeGinExtension`` +===================== + +.. class:: BtreeGinExtension() + + .. versionadded:: 1.11 + + Install the ``btree_gin`` extension. + ``HStoreExtension`` =================== diff --git a/tests/postgres_tests/migrations/0001_setup_extensions.py b/tests/postgres_tests/migrations/0001_setup_extensions.py index 400dd091f4..a32319b911 100644 --- a/tests/postgres_tests/migrations/0001_setup_extensions.py +++ b/tests/postgres_tests/migrations/0001_setup_extensions.py @@ -5,10 +5,12 @@ from django.db import migrations try: from django.contrib.postgres.operations import ( - CreateExtension, HStoreExtension, TrigramExtension, UnaccentExtension, + BtreeGinExtension, CreateExtension, HStoreExtension, TrigramExtension, + UnaccentExtension, ) except ImportError: from django.test import mock + BtreeGinExtension = mock.Mock() CreateExtension = mock.Mock() HStoreExtension = mock.Mock() TrigramExtension = mock.Mock() @@ -18,6 +20,7 @@ except ImportError: class Migration(migrations.Migration): operations = [ + BtreeGinExtension(), # Ensure CreateExtension quotes extension names by creating one with a # dash in its name. CreateExtension('uuid-ossp'),