Code First Migrations Error

Code First Migrations Error

Postby cedwards » Mon 24 Mar 2014 21:16

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.
cedwards
 
Posts: 2
Joined: Fri 21 Mar 2014 21:31

Re: Code First Migrations Error

Postby MariiaI » Tue 25 Mar 2014 14:22

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
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Code First Migrations Error

Postby cedwards » Tue 25 Mar 2014 15:45

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.
cedwards
 
Posts: 2
Joined: Fri 21 Mar 2014 21:31

Re: Code First Migrations Error

Postby MariiaI » Wed 26 Mar 2014 12:06

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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Code First Migrations Error

Postby MariiaI » Wed 09 Apr 2014 11:22

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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Code First Migrations Error

Postby MariiaI » Thu 10 Apr 2014 12:54

New build of dotConnect for PostgreSQL 7.3.135 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgresql/download.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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for PostgreSQL