title: Error "Requested value 'UpdateDatabaseOperation' was not found" when attempting to generate an idempotent Code First Migration script
body: <p>I'm using dotConnect 7.3.115.0 with EntityFramework 6.0.2.</p>
  
  <p>When I try to generate a script for my migration, I get the error "Requested value 'UpdateDatabaseOperation' was not found."</p>
  
  <p>Here are the details and stack trace:</p>
  
  <pre><code>PM&gt; Update-Database -Script -SourceMigration: $InitialDatabase -TargetMigration: Test -Verbose
  </code></pre>
  
  <p>Using StartUp project 'Domain.DataAccess'.<br>
  Using NuGet project 'Domain.DataAccess'.<br>
  Target database is: 'TestDatabase' (DataSource: localhost, Provider: Devart.Data.PostgreSql, Origin: Configuration).<br>
  Applying explicit migrations: [201403241857577_InitialCreate, 201403241941149_Test].<br>
  Applying explicit migration: 201403241857577_InitialCreate.<br>
  Applying explicit migration: 201403241941149_Test.</p>
  
  <pre><code>System.ArgumentException: Requested value 'UpdateDatabaseOperation' was not found.
     at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
     at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult&amp; parseResult)
     at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
     at Devart.Common.Entity.Migrations.a.b(MigrationOperation A_0)
     at Devart.Common.Entity.Migrations.f.a(MigrationOperation A_0)
     at Devart.Common.Entity.Migrations.f.a(IEnumerable`1 A_0)
     at Devart.Common.Entity.Migrations.c.a(IEnumerable`1 A_0, String A_1)
     at Devart.Data.PostgreSql.Entity.Migrations.PgSqlEntityMigrationSqlGenerator.Generate(IEnumerable`1 migrationOperations, String providerManifestToken)
     at System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList`1 operations, String migrationId)
     at System.Data.Entity.Migrations.Infrastructure.MigratorBase.GenerateStatements(IList`1 operations, String migrationId)
     at System.Data.Entity.Migrations.Infrastructure.MigratorScriptingDecorator.ScriptUpdate(String sourceMigration, String targetMigration)
     at System.Data.Entity.Migrations.Design.ToolingFacade.ScriptUpdateRunner.Run()
     at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
     at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
     at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
     at System.Data.Entity.Migrations.Design.ToolingFacade.ScriptUpdate(String sourceMigration, String targetMigration, Boolean force)
     at System.Data.Entity.Migrations.UpdateDatabaseCommand.&lt;&gt;c__DisplayClass2.&lt;.ctor&gt;b__0()
     at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
  Requested value 'UpdateDatabaseOperation' was not found.
  </code></pre>
  
  <hr>
  
  <h2>Update</h2>
  
  <p>It seems that the issue is related to generating the idempotent scripts using -SourceMigration: $InitialDatabase</p>
  
  <p>Per Microsoft:</p>
  
  <blockquote>
    <p><a href="http://msdn.microsoft.com/en-us/data/jj591621.aspx#idempotent" rel="nofollow">Generating Idempotent Scripts (EF6 onwards)</a>  </p>
    
    <p>Starting with EF6, if you specify –SourceMigration $InitialDatabase
    then the generated script will be ‘idempotent’. Idempotent scripts can
    upgrade a database currently at any version to the latest version (or
    the specified version if you use –TargetMigration). The generated
    script includes logic to check the __MigrationsHistory table and only
    apply changes that haven't been previously applied.</p>
  </blockquote>
  
  <p>I only encounter this error when using dotConnect pointed at a PostgreSQL database. Everything works as expected when using a SQLServer instance.</p>