Presentation is loading. Please wait.

Presentation is loading. Please wait.

Brian Keller Technical Evangelist

Similar presentations


Presentation on theme: "Brian Keller Technical Evangelist"— Presentation transcript:

1 Brian Keller Technical Evangelist Brian.Keller@Microsoft.com

2 What is Visual Studio Team System? The Database Development Lifecycle Getting Started: Establishing the Project Navigating the Project and Working with Source Control Working with the Schema: Editing and Refactoring PowerTools for Team Edition for Database Professionals The Deployment Story: Build and Deploy Schema Validation: Data Generation and Unit Testing Session Objectives And Agenda

3 Visual Studio Team System Visual Studio Productivity Productivity Powerful Powerful Ease of use Ease of use World-class IDE World-class IDE Broad reach Broad reach Developer

4 Architect Project Manager Tester Designer Visual Studio Team System Expand to development team Business results from IT Team productivity and collaboration Integrated quality Developer

5 Business Analyst PMO Operations CIO Application Support Architect Project Manager Tester Designer Visual Studio Team System Developer

6 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

7 Customer Testimonials “Visual Studio Team Edition for Database Professionals gives us a truly revolutionary way to do database development, start to finish. Visual Studio Team Edition for Database Professionals helped us avoid several days of downtime. That meant we could keep customers supplied and revenues coming in.” – Jeff Lynch, Gulf Coast Seal

8 Customer Testimonials “For us, it’s usually a yearlong development cycle. Using Team Edition for Database Professionals and applying MSF life-cycle principles, we’ve essentially cut that time in half. Using Team Edition for Database Professionals, database programmers are better connected to their teammates’ actions and are able to propagate changes seamlessly through the code.” – Ted Malone, Configuresoft

9 Incorporate the Database Professional into the software lifecycle and provide them with a foundation for change management and process integration. 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 –MSBuild Integration for Database Deployments/Builds based on Projects –Either Create a new Database at the target location or Update an Existing Schema

10 Conceptual Overview Difficult to manage change to the 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 Changes often made to production database and not rolled back into test Production Database Management Studio TuningMonitoring “One Version of the Truth” for the Truth” for Data and Schema Schema Schema Changes

11 Conceptual Overview Schema Change now managed in Visual Studio Team System and Visual Studio Team Foundation Server 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 “One version of the truth” for Schema is under source control Production Database Management Studio TuningMonitoring “One Version of the Truth” of the Truth” for Data “One Version of the Truth” for Schema OfflineOffline Under Source ControlUnder Source Control Schema Schema Changes Changes can be rolled out in a scheduled, managed way Scripts allow administrators to mange change updates

12 Test Database Production Database Create table AUCTION ( id int not null, title varchar(25) not null, startDate DateTime not null, length in not null) Offline Development

13 Database Development Life Cycle The cycle of life for database developers DatabaseProject Import database schema Reverse engineer existing.SQL script files Create New Project SQLScript DatabaseProjectTemplate SQL Server Database Deploy SQL Script SQL Server Database Build project Deployproject

14 Project Model The database project represents the “truth” with regards to schema versioning Optionally database project can be placed under source control.SQL script file is the canonical format used Changes are tracked at the “object level” –For example indexes, constraints, triggers are tracked independent of the base table definition, in order to have the highest granularity of change tracking The center of gravity

15 DatabaseProject Import schema DBA Check in to Source Control DBDev Production Database Staging Database SCM Establish the Project Environment

16 Isolated Iterative Development DBA DBDev Production Database Staging Database Sand box SyncCheck-outEdit/RefactorTestCheck-in Work is being driven and tracked via work items SCM Sand box

17 Build Cycle DBA DBDev Production Database Staging Database SCM Daily Build Test Get Latest Test Database Daily Build Output Can also be used in a “Continuous” build environment

18 Conceptual Overview DBA Production Database Staging Database SCM DBDev DatabaseProject Sync from Label SQL Deploy Script Build Deploy Refine deploy script Verify

