Database Versioning: The ignored aspect of version control.

Version control is an important aspect of writing code. From the initial check-in to the final build, it is crucial to keep track of every change that is made to the code. Like stacking blocks of legos, you will find what started with a single brick evolving into a city. Databases, however are often ignored from version control. If you are lucky you use some form of ORM to connect to your database like Active Record. This will handle database migrations for you and provide database version control to some degree. However for legacy projects you are out of luck. More often than not I have seen the code managed very carefully with awesome branch and merge strategies implemented. Whereas all the database scripts simply dumped in a directly called SQL. Or if you are lucky there will be sub directories with stored procedures, tables and functions in their own directories.

By versioning the database you get the ability to apply and rollback changes or "deltas" to your database. The simplest way to do this is , as mentioned above, is to use an ORM. However if you have an already established database and code and switching to ORM is not an option then there are other ways in which you can do this. There are products available on market that can help you version you database. For SQL Server Red Gate offers SQL Source Control that integrates with leading VCS. For MySQL there is dbv.php. Then there is software like Liquibase which is feature rich, free and supports a lot of databases.

And when all else fails grab a scripting language of your choice and automate it yourself. With a mix of automation and policies you can bring any database under version control.

You can read more how how to achieve Database Versioning here Database Versioning: The ignored aspect of version control.

要查看或添加评论,请登录

Nilesh Nimkar的更多文章

  • Diagram as Code with Python

    Diagram as Code with Python

    As a Cloud Native Development Architect everything for me usually starts with a diagram. Sometimes I create the diagram…

    3 条评论
  • The Holy Grail called Immutable Infrastructure

    The Holy Grail called Immutable Infrastructure

    it is quite common to fix small problems directly on production servers by directly logging on to them and then back…

    1 条评论
  • Database Version Control Tools

    Database Version Control Tools

    A couple of years ago I wrote a blog post about Database Versioning and how it was ignored over source code versioning.…

    2 条评论
  • Walmart's OneOps: A Closer Look.

    Walmart's OneOps: A Closer Look.

    Walmartlabs recently released OneOps into the wild as an open source project. Walmart's OneOps is a Application…

  • DevOps: An Organic Evolution

    DevOps: An Organic Evolution

    The benefits of DevOps are immense as can be seen here, here, here and many other similar examples. Although many of…

    3 条评论
  • Code Metrics: How good is your code ?

    Code Metrics: How good is your code ?

    Code review and code metrics are two facts of life that a good developer cannot (or should not) escape. Code metrics…

  • Version Control: Branching Models

    Version Control: Branching Models

    A good developer always versions his or her code. And all good version control systems provide means to create branches.

    1 条评论
  • Database Versioning: Using Liquibase

    Database Versioning: Using Liquibase

    Last week I wrote an article about Database Versioning called Database Versioning: The ignored aspect of version…

    1 条评论

社区洞察

其他会员也浏览了