Search code examples
sqldelight

Queries not generated from migration


I am using sqldelight 1.4.1 on Android.

If I want to add tables in the second iteration of my app, where do I put the CREATE TABLE Preset(blabla) code? If I put it in 1.sqm, no queries are generated, only fun migrate(...) code is generated. There is no code generated for Preset class nor for queries querying that specific database.

I can't add it in Preset.sq, because it crashes during runtime when I query Presets, since the table did not exist when the app first was run (because the first version did not have it).


Solution

  • it needs to be in both, the .sqm file describe how to migrate, the .sq files describe how to create a fresh database, so in your case you'll need to add it to both in order to query from it in .sq files