
سلام روزتون بخیر :|
من موقع اضافه کردن مهاجرت تو پروژه ef core با خطای زرد رنگ توی تصویر بالا مواجه میشم ..دلیلش چیه؟ شما راه حل مناسبی سراغ دارید؟
سلام دوست من وقتتون بخیر
شما در داخل مایگریشنتون تغییراتی دارین که باعث از دست رفتن دیتا ممکنه بشه
مایگریشن رو مطالعه و بررسی کنید
The safe way to upgrade production DB is to break it up in multiple steps:
Add new Market entity and attach it to Promotion entity without dropping the existing column
EF will generate you a migration - CREATE TABLE + ADD FOREIGN KEY statements
Make your code to update/insert/select new values from both Market table and Market column preferring Market table
You deploy this. Now, you've got both old column with data and new table out there, being in sync for the new data.
Write a data migration, which will copy old values from Market column to Market table. Run it. Now you've got your data moved to the new Market table and new data sitting in Market table
Update your code to stop using old Market column. Deploy the change
Remove Market column from you entity. EF will generate migration where column will be dropped. Deploy this. You now have your data and schema migratedمن این رو از سایت استک آور فلو پیدا کردم ولی متوجهش نشدم متاسفانه
سلام دوست عزیزم وقت بخیر
بهترین راه کاری که میتونی انتخاب کنی این هست که مایگریشن رو مطالعه کنی و ببینی داخل مایگریشنت چه اتفاقی داره میفته