2. Agenda
● Challenges with Database Deployment
● How are these problems are being addressed
● Solution: Continuous Integration for Database Projects
● Q&A
3. Challenges with Database Deployments
Database Lifecycle Management is Hard
Too Many Details
● Need to preserve data puts focus on ALTER scripts
● Dependencies make even simple tasks complex
● Promoting databases across environments
Lack of Error Prevention
● Errors detected too late
● Drift has to be accommodated
Keeping in Sync
● Versioning your database as your application evolves
● Developing for different target platforms
● Migrating databases to the cloud
● Creating one package for multiple deployments
4. Possible Solutions
Project-based Development will solve
- Keeping DB Schema under version control
- Identifying errors early
Automated Change Script Generation
- Dependencies
- Environment specific publish profiles
5. • Protect existing org database assets using Source Control integrated with
TFS and Application lifecycle management process
• Developer Self-Service build and deploy of physical DB schemas to the
Dev environment
• Transition DB “change script” generation from Developer to Deployment
Engineer / Release Manager
• Enable developers with a DB schema comparison tool
• Enable automated build validation test for database changes
• Enable developer to get early notification e.g. Dependency
• Get ready to support continuous integration for database change
deployment
Demo Objectives
6. ● Adoption of Visual Studio Sql Server Database Projects may require a mental shift
for some developers or at least a change in process or workflows.
● Developers who have developed database applications where the production
database represents the current version of the database will need to adopt a source
code based approach where source code becomes the vehicle to which change is
made to databases
● In Visual Studio SQL Server Database Projects, the project and the source code is
the "One Version of the Truth" for the database schema and is managed using SCM
workflows likely already being used by the developer or organization for other
portions of their application stack. For the data, the production database remains its
"One Version of the Truth" as it should be.
Adoption of Sql Server Database Projects
7. SQL Server Data Tools
6/14/2011
Database is a project that builds into
DACPAC
Code can be tested locally (F5)
Syntax and semantic
validation
during compilation
LocalDB
T-SQL DOM
T-SQL Compiler
Connectivity
DAC FXVisual Studio
8. Connected Development
SSOX
● SQL Server Object Explorer (SSOX)
● Modeled after SSMS object explorer
Modern Experience
● Modern T-SQL Coding Experience
● Buffered Declarative Object Editing
● Model based with error detection
● Imperative Script Execution
● T-SQL Intelligence
Modern Design
● Code-behind Table Designer
● View/Edit/Script Data (incl. copy/paste)
● Execute/Debug T-SQL Procedures, Functions
Buffered
Declarative
Editing
Graphical
Table
Designer
9. Project-based Development
Visual Studio IDE
● Database definition managed in VS project
● Database artifacts using same/similar gestures as application code.
● Multi-target to SQL Server {2005-2014} or SQL Azure
Advancements
● Language Services for T-SQL
● Go To Definition/Find All References/Refactoring
● F5 debugging with LocalDB
Tightly Integrated
● Visualize schema differences and migrate changes
● Publish direct to database or via SQL script or DACPAC
● Point-in-time Snapshot
● Drag & Drop import from SQL Server Object Explorer
10. Application Lifecycle & Tools
Text/Icon/P
ic
MSBuild Tasks
● Build
● Publish
● T-SQL Static Code Analysis
● Database Unit Tests
MSBuild Utilities
● Redist SSDTBuildUtiities.msi
● DB projects in build server
○ environment
● No need to install full copy of VS
Standard Integration
● SSDT integrates with all standard VS SCCS providers
● DACFX v3
● Schema compare
● Publish
11. Target Version Aware
● SQL Server 2005
● SQL Server 2008
● SQL Server 2008 R2
● SQL Server 2012
● SQL Server 2014
● SQL Server 2106
● SQL Server Azure
Publish
● Direct
● via SQL script
● DACPAC snapshots
Publishing your Database Changes
15. Import Existing DB Schema
Tightly Integrated into VS IDE
SQL Database project type
Create New or Import Existing Schema from:
- .dacpac
- Existing database
- .sql script