Problem/Motivation
I am trying to create a field type that leverages the JSON and JSONB data types in Postgres. My goal is to have a field that can store JSON objects who's properties can be indexed. This is a Postgres specific feature.
- http://www.postgresql.org/docs/9.4/static/datatype-json.html
- http://pgeoghegan.blogspot.com/2014/03/what-i-think-of-jsonb.html
- http://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails
Proposed resolution
Add json:normal
and jsonb:normal
mapped to json
and jsonb
Drupal field types for pgsql driver, Schema::getFieldTypeMap().
'json:normal' => 'json',
'jsonb:normal' => 'jsonb',
);
return $map;
}
Remaining tasks
- Review field type map and approach
Data model changes
json and jsonb field types are available for use in schema for pgsql driver.
Release notes snippet
Basically I want to be able to paste JSON or parse a CSV with another custom module and store the object in this field with the intent of being able to query this data, treating it like a NoSQL store. Since Mongo isn't fully implemented, and would require two databases running instead of one, Postgres seems like a natural fit.