Skip to content

Rework migration code generation#51

Merged
sebastian-ederer merged 5 commits into
mainfrom
feature/rework_migration_code_generation
Jun 9, 2026
Merged

Rework migration code generation#51
sebastian-ederer merged 5 commits into
mainfrom
feature/rework_migration_code_generation

Conversation

@sebastian-ederer

Copy link
Copy Markdown
Member

Description

Before, migration files were spammed with .Sql() calls containing the raw SQL strings. This did not adhere to a clear separation of concerns and the migration files did not look clean. Now the migration files look a lot cleaner and we have a clearer SoC in the internal code. This also makes the code more maintanable as you only have one (and not two) locations where you need to maintain the raw SQL that will be executed.

Also, after refactoring renaming tables or columns is being handled better.

Type of Change

  • Bug fix (non-breaking change adressing an issue)
  • New feature (non-breaking change adding functionality)
  • Refactoring
  • Documentation
  • CI / build / tooling
  • Breaking change (fix or feature causing existing functionality to change)

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated (Testcontainers)
  • Existing tests pass (dotnet test)

Checklist

  • Code follows the project's coding styles and guidelines
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • No new compiler warnings introduced
  • Public API changes have XML documentation

Split runtime SQL generation into per-feature *SqlGenerator classes with a shared PolicyJobSqlBuilder, and add per-feature *CSharpGenerator classes so scaffolded migrations emit typed migrationBuilder calls instead of raw .Sql() strings and introduce FeatureDiffContext for rename maps and the recreated-aggregate cascade
@sebastian-ederer sebastian-ederer merged commit 0ad1fe7 into main Jun 9, 2026
3 checks passed
@sebastian-ederer sebastian-ederer deleted the feature/rework_migration_code_generation branch June 9, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant