-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I've encountered some problems when using kysely's migration module. The migration process starts by acquiring a global database lock (SQL GET_LOCK) and releasing it afterwards (SQL RELEASE_LOCK).
The lock is scoped to the "connection", so releasing the lock must happen inside the same connection, otherwise it has no effect. This by itself works correctly with the HTTP-based @planetscale/database driver, because it maintains a session ID within the Connection object.
Unfortunately, kysely-planetscale acquires a new connection for each request. In effect, database locks remain in place until they time out after 20 seconds.
It's likely that useSharedConnection would help, but that feature doesn't work at all (#40), and the README implies that it is not to be relied on.