package se.emilsjolander.sprinkles;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

class DbOpenHelper extends SQLiteOpenHelper {

	private DbOpenHelper(Context context, String dbName) {

        // +1 because version number for databases starts at 1, not 0
        // This is needed when opening an existing database.
		super(context, dbName, null,
				Sprinkles.sInstance.mMigrations.size() + 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		executeMigrations(db, 1, Sprinkles.sInstance.mMigrations.size() + 1);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		executeMigrations(db, oldVersion, newVersion);
	}

	@Override
	public void onOpen(SQLiteDatabase db) {
		super.onOpen(db);
		db.execSQL("PRAGMA foreign_keys=ON;");
	}

	private void executeMigrations(SQLiteDatabase db, int oldVersion, int newVersion) {
		for (int i = oldVersion; i < newVersion; i++) {
			Sprinkles.sInstance.mMigrations.get(i - 1).execute(db);
		}
	}

	static SQLiteDatabase sInstance;

	static synchronized SQLiteDatabase getInstance() {
		if (sInstance == null) {
			sInstance = new DbOpenHelper(Sprinkles.sInstance.mContext, Sprinkles.sInstance.dbName).getWritableDatabase();
		}
		return sInstance;
	}
}

@@ -159,16 +159,23 @@
 elper;%0A%0A
+public 
 class Db
@@ -1075,16 +1075,23 @@
 %09%7D%0A%09%7D%0A%0A%09
+public 
 static S

Make both the SQLiteDatabase and DbOpenHelper public to be able to hijack and insert a custom Database. Beware that you can break your migration scheme by doing this.