Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 4448 missing import for table model #4885

Merged

Conversation

griffio
Copy link
Contributor

@griffio griffio commented Dec 5, 2023

fixes #4448

馃 This is for both Sqlite and Postgresql dialects that support RETURNING *

app.cash.sqldelight.dialect.api.ReturningQueryable now returns the parent table reference instead of the statement table reference to use the correct package name that is taken from the source file

SelectQueryable works already

e.g the CREATE TABLE Test ... is contained in com\example\migration\1.sqm
INSERT INTO Test()...RETURNING* is contained in com\example\queries\Data.sq

The generated DataQueries must contain import com.example.migration.Test

The other migration fixtures assume that sqm and sq are co-located in same directory and thus work.

Change the result to use tableName
a fixture where the migration sqm files and query sq files are in varying packages.
This tests that the Queries interface imports the Data tables using the migration package name when ReturningQueryable is used
Copy link
Collaborator

@AlecKazakova AlecKazakova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice tests, thank you

@AlecKazakova AlecKazakova merged commit 7d12f88 into cashapp:master Dec 5, 2023
7 checks passed
hfhbd pushed a commit that referenced this pull request Apr 2, 2024
* Update ReturningQueryable.kt

Change the result to use tableName

* add MigrationQueryTest for ReturningQueryable

a fixture where the migration sqm files and query sq files are in varying packages.
This tests that the Queries interface imports the Data tables using the migration package name when ReturningQueryable is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated queries file missing import for table model
2 participants