Repository navigation
Add the data provider packages, dialects and system migrations - #2737
Merged
Merged
Conversation
This was referenced Nov 2, 2026
Closed
4 tasks done
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.
Closes #2689
Adds the provider seam and the three data provider packages, so that core has one code path and provider-specific SQL stays out of it.
FluentCMS.CoregetsIJsonSqlDialect,IJobClaimDialect,IDataProvider,SystemDbContextand a minimalAddFluentCmswithFluentCmsBuilder.FluentCMS.Data.Sqliteis complete and tested.FluentCMS.Data.PostgreSqlandFluentCMS.Data.SqlServerhave their wiring, conventions, dialects and first system migration, are marked experimental in their package description, and have never run on a database; #2711 validates and completes them.Dependencies:
Npgsql.EntityFrameworkCore.PostgreSQL10.0.3 andMicrosoft.EntityFrameworkCore.SqlServer10.0.14 (new).System.Security.Cryptography.Pkcs10.0.14 (new), a direct reference in the SQL Server package, becauseMicrosoft.Data.SqlClientotherwise brings 9.0.11, which has known vulnerabilities (GHSA-2fmv-rv2c-59x7, GHSA-846f-f764-76mx) that fail the restore.Microsoft.EntityFrameworkCore.Design10.0.14 (already inDirectory.Packages.props) is added to the provider projects as a private asset, so it is not in their packages.Acceptance
Under the scope change on the issue, the items that name all three providers apply to SQLite until #2711.
FluentCMS.Data.Testsruns the same test suite against all three providers in CI. SQLite only. PostgreSQL and SQL Server have offline tests (column types, GIN index, pending model changes, SQL text), with no CI matrix.FCMS13xxerror.FCMS1302, thrown byAddFluentCms.Verification
On Windows, after merging
main:dotnet build -c Release -warnaserror,dotnet test -c Release(916 tests, 915 passed, 1 existing skip),dotnet pack -c Release, anddotnet ef migrations has-pending-model-changesfor each provider.What later issues must do
cms_site,cms_role,cms_joband more): map it inSystemModelBuilderand add a migration to all three provider packages, as docs/system-migrations.md describes. The tests fail if a provider's snapshot falls behind.IDataProvider.MigrateOnStartupis the default to act on.SystemDbContextis registered with its migrations assembly andcms__migrations.FCMS1301stays free, and this PR takesFCMS1302andFCMS1303.CmsDbContextdoes not yet mark system tablesExcludeFromMigrations.IJsonSqlDialectwithEF.Property<string>(row, column)and values read from a holder;JsonScalar.TypeOf(fieldType)gives the comparison.tests/FluentCMS.Data.Tests/Sqlite/RowFilter.csshows the shape. The dialect does not restrict block filters toblocksfields, so the compiler must:json_extracton a block that is a bare string throws on SQLite.cms_jobwith the columns of spec 4.12 and callIJobClaimDialect.ClaimAsync. It relies on the status values inJobClaimStatus.AddFluentCmsreads aSchemaModelfrom the container, with an empty one as the default, until the builder can add content types.Interpretations beyond the specification
pendingandrunning; orderpriority DESC, run_at, id; a claim setsrunning, takes the lease and adds one toattempts;attempts < max_attemptsis required; and an expired lease is claimable, which goes beyond the spec'sWHERE lease_until IS NULL, so that a job returns after its worker dies.UPDATE ... RETURNING. With a rollback journal,RETURNINGcommits on a step thatMicrosoft.Data.Sqlitedoes not retry, and concurrent claimers gotdatabase is locked. The tests run both journal modes.cms_jobmust be written through EF.REAL. A decimal past double precision can compare equal to a neighbouring value; PostgreSQL and SQL Server compare exactly.TRY_CONVERT(bigint, ...)does not match a JSON12.0, while SQLite and PostgreSQL do. Only a value not written by the integer field type looks like that.ScalarEqualscompares only a value of its own type,ScalarContainsmatches only JSON text, andArrayContainsmatches only text elements of an array, so that results do not depend on how a provider renders another type. On SQLite this adds ajson_typeguard, becausejson_extractgives 1 fortrueand an array or object as its JSON text. ADR 0001's SQL has no such guard.@>for equality rather than a function comparison, because it keeps the JSON type, does not throw on an unexpected shape and is what a GIN index serves.Latin1_General_100_BIN2, to match the case-sensitive providers, and usesOPENJSONrather thanJSON_VALUE, which loses the JSON type.jsonis opt-in throughUseSqlServer(connectionString, nativeJson: true). The generated migration usesnvarchar(max), so a host choosing native JSON has no matching migration until Validate and complete the PostgreSQL and SQL Server providers #2711 decides how to handle it.AddFluentCms, before the host is built, rather than at host start. A second provider fails withFCMS1303.dotnet-efis a global tool in the documented steps; no tool manifest is added.