21
A Practical Approach to Version Control for SQL Server Steve Jones SQLServerCentral Redgate Software #SQLintheCityUK

A practical approach to version control for SQL Server - By Steve Jones

Embed Size (px)

Citation preview

A Practical Approach to

Version Control for SQL ServerSteve Jones

SQLServerCentral

Redgate Software

#SQLintheCityUK

Goals

• Store database code in version control

• Track code changes across time

• Branch and merge changes to database

code

#SQLintheCityUK

Learn, Grow, Adapt

07/10/15 sqlrelay.co.uk/ Nottingham

08/10/15 sqlrelay.co.uk/ Reading

12/10/15 sqlrelay.co.uk/ London

13/10/15 sqlrelay.co.uk/ Bristol

14/10/15 sqlrelay.co.uk/ Cardiff

15/10/15 sqlrelay.co.uk/ Birmingham

Get in touch

www.voiceofthedba.com

[email protected]

@way0utwest

Steve Jones

#SQLintheCityUK

Database Lifecycle Management

FreeTool

What is version control?…any kind of practice that tracks and provides control over changes to source code. Software developers sometimes use revision control software to maintain documentation and configuration files as well as source code.

(Wikipedia)

Source Control = Version Control = Revision Control

#SQLintheCityUK

Use version control because neither

you nor your developers are perfect.

#SQLintheCityUK

Getting Started

• Create a location in a VCS respository

• Script out objects to .sql files

• Commit files

#SQLintheCityUK

Demo – Setup in Git#SQLintheCityUK

Benefits

• Communication and collaboration

• History

• Undo

• Get back to previous versions

• Branching/merging

• Single version of the truth

• Building block for ALM

#SQLintheCityUK

Demo – Changes and history#SQLintheCityUK

Teamwork

• Work should be logically separated

• Sandboxes should to be used

• Developers’ work should not conflict

But sometimes we work on shared

databases, and …

#SQLintheCityUK

Everyone Wants Locking#SQLintheCityUK

Demo – Locking Objects#SQLintheCityUK

Branching#SQLintheCityUK

Example of branching and merging#SQLintheCityUK

Branches can be dangerous#SQLintheCityUK

Demo – Branching and merging#SQLintheCityUK

Finally

• Use a VCS, keep control of your code

• Ensure everyone has the tools

• Ensure everyone understands the process

• Write comments for the future you

#SQLintheCityUK

Goals

• Store database code in version control

• Track code changes across time

• Branch and merge changes to database

code

#SQLintheCityUK

Want to try the tools you’ve just seen?Head to the Hands-on Labs

Questions?

[email protected] @way0utwest

#SQLintheCityUK