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

Skip to content

griffio/sqldelight-postgres-01

Repository files navigation

SqlDelight 2.1.x Postgresql migrations with Flyway

see https://github.com/griffio/sqldelight-postgres-02 for Liquibase migrations

see https://github.com/griffio/sqldelight-pg-migration for "simple" migrations

https://github.com/cashapp/sqldelight

Some examples of newer postgresql support in sqldelight SNAPSHOT builds 2.1.x

Migrations performed

  • create sequence
  • alter sequence
  • add constraint foreign key
  • set default -
  • set not null
  • drop not null
  • drop column
  • rename column -
  • rename table
  • add check constraint
  • drop identity
  • alter identity

To find bugs/issues that need to be fixed/implemented

Issues

  • rename column - error with validation
  • alter table ... alter column ... drop identity - support but need fixing refers to old column if column was renamed
  • alter table ... alter column ... set default - compilation error must be specified in insert statement
  • sqm files must not have post-fix numbers e.g. V1_create_test_1.sqm as this breaks the ordering

Not supported

Bugs

  • data class import missing in generated queries source when using star INSERT INTO City (city_name) VALUES (?) RETURNING *;
  • allows unknown columns with alter table ... alter column - must show compiler error No column found to alter with name <unknown name>
  • compiler error when functions are used as DEFAULT column values

./gradlew build &&
./gradlew flywayMigrate

Flyway db migrations https://documentation.red-gate.com/fd/gradle-task-184127407.html

About

sqldelight 2.1.x postgresql flywaydb example

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages