private bool PreviouslyRun(IDatabaseMigration migration)
{
var command = new DbCommandSpec()
.SetCommandText(string.Format("select count(*) from {0} where {1} = {2}",
MIGRATIONS_TABLE_NAME,
session.DbAdapter.Quote(MIGRATION_NAME_COLUMN_NAME),
session.DbAdapter.FormatParameterName("name")))
.AddParameter("name", migration.Name);
var result = session.ExecuteScalar(command);
return Convert.ToInt64(result) > 0;
}