EF Core Migrations Deep Dive, Applying Migration, SQL Scripts

Опубликовано: 07 Октябрь 2024
на канале: Milan Jovanović
14,890
692

Get the source code for this video:   / milanjovanovic  
Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt

Managing database schemas as your applications grow can quickly become a headache. Manual changes are error-prone and time-consuming, which can easily lead to inconsistencies between development and production environments. I've seen these issues firsthand on countless projects, and they're not pretty. How can we do better?

Enter Entity Framework (EF) Migrations, a powerful tool that lets you version your database schemas.

Imagine this: Instead of writing SQL scripts, you define your changes in code. Need to add a column? Rename a table? No problem - EF Migrations has you covered. It tracks every modification to the data model. You can review, test, and apply changes confidently, even across different environments.

EF Core Migrations: A Detailed Guide
https://www.milanjovanovic.tech/blog/...

Migration tooling:
FluentMigrator: https://fluentmigrator.github.io/
DbUp: https://dbup.readthedocs.io/en/latest/
Grate: https://erikbra.github.io/grate/
Flyway: https://flywaydb.org/

Join my weekly .NET newsletter:
https://www.milanjovanovic.tech

Read my Blog here:
https://www.milanjovanovic.tech/blog

Chapters
0:00 What are EF Core migrations?
2:13 Configuring an EF Entity
5:18 Creating a database migration
6:27 Creating another database migration
7:55 Applying EF Core database migrations
10:01 Generating SQL Scripts for EF migrations
12:11 Writing custom SQL in EF migrations
13:00 Additional database versioning tools
14:15 EF Core migrations best practices