I have a database project in Visual Studio Team Services Git, and want to deploy into database on actual server.
(a) Is there setting in publish profile, to drop all objects and recreate?
(b) or is there a setting to create the whole DDL script, rather than just finding schema comparison discrepancy? Want to conduct this from Visual Studio, I know SSMS has option to Generate Scripts for all objects.
Want to conduct for all tables, sprocs, views, not just simple example below. Plan to redeploy and repopulate data warehouse everyday.
Example, say this in Source control database project.
Source Control:
create procedure dbo.SelectTestOne
as
select 1
And actual server on localdb is
Local Server Discrepancy:
create procedure dbo.SelectTestOne
as
select 2
Predeployment Script:
If I create a Script.PreDeployment, which drops all objects,
drop procedure dbo.SelectTest
This Final Automatic publish profile Script, will still do an alter, instead of recreate. So question is how do I drop all objects and recreate them? (I know Redgate has this option)
drop procedure dbo.SelectTest
GO
GO
PRINT N'Altering [dbo].[SelectTest]...';
GO
ALTER procedure dbo.SelectTest
as
select 1
GO
PRINT N'Update complete.';
GO
Note: I do not want to utilize Always-Recreate database, just want to drop all objects Tables, Sprocs, Views in database. I don't want to lose our data or reconfigure logins. Database Project to Drop Database before deploy?
This is for automatic deployment process for devops, we just want to redeploy and populate in same database everyday 2 am after hours.