Thanks to visit codestin.com
Credit goes to github.com

Skip to content

generateMainMyDatabaseInterface fails on timestamped naming convention sqm files #4296

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Adriel-M opened this issue Jun 21, 2023 · 1 comment · Fixed by #4297
Closed

generateMainMyDatabaseInterface fails on timestamped naming convention sqm files #4296

Adriel-M opened this issue Jun 21, 2023 · 1 comment · Fixed by #4297
Labels

Comments

@Adriel-M
Copy link
Contributor

SQLDelight Version

2.0.0-rc01

Operating System

Mac

Gradle Version

7.5.1

Kotlin Version

1.8.21

Dialect

Postgres

AGP Version

No response

Describe the Bug

Instead of using an incremental version naming convention, we want to use a timestamp based naming convention, but currently getting an error when generating the database interface.

Example:

v1.sqm
v2.sqm

vs

v202304242140.sqm
v202304251408.sqm

I would assume sqldelight would just process the files in alphabetical order but it looks like that's not the case.

Reproducible by #4295 and running dockerTest

Stacktrace

> Task :generateMainMyDatabaseInterface FAILED

Compiling with dialect app.cash.sqldelight.dialects.postgresql.PostgreSqlDialect

/Users/adrielmartinez/Development/sqldelight/sqldelight-gradle-plugin/src/test/integration-postgresql-migrations/src/main/sqldelight/migrations/app/cash/sqldelight/postgresql/integration/v202304251408.sqm: (1, 12): Attempting to alter something that is not a table.
1    ALTER TABLE foo
                 ^^^
2      ADD COLUMN bar VARCHAR(64) DEFAULT NULL

/Users/adrielmartinez/Development/sqldelight/sqldelight-gradle-plugin/src/test/integration-postgresql-migrations/src/main/sqldelight/migrations/app/cash/sqldelight/postgresql/integration/v202304251408.sqm: (1, 12): No table found with name foo
1    ALTER TABLE foo
                 ^^^
2      ADD COLUMN bar VARCHAR(64) DEFAULT NULL


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateMainMyDatabaseInterface'.
> A failure occurred while executing app.cash.sqldelight.gradle.SqlDelightTask$GenerateInterfaces
   > Generation failed; see the generator error output for details.

Gradle Build Script

No response

@Adriel-M Adriel-M added the bug label Jun 21, 2023
@hfhbd
Copy link
Collaborator

hfhbd commented Jun 22, 2023

We use Int as migration version and 202304242140 is bigger than Int.MAX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants