@medusajs/locking-postgres
Documentation | Website
Building blocks for digital commerce
PostgreSQL Locking Module Provider for Medusa: implements the Locking Module's locks with PostgreSQL advisory locks, using the application's existing database. Use it in production when you don't have Redis; the Redis provider is recommended when available. It ships with @medusajs/medusa and is registered through the @medusajs/medusa/locking-postgres path.
At a glance
| Package | @medusajs/locking-postgres |
| Type | Module Provider (Locking Module) |
| Provider ID | locking-postgres |
| Registered by default | No (the Locking Module uses an in-memory provider by default) |
| Import from | @medusajs/medusa/locking-postgres |
Installation
No installation needed. The provider is a dependency of @medusajs/medusa.
Usage
Register the provider in the Locking Module's providers array in medusa-config.ts, then run npx medusa db:migrate to create the provider's table.
import { defineConfig } from "@medusajs/framework/utils"
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/locking",
options: {
providers: [
{
resolve: "@medusajs/medusa/locking-postgres",
id: "locking-postgres",
// makes this the default locking provider
is_default: true,
},
],
},
},
],
})
Configuration
The provider has no options.