I have a similar problem with Oracle 12c and EF6: I cannot get automatic migrations to work. However, I found the following partial success factors: - I needed to establish
modelBuilder.HasDefaultSchema("")
in my DbContext, to get the runtime, see the tables in the specific user's login scheme. For the update database, you had to set the MyHistoryContext parameters as follows:
public class MyHistoryContext : HistoryContext { public MyHistoryContext(DbConnection dbConnection, string defaultSchema) : base(dbConnection, defaultSchema) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.HasDefaultSchema("L2SRVRIZ"); } }
NOTE. You need to hard code the schema name there. Thus, the update database does not try to use dbo as a schema (but automatic migrations are not possible, they will drop your MigrationHistory table and ruin everything). This, in my opinion, is a nasty bug inside EF6 or the regular Oracle class. Since I do not have a service contract with them, I cannot apply for a ticket.
In your case, I think it cannot be developed in any way to avoid an error message with automatic transitions. For some reason, EF6 thinks that if you use your own schema name, you are actually moving the __MigrationHistory table from the default dbo schema, which of course is incorrect.
Or did you find a solution to this?
BR Florian
flohack
source share