Making changes to a production database is serious business—one wrong move, and you could bring down an entire system. That’s why you should always follow a simple but life-saving rule: create three essential files before making any modifications. These files act as your safety net, ensuring that you can apply, undo, and verify changes smoothly.
The first file is APPLYSQL.sql, which contains the actual SQL statements you intend to run—whether it’s adding columns, updating data, or tweaking indexes. This is your execution plan.
Next, you need ROLLBACK.sql. Think of this as your escape plan. If something goes wrong, this file allows you to revert changes quickly. Without it, you’re stuck manually undoing mistakes, which is never fun.
Finally, there’s VERIFY.sql. This file ensures everything went as planned. It contains queries to check whether the changes were applied correctly, giving you peace of mind.
Skipping these steps is like fixing an engine without a backup plan—you might get lucky, but you’re gambling with disaster. So, before making any database changes, always prepare APPLYSQL.sql, ROLLBACK.sql, and VERIFY.sql. Your future self (and your team) will thank you!
Source Link: medium.com
Source: medium.com
Via: medium.com