Hello! I hope you can help me :slightly_smiling_fa...
# squarelibraries
d
Hello! I hope you can help me 🙂 I’m trying to get through the migration process using Sqldelight with postgress dialect in a spring boot project.. to add some context: - I have my entity in a
.sq
file with its queries - I’ve added a
1.sqm
file adding a new column - this is the sqldelight configuration:
Copy code
sqldelight {
  database("EntertainmentDb") {
    packageName = "[..].entertainment.db"
    sourceFolders = listOf("sqldelight")
    deriveSchemaFromMigrations = true
    schemaOutputDirectory = file("src/main/sqldelight/db/")
    migrationOutputDirectory = file("$buildDir/resources/main/migrations")
    migrationOutputFileFormat = ".sql"
    dialect = "postgresql"
  }
}
but when executing the interface task I get all these errors.. thanks in advance!
related to this, when I add the flag
Copy code
deriveSchemaFromMigrations = true
the task to generate the schema is gone and is replace with the task
generate[..]Migrations
n
deriveFromMigrations only uses .sqm files as inputs.. so your CREATE TABLE statements laos need to be in a migration eg 0.sqm
.sqm files must not be in packages.. but .sq files that contain queries must me
depending on if you want to use flyway for applying migrations you need to change the names of the .sqm files too (since flyway expects V1.sql) and enable outputting migraions as sql files
d
ah I see the difference!! thanks for your input @Nikky! I wanted to compare sqldelight vs flyway for migrations.. I’m now first trying just sqldelight.. so I’m not using the flag
deriveSchemaFromMigrations
anymore, and I have the entities in .sq files migrations in .sqm files both under
Copy code
src->main->sqldelight->..
thats not correct then? migration code its generated correctly 🙄 👍 also I have the question of how to handle the versions in order to create the tables fresh or go through
migrate(driver: SqlDriver, oldVersion: Int, newVersion: Int)
about flyway.. can you point me to any comparison between them? main benefit I see yet is the compile time verification