Managing the Database Lifecycle using Team Edition for Database Professionals Randy Pagels Developer Technology Specialist Microsoft Corporation
Agenda What is Visual Studio Team System? What is Visual Studio Team System? Key themes of “Data Dude” Key themes of “Data Dude” Living in the “Sandbox” Living in the “Sandbox” Database Project Types Database Project Types Data Generation Data Generation Unit Testing Unit Testing Refactoring Refactoring Build & Deploy Build & Deploy Schema & Data Compare Schema & Data Compare Process Guidance Process Guidance Setup Requirements Setup Requirements Q&A Q&A
What we heard from customers “why did we build it…” Managing Database Change is hard… Managing Database Change is hard… changes to the schema throughout the development process and after deployment changes to the schema throughout the development process and after deployment Managing Database State is hard… Managing Database State is hard… What’s the state for the Dev, Test, or Prod environments What’s the state for the Dev, Test, or Prod environments It’s hard to track changes to the database It’s hard to track changes to the database Managing Database Testing is hard… Managing Database Testing is hard… It’s hard to consistently establish the state of the database It’s hard to consistently establish the state of the database I can’t use my live production data I can’t use my live production data Disconnect between development and database teams Disconnect between development and database teams Developers may make poor database design decisions Developers may make poor database design decisions Needs to be more integrated Needs to be more integrated
Business Analyst PMO Operations CIO Application Support Architect Project Manager Tester Designer Visual Studio Team System Developer
Visual Studio Team System Business Analyst PMO Operations CIO Application Support Architect Project Manager Tester Designer Developer DB Pro Team Edition for Database Professionals Expand to database teams Manage Database Change Extend Team productivity and collaboration Integrated quality
Conceptual Overview Difficult to Manage Change to the schema Difficult to Manage Change to the schema Production Database is one version of the truth for Data and Schema Production Database is one version of the truth for Data and Schema DBA doesn’t have access to changes until he/she has deploy or reject choice DBA doesn’t have access to changes until he/she has deploy or reject choice Changes often made to production database and not rolled back into test Changes often made to production database and not rolled back into test Production Database Management StudioTuningMonitoring “One Version of the Truth” for Data and Schema Schema Schema Changes
Conceptual Overview Production Database Management StudioTuningMonitoring “One Version of the Truth” for Data “One Version of the Truth” for Schema Offline Under Source Control Schema Schema Changes Changes can be rolled out in a scheduled, managed way Scripts allow administrators to mange change updates Schema Change now managed in VSTS and TFS Schema Change now managed in VSTS and TFS Production Database is now “One version of the truth” only for Data Production Database is now “One version of the truth” only for Data DBA doesn’t have access to changes until he/she has deploy or reject choice DBA doesn’t have access to changes until he/she has deploy or reject choice “One Version of the truth for Schema” is Under Source Control “One Version of the truth for Schema” is Under Source Control
Visual Studio Team System Visual Studio Team Suite MSF Process and Guidance Visual Studio Team Foundation Server Visual Studio Industry Partners Software Architects Software Developers Software Testers Database Professionals Visual Studio Team Explorer Application Modeling Infrastructure and Deployment Modeling Code Analysis Performance Tuning Security Analysis Data Generation Database Projects Unit Testing Performance Testing Manual Testing Test Case Management Visual Studio Professional Edition Change Management Work Item Tracking Reporting Project Site Integration Services Project Management Load Test Agent Visio and UML Modeling Class Modeling Unit Testing Code Coverage Data/Schema Compare Build/Deploy Rename/Refactor New!
Key Themes Manage Database Schema Change Manage Database Schema Change Enable Version Control for Database schema Mitigate Risk of those changes Mitigate Risk of those changes Leverage the “Sandbox” Establish the Database Development Lifecycle ( DDLC ) Establish the Database Development Lifecycle ( DDLC ) Support iterative development Incorporate the DDLC into the Software Development Lifecycle ( SDLC ) Incorporate the DDLC into the Software Development Lifecycle ( SDLC ) Holistic Application
Test Database Production Database Create table AUCTION ( id int not null, title varchar(25) not null, startDate DateTime not null, length in not null) Import database schema to populate project from existing database Import database schema to populate project from existing database Changes to schema traditionally have immediate affect Changes to schema traditionally have immediate affect With off-line project nothing changes until you deploy the change With off-line project nothing changes until you deploy the change Off-line Development
Creating a Project Represents the off-line database You are NOT connected to a live database! Simply a series of files collected together into a single logical collection The files represent the truth of your schema Connects to SCCI providers for versioning such as Team Foundation Server The database project is a first class project along with the other VS project types ( C# / VB.NET / C++, etc. )
The Project System & Import Database Schema Creating the “Sandbox”
Test Data To create a solid foundation for testing we support data generation Deterministic – always generate the same layout Matched to your schema and very customizable Extensible mechanism, build your own generators & distributions Bottom Line: Realistic values with representative distributions
Establish a Representative Staging Area Fill the “Sandbox”
Database Unit Testing Unit Testing helps ensure that changes do not break existing code Unit Testing helps ensure that changes do not break existing code Unit test designer is SQL focused Unit test designer is SQL focused Work in the language of your choice: TSQL, VB.NET, C# Builds on existing Team Test Unit Test functionality Builds on existing Team Test Unit Test functionality Integrate your database tests along side your application unit tests Integrate your database tests along side your application unit tests We can test the following: We can test the following: Generate test stubs for these types Stored Procedures, Functions, Triggers Arbitrary SQL
Database Unit Testing Playing in the “Sandbox”
Refactoring Bring power of refactoring to SQL Bring power of refactoring to SQL Cascading Change Update all dependent objects in database project Update all dependent objects in database project Schema objects, Data generation, Unit Tests, SQL Scripts Preview all changes Make an atomic change Global Undo Rename Rename Meet corporate standards Better express semantic intent – clarity
Database Refactoring Leveraging the “Sandbox”
MSBuild Tasks Build, deploy and data generation all implemented as MSBuild tasks Build, deploy and data generation all implemented as MSBuild tasks MSBuild enables: MSBuild enables: Command line usage Programmatic access Chaining and composition of tasks Team Build integration TeamBuild on a Build Server TeamBuild on a Build Server It is a requirement to have VSDBPro installed on the Team Build Server
Safely Deploying & Managing Updates “Sandbox” the Next Stage
Incorporate the Database Professional into the software lifecycle and provide them with a foundation for change management and process integration. Change Management Change Management Project Based Development Project Model that represents schema as objects providing a “personal sandbox” for offline development that lives within a Visual Studio Solution Team Collaboration with Work Item and Process Integration with Team Foundation Server Automated Change Support Rename Refactoring with the ability to preview pending changes prior to execution Comparison Tools (Schema & Data Compare) allow comparisons & synchronization of schema and data with design/test/production databases Source/Version Control of all database objects with the ability to reverse engineer a database to bring it under Source Control Database Unit Testing Leverages the Test Project Infrastructure Generate “Real and Meaningful” Data Values through the ability to import information such as Row Counts and histograms from a real database Data Generator provides Repetitive Dataset Generation for tests based on saved settings Build / Deployment Build / Deployment MSBuild Integration for Database Deployments/Builds based on Projects Either Create a new Database at the target location or Update an Existing Schema
Wrap Up Managed, project oriented evolution of database schema – no more rollbacks Application and database schema can now be managed together Work in “isolation”, deploying only when changes verified Leverage VSTS work item tracking and process guidance Further Questions: Randy Pagels:
Related Content Blogs Blogs White papers White papers What Microsoft Visual Studio 2005 Team Edition for Database Professionals Can Do for You What Microsoft Visual Studio 2005 Team Edition for Database Professionals Can Do for You What Microsoft Visual Studio 2005 Team Edition for Database Professionals Can Do for You A Security Overview of Microsoft Visual Studio 2005 Team Edition for Database Professionals A Security Overview of Microsoft Visual Studio 2005 Team Edition for Database Professionals A Security Overview of Microsoft Visual Studio 2005 Team Edition for Database Professionals Samples Samples MSDN Forum MSDN Forum MSDN Forum MSDN Forum
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
MSF Process Guidance
MSF Integration Extends existing MSF process guidance for database development for both: Extends existing MSF process guidance for database development for both: MSF Agile MSF AgileAgile MSF CMMI MSF CMMICMMI Adds 2 roles: Adds 2 roles: Database Administrator Database Administrator Database Developer Database Developer Adds 3 new work streams: Adds 3 new work streams: Create a Database Project Create a Database Project Implement a Database Development Task Implement a Database Development Task Deploy a Database Project Deploy a Database Project Delivered as MSF content update through the web Delivered as MSF content update through the web
Setup Requirements Visual Studio 2005 Team Edition for Database Professionals Visual Studio 2005 Team Edition for Database Professionals Add-on to Visual Studio 2005 Team Suite Add-on to Visual Studio 2005 Team Suite Own SKU on top of Visual Studio 2005 Professional Own SKU on top of Visual Studio 2005 Professional Need to have C# or VB.NET installed for Unit Testing Need to have C# or VB.NET installed for Unit Testing Need a local SQL Server 2005 instance for background compile time validation Need a local SQL Server 2005 instance for background compile time validation