Open PaoloConte opened 2 months ago
🦺 This is an issue related to https://github.com/cashapp/sqldelight/issues/4474#issuecomment-1658348445
➰ The work around is to use migration files instead -so the CREATE EXTENSION
could be run in a separate migration, before the CREATE TABLE
.
Same problem with supporting CREATE TYPE
https://github.com/AlecKazakova/sql-psi/issues/533.
The topological sort for create statements is being done in sql-psi here: https://github.com/cashapp/sqldelight/blob/68692f23f1e6cb713413f66367a15a7441ea7ff1/sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/util/TreeUtil.kt#L225
SQLDelight Version
2.0.2
SQLDelight Dialect
postgresql
Describe the Bug
When defining the schema with CREATE EXTENSION and CREATE TABLE statements I would expect them to be executed in the same order, but the compiled code puts CREATE EXENSION at the bottom of the schema creation:
schema.sq
DatabaseImpl.kt
This doesn't work because the table itself is using citext.
Stacktrace
No response