Nice intent.
A few challenges:
-
Many good plugins create and manage their own tables. Looking at your code, I’m not sure you’ve taken account of that yet?
- Your challenge is that once you remove the plugin the migration disappears.
- What if the plugin changes data to a core table somehow (eg adds a record)? For example a data explorer query or something less transparent.
-
I don’t see a way your plugin protects the user from deleting the custom fields outside of a specific plugin they might want to “cleanse” - you are relying on the user to identify them? Just blocks deleting custom fields that are in core?
And on that note:
That looks a little risky. What if a core upgrade adds new ones that you don’t catalogue - are you going to risk deleting new core fields that you are not explicitly listing?
In any case I wish you luck with development, it’s definitely an interesting addition.