Created
October 2, 2023 09:24
-
-
Save InabaByakko/cda3451366f15c4c8aec72b942147faa to your computer and use it in GitHub Desktop.
Wordpress WP Offload Media の管理下へ既存メディアを移行するSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO wp_as3cf_items | |
| (provider, region, bucket, path, original_path, is_private, source_type, source_id, source_path, original_source_path, extra_info, originator, is_verified ) | |
| SELECT | |
| 'aws', 'ap-northeast-1', 'kedama-prod-wp-s3', | |
| CONCAT('wp-content/uploads/', meta_value), | |
| CONCAT('wp-content/uploads/', meta_value), | |
| 0, 'media-library', post_id, meta_value, meta_value, | |
| CONCAT( | |
| 'a:2:{s:7:"objects";a:2:{s:15:"__as3cf_primary";a:2:{s:11:"source_file";s:', | |
| LENGTH(SUBSTRING_INDEX(meta_value, '/', -1)), ':"', | |
| SUBSTRING_INDEX(meta_value, '/', -1), | |
| '";s:10:"is_private";b:0;}}s:14:"private_prefix";s:0:"";}' | |
| ), 0, 0 | |
| FROM | |
| wp_postmeta | |
| WHERE | |
| meta_key = '_wp_attached_file'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment