sqldelight
sqldelight copied to clipboard
Unable to run `ALTER TABLE <> DROP CONSTRAINT <> RESTRICT;` when using postgresql
SQLDelight Version
2.0.2
SQLDelight Dialect
app.cash.sqldelight:postgresql-dialect
Describe the Bug
I tried to make a migration file with the contents:
ALTER TABLE notes
DROP CONSTRAINT must_have_unique_text_for_one_user_in_one_class RESTRICT;
Taken the syntax from https://www.postgresql.org/docs/7.2/sql-altertable.html
Running this exact text just normally on the terminal works fine.
Stacktrace
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':backend:generateMainSqlDelightMigrations'.
> A failure occurred while executing app.cash.sqldelight.gradle.GenerateMigrationOutputTask$GenerateMigration
> Error Reading 3_remove_unique_notes.sqm:
/Users/backend/backend/src/main/sqldelight/com/stylianosgakis/migrations/3_remove_unique_notes.sqm: (4, 4): <column name real> or COLUMN expected, got 'CONSTRAINT'
3 ALTER TABLE table_name
4 DROP CONSTRAINT constraint_name RESTRICT
😞 Sadly DROP CONSTRAINT is not implemented
I will add it to the list https://github.com/griffio/sqldelight-postgres-01 and see if it can be quickly implemented
Sounds great, thanks a lot!