{"id":481,"date":"2012-05-15T06:41:00","date_gmt":"2012-05-15T06:41:00","guid":{"rendered":"https:\/\/opstree.com\/blog\/\/2012\/05\/15\/automated-database-update-or-rollback\/"},"modified":"2019-08-02T10:44:09","modified_gmt":"2019-08-02T10:44:09","slug":"automated-database-update-or-rollback","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/2012\/05\/15\/automated-database-update-or-rollback\/","title":{"rendered":"Automated Database Update Or Rollback"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align:left;\">One of the important step during release is doing database update and rollback in case something goes wrong, usually people perform this operation manually. In this blog I&#8217;ll talk about how we can automate this process by following some convention.<\/p>\n<p>Here I&#8217;m taking mysql database as an example we can have same conventions for other databases also<\/p>\n<p><b>Convention to manage rollback\/updates of a release<\/b><\/p>\n<ul style=\"text-align:left;\">\n<li>Each project codebase at it&#8217;s root will have a folder database_scripts<\/li>\n<li>The database_scripts folder will contain folder for each release i.e Release1_1, Release2_0&#8230;<\/li>\n<li>The database scripts release folder will in turn contains two folders update &amp; rollback which will contain updates &amp; rollbacks scripts for a release.<\/li>\n<\/ul>\n<p>Automating the rollback\/update<\/p>\n<ul style=\"text-align:left;\">\n<li>The update folder will have a source input file FileSequencer.txt. This file will point to all the update scripts in correct order that needs to be executed for the release<\/li>\n<li>In the similar manner rollback folder will have a source input file FileSequencer.txt. This file will point to all the rollback scripts in correct order that needs to be executed for the release<\/li>\n<li>At last we will have a utility shell script, this script will take db details and execute all the scripts referred in FileSequencer.txt using mysql command<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>One of the important step during release is doing database update and rollback in case something goes wrong, usually people perform this operation manually. In this blog I&#8217;ll talk about how we can automate this process by following some convention. Here I&#8217;m taking mysql database as an example we can have same conventions for other &hellip; <a href=\"https:\/\/opstree.com\/blog\/2012\/05\/15\/automated-database-update-or-rollback\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Automated Database Update Or Rollback&#8221;<\/span><\/a><\/p>\n","protected":false},"author":150552946,"featured_media":29900,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[44070,475,768739289,3490198,12397870],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/11\/DevSecOps-1.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-7L","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/481"}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/150552946"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=481"}],"version-history":[{"count":1,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":837,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions\/837"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29900"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}