Why database versioning is necessary

Source: Internet
Author: User
Tags svn table definition import database

Original: Huang csdn blog: Why the database version number control is necessaryPreface

The version number control during development is not common, but in the world of databases. Version number control is second-class or even third-class citizens. When multiple people develop a database management and application system at the same time, it is very important to use reasonable methods to monitor the changes of the tables, stored procedures and views in the database. Change the database every time. Need to make a specific record, a little inattentive on the problem. I have worked in several companies in the development process version number control is done very well, but the database is a blank. In the development process, it often involves adding columns, altering columns, altering stored procedures, and views on the table, and the previous database object definition is lost, causing a lot of trouble for development. Here's my idea of solving the hassle of not having a database version number control mechanism.

backing up the database

To solve this problem, our first idea is to back up the database, backup the database every few days, and restore the backup library to the test machine and then find the corresponding stored procedure or table definition when we need to find the historical database object.

In this way, a lot of problems are found during use. The first time you need to view the history of the time to restore the backup is very troublesome, followed by the development, it is very difficult to remember who in what time changed what database object, must be a period of time the backup is restored and then to find. This process is not only very annoying, but also a waste of time and energy, fake device part of the interval too long, the change in the definition of the object can not be retrieved.

Export Database Objects

Later, the solution is to change the database object every time you modify the database object definition in. sql into SVN, such a way is very troublesome.

Very often developers are lazy and forget to check in SVN, which can cause a lot of problems. The people who added the new team were also very ugly. The ins and outs of the version number changes.

In addition This is a very non-intuitive approach. Suppose you want to see a history version number of a database object, and then go to SVN to find it. Display is also very not intuitive

Another problem is that development DBAs in the team are very unaccustomed to using SVN.

Save version number records to database

This is the way I've seen it on the Internet. is to record the change operations of the database through triggers in the database. As a development-born person. In this way is not very like.

Besides, it is a time-consuming and laborious thing to find the version number in the history table.

using third-party tools

Now some third-party companies have developed version number control tools for databases. We've tried Redgate's Sqlsource Control (http://www.red-gate.com/products/sql-development/sql-source-control/) before, The principle of Sqlsource control is based on SVN, it is not very consistent with the team's usage habits, ease of use is not enough, the training cost of the team promotion is also higher.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvrejbx0h1yw5nemo=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "/>

Another tool that the team is using recently is a very easy-to-use Chinese version of the database version number control software. Called SourceSafe for SQL Server (http://www.grqsh.com/products.htm?tab=sourcesafe-for-sql-server), the Source Safe for SQL The principle of server is to store change records in the version number library, periodically to import database-defined scripts into SVN, the database version number history can be viewed as in SVN, and the training cost of team promotion is lower. Help us overcome a lot of problems in the team.


PostScript

Database version number seems to be a dispensable process, but to do well, to reduce the development and implementation of even a lot of trouble in the production environment, our system is a living example. The approach described in this article is from previous team experience. The development of the development team will experience from childish to mature. Learn from the experience and methods of mature tools to promote understanding and solve this problem can be reduced to improve productivity loss.

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Why database versioning is necessary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.