Created
October 8, 2018 11:40
-
-
Save naz/532a06a88ae4b8b78cd805414dd2473d to your computer and use it in GitHub Desktop.
Ghost post restoration script (MySQL version)
This file contains 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
-- show available versions for a post | |
SELECT `mr`.`id` 'version id', `p`.`id` 'post id', `p`.`title`, `mr`.`mobiledoc` | |
FROM `posts` `p` | |
JOIN `mobiledoc_revisions` `mr` | |
ON `p`.`id` = `mr`.`post_id` | |
WHERE `p`.`id` = '$POST_ID' \G | |
-- restore specific versions of the post | |
UPDATE `posts` `p` | |
JOIN `mobiledoc_revisions` `mr` | |
ON `p`.`id` = `mr`.`post_id` | |
SET `p`.`mobiledoc` = `mr`.`mobiledoc` | |
WHERE `mr`.`id` = '$VERSION_ID'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment