Presentation is loading. Please wait.

Presentation is loading. Please wait.

Others Talk, We Listen. Managing Database Projects in Visual Studio 2013.

Similar presentations


Presentation on theme: "Others Talk, We Listen. Managing Database Projects in Visual Studio 2013."— Presentation transcript:

1 Others Talk, We Listen. Managing Database Projects in Visual Studio 2013

2 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 2 MCSE and PMP certified IT Consultant with CapTech since 2006 and have 13 years of Microsoft SQL Server experience https://www.captechconsulting.com/blogs/a-review-of-visual-studio-2013-database- projects Computer Science degree from the University of Richmond Masters degree in IT Management from the University of Virginia Founded my own MLB Data Analytics Company About Me – csnapp@captechconsulting.com

3 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 3 Visual Studio’s previous Database Project hasn’t been a sustainable way to create, manage, source control, schema compare, and deploy database objects. What Problems Do We Face Managing DB Schemas? First we model, develop and test in SQL Server Management Studio (SSMS) Then, we go to VS or another source control tool and retroactively make changes to reflect our work Finally, we script our changes and loop in DBAs and Release Managers

4 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 4 Project managed in Visual Studio, similar to.NET All objects are stored as scripts with folder structure Pre/Post Deployment scripts allow for data management Better Solution? Build to a local or dev server. 1-Click Publish to other targets with custom settings Latest enhancements are Azure focused Source Control actually works!!

5 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 5 Visual Studio Professional 2013 Requires linking to an MSDN license SQL Server Object Explorer replaces a lot of SSMS SQL Server Data Tools Much of what was BIDS Make sure you have the latest version of SSDT by going to the Visual Studio SQL menu and selecting Check for Updates Data-Tier Application Framework (DACFX) DLL by VS and SSMS, installer independent of SSDT Software

6 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 6 3 ways to begin Using a SQL Server Data-tier Application extract file (*.dacpac) Connecting directly to a SQL Server database Using one or multiple script files with all the object definitions Each file is a.sql file Recommend storing by schema/object type Always as a Create (no Alter/Drop) Table designer and script editor are familiar to Management Studio Also includes full T-SQL DDL And there’s real time errors and Intellisense! Project Setup

7 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 7 Import existing DB to project Add new table (dbo.Team) Add new view (lkup.vPitcherOrder) Add new column Rating to table Umpire Add new index to AtBat Add missing FK between Action and Game Demo

8 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 8 Project has a SQL Server target version Set if not 2014 Build & Debug use the Target Connection for data work Add references to other databases (master) Allows for use of sys.objects and other things useful in dynamic SQL Snapshots allow for platform specific validations, comparisons and deployments Project Properties and Snapshots

9 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 9 Can compare Project to Database or vice versa. Update directly from GUI, but only left to right. Great for previewing changes or synching without full deployment Handles Add/Change/Deletes to objects, not data Able to save comparison settings for later use Uncheck “Block incremental deployment if data loss might occur Schema Comparison

10 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 10 No more collecting scripts across environments!! Permitted one Pre and one Post deployment script These can execute other scripts stored in the project Recommend using MERGE statements Right click on the project and select Publish Interface has connection and many settings options Able to preview the script first Able to save and reuse publishing settings in XML Can also do via schema compare or DACPAC Deployments

11 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 11 Integrates with TFS, SourceTree/GIT Automatically detects check outs Easy to commit and sync changes Versioning in the tool is seamless Publish xmls can be saved here too Key to always perform a debug before commit to ensure all changes are valid in the project. Source Control

12 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 12 Add new script to populate Team table Add new Post Deployment process (not in build) Schema Compare, Build Deploy to remote server Demo

13 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 13 A DACPAC with data included Equivalent of a database backup and cannot be used to upgrade existing databases. Purpose is to move a database from one server to another, or the cloud, and archiving an existing database in an open format. BACPAC Portable artifact that can be deployed/applied to a database instance. Purpose is to deploy a tightly defined schema to DEV/QA/PROD Also, apture PROD schema and applying it to back to QA/DEV. Can also be extracted from an instance DACPAC Logical database management entity that defines all of the SQL Server objects DB must be registered as part of the process Encompasses tables, view, logins etc DAC Data-tier Applications (DAC vs DACPAC vs BACPAC)

14 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 14 Different ways to deploy a DACPAC: Visual Studio SQL Server Management Studio SqlPackage Windows PowerShell DacFx API DACPAC Continued

15 15 Thank You Sponsors

16 Copyright © 2015 CapTech Ventures, Inc. All rights reserved. 16 What did you think?

17 Others Talk, We Listen. Questions?


Download ppt "Others Talk, We Listen. Managing Database Projects in Visual Studio 2013."

Similar presentations


Ads by Google