0
votes

I'm searching for a way to update my firebird-database. I tried using migrations:

    private void btnUpdateDb_Click(object sender, EventArgs e)
    {
        DbConnection userDBConnection = ClassBasicRepository.GetDBConnection();

        var configuration = new Configuration();
        configuration.TargetDatabase = new DbConnectionInfo(
            userDBConnection.ConnectionString,
            "FirebirdSql.Data.FirebirdClient");

        DbMigrator migrator = new DbMigrator(configuration);
        migrator.Update();
    }

DbMigrationsConfiguration:

public sealed class Configuration : DbMigrationsConfiguration<BaseDbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;
        //SetSqlGenerator("FirebirdSql.Data.FirebirdClient", new FirebirdSql.Data.Entity.???);
    }

    protected override void Seed(BaseDbContext context)
    {
        MigrationsAssembly = Assembly.GetExecutingAssembly();
        MigrationsNamespace = "MyServices.Data.Migrations";
    }
}

"migrator.Update()" gives me the following Exception:

No MigrationSqlGenerator found for provider 'FirebirdSql.Data.FirebirdClient'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

I have to specify a MigrationSQLGenerator in the Configuration. But I can't find it in the FirebirdClient.dll. The only solution I found was to rewrite it on my own: https://github.com/mrward/entityframework-sharpdevelop/blob/master/src/EntityFramework/Migrations/Sql/SqlCeMigrationSqlGenerator.cs

Is a Firebird specific MigrationSQLGenerator really necessary and not not provided to enable migrations?

My Environment: EntityFramework 5.0.0 .NET 4.5 FirebirdClient 3.0.2.0

1
Hmmm, it seems that migrations are not (yet) supportet by the FirebirdClient.dll. But what is the alternative? Plain SQL? See: tracker.firebirdsql.org/browse/DNET-506 - Dust258

1 Answers

1
votes

Migrations are currently not supported. Actually you can use migrations, but you'll have to generate the script and change it to fit Firebird-flavor SQL.