Compare And Update SQL Server Database Project With ...
文章推薦指數: 80 %
In this article, you will learn how to create a SQL Server Database project using Visual Studio 2019 and how to compare and update the SQL ... CompareAndUpdateSQLServerDatabaseProjectWithVisualStudio HabibUlRehman UpdateddateAug26,2020 65.9k 0 9 Inthisarticle,youwilllearnhowtocreateaSQLServerDatabaseprojectusingVisualStudio2019andhowtocompareandupdatetheSQLServerDatabaseProjectfromtheremoteSQLServerDatabaseandviceversa. facebook twitter linkedIn Reddit WhatsApp Email Bookmark Print OtherArtcile Expand Introduction Whenweareworkingonanyproject,adatabaseplaysanimportantrole,andaftersometimewhenthenumberoftables,views,andstoreproceduresincreases,itbecomestoodifficulttomanagethedatabasechanges.It'sverydifficulttoupdateproductiondatabaseprojects. Andevenafterthatwhenwemanagethedatabase,thenwestillneedtocomparewhichscriptwehaveworkedonandwhichareremainingonanyparticulardatabase.Therearemanygoodtoolsavailableinthemarketforcomparingdatabasesbutmostofthemarepaid. So,inthisarticle,we’regoingtolearnabouthowtowecanmanageourdatabasescriptsusingVisualStudio’sSQLServerDatabaseProject. Wecancreateanewdatabaseprojectandcomparefromanexistingdatabase,a.sqlscriptfileoraData-tierapplication(.dacpac).Wecantheninvokethesamevisualdesignertools(Transact-SQLEditor,TableDesigner)availableforconnecteddatabasedevelopmenttomakechangestotheofflinedatabaseproject,andpublishthechangesbacktotheproductiondatabase.Thechangescanalsobesavedasascripttobepublishedlater.UsingtheProjectPropertiespanel,wecanchangethetargetplatformtodifferentversionsofSQLServer(includingSQLAzure). Prerequisite VS2015orVS2017orVS2019shouldbeinstalledinyourmachine. GettingStarted OpenVisualStudioandcreateanewprojectfromtheMenu,SelectFile>New>Project. SelecttheSQLServerDatabaseProjectfromthelist. EntertheProjectnameandclickoncreatebutton. Aftertheprojectiscreated,wecanseethedatabaseprojectintheSolutionExplorer. Right-clickonSchemaCompareDemoprojectandthenclickonSchemaCompareoptionfromthecontextmenu. ThenclickonSelectTargettoselectthedatabase. Thenclickontheselectconnection. Selectyourdatabaseorenternewdatabasecredentials.Selectdatabasenamefromthedrop-downandclickonconnect. AfterthedatabaseselectionclickontheswitchbuttontoswitchsourcewithtargetbecausewewanttoupdateourlocalDBprojectfromaremotedatabase. StartschemacomparisonbyclickingontheComparebutton. Thecomparisonviewwillbeshownaftersometime.YoucanselectthechangewhichyouwanttomakeintoyourlocalSQLServerDatabaseProject.AfterselectionclickontheUpdatebutton. Aftertheschemaupdateiscompleted,openyourSolutionExplorer.AsyoucanseethatyourSQLServerDatabaseProjecthasbeenupdatedfromtheremotedatabase. Allthetables,storedprocedures,viewsandetc.havebeenupdatedfromtheremotedatabase. Wedon'tneedtowriteanymigrationscriptlikeweusedtodoforDBmigration. Andafterthis,whenevertherearechangesinthetablesortheproceduresjustmakethechangestotheSQLServerProjectDatabaseinthesolution,compareandupdateyourchangestothetargetdatabase.VisualStudiowillupdatethetargetdatabaseaccordingly. So,managingourdatabasenowbecomeseasierusingSQLServerDatabaseProjectandnowthereisnoneedtoworryaboutproductiondbupdates. SQLServerSQLServerDatabaseProjectVisualStudio NextRecommendedReading SmartMinds WeProvideWeb,DesktopandMobileAppsSolution FEATUREDARTICLES ViewAll TRENDINGUP 01ConsumingRESTAPIsInGolang02CreateRESTAPIWithGinFrameworkAndGolang03VisualStudioForGitHubRepository04TypeCheckinginC#05CI/CDPipelineUsingJenkinsAndGitHubFor.NETCoreWebApplication06AngularCRUDUsing.NetCoreWebAPI07PythonVariables08PropsInReactJS😝097MinutestoBetterSellingPodcastEp.29-Part210IntroductiontotheBlazorFramework-BlazorFrameworkLearningSeries-Ep.1 ViewAll LearnSSRSIn11Hours Challengeyourself ReactSkillChallenge GetCertified JavaDeveloper
延伸文章資訊
- 1Update Database From Model Wizard - Overview
This article is relevant to entity models that utilize the deprecated Visual Studio integration o...
- 2EF Core 工具參考(套件管理員主控台) - Microsoft Learn
Entity Framework Core Visual Studio 套件管理員主控台的參考指南. ... Script-DbContext; Script-Migration; Update...
- 3EF Core tools reference (Package Manager Console)
Reference guide for the Entity Framework Core Visual Studio Package Manager ... Script-Migration;...
- 4update the database from package manager console in code ...
I'm trying to update the database from package Manager console.If my Domain class change, I have ...
- 5(Day 13) Model和資料庫間的一致(目前版本的Entity Framework ...
Update-Database:可以指定Migration快照檔為參數,也可不指定任何參數。 ... 現在到Visual Studio來實作Migration,我們到[工具]-->[NuGet套...