Version 7.9 convert metadata

In version 7.9 the field metadata array changed a bit. This data was converted during an upgrade but on a fresh install some packages are not working properly because they never went through the convert process.

I found the code that does the conversion upgrade/scripts/post/1_UpgradeRelationshipFields.php

I was able to replicate the functionality in the post_install but there are some functions (glob(), and write_array_to_file()) that would be banned by the installer for On-Demand. I tried calling the class directly but there is a required ($upgrader) parameter that must be passed when initiating the class and I'm not sure what that would be.

Any suggestions would be greatly appreciated.

  • Hi Shad Mickelberry,

    Are you upgrading from 7.7 or below ? If so, just to let you know, sugar has changed the way it parses the relationship metadata file. In newer version, it excepts relationship key to be the name of relationship table field.

    For example old version relationship fields array:

    'fields' =>
    array (
    0 =>
    array (
    'name' => 'id',
    'type' => 'id',
    ),
    1 =>
    array (
    'name' => 'date_modified',
    'type' => 'datetime',
    ),
    2 =>
    array (
    'name' => 'deleted',
    'type' => 'bool',
    'default' => 0,
    ),

    whereas in Sugar 7.9, this is how metadata fields array is organized:

    'fields' =>
    array (
    'id' =>
    array (
    'name' => 'id',
    'type' => 'id',
    ),
    'date_modified' =>
    array (
    'name' => 'date_modified',
    'type' => 'datetime',
    ),
    'deleted' =>
    array (
    'name' => 'deleted',
    'type' => 'bool',
    'default' => 0,
    ),

    So, if you have any old packages, I believe you need to update it manually. Let me know if this helps.

    Regards.

    Hats

  • Hello and thanks for the reply. In this case I was running into this for an installable package on fresh 7.9 installs but I'm guessing you are correct going from 7.7 to 7.9 I would have the same issue.

    This indeed seems to be the best way to do it and is certainly simple enough. I'll just have to replace the file if 7.9+.