1 year ago

#219712

test-img

andras

SqlDelight: "No table found with name"

I am having trouble with what seems like to be with the SqlDelight intellij plugin. I am trying to write the migrations in one place and not use CREATE statements at all inside the .sq files.

This is my setup:

src/main/sqldelight:

├── com
│   └── wtf
│       └── errorrepro
│           └── database
│               └── one.sq
├── migration
│   └── v1.sqm
└── schema

v1.sqm

CREATE TABLE something(
    id INTEGER
);

one.sq

Here is the issue I am getting inside the editor. No code table-related code hinting is available here, generate menu is also blank in this file.

what:
SELECT * FROM something;
              ^^^^^^^^^
              No table found with name something

build.gradle

I am only showing here the relevant sqldelight config, I am using version 1.5.3 (gradle plugin, intellij plugin and dependency are all on the same version).

...

sqldelight {
    MyDatabase {
        packageName = "com.wtf.errorrepro.database"
        deriveSchemaFromMigrations = true
        verifyMigrations = true
    }
}

...

If I run any of the gradle commands, like generateDebugMyDatabaseInterface, the proper queries are generated. So I do not understand why the editor shows the 'No table found with name' error.

I have reinstalled the plugin, updated gradle, did a clean rebuild, invalidated sources ... Nothing seems to solve this.


Edit:

It is even weirder that in case I create a totally separate project Kotlin + Groovy Gradle and set up SqlDelight there, then the code navigation works well. It is only if I create this setup in an Android project (it can be entirely new) when the navigation fails.

android

android-studio

sqldelight

0 Answers

Your Answer

Accepted video resources