最近我在尝试使用Djang与Django时遇到了麻烦.我用这种方式安装了hstore:
$ sudo -u postgres psql
postgres=# CREATE EXTENSION hstore;
WARNING: => is deprecated as an operator name
DETAIL: This name may be disallowed altogether in future versions of PostgreSQL.
CREATE EXTENSION
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+--------------------------------------------------
hstore | 1.0 | public | data type for storing sets of (key, value) pairs
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(2 rows)
Run Code Online (Sandbox Code Playgroud)
并天真地认为我的新数据库将包括hstore.情况并非如此:
$ createdb dbtest …Run Code Online (Sandbox Code Playgroud) 在最新版本的Django(1.8)中,添加了一些模型字段以利用Postgres数据类型.我对HStoreField感兴趣并且文档要求设置PG 扩展以便HStoreField在模型中使用新的s.
我如何实际使用此类HStoreExtension来执行数据库扩展?