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

Skip to content

generateMainMyDatabaseInterface fails on timestamped naming convention sqm files #4296

Closed
@Adriel-M

Description

@Adriel-M

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions