2. Goals
• Understand the value of version/source control
for databases
• Learn the tools, standards, patterns and best
practices needed to manage a database from
source control
• Identify the necessary flow within a team needed
to develop a database with source control
3. Get in touch
Steve Jones
www.voiceofthedba.com
sjones@sqlservercentral.com
@way0utwest
4. How many of you use version control for
your application code?
C#, ASP.NET, Javascript, VB.NET, etc.
5. How many of you use version control for
your application code?
database
18. Additional Reasons for Source Control
• Backup & Restore
• Undo
• Audit changes
• Sandbox
• Branching/Merging
19. Rules for Database Development
Never use a shared database for development.
Always Have a Single, Authoritative Source
For Your Schema.
Always Version Your Database.
20. The Ideal
• Each developer has a
dedicated environment with
a copy of the schema and
minimal data.
• A shared integration environment where all
developers’ changes are merged, available
for developer testing.
21. Patterns and Practices
• Get all your code
– Object DDL
– Assembly code
– Security grants and revokes
– Database configuration settings
– Jobs for your application
– Lookup data
22. Patterns and Practices
• Commit Early, Commit Often
• Use meaningful comments. Why, not what.
• Check for changes often
• Use common names and code patterns
• Use tools
• Branch Rarely
24. Teamwork
• Communication
o Team members need to be aware of (easily)
what others are doing.
• Coordination
o Teams need to work in a way that
complements each other.
25. Teamwork
• Communication
o Review each other’s code as you refactor
o Share knowledge
o Coordination
o Decide on common code styles and names
o And …
31. Best Practices
• Use version control for all code (including tests)
• Commit early, commit often
• Use tools
o If it’s hard, people don’t do it
• Train people
• Build often
35. Goals
• Understand the value of version/source control
for databases
• Learn the tools, standards, patterns and best
practices needed to manage a database from
source control
• Identify the necessary flow within a team needed
to develop a database with source control
36. Thanks for coming
www.voiceofthedba.com
sjones@sqlservercentral.com
@way0utwest
Want to try the tools you’ve just
seen? Come to our Hands-on Labs
37. References
• http://stackoverflow.com/questions/115369/do-you-use-source-control-for-your-
database-items
• http://www.codinghorror.com/blog/archives/001050.html
• http://www.codinghorror.com/blog/2008/02/get-your-database-under-version-
control.html
• http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterSQLServerData
bases.aspx
• http://odetocode.com/blogs/scott/archive/2008/01/30/three-rules-for-database-
work.aspx
• Check in early, check in often -
http://www.codinghorror.com/blog/2008/08/check-in-early-check-in-often.
html
• http://betterexplained.com/articles/a-visual-guide-to-version-control/
How many people in the audience use version control for their application code? Any of your front end code.
* Note number
Let’s ask the same question. How many of you use version control for your database code? For your tables, views, procedures? What about schemas? What about permissions and roles? What about cryptographic keys?
* Note number and difference.
Developers who refuse to use source/version control should be fired, simple as that. – top stack exchange
Isn’t this too much trouble for my crappy experimental program. - Drupal
Use source control because neither you nor your developers are perfect. – bottom stack exchange
There are no excuses where you should not use it. - makeuseof
If it’s not in source control, it doesn’t exist. - TroyHunt
http://programmers.stackexchange.com/questions/122150/how-can-i-convince-cowboy-programmers-to-use-source-control
http://www.makeuseof.com/tag/git-version-control-youre-developer/
http://www.mactech.com/articles/mactech/Vol.14/14.06/VersionControlAndTheDeveloper/index.html
http://drupal.org/node/299067
Developers who refuse to use source/version control should be fired, simple as that. – top stack exchange
Isn’t this too much trouble for my crappy experimental program. - Drupal
Use source control because neither you nor your developers are perfect. – bottom stack exchange
There are no excuses where you should not use it. - makeuseof
If it’s not in source control, it doesn’t exist. - TroyHunt
http://programmers.stackexchange.com/questions/122150/how-can-i-convince-cowboy-programmers-to-use-source-control
http://www.makeuseof.com/tag/git-version-control-youre-developer/
http://www.mactech.com/articles/mactech/Vol.14/14.06/VersionControlAndTheDeveloper/index.html
http://drupal.org/node/299067
Developers who refuse to use source/version control should be fired, simple as that. – top stack exchange
Isn’t this too much trouble for my crappy experimental program. - Drupal
Use source control because neither you nor your developers are perfect. – bottom stack exchange
There are no excuses where you should not use it. - makeuseof
If it’s not in source control, it doesn’t exist. - TroyHunt
http://programmers.stackexchange.com/questions/122150/how-can-i-convince-cowboy-programmers-to-use-source-control
http://www.makeuseof.com/tag/git-version-control-youre-developer/
http://www.mactech.com/articles/mactech/Vol.14/14.06/VersionControlAndTheDeveloper/index.html
http://drupal.org/node/299067
Developers who refuse to use source/version control should be fired, simple as that. – top stack exchange
Isn’t this too much trouble for my crappy experimental program. - Drupal
Use source control because neither you nor your developers are perfect. – bottom stack exchange
There are no excuses where you should not use it. - makeuseof
If it’s not in source control, it doesn’t exist. - TroyHunt
http://programmers.stackexchange.com/questions/122150/how-can-i-convince-cowboy-programmers-to-use-source-control
http://www.makeuseof.com/tag/git-version-control-youre-developer/
http://www.mactech.com/articles/mactech/Vol.14/14.06/VersionControlAndTheDeveloper/index.html
http://drupal.org/node/299067