VS 2010 Database Project deployment is not deploying indexes - visual-studio-2010

I have a database project in Visual Studio 2010 that deploys tables and stored procedures to the server without issue. However, none of the index scripts get included in the sql output script and therefore are not getting applied.
I have been unable to find anything that addresses this issue. I don't know what I'm missing. The index scripts' "Build Action" properties are set to "Build" and I don't see anything in the .sqldeployment or .sqlsettings files regarding index deployment specifically.

I discovered the issue. When anyone on my team did a schema compare to their local databases, VS would block comment the index scripts because those indexes don't exist locally. Once I discovered this and uncommented the scripts, the indexes were once again included in the deployment.

Related

Oracle Developer Tools (ODT) with Visual Studio 2019

I'm using Visual Studio 2019, 16.11.9, with Oracle Developer Tools for Visual Studio, 19.3.2.0.
I can do a schema compare with my local database, but there are a number of issues I have noticed which I can't have following through to deployment in test or production. I just wondered if I am doing something wrong or if these issues are limitation of the extension.
Using schema compare generated change scripts only ever drop and rebuild an existing table, never alter it. This obviously deletes all the data in the table too. How do I change this?
Whenever I do a database clean build I have to run the schema compare, or build script, multiple times as the tool doesn't order the build based on dependencies. Surely this is my setup as otherwise this is a HUGE oversight!
Any help welcome.

External References to SQL tables in Visual Studio

I'm trying to create a solution that includes a database project linked to an Azure database. The project requires setting up an elastic query to a separate table in a different Azure Database. This all exists already in Azure. I have imported the database using the visual studio wizard. It's imported the external table definition and the external data source, but not the masterkey or the scoped credential. I fully understand why as it's a security risk. However, I now can't publish my changes to the stored procedures etc as the external data sources have syntax errors where the scoped credentials are not defined. I've tried adding the masterkey and scoped credentials to my database project but the same syntax I used in the SQL management studio is not working in Visual Studio.
So my question is... how am I supposed to manage the external tables in my azure database in visual studio? I should mention that I am using VS2015. Is this functionality that is not working yet or am I missing something?
Thanks in advance for any help you guys can give.
Although SSDT gives a syntax error, can you verify that you can still build the project? The syntax error seems to be a intelliSense parser problem which shouldn't block build or deployment. Please let me know if it works.
Disclaimer: I work on the SSDT/DacFx team.

How to save a SQL Server Maintenance Plan within a Visual Studio Database Project

Having created a SQL Server maintenance plan in a SQL Server 2008 R2 instance, how can I import the definitions into a Visual Studio 2013 SSDT database project?
I don't mind using pre- and post-deployment scripts if that helps but I want it to be in a database project and to be able to build the project in VS and then to be able to deploy either a new instance of the plan, or to be able to synchronize an existing plan instance with the definitions in the database project. Also, drop and re-create is entirely acceptable.
Does anyone else already know how to do that ?
First of all maintenance plans are not supported by SSDT.
You can export it manually as an xml template file and then try to write some sql/batch post deploy scripts to deploy it.
You can find general instruction here (read comments also): https://robertbigec.wordpress.com/2013/10/03/automating-deployment-of-sql-server-maintenance-plans/
One note: The exported xml template contains some specific values such as server name or path to backup/log file locations. You might want to write custom script to get these values from target machine and replace it in the xml file.

Visual Studio 2013 SSDT Project Configurations

How using SSDT can I set up different database configurations for the different configurations specified in my solution (e.g. DEBUG, RELEASE etc)?
In the VS2010 database project I used to be able to set up different connection strings, SQL command variables and deployment configurations dependant on which configuration I had selected. I was then able to right click on my solution and click "Deploy" which would deploy all of the databases in my solution to their target actual database services.
This was very useful during development when in DEBUG configuration I would tend to set the options to...
Deploy to localhost\instancename
Drop the current database(s) and re-create
.. and then in release mode I could create an upgrade script to run on a test database before go live.
As I have multiple databases in my project the ability to deploy all of them in one go was very useful, however these options seem to have been replaced in SSDT with a publish option where I don't seem to get settings per configuration mode or the ability to deploy everything at once. Additionally, there seems to be no way to specify SQL command variables per configuration.
Has anyone else experienced this and found a solution or work around?
Thanks.
An workaround would be to create different publish profiles - from Publish window, after configuring the target database etc., "Save Profile As" [database name].debug.publish.xml, [database name].test.publish.xml...
If you want to deploy all databases at once, use a batch script to deploy.
Let's say, for the test environment the command for each database would be:
"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe" /Action:Publish /SourceFile<path>\<database name>.dacpac /Profile<path>\<database name>.test.publish.xml

Visual Studio 2008 Database project Deployment Baseline

I have a question about creating a deployment script using a database project in Visual studio 2008.
In a more traditional project we would create a deployment script that would create the DB and the initial objects for the first deployment. This would become the baseline.
Any additional objects would be scripted as ALTER statements. Each statement would check for the existence of the object, giving a re runnable database deployment script.
I want to be able to do the same thing with the database project, but it currently analyses the database and creates a script to take it from its current state to where the project specifies it should be. This is fine for local deployment, but I cannot use this to deploy to production, as they require a re runnable script that will not loose any data in the live system.
My first idea was to have a copy of the database that matches live, and then point the project to it to generate the statements for the deployment, but it does not seem very maintainable.
Does anyone have any idea about how achieve this?
Thanks
This is done by the Schema Compare option of the Database Edition of Visual Studio.
I Think you could find useful this link:
How to: Compare Database Schemas

Resources