Comments (6)
Thank you, this is a lot clearer. I have one follow-up question.
How does Dapper handle System.Data.Sqlite given the original PRs comments about type affinity? It seems like the short-term fix is to support both System.Data.Sqlite and Microsoft.Data.SQLite: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/compare#data-types
If I understand this correctly, I think part of the problem may be that your particular SQLite db has a type affinity to an arbitrary type that doesnt really exist? So, if you created your db with Microsoft.Data.SQLite driver, and you used non-standard type names, and now want to talk to it with System.Data.Sqlite, is that a problem? Just trying to fully grasp the problem before I provide a fix, which should be pretty easy once I understand the exact root cause.
from fluentmigrator.
We've always used System.Data.Sqlite. The older version of FluentMigrator just seemed to create the columns with the arbitery types (in our case UNIQUEIDENTIFIER and DATETIME). I think System.Data.Sqlite automatically maps these arbitery types to corresponding .NET types. Haven't used any special connection string when creating the sqlite databases so this was just mostly OOTB functionality. I do not think this has anything to do with dapper directly.
The workaround was pretty simple instead of AsGuid() I used AsCustom("UNIQUEIDENTIFIER") to revert back to the pre 5.0 functionality and that made the db look the same as previously.
I can provide a minimal repro tomorrow if it makes it clearer
from fluentmigrator.
What does SELECT typeof(Id) FROM YourTable
say the type is, assuming Id is the Guid Id
parameter column name?
The reason I am asking is its not listed as a type in the example type affinity table, so I am not sure how SQLite "knows" what affinity to bind it to https://www.sqlite.org/datatype3.html
It looks like, from https://www.sqlite.org/stricttables.html , the behavior in #1581 may want to take into consideration whether the table is in STRICT
mode. - That would be a bit tricky to support cleanly, as it requires knowing if the Table is in strict mode. We could probably allow users to configure it at a database-level through dependency injection - similar to how Entity Framework 6 used to require all DateTime to be either DateTime or DateTime2 and you could not mix and match across columns.
from fluentmigrator.
What does SELECT typeof(Id) FROM YourTable say the type is, assuming Id is the Guid Id parameter column name?
The type is Blob, seems like you are correct in your assumptions, also checked with a sqlite browser and the Guid is stored in binary format.
This is what the SQLite reader has defined for the columns:
After some debugging i found this under System.Data.Sqlite SQLiteConverters
Here is the full list of the System.Data.Sqlite type mappings:
https://github.com/haf/System.Data.SQLite/blob/8d2e5027723654e97d2ad208b9a076da496eee79/System.Data.SQLite/SQLiteConvert.cs#L1644
The github mirror to the System.Data.SQLite scm is old but the code still looks similar but there might be some changes to that list.
There seems to be multiple connection string flags under SQLiteConnectionFlags that modify this default behaviour for System.Data.Sqlite
from fluentmigrator.
Is there a way to customize SQLite column mapping without recompiling Fluentmigrator?
from fluentmigrator.
No, we have #1063 as a backlog item. I'm actually pretty close to making that a feature. I'm working on stuff right now in my local to make progress on idempotent migrations first.
from fluentmigrator.
Related Issues (20)
- Get rid of Microsoft.NETCore.App 2.1 dependency on dotnet-fm HOT 5
- Why FluentMigrator v5.1.0 is not visible on nuget.org? HOT 1
- Breaking changes in migration runner between 3.3.2 and 5.0.0 HOT 3
- fluentmigrator is missing NuGet package README file
- Sqlite AutoIncrement with other primary keys broken in 5.x HOT 9
- Publish option PublishSingleFile=true breaks fluent migrator rollout HOT 2
- Create index with include columns dont work HOT 12
- Obtain database type in fluent syntax HOT 6
- Table rename in custom schema HOT 3
- Can no longer create primary key on SQLite with FluentMigrator 5 HOT 2
- Update dependabot.yaml to support grouped updates HOT 5
- Tests failing on M1 Mac due to newline character comparison
- Remove obsolete property GenericGenerator.compatabilityMode HOT 1
- Still no migrations found using the fm tool. HOT 1
- How to determine the current runner default schema from within a migration? HOT 11
- GitHub AzureDevOps Pipeline Branch Filters no longer triggering CI builds
- SQLite FluentMigrator InSchema Error HOT 6
- Remove Obsolete ApplicationContext
- How to get rid of "Description:" in every column description? HOT 3
- Can no longer create foreign key on SQLite with FluentMigrator.Runner 5.2.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluentmigrator.