A Flyway wrapper for .NET
Bruno Monteiro, also known as b'uno.
First, download Flyway commandline tool
Note: Flyway commandline is required.
Install-Package Flyway.net
All you have to do is pass the Flyway's path in the constructor.
var flyway = new Flyway(@"[flyway path]");
You can configure in a few ways
By default, Load() will load a file from filesystem
var config = new FlywayConfiguration(configurationFilePath: "[flyway path]\conf\flyway.conf").Load();
config.FlywayPath = @"[flyway path]"; // is required
var flyway = new Flyway(config);
var config = new FlywayConfiguration();
configuration.FlywayPath = @"[flyway path]"; // is required
configuration.Url.Value = "jdbc:sqlserver://localhost;databaseName=master";
configuration.User.Value = "sa";
configuration.Password.Value = "Password";
var flyway = new Flyway(config);
You do not need to save the configurations, but you have that possibility. By default, Save() will write a file to the filesystem
var config = new FlywayConfiguration("[flyway path]\conf\flyway.conf");
config.BaselineDescription.Value = "Some baseline description";
config.Save();
You can implement your own configuration saver and loader
Action<string, string> saver = (arg, config) => { /* ... */ };
Func<string, string[]> loader = arg => new string[] { /* ... */ };
var config = new FlywayConfiguration(saver, loader);
// config.Load();
// config.Save();
var cleanOutput = flyway.Clean();
var infoOutput = flyway.Info();
var baselineOutput = flyway.Baseline();
var migrateOutput = flyway.Migrate();
var undoOutput = flyway.Undo();
var repairOutput = flyway.Repair();
var validateOutput = flyway.Validate();
// Overriding the config
var cleanOutput = flyway.Clean(anotherConfig);
var infoOutput = flyway.Info(anotherConfig);
var baselineOutput = flyway.Baseline(anotherConfig);
var migrateOutput = flyway.Migrate(anotherConfig);
var undoOutput = flyway.Undo(anotherConfig);
var repairOutput = flyway.Repair(anotherConfig);
var validateOutput = flyway.Validate(anotherConfig);
v. x
- ☐ Create the new options/parameters present in the new version of Flyway.
v. 1.1.1 (09/2020)
- ☑ Fix: Flyway constructor accepts FlywayConfiguration
v. 1.1.0 (04/2020)
- ☑ Updated to version 6.4.0 of Flyway
v. 1.0.0 (04/2020)
- ☑ First Release
The flyway.net source code is issued under MIT license, a permissive free license, which means you can modify it as you please, and incorporate it into your own commercial or non-commercial software.
Free Software, oh yeah!