abpframework / eShopOnAbp

Reference microservice solution built with the ABP Framework and .NET, runs on Kubernetes with Helm configuration, includes API Gateways, Angular and ASP.NET Core MVC applications, PostgreSQL and MongoDB databases
https://www.eShopOnAbp.com/
MIT License
694 stars 272 forks source link

eShopOnAbp: Triggering data seed without schema migration #153

Closed gterdem closed 1 year ago

gterdem commented 1 year ago

Currently, for EF Core, data seeding works only if there is a pending migration. However, there may be cases where there is no pending migration, but we need to seed database.

Possible solution: Run seed on every startup (optional) and manually trigger it in the admin side.

gterdem commented 1 year ago

This is fixed after moving to distributed locking for db migrations. IDataSeeder seeds independent of pending migrations.

https://github.com/abpframework/eShopOnAbp/blob/3a4767c6cd307a3741562b58389d4bde026f450d/shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs#L61-L78