Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Blocker] Move EF Core migrations out of application startup

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp

Research direction

Start with LearnStack/Program.cs:57-70 and trace the current Database.MigrateAsync() startup path. Review how the deployment pipeline can run dotnet ef migrations bundle --self-contained before swap and how the health endpoint should report connectivity or pending migrations. Done means startup performs no schema changes, deployment applies migrations observably, and failures block the swap rather than crash the app.

Written by the indexing model from the issue text.

Description

enhancement

Tier 1 — release blocker

Problem

Database.MigrateAsync() runs on every boot inside Program.cs and rethrows on failure, so a bad migration or a cold/throttled SQL connection takes the whole site down at startup. With more than one instance, migrations race against each other. This has already caused an Azure startup failure (commit 06b8f0a, "fix: add missing user display name migration").

Evidence
  • LearnStack/Program.cs:57-70
Proposed fix
  1. Generate a migration bundle in CI: dotnet ef migrations bundle --self-contained.
  2. Run the bundle as a deployment step against the target database, before the app is swapped in.
  3. Keep startup read-only — at most a CanConnectAsync check wired into the health endpoint.
  4. Optionally guard with a pending-migration check that fails the health probe rather than the process.
Acceptance criteria
  • App startup performs no schema changes
  • Deploy pipeline applies migrations as an explicit, observable step
  • A failed migration blocks the swap instead of crashing production
Dominant language
HTML
Stars
10
Forks
0
Avg merge
2h 35m
Merged PRs (30d)
21

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kasuken/LearnStack

All issues in kasuken/LearnStack

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.