Question

Is it possible to create a trigger with FluentMigrator, without resorting to raw SQL?

I have looked through the object model for the version currently released on Nuget (FluentMigrator.1.0.1.0) and can't see a way of doing it.

Was it helpful?

Solution

I'm sure you've figured out by now that the answer is no. And I don't think that triggers will be supported anytime soon. They are very database-specific and would require lots of code to cover all the different cases. See this article on Wikipedia: http://en.wikipedia.org/wiki/Database_trigger

If you really want a Create.Trigger expression in FluentMigrator then pull requests are always welcome!

OTHER TIPS

You can use Execute.Script

[Migration(1)]
public class Migration_0001_Baseline : Migration
{

    public override void Up()
    {                        
        Execute.Script("script1.sql");        
    }

    public override void Down()
    {

    }        
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top