From 6b7eb1cc6bd6d0ce7a208b4ce42276256134217a Mon Sep 17 00:00:00 2001 From: Ian Walls Date: Wed, 28 Oct 2020 10:57:08 -0400 Subject: [PATCH] Enable support for jsonb field types Adds a function to PostgreSQLSchemaManager.php to allow for FieldTypes that specify "json" as their type. Doing so will create a jsonb column in the database, which is better for jsonpath value retrieval than it's regular json counterpart. --- code/PostgreSQLSchemaManager.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/PostgreSQLSchemaManager.php b/code/PostgreSQLSchemaManager.php index 9c5b678..5312d9b 100644 --- a/code/PostgreSQLSchemaManager.php +++ b/code/PostgreSQLSchemaManager.php @@ -1246,6 +1246,17 @@ class PostgreSQLSchemaManager extends DBSchemaManager { return "decimal(4,0)"; } + + /* + * Return a JSON Binary field type (better for searching than a plain JSON type) + * + * @param array $values Contains a tokenised list of info about this data type + * @return string + */ + public function json($values) + { + return "jsonb"; + } /** * Create a fulltext search datatype for PostgreSQL