Obviously there may be a better way of doing this, but as this was surprisingly top Google account I thought it would be good to mention the idea i had after reading these answers:
Here's the issue i faced:
I was changing FK's generated by EF6 code first and came across the error:
Unable to determine the relationship represented by navigation property 'Account.SalaryIncomes' of type 'ICollection<Person>'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
I attempted many ways of defining the Mapping in the hopes of resolving this error, however i ended up dropping my Person table, and after removing the the relationship entirely in an attempt to start from scratch, the error was resolved. However when updating the database, it complained that "Person" did not exist - which lead me here.
After reviewing these answers, I decided I was too lazy to reload the data and thought that the migrations generated C# UP() and Down() methods - I thought, maybe i can reference another migration...
after extracting the up and down code into public methods in that migration, and referencing those from the new migration - the update worked and person was then created. Just to be safe - i wrapped the new calls in try catch... do my new UP method looks like this:
protected override void Up(MigrationBuilder migrationBuilder)
{
try
{
new AddPeople().CreatePersonTable(migrationBuilder);
}
catch { }
// Origional generated migration code
}
This answer comes with the caviat that I have not tested to see if this migration will be overridden next time (loosing the code) - however if the migrations are run in order, then pressingly you can in fact run this once, and then remove it after.
"Cannot find the object because it does not exist or you do not have permissions"
? – Chill