1

Context:

Starting from a sample existing database, like AdventureWorks. You create your application A. Building it using EF on the existing database. Selecting the table you need and defining your new one Table1, Table2.

You've Enabled the migration, Created the new migration, an Updated your database so it matches your definition.

Question:

Can you create a project B using some of the database tables and publish its migration on the same database?
Do you need a new __MigrationHistory Table (On a different shema for exemple)?
Or does they cohabitate in the same table (Using different ContextKey)?

Clarification:

Project A and Project B tables doesn't overlap. Doesn't share or modify the model of each other.enter image description here

Community
  • 1
  • 1
xdtTransform
  • 1,986
  • 14
  • 34
  • Proof reading my question, I had the feeling that "Context" part was an excercise. It's not this is a real question, this feeling comes from me trying to be clear and direct. This question is not about sharing data in 2 context and handleing the modification on one in the other. It's only about Enable migration add migration, update database in an other project on the same database without destroying something. – xdtTransform Apr 01 '19 at 14:39
  • If its the same database, you can't have separate migrations. Have you considered creating a shared project just for the database? – Sentry Apr 01 '19 at 15:16
  • https://stackoverflow.com/questions/21537558/multiple-db-contexts-in-the-same-db-and-application-in-ef-6-and-code-first-migra – Steve Greene Apr 01 '19 at 20:56

0 Answers0