Migrations
Sauce now ships with a database migrator.Note: Only one way migrations are supported. A Migration is defined as one or more of the following things.
- Add a table(s)
- Remove a table(s)
- Add a column(s) to an existing table
- Remove a column(s) from an existing table
- Change Column(s) types
- Execute arbitrary database commands
- setup a new project in your solution
- Remove a table(s)
- Add a column(s) to an existing table
- Remove a column(s) from an existing table
- Change Column(s) types
- Execute arbitrary database commands
After you create your new project (class lib)
copy DataAccess.Migrations.exe into your project. Set required some properties
Run Migrations
In this file, inherit from DBMigrator and implement GetDataStore()
Add a code file to your migrations folder for each migration you want to run, give it a name and inherit from DBMigration.
After you have done this implement the functions you need, when you run the project it will perform the migrations for you.
copy DataAccess.Migrations.exe into your project. Set required some properties
- Start External Program: <path to project>\bin\Debug\DataAccess.Migrations.exe
- Command Line Arguments: Path:<path to project>\bin\Debug\Migrations.dll
- DataAccess.Migrations.exe
- Whatever is required for your datastore (in the example mysql)
namespace Migrations
{
public class Migrator : DBMigrator
{
protected override IDataStore GetDataStore()
{
return new MySqlDataStore(ConfigurationManager.ConnectionStrings["Database"].ConnectionString);
}
}
}
After you have done this implement the functions you need, when you run the project it will perform the migrations for you.