Deploying new code that includes changes to your database schema doesn’t have to be a process fraught with stress and burned fingers. Follow these five tips and enjoy a good nights sleep.
1. Deploy with Roll Forward & Rollback Scripts
When developers check-in code that requires schema changes, that release should also require two scripts to perform database changes. One script will apply those changes, alter tables to add columns, change data types, seed data, clean data, create new tables, views, stored procedures, functions, triggers and so forth. A release should also include a rollback script, which would return tables to their previous state. Continue reading “5 Tips for Better Database Change Management”
Spencer Johnson is a great writer. His business book classic was a real page turner. He takes a page from the REWORK book and that’s a good thing.
Who Moved My Cheese is a story about mice living in a maze happy and content that they have an unlimited supply of cheese. Then one day the cheese runs out. Continue reading “Review – Who Moved My Cheese”
During the software development process, whether you’re cutting edge Agile developers, or traditional waterfall method folks, your code changes are periodically accompanied by database changes. For instance tables have particular rows and columns. When developers add new columns (ie fields on an index card), or create new tables, relationships, indexes or other database objects, all of these are lumped together as database changes.
Version control systems have brought great manageability gains to software projects, even ones involving only a single developer. That’s because they allow you to rewind to any savepoints, just like you can undo and redo changes in a word document. With database changes, however the picture because more muddied.
Database Change Management Best Practices
- Require developers to include a roll forward and a roll back script with each set of schema changes.
- Check in those scripts into the version control system just like other software code.
- Be sure developers test the roll forward and roll backward operation on dev.
- Ensure that changes are documented, as well as possible side affects.
During deployment, operations folks and/or a DBA must still have their fingers on the trigger. Some frameworks such as Ruby on Rails include Migration scripts. Do not for example allow rollback scripts to run automatically. This is a recipe for disaster.
- Be sure to take a backup of the database before running any schema change scripts.
- Consider application downtime if ALTERs or other operations may lock large tables.
- Perform another backup following the schema changes
- If database is particularly large you may isolate your backup to the schema or tables being altered.
Above all use common sense, and always second and/or third guess yourself. Better to be safe than sorry when juggling your crown jewels.
Quora discussion by Sean Hull – What is database change management and why is it important?
Every software service or component on a server requires configurations. In your desktop applications you set preferences for what your default page will be, how you’d like your margins set, or whether to save and restore cookies each time you restart.
Enterprise applications also require complex configuration settings. Want to monitor a webserver and a database with Nagios, that’s set in the config file. What to start MySQL with 8G of memory for InnoDB, that’s also set in a config file. What’s more config files contain server specific settings, based on IP address, or the servers role, webserver or database for example. The webserver may also have memcache and outbound email services running.
With more traditional deployments, the systems administrator will setup each physical box, and configure those services based on the business needs. As you bring online 10’s or 100’s of servers, however, you can quickly see how labor intensive this process would be, and also how much redundancy there is.
Enter configuration management into the picture. Previously I blogged about tools like Puppet that can bring great new best practices to the table. There is also cfengine, and the newer Chef which incorporates cloud deployments as well into the mix. Configuration management allows you to remotely administer servers, install packages, manage dependencies, install configurations based on a central copy, and even define roles and templates for new servers. This brings a whole new level of professionalism to deployments, and also newfound power and flexibility.
We’ll be writing more about configuration management, especially in the context of cloud deployments such as Amazon EC2 so please stay tuned.
Sean Hull asks on Quora – What is configuration management and why is it important?