dotnet / dotnet/EntityFramework.Docs

Code-first migration in high-replicated states

Open
#4,515 3 comments 0 reactions 0 assignees View on GitHub
area-migrations
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

Hello all,

I've been working with EF Core using the Code First approach with migrations. As I move towards deploying in a Kubernetes cluster, I've encountered challenges related to handling migrations in a highly replicated environment.

### Problem

During a rolling release with multiple replicas, if one pod initiates a migration that introduces breaking changes, other pods might not be able to handle the new database schema. This can lead to inconsistencies and potential failures.

### Questions

1. How can EF Core migrations be safely managed in a rolling release scenario in Kubernetes?
2. Are there recommended patterns or practices for ensuring that all pods can handle both the old and new schema during the transition?
3. How can we prevent simultaneous migrations from multiple pods?

Any guidance or best practices in this area would be greatly appreciated. I aim to achieve zero-downtime deployments without resorting to a complete service swap.

Thank you for your assistance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.