Open
Description
Currently it isn't possible to declare a constraint, while making it DEFERRABLE or set a initial deferred state.
Workaround 1:
guard let db = database as? PostgresDatabase else {
throw Abort(.internalServerError)
}
try db.simpleQuery("ALTER TABLE waitlist ADD CONSTRAINT no_duplicate_ranks UNIQUE(waitlist_rank) DEFERRABLE;").wait()
Workaround 2:
// In create migration
.constraint(.custom("CONSTRAINT \"no_duplicate_ranks\" UNIQUE(waitlist_rank) DEFERRABLE"))