XF 2.0 Rebuilding XFRM 2 custom field values

b94

Member
I have migrated data across from a legacy website into XFRM 2 (via XFRM1 using an addon I found and modified), and manually inserted rows into xf_resource_field_value (they are still in xf_rm_resource_field_value ) after creating fields.

Despite the rows existing and them showing up when editing the resources in XFRM1, in XFRM2 they neither show on the resource page or when editing.

Is there anyway way to rebuild resource custom fields or does anyone know where I can find the serialised field etc. that needs updating?
 
Figured it out, somehow missed the "custom_fields" column on xf_rm_resource.

Quick and dirty SQL to rebuild this field for two fields is something like this:

SQL:
UPDATE
    xf_rm_resource r
    JOIN xf_rm_resource_field_value cf1 ON r.resource_id = cf1.resource_id AND cf1.field_id = 1
    JOIN xf_rm_resource_field_value cf2 ON r.resource_id = cf2.resource_id AND cf2.field_id = 2
SET
    r.custom_fields = concat('a:2:{i:2;s:', CHAR_LENGTH(cf2.field_value), ':"', cf2.field_value, '";i:1;s:', CHAR_LENGTH(cf1.field_value), ':"', cf1.field_value, '";}')
 
Top Bottom