Force comparator to add comment (json -> json_array)

I know, this is REALLY nasty but that was the only way I've found to
make it work properly.
parent e0e67b9c
......@@ -435,6 +435,13 @@ class Comparator
}
}
// This is a very nasty hack to make comparator work with the legacy json_array type, which should be killed in v3
if ($this->isALegacyJsonComparison($properties1['type'], $properties2['type'])) {
array_shift($changedProperties);
$changedProperties[] = 'comment';
}
if ($properties1['default'] != $properties2['default'] ||
// Null values need to be checked additionally as they tell whether to create or drop a default value.
// null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
......@@ -497,6 +504,21 @@ class Comparator
return array_unique($changedProperties);
}
/**
* TODO: kill with fire on v3.0
*
* @deprecated
*/
private function isALegacyJsonComparison(Types\Type $one, Types\Type $other) : bool
{
if ( ! $one instanceof Types\JsonType || ! $other instanceof Types\JsonType) {
return false;
}
return ( ! $one instanceof Types\JsonArrayType && $other instanceof Types\JsonArrayType)
|| ( ! $other instanceof Types\JsonArrayType && $one instanceof Types\JsonArrayType);
}
/**
* Finds the difference between the indexes $index1 and $index2.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment