SlideShare a Scribd company logo
1 of 14
Get Your SQL
into
Version Control
USING MICROSOFT SQL SERVER DATABASE PROJECTS
Floyd Hilton
@fhilton
Boston Code Camp 23 - Thanks to our Sponsors!
Gold
Bronze
In-Kind Donations
Background
Why put SQL into Version Control?
Lower Risk, Increased Quality
•Keeps history
•Documentation – Tie to issue tracker
•Makes processes repeatable
•Group changes (by feature)
•Continuous Integration and Deployment
•Portability
Two Version Control Processes for SQL
1. Transformation
2. State
Transformation
Incremental changes to the database are saved and then can be run
in order to gain the desired database state
V0.0.1
0001
Database Create
Script
0002
Add Table
0003
Add Procedure
0004
Add Lookup Data
V0.0.2
State 1 State 2
Actual state is not saved, only how to get there
Basic Transformation Process
Custom Tool
V0.1.0
SQL Management Studio
Transformation Tools
•DbUp
•https://www.nuget.org/packages/dbup/
•Flyway
•http://flywaydb.org/
•Nmigrations
•https://github.com/sklose/NMigrations
•roundhouse
•https://github.com/chucknorris/roundhouse
State
The full state of the database is stored for every version
State is saved, and tools are used to transform a
database from one state to another
V0.0.2
Schema
in source control
V0.0.1
Schema
in source control
V0.0.1
Database
Tool compares state
ofcurrent database
to state of schema
in version control
V0.0.2
Database
Transformation
Script or other
Method
Developers
Make
Changes
V0.0.3
Schema
in source control
Developers
Make
Changes
State Tools/Methods
•Manual
•Manually script schema objects and store in source
control
•Entity Framework Migrations
•Redgate SQL Source Control
•SQL Server Database Project
Which to Choose?
TRANSFORMATIONS
When to use
◦ Starting from scratch
◦ Simple model used for a single system
◦ Small team
◦ When a state tool is not available
STATE
When to use
◦ Existing, complex data models
◦ Multiple, interconnected databases
◦ Databases that are used by many systems
◦ Large Team
What is an SQL Database Project?
It is a Visual Studio Project specifically for storing database schema and
information.
What is a Visual Studio Project?
◦ "Projects are used in a solution to logically manage, build, and debug the items that make up
your application. The output of a project is usually an executable program (.exe), a dynamic-
link library (.dll) file or a module, among others.“
◦ For a Database Project, the output is a DACPAC (Data-Tier Application Package)
What is a Solution?
◦ "Solutions contain items that you need in order to create your application. A solution
includes one or more projects, plus files and metadata that help define the solution
as a whole."
Demonstration – SQL Database Project
Resources
Enrico Campidoglio
◦ NDC talk on Continuous Delivery for SQL
◦ http://www.ndcvideos.com/#/app/video/2531
◦ Features DbUP (https://www.nuget.org/packages/dbup/)
◦ .NETROCKS discussion on Continuous Delivery for SQL
◦ http://www.dotnetrocks.com/default.aspx?showNum=1079
Deborah Kurata
◦ Pluralsight video – Visual Studio Data Tools for Developers
◦ http://www.pluralsight.com/courses/visual-studio-data-tools-developers

More Related Content

What's hot

Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 
SQL Server 2012 High Availability with AlwaysOn Availability Groups
SQL Server 2012 High Availability with AlwaysOn Availability GroupsSQL Server 2012 High Availability with AlwaysOn Availability Groups
SQL Server 2012 High Availability with AlwaysOn Availability Groups
Edwin M Sarmiento
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
deepakk073
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahk
sqlserver.co.il
 

What's hot (20)

Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
 
Troubleshooting sql server
Troubleshooting sql serverTroubleshooting sql server
Troubleshooting sql server
 
Sql server 2014 online operations
Sql server 2014 online operationsSql server 2014 online operations
Sql server 2014 online operations
 
Mysql
MysqlMysql
Mysql
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
SQL Server 2012 High Availability with AlwaysOn Availability Groups
SQL Server 2012 High Availability with AlwaysOn Availability GroupsSQL Server 2012 High Availability with AlwaysOn Availability Groups
SQL Server 2012 High Availability with AlwaysOn Availability Groups
 
Introducing Microsoft SQL Server 2012
Introducing Microsoft SQL Server 2012Introducing Microsoft SQL Server 2012
Introducing Microsoft SQL Server 2012
 
Mobile
MobileMobile
Mobile
 
Sql Nexus
Sql NexusSql Nexus
Sql Nexus
 
Sql Server 2008 Enhancements
Sql Server 2008 EnhancementsSql Server 2008 Enhancements
Sql Server 2008 Enhancements
 
HPE NonStop SQL WebDBS - Introduction
HPE NonStop SQL WebDBS - IntroductionHPE NonStop SQL WebDBS - Introduction
HPE NonStop SQL WebDBS - Introduction
 
Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 
Database mirroring setup
Database mirroring setupDatabase mirroring setup
Database mirroring setup
 
Alwayson AG enhancements
Alwayson AG enhancementsAlwayson AG enhancements
Alwayson AG enhancements
 
BI Publisher Data model design document
BI Publisher Data model design documentBI Publisher Data model design document
BI Publisher Data model design document
 
Writing simple web services in java using eclipse editor
Writing simple web services in java using eclipse editorWriting simple web services in java using eclipse editor
Writing simple web services in java using eclipse editor
 
OBIEE11g Multi User Development - MUD
OBIEE11g  Multi User Development - MUDOBIEE11g  Multi User Development - MUD
OBIEE11g Multi User Development - MUD
 
SQLite3
SQLite3SQLite3
SQLite3
 
Database Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David IzahkDatabase Mirror for the exceptional DBA – David Izahk
Database Mirror for the exceptional DBA – David Izahk
 

Similar to SQL in Version Control using SQL Server Database Projects

DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
David Mann
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database Development
Vladimir Bakhov
 

Similar to SQL in Version Control using SQL Server Database Projects (20)

Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringar
 
Delivering Changes for Applications and Databases
Delivering Changes for Applications and DatabasesDelivering Changes for Applications and Databases
Delivering Changes for Applications and Databases
 
Database CI/CD Pipeline
Database CI/CD PipelineDatabase CI/CD Pipeline
Database CI/CD Pipeline
 
Delivering changes for applications and databases
Delivering changes for applications and databasesDelivering changes for applications and databases
Delivering changes for applications and databases
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database Development
 
Oracle plsql code refactoring - from anonymous block to stored procedure
Oracle plsql code refactoring - from anonymous block to stored procedureOracle plsql code refactoring - from anonymous block to stored procedure
Oracle plsql code refactoring - from anonymous block to stored procedure
 
KoprowskiT_SQLSat419_WADBforBeginners
KoprowskiT_SQLSat419_WADBforBeginnersKoprowskiT_SQLSat419_WADBforBeginners
KoprowskiT_SQLSat419_WADBforBeginners
 
Rapid SQL Datasheet - The Intelligent IDE for SQL Development
Rapid SQL Datasheet - The Intelligent IDE for SQL DevelopmentRapid SQL Datasheet - The Intelligent IDE for SQL Development
Rapid SQL Datasheet - The Intelligent IDE for SQL Development
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
 
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday SloveniaContinuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
Continuous Integration and the Data Warehouse - PASS SQL Saturday Slovenia
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
Chetan.Kumar-SQL_DBA 9115
Chetan.Kumar-SQL_DBA 9115Chetan.Kumar-SQL_DBA 9115
Chetan.Kumar-SQL_DBA 9115
 
Workshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databasesWorkshop: Delivering chnages for applications and databases
Workshop: Delivering chnages for applications and databases
 
Sql data base
Sql data baseSql data base
Sql data base
 
Database CI Demo Using Sql Server
Database CI  Demo Using Sql ServerDatabase CI  Demo Using Sql Server
Database CI Demo Using Sql Server
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Ow
OwOw
Ow
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

SQL in Version Control using SQL Server Database Projects

  • 1. Get Your SQL into Version Control USING MICROSOFT SQL SERVER DATABASE PROJECTS Floyd Hilton @fhilton
  • 2. Boston Code Camp 23 - Thanks to our Sponsors! Gold Bronze In-Kind Donations
  • 4. Why put SQL into Version Control? Lower Risk, Increased Quality •Keeps history •Documentation – Tie to issue tracker •Makes processes repeatable •Group changes (by feature) •Continuous Integration and Deployment •Portability
  • 5. Two Version Control Processes for SQL 1. Transformation 2. State
  • 6. Transformation Incremental changes to the database are saved and then can be run in order to gain the desired database state V0.0.1 0001 Database Create Script 0002 Add Table 0003 Add Procedure 0004 Add Lookup Data V0.0.2 State 1 State 2 Actual state is not saved, only how to get there
  • 7. Basic Transformation Process Custom Tool V0.1.0 SQL Management Studio
  • 9. State The full state of the database is stored for every version State is saved, and tools are used to transform a database from one state to another V0.0.2 Schema in source control V0.0.1 Schema in source control V0.0.1 Database Tool compares state ofcurrent database to state of schema in version control V0.0.2 Database Transformation Script or other Method Developers Make Changes V0.0.3 Schema in source control Developers Make Changes
  • 10. State Tools/Methods •Manual •Manually script schema objects and store in source control •Entity Framework Migrations •Redgate SQL Source Control •SQL Server Database Project
  • 11. Which to Choose? TRANSFORMATIONS When to use ◦ Starting from scratch ◦ Simple model used for a single system ◦ Small team ◦ When a state tool is not available STATE When to use ◦ Existing, complex data models ◦ Multiple, interconnected databases ◦ Databases that are used by many systems ◦ Large Team
  • 12. What is an SQL Database Project? It is a Visual Studio Project specifically for storing database schema and information. What is a Visual Studio Project? ◦ "Projects are used in a solution to logically manage, build, and debug the items that make up your application. The output of a project is usually an executable program (.exe), a dynamic- link library (.dll) file or a module, among others.“ ◦ For a Database Project, the output is a DACPAC (Data-Tier Application Package) What is a Solution? ◦ "Solutions contain items that you need in order to create your application. A solution includes one or more projects, plus files and metadata that help define the solution as a whole."
  • 13. Demonstration – SQL Database Project
  • 14. Resources Enrico Campidoglio ◦ NDC talk on Continuous Delivery for SQL ◦ http://www.ndcvideos.com/#/app/video/2531 ◦ Features DbUP (https://www.nuget.org/packages/dbup/) ◦ .NETROCKS discussion on Continuous Delivery for SQL ◦ http://www.dotnetrocks.com/default.aspx?showNum=1079 Deborah Kurata ◦ Pluralsight video – Visual Studio Data Tools for Developers ◦ http://www.pluralsight.com/courses/visual-studio-data-tools-developers

Editor's Notes

  1. Initial Questions Who works with applications that use a database Who works with applications that use an SQL Server databbase Who works with creating or updating databases? Who has their db code in version control? Who has used an SQL Database Project? Who has used SQL Server Database Tools in Visual Studio? Who has used other tools like Redgate for comparing schema etc?
  2. Initial Questions Who works with applications that use a database Who works with applications that use an SQL Server databbase Who works with creating or updating databases? Who has their db code in version control? Who has used an SQL Database Project? Who has used SQL Server Database Tools in Visual Studio? Who has used other tools like Redgate for comparing schema etc? Background: Version controls rcs, visual source safe, cvs, subversion, mercurial, git Client with sql database project
  3. Background: Version controls rcs, visual source safe, cvs, subversion, mercurial, git Client with sql database project
  4. Keeps History Ability to get back to a point in time for debugging Know what changed Repeating process