Skip to content

adambird/migratordotnet

Repository files navigation

migratordotnet for Sqlite in-memory databases

I wanted to use an in memory database for query testing and wanted to use the same migrations as the production DB.

Migratordotnet looked like a great tool but would only accept a ConnectionString as a parameter meaning the migrations would run happily but any scheme changes weren’t available when the testing started.

So I’ve tweaked the SQLiteTransformationProvider and TransformationProvider slightly.

Sample Usage

In the TestFixtureSetup

_inMemoryDbConnection = new SQLiteConnection("Data Source=:memory:");
_inMemoryDbConnection.Open();
var provider = new SQLiteTransformationProvider(new SQLiteDialect(), _inMemoryDbConnection, true);
var migrator = new Migrator.Migrator(provider, typeof (M001CreateInvoicesTable).Assembly, true);
migrator.MigrateToLastVersion();

Now I can run my tests by passing in the connection to the appropriate classes.

And

I’m going to try using it for a bit and then, all being well, submit a request to the owners to have this included going forward.

About

My working copy of the migratordotnet project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages