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

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

Jan 22, 2018

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A practical approach to version control for SQL Server - By Steve Jones

A Practical Approach to

Version Control for SQL ServerSteve Jones

SQLServerCentral

Redgate Software

#SQLintheCityUK

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

Goals

• Store database code in version control

• Track code changes across time

• Branch and merge changes to database

code

#SQLintheCityUK

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

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

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

Get in touch

www.voiceofthedba.com

[email protected]

@way0utwest

Steve Jones

#SQLintheCityUK

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

Database Lifecycle Management

FreeTool

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

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

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

Use version control because neither

you nor your developers are perfect.

#SQLintheCityUK

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

Getting Started

• Create a location in a VCS respository

• Script out objects to .sql files

• Commit files

#SQLintheCityUK

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

Demo – Setup in Git#SQLintheCityUK

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

Benefits

• Communication and collaboration

• History

• Undo

• Get back to previous versions

• Branching/merging

• Single version of the truth

• Building block for ALM

#SQLintheCityUK

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

Demo – Changes and history#SQLintheCityUK

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

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

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

Everyone Wants Locking#SQLintheCityUK

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

Demo – Locking Objects#SQLintheCityUK

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

Branching#SQLintheCityUK

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

Example of branching and merging#SQLintheCityUK

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

Branches can be dangerous#SQLintheCityUK

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

Demo – Branching and merging#SQLintheCityUK

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

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

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

Goals

• Store database code in version control

• Track code changes across time

• Branch and merge changes to database

code

#SQLintheCityUK

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

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

Questions?

[email protected] @way0utwest

#SQLintheCityUK