Part of the EF Core migration generation epic — tracking issue #371.
Weasel does not currently model computed/generated columns for PostgreSQL or SQL Server — GeneratedAlwaysAsStored / GeneratedAsIdentity are commented out in Weasel.Postgresql/Tables/TableColumn.cs. SQLite already supports GeneratedAs(...), so this is parity work. This is also a documented gap in the EF Core schema-comparison harness (EFCORE_IMPROVEMENTS.md), since EF Core can express computed columns via HasComputedColumnSql.
This phase is pure Weasel work with no EF dependency, so it can proceed independently of the rest of the epic.
Scope
- PostgreSQL:
GENERATED ALWAYS AS (expression) STORED (PG 12+). Model VIRTUAL as well (arrives in PG 18) but gate DDL emission by server capability.
- SQL Server: computed columns
AS (expression) [PERSISTED].
- Model: expression + stored/virtual flag on
TableColumn (fluent API mirroring the existing SQLite GeneratedAs), surfaced on the provider-neutral ITableColumn where sensible.
- Introspection: read generated-column metadata in
FetchExisting (pg_attribute.attgenerated on PostgreSQL, sys.computed_columns on SQL Server) so the "actual" model captures it.
- Delta detection: participate in
TableDelta comparison (expression normalization will be needed — the catalogs return normalized expressions, similar to the existing index/check DDL canonicalization).
- EF Core mapping:
MapToTable in Weasel.EntityFrameworkCore translates HasComputedColumnSql → the new Weasel computed-column model.
- Harness: add a computed-column scenario to the
SchemaComparison tests for PostgreSQL and SQL Server, and remove the "known gap" entry from EFCORE_IMPROVEMENTS.md.
Acceptance
- Tables with computed columns round-trip: create via Weasel → delta detection reports
None.
- EF DbContext with
HasComputedColumnSql maps to Weasel and passes the dual-schema comparison harness on both providers.
Part of the EF Core migration generation epic — tracking issue #371.
Weasel does not currently model computed/generated columns for PostgreSQL or SQL Server —
GeneratedAlwaysAsStored/GeneratedAsIdentityare commented out inWeasel.Postgresql/Tables/TableColumn.cs. SQLite already supportsGeneratedAs(...), so this is parity work. This is also a documented gap in the EF Core schema-comparison harness (EFCORE_IMPROVEMENTS.md), since EF Core can express computed columns viaHasComputedColumnSql.This phase is pure Weasel work with no EF dependency, so it can proceed independently of the rest of the epic.
Scope
GENERATED ALWAYS AS (expression) STORED(PG 12+). ModelVIRTUALas well (arrives in PG 18) but gate DDL emission by server capability.AS (expression) [PERSISTED].TableColumn(fluent API mirroring the existing SQLiteGeneratedAs), surfaced on the provider-neutralITableColumnwhere sensible.FetchExisting(pg_attribute.attgeneratedon PostgreSQL,sys.computed_columnson SQL Server) so the "actual" model captures it.TableDeltacomparison (expression normalization will be needed — the catalogs return normalized expressions, similar to the existing index/check DDL canonicalization).MapToTableinWeasel.EntityFrameworkCoretranslatesHasComputedColumnSql→ the new Weasel computed-column model.SchemaComparisontests for PostgreSQL and SQL Server, and remove the "known gap" entry fromEFCORE_IMPROVEMENTS.md.Acceptance
None.HasComputedColumnSqlmaps to Weasel and passes the dual-schema comparison harness on both providers.