I've got this db col:
<d:integer name="process" ondelete="cascade" references=".processes" unique="true" />
Triggers a warning:
"Columns that are both unique and nullable are not supported, disabled nullability"
Ok, I can remove "unique", no problem.
However, then this Kysely code throws an error:
await whdb.db<WvuawDB>()
.insertInto("wvuaw.ai_processes")
.values([
{
process: processId,
conclusion: sentiment_is_positive ? "price_accepted" : "price_rejected",
}
])
.onConflict((oc) =>
oc.column("process")
.doUpdateSet({ conclusion: whdb.sql`excluded.conclusion` })
)
.execute();
Error:
** UNEXPECTED EXCEPTION: there is no unique or exclusion constraint matching the ON CONFLICT specification
/Users/wouter/projects/webhare/whtree/jssdk/whdb/vendor/postgresql-client/src/connection/connection.ts:185:25: Called from Connection.query
node:internal/process/task_queues:105:5: Called from process.processTicksAndRejections
/Users/wouter/projects/webhare/whtree/jssdk/whdb/src/impl.ts:322:14: Called from async <anonymous>
/Users/wouter/projects/webhare/whtree/node_modules/kysely/dist/cjs/dialect/postgres/postgres-driver.js:75:28: Called from async PostgresConnection.executeQuery
/Users/wouter/projects/webhare/whtree/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28: Called from async
/Users/wouter/projects/webhare/whtree/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20: Called from async DefaultConnectionProvider.provideConnection
/Users/wouter/projects/webhare/whtree/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16: Called from async DefaultQueryExecutor.executeQuery
...
Removing `unique="true"` gets rid of the error but adds the linter warning.
Is there some way to have it work without the warning? (I've only added `unique="true"` because of the error).