https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
c

Colton Idle

03/18/2024, 12:28 AM
Is there an easy way to debug why sqldelight isn't generating my Queries class? It is somehow finding and generating the hockeyPlayer class inside of my Player.sq, but not generating the PlayerQuery. Ive deleted the gereated folder and reran the gradle task, and it keeps generating the db, HockeyPlayer but not the query. searching slack and stackoverflow seems to point to the package being incorrect, but since HockeyPlayer is being generated. i dont think thats the case. kinda hoping theres like a debug flag or something i can run the gradle task with that'll tell me what directory structure its looking at. edit: technically its a kmm project, but the :server module is the one that has anything related to sqldelight and is the only one that has the sqldelight plugin applied. so i dont think its any sort of misconfig? 🤔
Whoops. i copy pastad the first example which apparently wont generate that file
Copy code
CREATE TABLE hockeyPlayer (
  player_number INTEGER PRIMARY KEY NOT NULL,
  full_name TEXT NOT NULL
);

CREATE INDEX hockeyPlayer_full_name ON hockeyPlayer(full_name);

INSERT INTO hockeyPlayer (player_number, full_name)
VALUES (15, 'Ryan Getzlaf');
h

hfhbd

03/18/2024, 6:10 AM
This sql code does not contain any queries but only schema and init code.
c

Colton Idle

03/18/2024, 2:26 PM
How do I know if that init code would be run? I feel like i didn't run into this when I was working with sqldelight on android
h

hfhbd

03/18/2024, 2:33 PM
All sql code except sqldelight queries (with a name) are executed during schema creation/migration.
c

Colton Idle

03/18/2024, 3:19 PM
ooh. TIL. Thank you!