Esempio n. 1
0
        public static bool Run()
        {
            var dbConnection = new DatabaseConnection(new MySqlConnection(Program.ConnectionString));

            var options = new MigratorOptions()
            {
                EntitiesExcluded = new List <Type>()
                {
                    { typeof(Application.Entities.BaseEntity) }, { typeof(Application.Entities.CustomFieldEntity) }
                }
            };

            var migrator = new Migrator(dbConnection, options);

            var script = migrator.GetDatabaseUpdateScript();

            if (!string.IsNullOrEmpty(script))
            {
                migrator.RunDbUpdate(script);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 public Migrator(IDatabaseConnection dbConnection, MigratorOptions options)
 {
     DbConnection     = dbConnection;
     SchemaRepository = new SchemaRepository(dbConnection);
     Options          = options;
 }