sqldelight icon indicating copy to clipboard operation
sqldelight copied to clipboard

Enable creation of a database interface with dependencies only, no .sq files

Open Qubiz opened this issue 2 weeks ago • 0 comments

Description

I have a project with the following modules:

:app

sqldelight {
    databases {
        create("Database") {
            packageName = "com.example.app.db"
            dependency(projects.featureA)
            dependency(projects.featureB)
        }
    }
}

:feature-a

sqldelight {
    databases {
        create("Database") {
            packageName = "com.example.feature.a.db"
        }
    }
}

:feature-b

sqldelight {
    databases {
        create("Database") {
            packageName = "com.example.feature.b.db"
        }
    }
}

The :app module does not contain any .sq files in its source set. So, in the current situation, sqldelight does not create a Database interface for the :app module.

As a workaround I create a dummy database table in the :app source set. This then enables sqldelight to generate the Database interface for the :app module.

-- Empty.sq
CREATE TABLE  DbEmpty(
    id INTEGER PRIMARY KEY AUTOINCREMENT
);

Requested feature

It would be nice if the Database interface would be generated for the :app module, even if the module does not have any .sq / .sqm files in the source set.

Qubiz avatar Jun 26 '24 08:06 Qubiz