瀏覽代碼

Refs #27162 -- Complemented docs related to CreateExtension

Thanks Tim Graham for the review.
Claude Paroz 8 年之前
父節點
當前提交
6b54504e66
共有 2 個文件被更改,包括 18 次插入1 次删除
  1. 11 1
      docs/ref/contrib/gis/install/postgis.txt
  2. 7 0
      docs/ref/databases.txt

+ 11 - 1
docs/ref/contrib/gis/install/postgis.txt

@@ -65,7 +65,17 @@ functionality::
 
 The database user must be a superuser in order to run
 ``CREATE EXTENSION postgis;``. The command is run during the :djadmin:`migrate`
-process.
+process. An alternative is to use a migration operation in your project::
+
+    from django.contrib.postgresql.operations import CreateExtension
+    from django.db import migrations
+
+    class Migration(migrations.Migration):
+
+        operations = [
+            CreateExtension('postgis'),
+            ...
+        ]
 
 GeoDjango does not currently leverage any `PostGIS topology functionality`__.
 If you plan to use those features at some point, you can also install the

+ 7 - 0
docs/ref/databases.txt

@@ -164,6 +164,13 @@ lookups that use the ``LIKE`` operator in their SQL, as is done with the
 
 .. _PostgreSQL operator class: http://www.postgresql.org/docs/current/static/indexes-opclass.html
 
+Migration operation for adding extensions
+-----------------------------------------
+
+If you need to add a PostgreSQL extension (like ``hstore``, ``postgis``, etc.)
+using a migration, use the
+:class:`~django.contrib.postgres.operations.CreateExtension` operation.
+
 Test database templates
 -----------------------