-
Notifications
You must be signed in to change notification settings - Fork 257
Closed
Closed
Copy link
Description
Technical details
Npgsql.EntityFrameworkCore.PostgreSQL 2.2.4
Microsoft.EntityFrameworkCore 2.2.6
Postgresql 12.1
netcoreapp2.2 + fsharp
Steps to reproduce
DbContext configuration :
type Bai (options: DbContextOptions<Bai>) =
inherit DbContext(options)
static do
NpgsqlConnection.GlobalTypeMapper.MapEnum<AccountState>() |> ignore
let configurePostgres (modelBuilder: ModelBuilder) =
modelBuilder
.ForNpgsqlUseIdentityByDefaultColumns()
.WithSnakeCaseNamingConvention()
let configureEnums (modelBuilder: ModelBuilder) =
modelBuilder.ForNpgsqlHasEnum<AccountState>(schema = DefaultSchema)
let configureEntities (modelBuilder: ModelBuilder) =
modelBuilder
.HasDefaultSchema(DefaultSchema)
.ApplyConfigurationsFromAssembly(typeof<Bai>.Assembly)
override __.OnModelCreating modelBuilder =
modelBuilder
|> configureEnums
|> configureEntities
|> configurePostgres
|> ignoreTrying to update the database :
dotnet ef database update ...
Generated scripts :
...
CREATE TYPE sch_bai.account_state AS ENUM ('unknown', 'ok', 'requested');
...
CREATE TABLE sch_bai.accounts (
id uuid NOT NULL,
...
state account_state NOT NULL,
...
CONSTRAINT pk_accounts PRIMARY KEY (id)
);The issue
Exception : Npgsql.PostgresException (0x80004005): 42704: type "account_state" does not exist
The schema is missing for
state account_state NOT NULL
and must rather be
state sch_bai.account_state NOT NULL.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels