{sus}
Setting a Default Value for Migrations
I have a relationship between two models but the relationship is not required, i.e. the first model which "belongs to" the other model can exists on its own.
So in essence, class
Item
can stand on its own but it can also belong to someone.
I am getting this when trying to run the database update command for the seed data which has set the OwnerId to 0
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Items_Owners_OwnerId". The conflict occurred in database "<DB>", table "dbo.Owners", column 'Id'.
54 replies
✅ Migration-independent Database Seeding
Curious if EF has some sort of independent database seeding potential? I am kinda hoping to see a similar functionality to Laravel's Database Seeder where you can write the seed in a file which you can run at any time, regardless of whether or not your migrations are already ran. I find the
HasData
fucntiuonality inherently counterproductive as I don't want to re-run all migrations over and over just so I can work with my seed data.
Laravel Seeding: https://laravel.com/docs/11.x/seeding86 replies