Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 2.59 KB

driver-mysql.mdx

File metadata and controls

57 lines (41 loc) · 2.59 KB
title Driver Mysql schema — Data Protocol reference
navTitle Driver Mysql
description MySQL / MariaDB driver configuration — the config slot of a datasource whose driver resolves to mysql (mysql2).

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

MySQL / MariaDB driver configuration — the config slot of a datasource whose driver resolves to mysql (mysql2).

The driver id was offered by the connection form and buildable by the shared factory long before #4410, but had no config shape at all in packages/spec — postgres, mongo and memory each had one and mysql did not, so its config was the one slot with neither a gate nor a documented shape.

Every key here is read by createDefaultDatasourceDriverFactory (→ SqlDriver, knex mysql2). Postgres-only knobs are deliberately absent: mysql2 has no application_name and no statement_timeout, so declaring them would advertise settings the client drops.

**Source:** `packages/spec/src/data/driver/mysql.zod.ts`

TypeScript Usage

import { MysqlConfigSchema } from '@objectstack/spec/data';
import type { MysqlConfig } from '@objectstack/spec/data';

// Validate data
const result = MysqlConfigSchema.parse(data);

MysqlConfig

MySQL / MariaDB connection configuration

Properties

Property Type Required Description
url string optional Connection URI (supersedes the discrete fields; must not embed a password — bind the secret instead)
host string optional (default: "localhost") Host address
port integer optional (default: 3306) Port number
database string optional Database name
username string optional Authentication user
password never optional Set through the connection form's secret field or external.credentialsRef — encrypted into sys_secret, never stored in config. A datasource defined in code (defineDatasource) leaves the credential out of the declaration: it is read at connect time from the runtime environment variable derived from the datasource name (OS_DATASOURCE_WAREHOUSE_PASSWORD for a datasource named warehouse), which os serve / os start honour by default (OS_DATASOURCE_ENV_CREDENTIALS=on).
ssl boolean optional Enable TLS. Certificates go in the datasource-level ssl block.
autoMigrate Enum<'off' | 'safe'> optional Dev-only non-destructive schema self-heal