main
 1using System.Linq;
 2using gorilla.migrations.utility;
 3
 4namespace gorilla.migrations.data
 5{
 6    public class SqlDatabaseGateway : DatabaseGateway
 7    {
 8        DatabaseCommandFactory command_factory;
 9
10        public SqlDatabaseGateway(DatabaseCommandFactory command_factory)
11        {
12            this.command_factory = command_factory;
13        }
14
15        public void run(SqlFile file)
16        {
17            using (var command = command_factory.create())
18            {
19                if (command.run("select * from migration_scripts").Any(x => !file.is_greater_than(x["version"].convert_to<int>()))) return;
20
21                command.run(file);
22            }
23        }
24    }
25}