Add support for managing Triggers with EF migration

Open
#10,770 18 comments 26 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
database

Research direction

Start with the EF Core migrations operations documentation linked in the issue and the EntityTypeBuilder API area. Define the supported trigger model and provider behavior before implementation; done would include creating, changing, removing, and updating triggers through entity state and generated migrations, with unsupported providers handled explicitly.

Written by the indexing model from the issue text.

Description

area-model-building

I've found this : https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/operations and i was thinking : Great i could maybe use this to handle the creation of my table triggers...
But sadly there is actually no way to tell the EntityTypeBuilder that i would like to have some triggers on my table... and i clearly think that a trigger should not only be in a single migration but also in current state of the entity (and that we could change/remove/update/etc the trigger and create a new migration for it)
So my question : Why ? Is there something difficult to manage with triggers ? Why could we add some custom operations on EntityTypeBuilder to add and manage those kind of things (and then handle those custom operation in the migration generator) ?

I was naively thinking that a trigger was :

  • a name
  • on a table in a schema
  • with some "simple" properties
  • and a custom code

I could understand that some database target of entityframework don't have triggers but we could easily send an exception saying : "Sorry this operation (....) is not supported by this database provider" and let the user choose to change the database provider or don't use the feature... no ?

Does not seem too difficult to handle, to create and to check changes, no ?
So, i clearly miss something, could someone tell why there's nothing to handle such kind of concept and help me understand the complexity...

Thanks for your amazing lib !!

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.