0

I'm updating an old EE1 site that used to use matrix with a file field for downloadable files and a text field for the optional download text. I've successfully migrated the content into a new EE2.10 build and now have a grid field with an assets file field and the text box.

However, thinking about it, the grid is overkill because assets allows you to select multiple files, and the site admins were rarely completing the download text field in the grid.

My question is, how complex is it for me to move away from an assets field inside a grid, to a standalone assets field with multiple selections? I realise that a lot of this probably hinges on the exp_assets_selection table; could it be a case of updating the fieldtype to be assets (only) and some handy sql to iterate through exp_grid_field_x and somehow populate the exp_assets_selection table with the data it needs?

Anyone got any experience of doing this? Or is it a case of 'if it ain't broke...'? :)

1

I'd recommend doing some trial and error on a copy, howeve your plan is almost right...

You'r right in that you would have to disect how multiple selections are stored in exp_assets_selection table, and iterate the grid table, making entries in this table as you go.

Once you're done ther you'll need to iterate your entries on the exp_channel_data table, setting the asset's ID in the correct field_data column, then it should just work...

Never done this myself, but the theory is sound... You could end up wih quite a lot of SQL mashing though, so if it's not cost effective to invest the time I'd go with "Ain't Broke, Don't fix"...

3
  • This. Other than writing some complex headache-y migration script, or finding someone else's already created migration tool, I'd leave the field the way it is. – jrothafer May 7 '15 at 12:45
  • OK that's two votes (plus my own suspicion that it's more work than it's worth) to keep things as they are. I'll accept the answer, and if anyone comes along later with an actual solution hopefully they can add it to the thread! Thanks folks :) – BellamyStudio May 7 '15 at 13:04
  • No Problem Bellamy, If only I has Assets installed on my sandbox site I'd write you the guide, but as wee've all confered, this will be a good few hours of work, compared to a little bit of documentation to your admins on how to populate the channel entries :D – Blatant May 7 '15 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.