caspahouzer / wp-cpt-tables

Allow storing WordPress custom post types in their own tables in order to make querying large datasets more efficient
9 stars 2 forks source link

Automatically migrating cpt when isn't yet + Change name of migrating tables? #2

Open DjodyKort opened 1 year ago

DjodyKort commented 1 year ago

I must say this actually is an incredible plugin.

Small question, is there a way to change the name of the tables when you migrate them?

And I wanted to build a plugin myself to check if a table is migrated and if not then migrate it for me. Right now I already have a way to check if a custom post type is migrated or not. Just use the name of the custom post type and look up if a database table with "wpcpt"+tableName exists.

And if not then it just migrates the custom post type. But the problem is I don't think I can do it through my plugin right? What would you think is the best way?

Cheers, Djody :)

caspahouzer commented 1 year ago

Hey @DjodyKort thanks for the flowers.

IMHO an automatic migration is very unsafe as the user won't get informed or something unwanted happens there.

If I would make some integration, I would make a checkbox called "Automatic migration of new post types" and there the plugin will compare the post types within the cpt_tables:tables_enabled options array with the existing wp_cpt_* tables.

But again: I personally would be annoyyed, if there are tables created when it's not wished by me.

If you found a solution to make it nice and clean, you can add this to cpt-tables by a PR. You're always welcome

DjodyKort commented 1 year ago

Thank you for the advice! I have looked into the plugin some more and I found a little bug that confused me a bit. Let me describe it real quick:

So when you try putting meta_data into a migrated cpt it doesnt appear within the post's frontend for some reason. I feel like this is just a minor bug and isn't that big of a problem probably because I think it still is connected via the backend.

At least I think so.

Also I still am not too comfortable with Wordpress plugin development so I'm still learning and don't think I'm able to actually create a clean PR.

Anyways I wanted to thank you for your work, you truely made a plugin that is helpful for loads of people including me. Although I'm not sure if I am gonna seperate all the posts yet.

Cheers, Djody :)