win7user10 / Laraue.EfCoreTriggers

Library to write triggers in C# with EF.Core
MIT License
114 stars 22 forks source link

Recreate triggers after SQLite table rebuild #87

Open berhir opened 1 year ago

berhir commented 1 year ago

SQLite has limited support for schema changes and in many cases a table rebuild is required. EF Core does the table rebuilds automatically behind the scenes and it's not obvious when they are happening. EF assumes the domain/EF model fully represents the database schema. Triggers are not part of the model, and they get removed without any warning. See https://github.com/dotnet/EntityFramework.Docs/issues/4429 for more information.

It would be great to automatically detect if a table rebuild is required and add the CREATE TRIGGER statement to the migration if necessary.