-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an extension point to allow appending a custom migration operation in every migration #35456
Comments
We don't have support for this, and I don't think anyone else has requested something like it. |
Can you explain more how it would work if we added support for it? Would you always add the same line in each migration? Does it change depending on the other operations? |
thanks for entertaining it this far @AndriySvyryd here's a reasonable discussion of it, although please note that i haven't yet made sure that what's described here is completeable today having said that
the workflow for adding a timescale entity to the dbcontext seems to be as normal
after create table timescale workflow calls for converting the table to a hypertable. users integrating with efcore therefore need to add the below to their migrations once, when they add the entity to the dbset as usual
i'm suggesting an enhancement that would reduce the cognitive load of such 'modify the Up()' method workflows by some mechanism that fits ef core idioms like savechanges interceptors for example in the interceptors case these are registered in OnConfiguring if the proposed enhancement was able to follow the same pattern, the hypertable creation workflow would be
note that hyperscale users may want to use dbfunctions, in which case both the Up() and Down() methods would need to be modified
let me know where any lucidity slippage is occurring |
I see. You should be able to accomplish that with the extension points that we already have. You can add a custom annotation to every entity type, something like: modelBuilder.Entity<Stock>().HasAnnotation("HypertableColumn", "Time"); Then, create a class derived from Then, create a class derived from I explain more how this works in #34454 (comment) To avoid having to put the annotation on each entity type manually you can implement a custom convention with the rules that make sense for your scenario. |
what: extension point is available to add code executed before Migration.Up(), the equivalent of adding 'default' statements to Up()?
if it's possible, here's what i've tried and why
i want to automate this migration operation (minimize requirements for remembering to add code to Up())
i can see other people circling this
i read this
the canonical documentation refers to a custom operation called like this
but i want to automate this step => Add the following lines to the end of the Up method in the new migration.
what part of the documentation haven't read?
or is this actually a feature request for an extension point to run migrationbuilder statements before and after up?
please advise
The text was updated successfully, but these errors were encountered: