标签云

微信群

扫码加入我们

WeChat QR Code

I often run into the following problem.

I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always remember what I've changed and I don't always remember to write it down.

So, I make a push to the live system and get a big, obvious error that there is no NewColumnX, ugh.

Regardless of the fact that this may not be the best practice for this situation, is there a version control system for databases? I don't care about the specific database technology. I just want to know if one exists. If it happens to work with MS SQL Server, then great.


Here is another discussion on DB versioning.

2018年07月19日44分56秒

According to our on-topic guidance, "Some questions are still off-topic, even if they fit into one of the categories listed above:...Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic..."

2018年07月19日44分56秒

This is the choice for Ruby projects. The nearest equivalent to this design in java is mybatis schema migrations. For .NET the equivalent is code.google.com/p/migratordotnet. They're all excellent tools for this job IMO.

2018年07月19日44分56秒

we use liquibase, but we use 3 different approach for the different information: 1. structure (table, views, ...): historical changelog 2. codes (procedures, pl/sql, functions): changelog with only one changeset marked with runalways=true runonchange = true 3. code tables, other meta "constants" stored in tables: the same approach as for codes, only one changeset, delete from, insert all info

2018年07月20日44分56秒

For Java I highly recommend to have a look into flywaydb.org these days - see also the feature comparison on this site

2018年07月19日44分56秒

Yeah, but diffing SQL files won't give you the neccessary scripts to upgrade your dev/prod db from one revision to another

2018年07月19日44分56秒