wp-cli / search-replace-command

Searches/replaces strings in the database.
MIT License
57 stars 45 forks source link

GUID updating in search-replace #108

Closed dasbuilder closed 5 years ago

dasbuilder commented 5 years ago

I've opened this issue after commenting from issue #92

I'm not a contributor, but I can say that when running a search/replace, more often than not I see guid table does get updated or shows that it's a table that is updated when I run

wp search-replace "http://olddom" "https://newdom" --all-tables --skip-columns=guid --skip-columns=user_email --precise --skip-plugins --skip-themes --report-changed-only

+-------------------------+---------------+--------------+------+
| Table                   | Column        | Replacements | Type |
+-------------------------+---------------+--------------+------+
| wp_options              | option_value  | 9            | PHP  |
| wp_postmeta             | meta_value    | 2            | PHP  |
| wp_posts                | post_content  | 67           | PHP  |
| wp_posts                | post_excerpt  | 28           | PHP  |
| wp_posts                | guid          | 600          | PHP  |
| wp_users                | user_url      | 1            | PHP  |
| wp_woocommerce_sessions | session_value | 1            | PHP  |
+-------------------------+---------------+--------------+------+
Success: Made 708 replacements. Please remember to flush your persistent object cache with `wp cache flush`

I will see if I can gather more data on this, but it appears the guid is being updated in posts table. I'll have to snag some info from another search/replace when I run it.

schlessera commented 5 years ago

I'm not a contributor

I disagree, as you're clearly commenting and opening issues in here...

Yes, this doesn't correspond to the expected behavior. Either the functionality is broke (in which case we should fix it) or it is not as obvious as it should be on how to use it (in which case we should document this).

chesio commented 5 years ago

@dasbuilder, you have specified --skip-columns argument twice: --skip-columns=guid --skip-columns=user_email. The second occurence overwrites the first one.

Try this instead: --skip-columns=guid,user_email

dasbuilder commented 5 years ago

After updating my search-replace to the one that Chesio suggested, the guids aren't being updated. I guess user error?

dasbuilder commented 5 years ago

I'm closing this issue since after using the correct flags, I'm not longer seeing guids being updated. Thanks!