schambers/fluentmigrator — pull request #231 by Pathoschild (2012-01-24 22:07:49+00:00)
Title: Configurable support for database features not implemented by the underlying database

This adds configurable support for certain database features that are not normally supported by the underlying database. This is enabled by setting `EmulateCompatibility = true`; the behaviour otherwise is unchanged.

Currently, this feature enables schemas for all databases by prefixing them into the table name (`[schema].[table]` becomes `[schema_table]`). (This is the same solution and format used by NHibernate for databases that don't support schemas.)

## Example
The runner context below will apply migrations to a blank SQLite database file. SQLite does not support schemas, which means code that depends on schemas (such as unit tests for a multi-tenant database) will fail when using SQLite. This can be resolved by setting `EmulateCompatibility = true`:

```c#
RunnerContext migrationContext = new RunnerContext(this.Announcer)
{
Database = "Sqlite",
Connection = "Data Source=blank.sqlite;Version=3;",
Target = this.GetType().Assembly.FullName,
Task = "migrate:up",
EmulateCompatibility = true
};
new TaskExecutor(migrationContext).Execute();
```

Let's say one of our migrations looks like this:

```c#
///
Upgrade the database to this version.

public override void Up()
{
this.Create.Table("example").InSchema("company");
}
```

Normally FluentMigrator would ignore the schema entirely, so it would generate SQL like this: `CREATE TABLE 'example' (...)`. With `EmulateCompatibility = true`, schema support is emulated by generating `CREATE TABLE 'company_example' (...)`.