How does FluentMigrator know what migrations to execute / migrate when you start up the application?
Example: I got two migrations already performed (1 and 2). Now I create a third migration and give it an id of 3
. When I launch my application, FluentMigrator will execute the migrations, but how does it know to skip the first two?
using FluentMigrator;
namespace test
{
[Migration(3)]
public class AddLogTable : Migration
{
public override void Up()
{
Create.Table("Log")
.WithColumn("Id").AsInt64().PrimaryKey().Identity()
.WithColumn("Text").AsString();
}
public override void Down()
{
Delete.Table("Log");
}
}
}
It stores all information in “VersionInfo
” table by default. Using this information, it can determine what migrations need to be applied to that database and will then execute each migration in succession that it needs to apply. Also, you can manage metadata of this table if you need