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.

Parents
  • 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

Reply
  • 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

Children