EntityFramework6.Npgsql
EntityFramework6.Npgsql copied to clipboard
EF Migration fails due to [3F000: schema "xxxx" does not exist]" (it's because of the case)
Trying to setup a brand new project from scratch (for R&D purposes) I always fall in the [3F000: schema "MySchema" does not exist].
this is my Context:
public class CinteraContext : DbContext
{
public CinteraContext()
: base("CinteraContext")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//Configure default schema
modelBuilder.HasDefaultSchema("MySchema");
}
public DbSet<Case> Cases { get; set; }
}
and this is the generated scripts:
CREATE SCHEMA IF NOT EXISTS MySchema
;
CREATE TABLE "MySchema"."Cases"("CaseId" serial4 NOT NULL,CONSTRAINT "PK_MySchema.Cases" PRIMARY KEY ("CaseId"))
;
Unfortunately it create the schema without the double quotes ["] and when it try to create the table prefixing it the schema name (this time using correctly the Double Quotes) it receive the error.
If I change from this:
modelBuilder.HasDefaultSchema("MySchema");
to this:
modelBuilder.HasDefaultSchema("lowercasename");
everything works fine.