@lucidcms/db-postgres
v1.0.2
Published
The official Postgres database adapter for Lucid CMS
Maintainers
Readme
Lucid CMS - Postgres Database Adapter
The official Postgres database adapter for Lucid CMS
The Lucid CMS Postgres database adapter allows you to use PostgreSQL as your database. This registers a postgres dialect for Kysely under the hood and makes use of the Postgres library.
Installation
npm install @lucidcms/db-postgresSetup
To use the Postgres database adapter, you need to add it to your Lucid CMS config file. You'll need to provide a PostgreSQL connection URL at a minimum.
import { configureLucid } from "@lucidcms/core";
import { node } from "@lucidcms/runtime-node";
import { postgres } from "@lucidcms/db-postgres";
export default configureLucid({
runtime: node,
db: postgres,
config: () => ({
// ...other config
}),
});Configuration
The no-call db: postgres form reads DATABASE_URL from Lucid's resolved env. You can also pass a configuration object or env callback via postgres():
{
url: string,
...postgresClientOptions,
}This uses the Postgres library under the hood, so every property other than url is passed directly through as a Postgres client option.
