Skip to content

griffio/sqldelight-postgres-02

Repository files navigation

SqlDelight 2.1.x Postgresql migrations with Liquibase

see https://github.com/griffio/sqldelight-postgres-01 for flyway migrations

https://github.com/cashapp/sqldelight

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

Migrations performed

  • create sequence
  • add constraint foreign key
  • set default - issue that default column must be populated by insert
  • set not null
  • drop not null
  • drop column
  • rename column - must manually rename column in queries
  • rename table
  • add check constraint
  • drop identity - issue if table and column was previously renamed

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

  • alter/drop sequence
  • alter table ... add constraint primary key ... (doesn't update data class property to non-nullable type)
  • add constraint check, foreign key valid and not valid clauses

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>

./gradlew build
./gradlew update

Liquibase db migrations https://contribute.liquibase.com/extensions-integrations/directory/integration-docs/gradle/

About

sqldelight 2.x postgresql migrations liquibase

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages