payloadcmsdirectory

db sql

by payloadcmsdirectory
Databases & data
v3
3.29.0

Overview

Summary generated from the README

A database adapter that lets Payload use MySQL as its data store, configured through the db option with a mysqlAdapter function. It takes connection pool options, an optional table prefix and an ID type of auto or uuid. It manages tables and schema automatically and supports relationships, transactions, versioning and localization. It is marked alpha and not for production; sorting and full text search are not yet implemented.

Features

  • MySQL support through a mysqlAdapter function set in the Payload db config
  • Automatic table and schema management
  • Relationship, versioning and localization support
  • Transactions through Drizzle ORM
  • Configurable connection pool, table prefix and ID type (auto or uuid)
  • Jest test suites for connection, relationships and adapter behavior

Use cases

  • Experiment with running a Payload project on a MySQL database
  • Evaluate MySQL as an alternative to the standard database adapters in a non-production setup

From the author

SQL database adapter for PayloadCMS

Installation

npm i @payloadcmsdirectory/db-sql

0

Stars

0

Forks

0

Open Issues

1 years ago

Last Updated

0

Weekly Downloads

v

npm Version

Dependencies

GitHub stars

00 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
Oct 24, 20260
Oct 23, 20260
Oct 22, 20260
Oct 21, 20260
Oct 20, 20260
Oct 19, 20260
Oct 18, 20260
Oct 17, 20260
Oct 16, 20260
Oct 15, 20260
Oct 14, 20260
Oct 13, 20260
Oct 12, 20260
Oct 11, 20260
Oct 10, 20260
Oct 9, 20260
Oct 8, 20260
Oct 7, 20260
Oct 6, 20260
Oct 5, 20260
Oct 4, 20260
Oct 3, 20260
Oct 2, 20260
Oct 1, 20260
Sep 30, 20260
Sep 29, 20260
Sep 28, 20260
Sep 27, 20260
Sep 26, 20260
Sep 25, 20260
Sep 24, 20260
Sep 23, 20260
Sep 22, 20260
Sep 21, 20260
Sep 20, 20260
Sep 19, 20260
Sep 18, 20260
Sep 17, 20260
Sep 16, 20260
Sep 15, 20260
Sep 14, 20260
Sep 13, 20260
Sep 12, 20260
Sep 11, 20260
Sep 10, 20260
Sep 9, 20260
Sep 8, 20260
Sep 7, 20260
Sep 6, 20260
npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

Each point is npm's rolling 7-day download count.

Health Score

10/100Poor

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/956110967-root.svg)](https://payloaddirectory.dev/plugins/956110967-root)
HTML
<a href="https://payloaddirectory.dev/plugins/956110967-root"><img src="https://payloaddirectory.dev/badge/956110967-root.svg" alt="Payload Directory"></a>
Updated Mar 28, 2025Created Mar 27, 2025

README

Payload SQL Database Adapter

An SQL database adapter for PayloadCMS.

Note: This package is currently in alpha development and should not be used in production.

Current Version: 0.0.53

What's New

  • Updated the feature list to correctly reflect versioning and localization support
  • Fixed bug in MySQL adapter initialization
  • Added improvements to the connection handling
  • Updated documentation
  • Added integration test suite with full PayloadCMS API testing
  • Improved documentation for testing approaches
  • Added comprehensive test coverage for adapter functionality
  • Updated testing scripts with dedicated integration test command

Installation

npm install @payloadcmsdirectory/db-sql
# or
yarn add @payloadcmsdirectory/db-sql
# or
pnpm add @payloadcmsdirectory/db-sql

Usage

import { buildConfig } from 'payload/config';
import { mysqlAdapter } from '@payloadcmsdirectory/db-sql/mysql';

export default buildConfig({
  collections: [...],
  db: {
    adapter: mysqlAdapter({
      pool: {
        host: 'localhost',
        port: 3306,
        user: 'user',
        password: 'password',
        database: 'payload'
      }
    }),
  },
});

MySQL Adapter Configuration

OptionTypeDescriptionDefault
poolObjectMySQL connection pool options-
prefixstringTable prefix-
idTypestringType of ID field (auto, uuid)auto

Features

Current implementation features:

  • ✅ MySQL database support
  • ✅ Automatic table and schema management
  • ✅ Relationship support
  • ✅ Transaction support through Drizzle ORM
  • ✅ TypeScript compatibility
  • ✅ Basic query filtering
  • ✅ Migration foundation
  • ✅ Versioning support
  • ✅ Localization support
  • Sorting support
  • Full text search

Supported Field Types

All standard PayloadCMS field types are supported.

Testing

The adapter includes comprehensive Jest-based test suites to verify functionality:

# Run all tests
pnpm test

# Run individual test suites
pnpm test:connection   # Basic connection functionality
pnpm test:relationship # Relationship management
pnpm test:sorting      # Sorting capabilities
pnpm test:fulltext     # Full-text search functionality
pnpm test:adapter      # Complete adapter functionality

To run the tests, you need a MySQL server with the following configuration:

  • Host: localhost
  • Port: 3306
  • User: root
  • Password: rootpassword
  • Database: payload_test

You can modify these settings in the test files if needed.

Limitations

  • Currently only supports MySQL databases.

Development

# Clone the repository
git clone https://github.com/yourusername/your-repo.git

# Install dependencies
pnpm install

# Build the package
pnpm build

# Run tests
pnpm test

License

MIT

Similar plugins