19 DEMO

20 File Naming and Extension Scheme Everything is a.SQL file –Associated with the T-SQL editor Using a two-part naming scheme to identify types –This is not required, but helps identification of types By default the file name encodes the object name –Not required Filename does not have to match the containing type name Required since SQL Server namespace restrictions do not match the file system naming restrictions

21 Two-Part File Extension Relying on the two-part file extension –Providing visual feedback (icon) –Associating with code-behind designers in the future Enforcing the single object per file –Allows: create table t1 ( c1 int not null check (c1 > 1) ) –Not allowed: create table schema.t1 ( c1 int not null ) alter table t1 add constraint c1_chk check (c1 > 1)

22 File Extensions….aggregate.sql.approle.sql.assembly.sql.chkconst.sql.contract.sql.ddltrigger.sql.defconst.sql.eventnotification.sql.filegroup.sql.fkey.sql.fulltext.sql.fulltextindex.sql.function.sql.index.sql.messagetype.sql.partitionfunction.sql.partitionscheme.sql.pkey.sql.proc.sql.queue.sql.remoteservicebinding.sql.role.sql.route.sql.schema.sql.service.sql.statistic.sql.synonym.sql.table.sql.trigger.sql.uddt.sql.udtclr.sql.ukey.sql.user.sql.view.sql.xmlIndex.sql.xmlschema.sql

23 DEMO

24 Source Code Control Integration… SSCI provider-based –Supporting all Visual Studio-based source control providers –Visual Studio Team Foundation Server, Visual SourceSafe, etc. Standard Visual Studio UI support through Solution Explorer Default Visual Studio mode of operation is to automatically check out file that are touched –Can be turned off via Tools  Options  Source Control  Environment Scripts are by default stored as Unicode scripts

25 Source Code Control Integration Think through the physical project structure you want to use ahead of time –This means before you check in the initial version of the project 2 directory structure flavors: –By file type –By schema by file type Optionally you can encode the schema in to the file name But we do allow you to use a completely random or arbitrary organization

26 “A database refactoring is a small change to your database schema which improves its design without changing its semantics.” –Agile Database Development, Scott Ambler For example: –Rename a Schema Object Name for consistency, understandability, maintainability… –Objective: Rename ALL schema object references; direct and indirect inside all: Tables, views, stored procedures, user defined functions, … What is refactoring?

27 Rename any SQL Server 2000 and SQL Server 2005 schema objects Updates all references in… –Schema Objects –Data Generation Plans –Scripts –Database Unit Tests Preview changes prior to commit Global undo to reverse all changes Rename refactoring…

28 DEMO

29 Build and Deploy Sandbox Target Database SQL Deployment Script Production Target Database DatabaseProject MSBuild

30 MSBuild Tasks Build, deploy, and data generation all implemented as MSBuild tasks MSBuild enables: –Command line usage –Programmatic access –Chaining and composition of tasks –Team Build integration

31 Two Types of Deployments Full Deployment –Creates entire Database Schema at Target location –Occurs by default when the defined Target does not exist. –Can be forced through the “Always Recreate Database” Build option Incremental Deployment –Only deploys the difference between the Target and the Project –Make sure “Always Recreate Database” is off –Incremental Deployment Scripts validate: Server version Database name Database compatibility level … If validation fails, deployment is aborted

32 DEMO

33 Data Generation Target Database Data Generators SQL Deploy Script Build Deploy DatabaseProject Unit Testing Project(s)

34 Setting up Data Generation implies defining: –Which generator to use –Which distribution to attach to the generator –Changing setting on the generator and distribution –The numbers of rows to generate –Optionally defining the rowcount ratios between tables By default: –Each column is bound to the generator matching the column data type FK columns are mapped to the Foreign Key generator Uniqueness is inferred from PK, UC constraints and indexes Using the Uniform distribution when not unique Design time

35 Value generators –Simple generators for each data type Strings: ASCII and Unicode ((var)char, n(var)char, (n)text) Numbers: tinyint, smallint, int, bigint, real, float, decimal, numeric, money Binary ((var)binary, image) Date and Time UniqueIdentifier (GUID) Bit –Complex generators Foreign Key, Regular Expression, Data Bound –Distributions Uniform, Normal, Inverse Normal, Exponential, Inverse Exponential Design time

36 Validation of: –Security requirements Fails when security requirements are not met! –Target schema against DGEN definitions Fails the generation when bindings do not match! Optionally purge tables –Required to guarantee repeatable data generation Spin up parallel streams of INSERT statements –Based on relationships between tables –Number of connections used is currently gated by the schema relationships Configurable Error Thresholds Executing a Data Generation Plan

37 Customization and extensibility Customization of value generation –RegEx Generator –Data Bound Generator Extensibility –Custom Generator –Custom Distribution

38 DEMO

39 Ensures that database changes do not break existing code Generate automated tests for programmability objects Develop a battery of tests to run with every database build Design and customize your tests in the language of your choice –T-SQL, Visual Basic.NET/C# Builds on existing Team Test unit testing functionality Integrate your database tests along side your application unit tests Overview

40 Develop your database unit test through an easy-to-use database test designer Test Script Generation –Automatically generate test script stub for: Stored Procedures, Functions, Triggers Test Script –SQL to exercise the object under test Pre/Post Test Scripts –SQL executed prior to and after test script to set up and clean up test Test Initialize/Cleanup Scripts –Common SQL executed prior to and after every test Designer experience

41 Two primary methods of validating database unit tests –T-SQL Assertions RAISERROR –Test Conditions Easily configured UI-based client side assertions Supported types –Empty ResultSet –Not Empty ResultSet –Row Count –Scalar Value –Execution Time –Inconclusive Test validation

42 Automatic Deployment Integration –Automatically deploy database project prior to running tests Data Generation Integration –Automatically generate data based on generation plan prior to running tests Execution and Validation connections –Validation connection can be higher privileged account Test execution

43 Customization –Database Unit Test designer generates C# or Visual Basic.NET code –Can customize generated code for: Custom test validation logic Parameterized test support Managing transactions Additional test setup and teardown of tests Extensibility –Custom Client Side Test Assertions Customization and extensibility

44 DEMO

45 Service Release 1 Available for Download 3 Major Features: –3 & 4 part names Through “Database References” Reduces number of warnings –Filegroup Support –SQLCmd $Variable Support Adds support for SQL Server 2005 SP2 and Windows Vista Requires Visual Studio 2005 SP1

46 Power Tools: Continuous Innovation Refactoring improvements: –Move Schema Refactoring –Disambiguate Schema Refactoring –Wild Card Expansion Refactoring –sp_rename & move schema deployment script generation MSBuild task improvements: –Schema Compare Build Task –Data Compare Build Task –SQL Script Pre-Processor Task Expands variables and include files –SQL Extended Property Build Task Used for getting and setting object level versioning information

47 Power Tools: Continuous Innovation Data Generator improvements: –Data Generation Editors for Regular Expression String and Data Bound Generators –Stream based Data Bound Generator –Regular Expression Generator for Check Constraints New functionality –Dependency Tree Viewer –API Access to Schema View –T-SQL Static Code Analysis –Graphical Show Plan

48 DEMO

49 Resources Technical Communities, Webcasts, Blogs, Chats & User Groups http://www.microsoft.com/communities/default.mspx Channel 9 Videos and Screencasts http://channel9.msdn.com/tags/vsts Product Website http://msdn.microsoft.com/vstudio/teamsystem/products/dbpro/default.aspx Microsoft Learning and Certification http://www.microsoft.com/learning/default.mspx Microsoft Solutions Framework http://www.microsoft.com/msf Product MSDN Forums http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=725&SiteID=1 http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=725&SiteID=1 Blogs http://blogs.msdn.com/gertd http:// blogs.msdn.com/duncand

50 © 2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Brian Keller Technical Evangelist"

Similar presentations


Ads by Google