Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 17
    Version controlling full schema scripts is very useful for reference purposes. For instance, it is impossible to see what exactly was changed in a stored procedure by looking at ALTER PROCEDURE statement. Commented Sep 24, 2008 at 14:36
  • 12
    Dumping (and versioning) the full DB schema after running new upgrade scripts is a good way to make information available to other tools in your build/deploy process as well. Also, having the full schema in a script means being able to "spin up" a fresh database without going through all the migration steps. It also makes it possible to diff the current version against accumulated previous versions. Commented Jun 16, 2009 at 21:50
  • 2
    Are saying that you put upgrade scripts in source control, nut do not put rollback ones there? Commented Jul 7, 2009 at 13:16
  • 9
    I have a habit of maintaining a full create and drop script, as well as delta scripts for updating existing db instances up to date. Both go into version control. The delta scripts are named according to revision numbers. That way it's easy to automate db patching with an update script. Commented Jan 28, 2010 at 22:46
  • 1
    @nikc.org's answer, plus post-commit hooks for automation. Commented Nov 6, 2014 at 23:26

lang-sql