Add support for DDL generation/migrations#9
Conversation
008d912 to
6139988
Compare
There was a problem hiding this comment.
Pull request overview
Adds EF Core DDL/migrations support for the ClickHouse provider, including engine-specific table DDL, annotation flow through migrations/model differ, design-time services for dotnet-ef, and broad unit/integration/CLI smoke test coverage.
Changes:
- Implement ClickHouse-specific migrations SQL generation (CREATE TABLE with ENGINE clauses, ALTER COLUMN removals, skipping indexes, create/drop database ops) and history repository behavior.
- Add ClickHouse engine/DDL fluent APIs + conventions (default MergeTree + ORDER BY behavior) and propagate annotations through design-time/migrations.
- Add integration and CLI smoke tests (Testcontainers +
dotnet-ef) and wire CI to installdotnet-ef.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.ClickHouse.Tests/MigrationSqlGeneratorTests.cs | Unit tests for generated migration SQL (engines, expressions, removals, indexes). |
| test/EFCore.ClickHouse.Tests/MigrationIntegrationTests.cs | Integration tests verifying applied migration effects via ClickHouse system tables. |
| test/EFCore.ClickHouse.Tests/EnsureCreatedTests.cs | Integration tests for EnsureCreated/EnsureDeleted behavior against ClickHouse. |
| test/EFCore.ClickHouse.Tests/EngineConfigurationTests.cs | Unit tests for fluent engine configuration annotations and conventions. |
| test/EFCore.ClickHouse.Tests/EFCore.ClickHouse.Tests.csproj | Adds EFCore.Design dependency for test scenarios. |
| test/EFCore.ClickHouse.Tests/DotnetEfCliTests.cs | End-to-end dotnet-ef CLI smoke tests against a real ClickHouse instance. |
| test/EFCore.ClickHouse.DesignSmoke/SmokeDbContext.cs | Design-time DbContext + factory used by CLI smoke tests. |
| test/EFCore.ClickHouse.DesignSmoke/Program.cs | Minimal entry point for dotnet-ef discovery. |
| test/EFCore.ClickHouse.DesignSmoke/EFCore.ClickHouse.DesignSmoke.csproj | Standalone smoke project referencing provider + EFCore.Design. |
| src/EFCore.ClickHouse/Migrations/Operations/ClickHouseDropDatabaseOperation.cs | New migration operation for dropping databases. |
| src/EFCore.ClickHouse/Migrations/Operations/ClickHouseCreateDatabaseOperation.cs | New migration operation for creating databases. |
| src/EFCore.ClickHouse/Migrations/Internal/ClickHouseMigrationsAnnotationProvider.cs | Ensures ClickHouse annotations are carried onto “remove” operations. |
| src/EFCore.ClickHouse/Migrations/Internal/ClickHouseMigrationDatabaseLock.cs | No-op migrations lock implementation for ClickHouse. |
| src/EFCore.ClickHouse/Migrations/Internal/ClickHouseHistoryRepository.cs | ClickHouse-specific migrations history table + idempotent-script rejection. |
| src/EFCore.ClickHouse/Migrations/ClickHouseMigrationsSqlGenerator.cs | Core migration SQL generator implementation for ClickHouse DDL/DML ops. |
| src/EFCore.ClickHouse/Metadata/Internal/ClickHouseAnnotationProvider.cs | Adds annotation emission from model/table/index/column into relational model. |
| src/EFCore.ClickHouse/Metadata/Internal/ClickHouseAnnotationNames.cs | Expands annotation constants for engines, settings, columns, and skipping indexes. |
| src/EFCore.ClickHouse/Metadata/Conventions/ClickHouseDefaultEngineConvention.cs | Sets default MergeTree + default ORDER BY behavior at model finalization. |
| src/EFCore.ClickHouse/Metadata/Conventions/ClickHouseConventionSetBuilder.cs | Removes FK conventions and adds default engine convention. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseVersionedCollapsingMergeTreeEngineBuilder.cs | Fluent builder for VersionedCollapsingMergeTree-specific configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseSummingMergeTreeEngineBuilder.cs | Fluent builder for SummingMergeTree-specific configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseSimpleEngineBuilder.cs | Fluent builder enforcing restrictions for “simple” engines (Memory/Log/etc.). |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseReplacingMergeTreeEngineBuilder.cs | Fluent builder for ReplacingMergeTree-specific configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseMergeTreeEngineBuilder.cs | Fluent builder for MergeTree configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseGraphiteMergeTreeEngineBuilder.cs | Fluent builder for GraphiteMergeTree configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseEngineBuilder.cs | Base fluent builder implementing shared table options (ORDER BY, TTL, settings, etc.). |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseCollapsingMergeTreeEngineBuilder.cs | Fluent builder for CollapsingMergeTree configuration. |
| src/EFCore.ClickHouse/Metadata/Builders/ClickHouseAggregatingMergeTreeEngineBuilder.cs | Fluent builder for AggregatingMergeTree configuration. |
| src/EFCore.ClickHouse/Infrastructure/Internal/ClickHouseModelValidator.cs | Adds engine configuration validation/warnings in model validator. |
| src/EFCore.ClickHouse/Extensions/ClickHouseServiceCollectionExtensions.cs | Registers migrations services (SQL generator, history repo, annotation provider). |
| src/EFCore.ClickHouse/Extensions/ClickHousePropertyExtensions.cs | Adds property-level annotation accessors (codec/ttl/comment). |
| src/EFCore.ClickHouse/Extensions/ClickHousePropertyBuilderExtensions.cs | Adds fluent APIs for property codec/ttl/comment. |
| src/EFCore.ClickHouse/Extensions/ClickHouseIndexExtensions.cs | Adds index-level annotation accessors for skipping indexes. |
| src/EFCore.ClickHouse/Extensions/ClickHouseIndexBuilderExtensions.cs | Adds fluent APIs for skipping index type/granularity/params. |
| src/EFCore.ClickHouse/Extensions/ClickHouseEntityTypeExtensions.cs | Adds entity/table-level annotation accessors (engine, order by, ttl, settings, etc.). |
| src/EFCore.ClickHouse/Extensions/ClickHouseEntityTypeBuilderExtensions.cs | Adds ToTable(...).Has*Engine() fluent entry points. |
| src/EFCore.ClickHouse/EFCore.ClickHouse.csproj | Adds EFCore.Design reference to runtime package. |
| src/EFCore.ClickHouse/Design/Internal/ClickHouseDesignTimeServices.cs | Registers design-time services for tooling (dotnet-ef). |
| src/EFCore.ClickHouse/Design/Internal/ClickHouseCodeGenerator.cs | Provider code generator for UseClickHouse(...) scaffolding output. |
| src/EFCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs | Ensures ClickHouse-prefixed annotations are not treated as convention-handled. |
| README.md | Documents engine configuration + migrations support and limitations. |
| ClickHouse.EntityFrameworkCore.sln | Adds the new DesignSmoke project to the solution. |
| .github/workflows/tests.yml | Installs dotnet-ef in CI before restore/build/test. |
| .github/workflows/coverage.yml | Installs dotnet-ef in CI before coverage run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex[agent] review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 45 out of 45 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dotnet-version: 10.x | ||
|
|
||
| - name: Install dotnet-ef | ||
| run: dotnet tool install --global dotnet-ef |
There was a problem hiding this comment.
The workflow installs dotnet-ef without a version pin. To keep CI deterministic and compatible with the EF Core version referenced by the projects, pin the tool version (e.g., --version 10.0.2 / 10.*).
| run: dotnet tool install --global dotnet-ef | |
| run: dotnet tool install --global dotnet-ef --version 10.0.2 |
No description provided.