Repository navigation
✨ feat: map a schema another tool created, with every driver at its latest - #15
Merged
Merged
Conversation
The accessor the source generator writes read members through one switch expression, and C# typed it by the arms' best common type. JsonNode converts implicitly from strings, numbers, booleans, dates and Guids, so an entity with a JsonNode member read every one of those members as a JsonValue, bound it as jsonb, and failed its insert (42804). Each arm is now boxed on its own. The generator is wired into every provider's test project, the way the shipped package wires it, and each relational suite round-trips an entity with a JsonNode member beside int, string, bool and DateTime members. Refs #14
…ngines A member can now say what a schema another tool created holds: - [Facet(Required = true)], or Required(...) on the relational builder: the migrations create the column NOT NULL, the drift check expects it so, and a migration that adds a required column to a table with rows is refused before anything runs unless the member declares the value those rows take, which then fills them. - [DateStorage(WithoutZone = true, Precision = n)], or DateStorage(...): the column holds the UTC wall time with no zone (PostgreSQL timestamp(n) without time zone, MySQL datetime(n), SQL Server datetime2(n)). It is carried as a column conversion, so inserts, staged and set-based updates, upserts, filters, inlined literals and materialisation all go through it: a value is written as UTC whatever the session's time zone (PostgreSQL binds it as timestamp), rounded half away from zero to the precision, and read back as UTC. A declaration that cannot apply is refused when the model is built, naming the member. The drift check now spells a time type with its precision inside its name the way PostgreSQL reports it (timestamp(3) without time zone came out as "timestamp without time zone(3)without time zone"), and reads the scale of SQL Server's datetime2, datetimeoffset and time, so a declared precision is compared. Refs #14
SqlClient sends a DateTime parameter as datetime unless told otherwise, and datetime keeps a three-hundredth of a second, so a datetime2 column the dialect created received .124 as .123. Every date the dialect stores is a datetime2, so a date now binds as one. Found by the round trip of a date declared at millisecond precision, which reads back what every other engine reads back. Refs #14
…DB, Cosmos DB and Cassandra [DateStorage] means on the document and wide-column engines what it means on the relational ones: a value is converted to UTC, rounded half away from zero to the declared precision before it is written, and read back as UTC, a DateTimeOffset with offset zero. MongoDB stores it as a BSON date through a member serializer (which its LINQ translation also uses for constants), Cosmos DB through a member converter in its ISO 8601 form, and Cassandra through its column conversion. MongoDB and Cassandra keep milliseconds, so a precision above 3 is refused when the model is built, and so is a date declaration on a member that is not a date or that a converter of its own also claims. MongoDB also gets the fluent DateStorage(...). None of the three has column nullability, so [Facet(Required = true)] changes nothing they store, and Explain() says the requirement is not enforced. Each engine round-trips an entity with a JsonNode member beside int, string, bool and DateTime members, and the dates of the shared scenario. Refs #14
EQD006 reported [Facet(Required = true)] as a facet that declares nothing, so every required member would have warned (an error where warnings are errors). A facet that declares only Required is now a facet. EQD015 reports a [DateStorage] on a member that is not a DateTime or DateTimeOffset, or with a precision outside 0 to 6, at compile time, as the model build does at run time. Refs #14
- MongoDB.Driver 3.10.0 to 3.14.0 - Microsoft.Azure.Cosmos 3.58.0 to 3.64.0 - CassandraCSharpDriver 3.22.0 to 3.23.0, which fixes CVE-2024-21907 (through Newtonsoft.Json) and CVE-2026-40894 (through OpenTelemetry.Api), and now closes a connection on a heartbeat timeout - Newtonsoft.Json 13.0.3 to 13.0.4 (Cassandra and Cosmos DB) The Microsoft.Extensions abstractions stay at the floor a library declares.
Npgsql 9.0.3 to 10.0.3, with what its breaking changes would have changed for a consumer of 7.0 absorbed in the engine: - Npgsql 10 reads `date` and `time` as DateOnly and TimeOnly through non-generic reads, which every relational read path uses. The engine's value conversion now gives a DateTime member the date at midnight with no kind and a TimeSpan member the time of day, as Npgsql 9 did, for entities, projections, group keys, read-backs and MIN/MAX alike (MIN/MAX converted on their own, and now go through the same conversion). A test round-trips a DateTime over a `date` column and a TimeSpan over a `time` column; it passes on Npgsql 9 and failed on Npgsql 10 before this change. The data source is left as it is, rather than forced onto LegacyDateAndTimeResolverFactory. - NpgsqlParameter.DataTypeName now wins over NpgsqlDbType. No parameter sets both: a JSON value sets DataTypeName, a zone-less date sets NpgsqlDbType. - PostgresException.BatchCommand is null by default. DuplicateKeyException names the constraint from ConstraintName, and nothing reads BatchCommand. - The cidr mapping, COPY timeouts, text import and export, and the NativeAOT slim builder's JSON types touch nothing core-data uses. Not absorbed, since they are connection settings and observability, not the engine's: Npgsql's metric names and span tags follow OpenTelemetry now, TLS with a Root Certificate no longer falls back to the system CA store, and a Linux host without Kerberos logs a libgssapi load error once.
Microsoft.Data.SqlClient 6.0.2 to 7.1.2, and Microsoft.Data.SqlClient.Extensions. Azure 7.1.2 beside it. SqlClient 7 moved Entra ID authentication (Authentication=Active Directory ...) into that package, so a connection string that signed in with Entra ID on core-data 7.0 would have failed at run time on a project referencing only this provider. Referencing the package is all the driver needs. A test resolves a provider for every Entra ID method; without the package five of its six cases fail. The package brings Azure.Identity, which needs the Microsoft.Extensions abstractions at 10.0.3, so the provider's own reference moves from 10.0.0 to that floor (10.0.0 would be a downgrade, NU1605). Checked and not absorbed: SqlAuthenticationMethod.ActiveDirectoryPassword is obsolete (core-data never names it, and no warning surfaces here), and 7.1 removed Type System Version=SQL Server 2000: a connection string that names it now fails to open with ArgumentException, a driver decision core-data cannot undo.
MySqlConnector 2.6.2 to 3.0.0. It needs the Microsoft.Extensions abstractions at 10.0.15, so the provider's own reference moves from 10.0.0 to that floor (10.0.0 would be a downgrade, NU1605). Checked against what core-data relies on: - 3.0 no longer reads VARBINARY(16) as a Guid under GuidFormat=Binary16. core-data stores a Guid as char(36), so nothing changes: every MySQL and MariaDB test keys rows by Guid, and a new test reads a char(36) key written by raw SQL back as its Guid. - The same test reads a DateTime over a DATE column and TimeSpans over TIME columns as they read on 7.0, written by raw SQL and through the repository, MAX included. - ChangeDatabase, TransactionScope XA isolation and the tables schema columns are nothing core-data uses. Not absorbed: 3.0 emits only OpenTelemetry's stable database conventions, so the experimental tags (db.statement, db.system, net.* and the rest) are gone.
… nullability The annotations guide gives both declarations their row in the matrix, what each engine stores, the EQD006 change and EQD015. The fluent guide shows Required(...) and DateStorage(...). Each provider guide names its stored form (PostgreSQL also how a date and a time read since Npgsql 10, SQL Server the datetime2 binding and the Entra ID package). The drift check's guide states its nullability rule, now that a required member is expected NOT NULL, and that a precision is compared, and the Explain guide shows the new lines. Refs #14
edgarmesquita
commented
Nov 15, 2026
edgarmesquita
left a comment
Contributor
Author
There was a problem hiding this comment.
Secondary review, round 1 (Antigravity), because Copilot can't be requested on this repository (GitHub accepts the request and drops it).
No findings. The review closes here.
|
🎉 This PR is included in version 7.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eQuantic Space maps its 89 Prisma tables with eQuantic.Core.Data (eQuantic/equantic-space#701). Generating a model per table and running the drift check and a round trip over all of them found two defects and two things a model could not say. This fixes them on every engine, and takes every driver to its latest release.
Change: core-existing-schema-fidelity
What it fixes
JsonNodemember wrote every member as JSON. The generated accessor's switch tookJsonNodeas its arms' common type, sinceJsonNodeconverts implicitly from strings, numbers, dates and Guids. Each arm now boxes on its own.timestamp(3) without time zoneastimestamp without time zone(3)without time zone.DateTimeasdatetime, which keeps a three-hundredth of a second, so adatetime2column the dialect created received.124as.123. A date now binds asdatetime2, the only type the dialect stores dates as.What it adds
[Facet(Required = true)]andRequired(...): PostgreSQL, MySQL/MariaDB and SQL Server create the columnNOT NULLand the drift check expects it so. A migration refuses to add one to a table without a default for the rows already there. MongoDB, Cosmos DB and Cassandra have no column nullability, andExplain()says so.[DateStorage(WithoutZone = true, Precision = n)]andDateStorage(...): the UTC wall time with no zone (timestamp(n) without time zone,datetime(n),datetime2(n)), written as UTC whatever the session's time zone and read back as UTC, in inserts, updates, upserts, filters and literals. Every engine rounds to the precision before writing, so all six read back the same value.[DateStorage]).From the spec: "The value stored SHALL NOT depend on the time zone of the store's session", and "A JSON member SHALL NOT change how any other member of the same entity is read, written or bound".
Drivers
Npgsql 10.0.3, Microsoft.Data.SqlClient 7.1.2, MySqlConnector 3.0.0, MongoDB.Driver 3.14.0, Microsoft.Azure.Cosmos 3.64.0, CassandraCSharpDriver 3.23.0 (which fixes CVE-2024-21907 and CVE-2026-40894 in its dependencies), Newtonsoft.Json 13.0.4. The breaks of the three new majors are absorbed here, each with a test:
dateandtimeasDateOnlyandTimeOnly, and aDateTimeorTimeSpanmember still materialises as it did.Authentication=Active Directory ...connection string keeps working.VARBINARY(16)reads as a Guid, and core-data keeps Guids aschar(36).What a consumer can still notice: the drivers' metric and tracing tag names changed, Npgsql no longer falls back to the system CA store when a root certificate is given, and SqlClient 7.1 dropped
Type System Version=SQL Server 2000. The SQL Server and MySQL providers raise theirMicrosoft.Extensions.DependencyInjection.Abstractionsfloor (10.0.3 and 10.0.15), which the drivers need.Every addition is new API and the release is a minor, 7.1.0. All suites pass locally on the final versions: core 294, analyzers 19, PostgreSQL 203, MySQL and MariaDB 178, SQL Server 100, MongoDB 255, Cosmos DB 156, Cassandra 201.
Closes #14