Devart.Data.PostgreSql.Entity.EFCore can not create EFCore migration history table in custom schema
Posted: Thu 10 Oct 2019 14:06
I'm using the package Devart.Data.PostgreSql.Entity.EFCore, version 7.14.1470.0, and I'm facing an error when I try to set a custom schema to the migration history table.
Here is some code:
If I try to initiate a database with the command Update-Database, the following error is thrown:
Here is some code:
Code: Select all
var builder = new DbContextOptionsBuilder<ContactContext>();
builder.UsePostgreSql(
"Data Source=localhost;User Id=postgres;Password=admin;Database=Contacts;Unicode=true",
b => b.MigrationsHistoryTable(HistoryRepository.DefaultTableName, "SomeSchema"));
Code: Select all
Failed executing DbCommand (9ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
-- Script
CREATE SCHEMA IF NOT EXISTS "TestSchema";
CREATE TABLE "TestSchema"."__EFMigrationsHistory" (
"MigrationId" varchar(150) NOT NULL,
"ProductVersion" varchar(32) NOT NULL,
PRIMARY KEY ("MigrationId")
)
Devart.Data.PostgreSql.PgSqlException (0x80004005): cannot insert multiple commands into a prepared statement
at .(Boolean , Boolean , Char , Boolean )
at . ( )
at .()
at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteNonQuery()
at .ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
cannot insert multiple commands into a prepared statement