Page 1 of 1

Code First Migrations Error

Posted: Mon 24 Mar 2014 21:16
by cedwards
Hello,

I'm using dotConnect 7.3.115.0 with EntityFramework 6.0.2.

When I try to generate a script for my migration using the package manager console, I get the error "Requested value 'UpdateDatabaseOperation' was not found."

Here are the details and stack trace:

PM> Update-Database -Script -SourceMigration $InitialDatabase -TargetMigration: Test -Verbose

Using StartUp project 'Domain.DataAccess'.
Using NuGet project 'Domain.DataAccess'.
Target database is: 'TestDatabase' (DataSource: localhost, Provider: Devart.Data.PostgreSql, Origin: Configuration).
Applying explicit migrations: [201403241857577_InitialCreate, 201403241941149_Test].
Applying explicit migration: 201403241857577_InitialCreate.
Applying explicit migration: 201403241941149_Test.

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& 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.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Requested value 'UpdateDatabaseOperation' was not found.

Re: Code First Migrations Error

Posted: Tue 25 Mar 2014 14:22
by MariiaI
This issue is not related to dotConnect for PostgreSQL. It is related to the EF tool and the command being used in it:

Code: Select all

Update-Database -Script -SourceMigration $InitialDatabase -TargetMigration: s -Verbose

It is necessary to use the '-Script' parameter or the '-Verbose' parameter, but not both at the same time.
Please try using, for example:

Code: Select all

Update-Database -Script
To get detailed information for each command please use:

Code: Select all

get-help Update-Database -detailed 

Re: Code First Migrations Error

Posted: Tue 25 Mar 2014 15:45
by cedwards
Thanks for the reply. Including both the -Script and -Verbose flags doesn't appear to be the issue. I can run "Update-Database -Script -Verbose" and it runs fine. The issue appears to be generating the idempotent script using the "-SourceMigration: $InitialDatabase" parameters. Also, this all works fine when I use SQLServer as my database so I'm not sure this still isn't a dotConnect issue.

Re: Code First Migrations Error

Posted: Wed 26 Mar 2014 12:06
by MariiaI
Thank you for the additional information. We will investigate this issue in more details and inform you about the results as soon as any are available.

Re: Code First Migrations Error

Posted: Wed 09 Apr 2014 11:22
by MariiaI
The UpdateDatabaseOperation operation in Code-First Migrations for EF 6.x has been supported.
We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

Re: Code First Migrations Error

Posted: Thu 10 Apr 2014 12:54
by MariiaI
New build of dotConnect for PostgreSQL 7.3.135 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=29346.