Replace JSON column with normalized table structure
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3535768. -->
Reported by: [alorenc](https://www.drupal.org/user/3603980)
Related to !10
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The track_usage module currently uses a JSON column to store metadata paths, which is not<br>
natively supported by Drupal's database abstraction layer. </p>
<p>This creates several issues:<br>
* JSON columns are MySQL-specific<br>
* Drupal's schema API doesn't have native JSON column support<br>
* JSON queries require database-specific syntax</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Replace the JSON meta column with a normalized table structure.</p>
<ul>
<li>Add a new serial/autoincrement field to track_usage table (tid)</li>
<li>Add e a 2nd table track_usage_paths with (filed names are only suggested, pick the best)
<ol>
<li>tid: ref to track_usage serial field</li>
<li>path (int): 0..N</li>
<li>delta (int): 0..N position within one path</li>
<li>type (string): entity type</li>
<li>id (string): entity id</li>
<li>revision (int)</li>
</ol>
</li>
<li>Add proper table indexes</li>
<li>Add an update path
<ol>
<li>Remove the first element of each path (it's already the source entity from main table)
</li><li>Move data from JSON field into the new table</li>
<li>Delete the JSON field</li>
</ol>
</li>
</ul>
issue