Skip to content

Can't scaffold database with expression indices #12

Description

@roji

From @adopilot on December 5, 2015 19:57

Npqsql sometimes fail to Reverse engineering with exception which is unreadable to user.

I was trying to Scaffold database of Discourse forum.

In VS2015 console app created targeting .NETFramework,Version=v4.5.1 with EntityFramework7.Npgsql.Design.3.1.0-rc1-3 when try to Scaffold database using Package Manager Console by command like this

Scaffold-DbContext -provider EntityFramework7.Npgsql -connection "Port=5432;Server=xx.xx.xx.xx;Database=discourse;UserId=xx;Password=xx;"

user get generated exception like this

PM> Scaffold-DbContext -provider EntityFramework7.Npgsql -connection "Port=5432;Server=172.16.0.17;Database=discourse;UserId=;Password=;"
System.InvalidCastException: Column is null
at Npgsql.BackendMessages.DataRowMessage.CheckNotNull()
at Npgsql.NpgsqlDataReader.ReadColumnWithoutCache[T](Int32 ordinal)
at Npgsql.NpgsqlDataReader.ReadColumn[T](Int32 ordinal)
at Npgsql.NpgsqlDataReader.GetString(Int32 ordinal)
at Microsoft.Data.Entity.Scaffolding.NpgsqlDatabaseModelFactory.GetColumns()
at Microsoft.Data.Entity.Scaffolding.NpgsqlDatabaseModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet)
at Microsoft.Data.Entity.Scaffolding.RelationalScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet)
at Microsoft.Data.Entity.Scaffolding.NpgsqlScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet)
at Microsoft.Data.Entity.Scaffolding.Internal.ReverseEngineeringGenerator.GetMetadataModel(ReverseEngineeringConfiguration configuration)
at Microsoft.Data.Entity.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken)
at Microsoft.Data.Entity.Design.DatabaseOperations.ReverseEngineerAsync(String provider, String connectionString, String outputDir, String dbContextClassName, List`1 schemas, List`1 tables, Boolean useDataAnnotations, CancellationToken cancellationToken)
at Microsoft.Data.Entity.Design.OperationExecutor.<ReverseEngineerImpl>d__19.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Data.Entity.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0`1.<Execute>b__0()
at Microsoft.Data.Entity.Design.OperationExecutor.OperationBase.Execute(Action action)
Column is null

image

That is prryt unreadibile and hard to debug what is wrong with database

Here is gist dump of scema Discourse database I am trying to scaffold.

Copied from original issue: npgsql/npgsql#892

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions