Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite RevEng: Error when minimal foreign key specified #19920

Closed
bricelam opened this issue Feb 13, 2020 · 1 comment · Fixed by #20063
Closed

SQLite RevEng: Error when minimal foreign key specified #19920

bricelam opened this issue Feb 13, 2020 · 1 comment · Fixed by #20063
Assignees
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@bricelam
Copy link
Contributor

bricelam commented Feb 13, 2020

create table test (
    id integer primary key,
    parentId integer references test
);
InvalidOperationException: The data is NULL at ordinal 1. This method can't be called on NULL values. Check using IsDBNull before calling.
   at Microsoft.Data.Sqlite.SqliteValueReader.GetString(Int32 ordinal)
   at Microsoft.Data.Sqlite.SqliteDataReader.GetString(Int32 ordinal)
   at Microsoft.EntityFrameworkCore.Sqlite.Scaffolding.Internal.SqliteDatabaseModelFactory.GetForeignKeys(DbConnection connection, DatabaseTable table, IList`1 tables)+MoveNext()
   at Microsoft.EntityFrameworkCore.Sqlite.Scaffolding.Internal.SqliteDatabaseModelFactory.Create(DbConnection connection, DatabaseModelFactoryOptions options)
   at Microsoft.EntityFrameworkCore.Sqlite.Scaffolding.Internal.SqliteDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options)

EF Core version: 3.1.2

@bricelam bricelam changed the title SQLite RevEng: Error when foreign key name unspecified SQLite RevEng: Error when minimal foreign key specified Feb 13, 2020
@bricelam
Copy link
Contributor Author

Looks like it stems from the columns not being specified. This works:

parentId integer references test (id)

@ajcvickers ajcvickers added this to the 5.0.0 milestone Feb 14, 2020
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 25, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-preview3 Mar 31, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-preview3, 5.0.0 Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants