Exemple #1
0
 public void TestRollback()
 {
     Migrator m = new Migrator(Assembly.GetExecutingAssembly(), new SQLiteMigrationFormatter("data source=db.sqlite"));
     m.Rollback();
 }
Exemple #2
0
        static void MigrateRollback2(string[] args)
        {
            string command = args[0], assembly = args[1];

            var a = Assembly.LoadFile(Path.Combine(Directory.GetCurrentDirectory(), assembly));
            var config = ConfigurationManager.OpenExeConfiguration(a.Location);
            var connection = config.ConnectionStrings.ConnectionStrings[config.AppSettings.Settings["database"].Value];
            string connectionString = connection.ConnectionString;
            string providerName = connection.ProviderName;
            var m = new Migrator(a, GetMigrationFormatter(providerName, connectionString));
            m.Migrating += delegate(object sender, MigrationEventArgs e) {
                Console.WriteLine(e.Message);
            };

            if (command == "migrate") {
                m.Migrate();
            } else if (command == "rollback") {
                m.Rollback();
            } else {
                throw new NotSupportedException();
            }
        }
Exemple #3
0
 public void TestMigrate()
 {
     //			Migrator m = new Migrator(Assembly.GetExecutingAssembly(), new SQLiteMigrationRepository("data source=db.sqlite"));
     Migrator m = new Migrator(Assembly.GetExecutingAssembly(), new SQLiteMigrationFormatter("data source=db.sqlite"));
     m.Migrate();
 }
Exemple #4
0
        static void MigrateRollback(string[] args)
        {
            string command = args[0], assembly = args[1], connectionString = args[2], providerName = args[3];

            var m = new Migrator(Assembly.LoadFile(Path.Combine(Directory.GetCurrentDirectory(), assembly)), GetMigrationFormatter(providerName, connectionString));
            m.Migrating += delegate(object sender, MigrationEventArgs e) {
                Console.WriteLine(e.Message);
            };

            if (command == "migrate") {
                m.Migrate();
            } else if (command == "rollback") {
                m.Rollback();
            } else {
                throw new NotSupportedException();
            }
        }