I'm having an issue with SQLDelight (2.0.0) that's a little odd. For background, the app I'm working on has, for business reasons, two separate databases: the newer one, which I converted to SQLDelight (including prior history), works great. This was our proof-of-concept and with only 3 or 4 schema versions, it was not hard to convert everything, and was a great learning exercise. 🙂
The other database has been in the app much longer (~150 schema revisions) and has many more tables. For this one, I dumped the schema from the current DB and have that in one big .sq file in the src dir and made an empty .sqm to get the schema versions aligned. As we migrate queries to SQLDelight we break the tables out into in separate files. The first minor issue I'm seeing with this database is that in Android Studio the plugin doesn't seem to be able to see tables that are in other .sq files, here the gradle build works fine generating the schema, so I can just ignore the warnings. The second and critical issue I've hit is with some new tables I've added with foreign keys. In the .sq file these tables works fine (though the IDE warns that is there's no table with that name in the FK definition). In the migration file however the build fails with an error: "Table foo does not have a unique index on columns [bar, baz]" Only a few lines up exists: "CREATE UNIQUE INDEX IDX_foor_bar_baz ON foo (bar, baz ASC);". This exact SQL works fine in the .sq definition files (verified in the created DB).
Anyone have any ideas?