Migrations on SQLite run without four "cannot be executed in a transaction" warnings #21

Closed
opened 2026-10-31 12:41:51 -04:00 by claude · 0 comments
Owner
  • Draft: REL-13
  • Priority: low (harmless, but every fresh SQLite install and every Windows service event log shows them)
  • Agent: storage-coder
  • Depends on: none
  • Decisions: none

Why

The table-rebuild migrations emit PRAGMA foreign_keys = 0, which SQLite cannot run inside a
transaction, so EF Core logs four Warnings on a fresh install (RP-1 on Linux; RP-3w found the same
four as the first entries in the Windows Application log). They describe EF behaviour, not a
problem with the database.

What changes

src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Extension/DbContextOptionsBuilderExtension.cs:46-60
(UseNinlilDnsSqlite): log that one event id (the EF Core warning for a migration operation that
cannot run in a transaction; name the exact RelationalEventId member) at Debug, as
QuietCommandLogging (:184-187) does for CommandExecuted, with a comment saying why it is
safe (the migrator snapshots the file first, Storage:MigrationSafety).

Acceptance

  • A test in src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests (SQLite, no Docker) migrates
    a new file with a capturing logger and asserts no Warning from
    Microsoft.EntityFrameworkCore.Migrations (fails first with 4).
  • Other providers unchanged.

Source

release-prep.md:21 (RP-1 nits), release-prep.md:133 (RP-3w event log entries).

- **Draft:** REL-13 - **Priority:** low (harmless, but every fresh SQLite install and every Windows service event log shows them) - **Agent:** storage-coder - **Depends on:** none - **Decisions:** none ### Why The table-rebuild migrations emit `PRAGMA foreign_keys = 0`, which SQLite cannot run inside a transaction, so EF Core logs four Warnings on a fresh install (RP-1 on Linux; RP-3w found the same four as the first entries in the Windows Application log). They describe EF behaviour, not a problem with the database. ### What changes `src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Extension/DbContextOptionsBuilderExtension.cs:46-60` (`UseNinlilDnsSqlite`): log that one event id (the EF Core warning for a migration operation that cannot run in a transaction; name the exact `RelationalEventId` member) at Debug, as `QuietCommandLogging` (`:184-187`) does for `CommandExecuted`, with a comment saying why it is safe (the migrator snapshots the file first, `Storage:MigrationSafety`). ### Acceptance - [ ] A test in `src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` (SQLite, no Docker) migrates a new file with a capturing logger and asserts no Warning from `Microsoft.EntityFrameworkCore.Migrations` (fails first with 4). - [ ] Other providers unchanged. ### Source `release-prep.md:21` (RP-1 nits), `release-prep.md:133` (RP-3w event log entries).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#21
No description provided.