Return to Snippet

Revision: 65411
at November 30, 2013 03:32 by web_la


Updated Code
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT post_id, 'amazonS3_info' as meta_key, CONCAT('a:2:{s:6:"bucket";s:7:"bucketname";s:3:"key";s:', CHAR_LENGTH(meta_value) + 19,':"wp-content/uploads/', meta_value, '";}') FROM wp_postmeta WHERE meta_key = '_wp_attached_file'

Revision: 65410
at November 29, 2013 03:58 by web_la


Updated Code
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT post_id, 'new_url' as meta_key, CONCAT('a:2:{s:6:"bucket";s:7:"bucketname";s:3:"key";s:', CHAR_LENGTH(meta_value),':"', meta_value, '";}') from wp_postmeta WHERE meta_key = '_wp_attached_file'

Revision: 65409
at November 29, 2013 03:39 by web_la


Updated Code
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT post_id, 'new_url' as meta_key, CONCAT('a:2:{s:6:"bucket";s:7:"crewtoo";s:3:"key";s:', CHAR_LENGTH(meta_value),':"', meta_value, '";}') from wp_postmeta WHERE meta_key = '_wp_attached_file'

Revision: 65408
at November 29, 2013 03:34 by web_la


Updated Code
INSERT INTO wp_postmeta2 (post_id, meta_key, meta_value)
SELECT post_id, 'new_url' as meta_key, CONCAT('a:2:{s:6:"bucket";s:7:"crewtoo";s:3:"key";s:', CHAR_LENGTH(meta_value),':"', meta_value, '";}') from wp_postmeta2 WHERE meta_key = '_wp_attached_file'

Revision: 65407
at November 28, 2013 22:51 by web_la


Initial Code
INSERT INTO wp_postmeta2 (post_id, meta_key, meta_value)
SELECT post_id, 'new_url' as meta_key, CONCAT('{', meta_value, '}') from wp_postmeta2 WHERE meta_key = '_wp_attached_file'

Initial URL

                                

Initial Description
For use with AWS S3 Wordpress pluign

Initial Title
Duplicate MySQL rows with slight changes

Initial Tags

                                

Initial Language
MySQL