View on GitHub

SauceDB

.net ORM with multipe database engine support.

Download this project as a .zip file Download this project as a tar.gz file

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
In order to set this up, do the following things.
  1. setup a new project in your solution
  2. Remove a table(s)
  3. Add a column(s) to an existing table
  4. Remove a column(s) from an existing table
  5. Change Column(s) types
  6. Execute arbitrary database commands
After you create your new project (class lib)
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
Add Requried References
  • DataAccess.Migrations.exe
  • Whatever is required for your datastore (in the example mysql)
Add a file to setup your migrator In this file, inherit from DBMigrator and implement GetDataStore()
namespace Migrations
{
    public class Migrator : DBMigrator
    {
        protected override IDataStore GetDataStore()
        {
            return new MySqlDataStore(ConfigurationManager.ConnectionStrings["Database"].ConnectionString);
        }
    }
}
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.