cashapp / sqldelight

SQLDelight - Generates typesafe Kotlin APIs from SQL
https://cashapp.github.io/sqldelight/
Apache License 2.0
6.01k stars 501 forks source link

Fix 5309 alter table add column if not exists #5311

Open griffio opened 1 week ago

griffio commented 1 week ago

fixes #5309

Support IF NOT EXISTS in ALTER TABLE ADD COLUMN ...

Added override rule for alter_table_add_column as redeclared for extra clause Added custom mixin to prevent duplicate property field in data class when using IF NOT EXISTS and column exists already

CREATE TABLE T (
  id INTEGER,
  txt VARCHAR[]
);

ALTER TABLE T ADD COLUMN IF NOT EXISTS txt VARCHAR[] DEFAULT '{}';

Added migration integration test