Skip to content

Provide Migrations hooks to execute SQL and/or seeding before and after each migration has been applied #24710

@riedd2

Description

@riedd2

Hello

I would like to include some custom sql (create stored procedure) in the generate migration script. This code should be run whenever the migration is executed, so no version constraint.
I tried to accomplish this with a custom MigrationOperation / SqlServerMigrationsSqlGenerator approach, but this does not work if there are no new migrations.

Is there another way to achieve this?

Thank you in advance for your Feedback.
Cheers
David

EF Core version: 5.0.5
Database provider: Microsoft.Data.SqlClient
Target framework: NET 5.0
Operating system: Windows
IDE: Visual Studio 2019 16.8

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions