ralmsdeveloper / EntityFrameworkCore.FirebirdSQL

FirebirdSQL database provider for Entity Framework Core.
Other
44 stars 26 forks source link

Boolean Type is Mapped to BOOLEAN Data Type #11

Closed ganagus closed 6 years ago

ganagus commented 6 years ago

The issue

If I understand correctly from the online documentation, the data type for true/false in Firebird 2.5 is INTEGER or CHAR(1). When I use migration tool in Visual Studio 2017 using EntityFrameworkCore.FirebirdSql version 2.0.10, by executing Add-Migration command from Package Manager Console, the conversion of bool type is BOOLEAN data type. It should be INTEGER or CHAR(1).

Steps to reproduce

Error details

When I run the migration from a Console application, an exception was thrown:

Exception message:

Dynamic SQL Error
SQL error code = -607
Invalid command
Specified domain or source column BOOLEAN does not exist

Stack trace:

   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery() in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 478
   at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at EntityFrameworkCore.FirebirdSql.Storage.Internal.FirebirdRelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at ConsoleTest.Program.Main(String[] args) in C:\Users\User\source\repos\PenaBiz\src\ConsoleTest\Program.cs:line 38

Further technical details

Firebird version: Firebird-2.5.7.27050 EntityFrameworkCore.FirebirdSql version: 2.0.10

Other details about my project setup: n/a

ralmsdeveloper commented 6 years ago

Hello @ganagus, I'm checking this out, when it was built a lot of things happened in FB 3.0. I will make this compatible, thanks for the issue!

ralmsdeveloper commented 6 years ago

Could try with EntityFrameworkCore.FirebirdSql 2.0.11-preview1

fabriciogsantos commented 5 years ago

i'm having the same problem with version 7.0.0, could you help me?

EmailConfirmed = table.Column<bool>(type: "BOOLEAN",nullable: false), EmailConfirmed = table.Column<bool>(nullable: false),

Error details update-database -context ApplicationDbContext Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 2.2.6-servicing-10079 initialized 'ApplicationDbContext' using provider 'FirebirdSql.EntityFrameworkCore.Firebird' with options: None Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (64ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT COUNT(*) FROM rdb$relations WHERE COALESCE(rdb$system_flag, 0) = 0 AND rdb$view_blr IS NULL AND rdb$relation_name = _UTF8'__EFMigrationsHistory' Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (10ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT COUNT(*) FROM rdb$relations WHERE COALESCE(rdb$system_flag, 0) = 0 AND rdb$view_blr IS NULL AND rdb$relation_name = _UTF8'__EFMigrationsHistory' Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (123ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT "MigrationId", "ProductVersion" FROM "__EFMigrationsHistory" ORDER BY "MigrationId"; Applying migration '20190819181422_initial_identity_19082019'. Microsoft.EntityFrameworkCore.Migrations[20402] Applying migration '20190819181422_initial_identity_19082019'. Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (9ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetRoles" ( "Id" VARCHAR(110) NOT NULL, "Name" VARCHAR(110), "NormalizedName" VARCHAR(110), "ConcurrencyStamp" BLOB SUB_TYPE TEXT, CONSTRAINT "PK_AspNetRoles" PRIMARY KEY ("Id") ); Failed executing DbCommand (58ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUsers" ( "Id" VARCHAR(110) NOT NULL, "UserName" VARCHAR(110), "NormalizedUserName" VARCHAR(110), "Email" VARCHAR(110), "NormalizedEmail" VARCHAR(110), "EmailConfirmed" BOOLEAN NOT NULL, "PasswordHash" BLOB SUB_TYPE TEXT, "SecurityStamp" BLOB SUB_TYPE TEXT, "ConcurrencyStamp" BLOB SUB_TYPE TEXT, "PhoneNumber" BLOB SUB_TYPE TEXT, "PhoneNumberConfirmed" BOOLEAN NOT NULL, "TwoFactorEnabled" BOOLEAN NOT NULL, "LockoutEnd" VARCHAR(48), "LockoutEnabled" BOOLEAN NOT NULL, "AccessFailedCount" INTEGER NOT NULL, CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id") ); fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (58ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUsers" ( "Id" VARCHAR(110) NOT NULL, "UserName" VARCHAR(110), "NormalizedUserName" VARCHAR(110), "Email" VARCHAR(110), "NormalizedEmail" VARCHAR(110), "EmailConfirmed" BOOLEAN NOT NULL, "PasswordHash" BLOB SUB_TYPE TEXT, "SecurityStamp" BLOB SUB_TYPE TEXT, "ConcurrencyStamp" BLOB SUB_TYPE TEXT, "PhoneNumber" BLOB SUB_TYPE TEXT, "PhoneNumberConfirmed" BOOLEAN NOT NULL, "TwoFactorEnabled" BOOLEAN NOT NULL, "LockoutEnd" VARCHAR(48), "LockoutEnabled" BOOLEAN NOT NULL, "AccessFailedCount" INTEGER NOT NULL, CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id") ); FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Dynamic SQL Error SQL error code = -607 Invalid command Specified domain or source column BOOLEAN does not exist ---> Dynamic SQL Error SQL error code = -607 Invalid command Specified domain or source column BOOLEAN does not exist at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary2 parameterValues) FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Dynamic SQL Error SQL error code = -607 Invalid command Specified domain or source column BOOLEAN does not exist ---> Dynamic SQL Error SQL error code = -607 Invalid command Specified domain or source column BOOLEAN does not exist at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable1 migrationCommands, IRelationalConnection connection) 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.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) Dynamic SQL Error SQL error code = -607 Invalid command Specified domain or source column BOOLEAN does not exist`