dradovic / MigSharp

Mig# (MigSharp) is a .NET framework for database migrations and versioning
Other
106 stars 34 forks source link

Multiple Calls to Up() #48

Closed BobD01 closed 10 years ago

BobD01 commented 10 years ago

I am a new user. I added a class do test upgrade calls, and I am seeing that the Up() method is called 13 times for each timestamp:

[MigSharp.MigrationExport]
public class MyClassMigration1 : MigSharp.IMigration
{
    public void Up(MigSharp.IDatabase db)
    {
        using (StreamWriter sw = new StreamWriter("c:\\temp\\Migrate.log", true))
        {
            sw.WriteLine("Migrate1 Called: " + DateTime.Now);
        }
    }
}

Why is it called 13 times, and how do I handle this?

dradovic commented 10 years ago

It's called multiple times to validate it against different providers. Please read https://github.com/dradovic/MigSharp/wiki/Manual#validation . These are just dry runs. The actual execution on the database will only happen exactly once.