CRM/Logging - Fix various bugs in schema parsing
authorPatrick Figel <pfigel@greenpeace.org>
Sun, 13 Jan 2019 18:11:41 +0000 (19:11 +0100)
committerPatrick Figel <pfigel@greenpeace.org>
Sat, 23 Feb 2019 10:16:20 +0000 (11:16 +0100)
commit9c8a302515c660178f2cb3de7a0b03e2cb7624a4
treee93763784579d2492bf0527f8d02b551bd78d6ee
parent753d6473842f18d0ba83b24402c89c51f419965b
CRM/Logging - Fix various bugs in schema parsing

This fixes a couple of bugs in the schema parsing methods used by
Civi's extended logging feature:

- CRM_Logging_Schema::getIndexesForTable only queried for constraints,
  not returning any indexes.
- CRM_Logging_Schema::getIndexesForTable returned an array in the form
  [0 => ['constraint_name' => 'foo']] rather than the expected array
  of index names (i.e. ['foo']).
- CRM_Logging_Schema::columnSpecsOf contained an off-by-one error and
  a wrongly used substr parameter causing column lengths to include
  surrounding parenthesis. This would result in a "varchar(42)"
  column returning a length of "(42)" instead of "42".
CRM/Logging/Schema.php
tests/phpunit/CRM/Logging/SchemaTest.php