Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to update a SSDT DB project from a database?

We have two software projects that both communicate with a single database. Right now SQL updates are all done on the database and it's relying on developers to make sure to update both sets of projects independently to use the latest database model. Making these matters worse both projects are in separate solutions in separate source control repositories.

While I acknowledge this is a terrible situation to be in, I inherited this situation, and while my long term goal is to consolidate and share the (lots) of duplicated logic between them in one common project shared among both sets of application for various reasons it is not feasible to jump right into that right now due to critical deadlines coming up and the need to combine them iteratively and schedule it with other developers to not disrupt work too much.

Keeping that in mind, I really want to use SSDT to at least start bringing the database structure under source control and make it easier to manage, as there are quite a few database changes that I'm about to do.

The problem with SSDT in this scenario is that you can only import from database once. After that the option is greyed out and unavailable, which is apparently a design decision of SSDT, since it's explicitly listed in the MSDN documentation.

Is there any easy way to update my SSDT project without nuking the current project and recreating it each time someone makes a change to the database structure?

like image 983
KallDrexx Avatar asked Jun 22 '15 20:06

KallDrexx


People also ask

What is used to update the database?

The Update Database operator is used for updating an existing table in the specified SQL database. You need to have at least basic understanding of databases and database connections in order to use this operator properly.


1 Answers

Firstly your right, it is a horrible situation so work on improving it in the long term!

There are two things you can do, firstly you could use SSMS "Generate Scripts" to export all the objects and then use the import in SSDT to import from the scripts - this isn't greyed out.

The second thing you can do is manually bring the changes in using the schema compare in SSDT, you can set the database as the source and project as the destination and choose what you drop, update and import.

Ed

like image 132
Ed Elliott Avatar answered Nov 04 '22 12:11

Ed Elliott