Group Group Group Group Group Group Group Group Group

Reference to member 'sqlite' cannot be resolved without a contextual type. Vapor course

I am running into this issue when trying to build, thanks for any help on this error

Reference to member ‘sqlite’ cannot be resolved without a contextual type

@alfred1963 are you running on Xcode 11.4 Beta? If so, that’s a known issue with the 5.2 compiler and you need to provide the full database identifier.

If not, does Acronym conform to SQLiteModel?

1 Like

UPDATE: I found the solution at: https://forums.swift.org/t/vapor-3-swift-5-2-regression/34764

~~Please. I upgrade to Swift 5.2 compiler and now I am getting same error. I didn’t figure out how ‘provide full database identifier’. Could you give me a example?
My Code is
migrations.add(model: Todo.self, database: .sqlite)

1 Like

Try using DatabaseIdentifier<Todo.Database>.sqlite

4 Likes

@alfred1963 Do you still have issues with this?

@dairan Thank you for sharing the link. Do you still have issues with this?

@onurtunalj Thank you for sharing this!

I decided to rework my project in Vapor 4, from scratch. I am still learning how to go about.

Thanks for your help and yes please remove the post!

Regards Alfred Schmidt

I have the same issue and your code make it run. Can you explain me why ? It happen after I update xcode 11.4

It’s a bug in the Swift 5.2 compiler - you can read about it in the forum link posted above.

Still having issue and the above fix doesnt seem to working. migrations.add(model: Acronym.self, database: DatabaseIdentifier<SQLiteDatabase>.sqlite)

Throws the error
Cannot convert value of type ‘DatabaseIdentifier’ to expected argument type ‘DatabaseIdentifier<Acronym.Database>’

LOL fixed it this code worked

    migrations.add(model: Acronym.self, database:  DatabaseIdentifier<Acronym.Database>.sqlite)
3 Likes

Thank you your help, I fixed it :smiley:.

Thanks for the response! I was having the same problem and this solved it.

@quinwoodz Thank you for sharing your solution - much appreciated!