Black marble the strategic IT asset for your organisation DEVELOPMENT LIFE CYCLE USING VISUAL STUDIO...

Post on 26-Mar-2015

216 views 0 download

Tags:

transcript

blackmarble

the strategic IT asset for your organisation

DEVELOPMENT LIFE CYCLE USING VISUAL STUDIO TEAM EDITION FOR

DB PROFESSIONALS

Richard FennellEngineering Director

Leeds SQL Users Group 19th July 2008

blackmarble

Agenda

• Why do we need DB Pro.?• What is Visual Studio Team System• DB Pro. Features

– Project Life-cycle– Testing– Deployment– Power Tools

• The Future

blackmarble

Pain points in DB development

• What is the ‘correct DB schema’?• How do we version control it?• How do I know the impact of a change?• How do we publish a DB?• Where do we get test data from?• How do we test it anyway?

• There has been no standard way to manage the DB – until now

ExcelExcel

ProjectProject

Operations, QA Operations, QA and Help Deskand Help Desk Non-Microsoft Non-Microsoft

DeveloperDeveloper

Team System Team System Web AccessWeb Access

Visual Studio Team SystemApplication Life Cycle Management (ALM) Solution

blackmarble

Visual Studio for Database Professionals

• Was known as ‘DataDude’ in beta phase

• Came out in 2006, a year after the main VS 2005 release.

• New release VS 2008 is really more of a service pack than a major release.

blackmarble

DB Pro provides support for the fulldatabase lifecycle

blackmarble

DBPro Features

• Incorporates the Database Professional into the software development lifecycle

• Provides a foundation for change management and process integration

• Exposes database schema as individual script files

• Provides a set of essential tools– Version Control via Visual Studio supported providers– Rename Refactoring– Schema Comparison Tools– Data Comparison Tools

blackmarble

DBPro Features

• Database Unit Testing– Leverages the existing Test Project

Infrastructure – Supports data generation

• Build and Deployment– MSBuild and Team Build integration

blackmarble

Power Tools

• Power Tools add additional features that didn’t make the product release cycle– Dependency Viewer – New Refactorings– Data Generation Wizard– MSBuild Tasks – T-SQL Static Code Analysis – Schema Manager API

blackmarble

Team Foundation Server Integration

• As a member of the Visual Studio Team System family, DBPro is integrated with all of the team features

• TFS provides– Team project with prescriptive guidance– Version control management– Work Item tracking– Team Build integration

Writes Tests

Writes DB Code

Refactors

Runs Tests

Checks In

Works with other developers to integrate

Reviews Changes

Compares Updates to Production

Builds Deploy Package

Deploys to Production

Creates New DB Project

Reverse Engineers DB to Project

Creates Data Generation Plan

DB DeveloperDB Administrator

Manage Develop Deploy

Roles in a DB Project

DB Administrator

Creating the DB Project

DatabaseDatabaseProjectProject Import schemaImport schema

Check in to

Check in to

Source

Source

Control

Control

ProductionProductionDatabaseDatabase

StagingStagingDatabaseDatabase

Create a ProjectCreate a Project

DBADBA

DBProDBPro

TFSTFSServerServer

DBProDBPro

TFSTFSServerServer

DBADBA

Isolated Iterative Development• Sync Sync • Check-outCheck-out• Edit/RefactorEdit/Refactor• TestTest• Check-inCheck-in• Work is being drivenWork is being driven

and tracked viaand tracked viawork itemswork items

• Other team members can Other team members can pick up changespick up changes

TFS Shelving TFS Shelving allows DBAallows DBAto provide guidanceto provide guidanceand evaluate workand evaluate work

ProductionDatabase

StagingDatabase

SandboxDatabase

SandboxDatabase

SandboxDatabase

DBProDBPro

TFSTFSServerServer

Automated Build & Testing

Build ServerBuild Server

Test Test

DBADBA

ProductionDatabase

StagingDatabase

Get LatestGet Latest

TestTestEnvironmentEnvironment

Reports

Deploy the Project

DatabaseDatabaseProjectProject

Sync from

S

ync from

Label Label

SQLSQLDeploy Deploy ScriptScriptBuildBuild

DeployDeploy

Refine deploy Refine deploy scriptscript

VerifyVerify

DBProDBPro

TFSTFSServerServer

DBADBA

ProductionDatabase

StagingDatabase

PublishPublish

blackmarble

the strategic IT asset for your organisation

demodemo

DB Life CycleDB Life Cycle

blackmarble

So what DBs did I end up with?

Live DB VS Dev DB Local Test DB

Live production DB

You may also have a

test or staging DB

DB Created by Visual Studio

Used by IDE for design time validation

Developers Test DB

Used for sandbox testing

(might be shared)

blackmarble

Data Generation

• Shipped with the product– Data-bound, Regular Expression, Random Number

• Available as a Power Tool– File-bound and a Wizard tools to ease the process

• Codeplex – DbProGenerators– Lorem Ipsum, soon XML bound, Word bound and

web search bound

• Plus what you write yourself.....

blackmarble

the strategic IT asset for your organisation

demodemo

Data GenerationData Generation

blackmarble

Testing in DB Pro

• Firstly remember that can test any CLR code before loading it into SQL Server

• DBPro adds database tests that can be used to test any stored procedure, function, trigger or DB object

• A single test project can contain a variety of test types

• Can be used to auto generate test stubs

blackmarble

Is DB Testing Valid?

• You have to ask how useful it is to test at the raw data layer?

• Usually more effective to test the DB via the data access layer or as part of integration testing

blackmarble

MSBuild

• All the key DB tasks can be scripted

• Database operations can become part of a scheduled build

• However this can all get a bit complex and DBPro MSBuild tasks are a bit idiosyncratic.

• Check the web for examples

blackmarble

The Future

• VSTS 2008 Database Edition GDR June CTP– Architectural changes

• No longer requires a local SQL Server instance • Providers are not restricted to relational database

– Project System• Database & Server project separation• Partial projects

– Build & Deploy• Separation of the build and deployment process

– Refactoring• Implementation of a feature named "Preservation of

Intent"

blackmarble

Summary

• Visual Studio Team Edition for Database Professionals make SQL development part of the project mainstream.

• Team System coupled with integrated version control helps to mitigate risks associated with DB schema change

• Build integration provides for quality tracking and improvement

• Process reduces last minute problems and the need to rollback changes out of production

blackmarble

Good VSTS Blogs

• Brian Harry (Product Unit Manager for Team Foundation Server )– http://blogs.msdn.com/bharry

• Rob Caron (Lead Product Manager for Developer Content Strategy at Microsoft)– http://blogs.msdn.com/robcaron

• Gert Drapers (Architect/Development Manager Visual Studio Team Edition for DB Professionals )–  http://blogs.msdn.com/gertd

blackmarble

For Further Information

• My random thoughts ‘But it works on my PC!’ http://blogs.blackmarble.co.uk/blogs/rfennell

• You can also get in touch via: Email – richard@blackmarble.co.uk

WebSite – www.blackmarble.co.uk