ErikEJ / SqlCeToolbox

SQLite & SQL Server Compact Toolbox extension for Visual Studio, SSMS (and stand alone)
Other
838 stars 175 forks source link

SQL columns all created as TEXT #985

Closed glittle closed 2 weeks ago

glittle commented 3 weeks ago

I have code-first db structure in .net core 8.

When running with "dotnet run" it uses a local Sqlite db and creates it with seed data.

When running with a different launch profile, in program.cs it does not use Sqlite but uses SQL Server and applies migrations. That was failing with this issue, so I used the Compact Toolbox, selected the SQLite db file and chose "Migrate to SQL Server". It seemed to work, but the SQL tables have type TEXT or BIGINT for all columns. The columns should be uniqueidentifer, bit, varchar, etc. The "Migrations" file generated by the tool specifies TEXT like this:

OrgGuid = table.Column<Guid>(type: "TEXT", nullable: false)

What am I missing? Do I need to annotate every single column in C#?

Steps to reproduce

n/a

Further technical details

Version 4.8.776.0 - more than 1,100,000 downloads

SQL Server Compact 4.0 in GAC - Yes - 4.0.8482.1 SQL Server Compact 4.0 DbProvider - Yes SQL Server Compact 4.0 Simple DDEX provider - Yes

SQL Server Compact 3.5 in GAC - No SQL Server Compact 3.5 DbProvider - No Sync Framework 2.1 SqlCe 3.5 provider - No

SQLite Engine in use - 3.40.0 SQLite ADO.NET provider loaded - 1.0.117.0 SQLite EF6 DbProvider in GAC - No System.Data.SQLite DDEX provider - No SQLite Simple DDEX provider - Yes

Database engine: SQlite and SQL Server

Visual Studio or SSMS version: VS 2022

ErikEJ commented 3 weeks ago

First, this tool has nothing to do with EF Core.

Sqlite has a very limited type system, and that is reflected in the migration, which simply inspects the actual types in the database.

Keep in mind that migration means move in the context of this tool.