Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Add support for plain text field migrations #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

domstubbs
Copy link
Contributor

I’ve just migrated an old Craft 2 project to Craft 3 and wanted to convert some old Plain Text fields containing URLs to Embed fields. There was no "Changing this may result in data loss” exclamation mark so I assumed I’d be on safe ground, but although the old data wasn’t touched the Embed field type wasn’t able to parse it either, so when viewing old entries in the CP they appear to have no data in the video field and as soon as the entry was saved the old plain text value was deleted.

This little change adds a check for plain text URLs and normalises them. I’ve verified that it works on the frontend and backend and that existing JSON data is unaffected by the change.

This does mean that frontend requests can trigger slow embed->parse calls that I assume normally only happen in the CP, but that’s easily addressed by running craft resave/entries to ensure that all of the old text values are migrated to the Embed JSON format.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant