0

I'm working on a project that started with code first without using the migrations.

Over time the project was growing and with each new information required, they were manually entered into the code and an update script for the database.

As there are many clients and each one with a different need, not all databases have been updated with these scripts.

I inserted the migrations in the project in order to improve this update process.

However I have a problem with the old bases, every time the project runs and it does not find a column it ends unexpectedly.

I do not want to be checking all databases manually and running scripts, because there are more than one thousand databases.

Is there a way to optimize this process in migrations itself? Identify columns that do not exist and create them dynamically

  • You are probably more likely to get a good answer if you can condense your question; it's a bit long and I'm guessing that the code for most of these classes isn't really relevant to the problem you're trying to solve (although I could be wrong). – levininja Apr 18 '18 at 17:52
  • 1
    The error you are currently experiencing is a duplicate of [this question](https://stackoverflow.com/questions/2575907/cannot-open-database-test-requested-by-the-login-the-login-failed-login-fail). If you resolve that error but still have a question, I would amend this question, or close it and ask a new question. – levininja Apr 18 '18 at 17:55
  • OK, 2 different questions. At the top is a question about getting databases up to date, at the bottom is a common connection string issue (see @levininja link). Syncing old databases with __MigrationHistory will be problematic. You could probably script out your migrations and then on a case by case basic comment out any objects that already exist. – Steve Greene Apr 18 '18 at 18:38
  • I updated the description, I'm sorry if it was kind of dark, I hope it's clear now :D – K. Oliveira Apr 19 '18 at 18:51

0 Answers0