jpskill.com
🛠️ 開発・MCP コミュニティ

api-baas-planetscale

PlanetScaleは、ブランチ機能やデプロイリクエスト、エッジ環境対応のドライバーを備えたサーバーレスMySQLプラットフォームで、スケーラブルなデータベースを容易に構築・運用するSkill。

📜 元の英語説明(参考)

Serverless MySQL platform with branching, deploy requests, and edge-compatible driver

🇯🇵 日本人クリエイター向け解説

一言でいうと

PlanetScaleは、ブランチ機能やデプロイリクエスト、エッジ環境対応のドライバーを備えたサーバーレスMySQLプラットフォームで、スケーラブルなデータベースを容易に構築・運用するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o api-baas-planetscale.zip https://jpskill.com/download/10226.zip && unzip -o api-baas-planetscale.zip && rm api-baas-planetscale.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10226.zip -OutFile "$d\api-baas-planetscale.zip"; Expand-Archive "$d\api-baas-planetscale.zip" -DestinationPath $d -Force; ri "$d\api-baas-planetscale.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して api-baas-planetscale.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → api-baas-planetscale フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

PlanetScale Serverless MySQL パターン

クイックガイド: HTTP (Fetch API) 経由でエッジ/サーバーレス MySQL にアクセスするには、@planetscale/database を使用します。リクエストごとに接続を作成するには Client を、パラメータ化されたクエリを実行するには conn.execute() を、アトミックな操作を実行するには conn.transaction() を使用します。本番環境で DDL を直接実行しないでください。安全なマイグレーションを有効にしたデプロイリクエストを使用してください。PlanetScale は Vitess 上で動作します。外部キーはサポートされていますが、オプトインです。ストアドプロシージャはサポートされていません。すべてのスキーマ変更はオンライン DDL を介して行われます。組み込みの cast は通常の整数と浮動小数点数を自動的に処理しますが、BigInt、Date、および boolean 型の列にはカスタムの cast を提供してください。開発/プレビュー環境用に、git のブランチのようにデータベースをブランチングします。


<critical_requirements>

重要: この Skill を使用する前に

すべてのコードは CLAUDE.md のプロジェクト規約に従う必要があります (kebab-case、名前付きエクスポート、インポート順序、import type、名前付き定数)

(パラメータ化されたクエリでは、必ず conn.execute(sql, params) を使用してください。SQL 文字列にユーザー入力を補間しないでください)

(本番ブランチでのすべてのスキーマ変更には、安全なマイグレーションを有効にしたデプロイリクエストを使用する必要があります。直接 DDL は拒否されます)

(サーバーレス環境では、リクエストごとに新しい Client.connection() を作成する必要があります。呼び出し間で接続を再利用しないでください)

(Vitess/MySQL の互換性の違いを処理する必要があります。ストアドプロシージャ、直接 DDL による RENAME COLUMN:= 演算子、LOAD DATA INFILE は使用できません)

(BigInt (INT64/UINT64)、Date (DATETIME/TIMESTAMP)、および boolean (TINYINT(1)) 型の列には、カスタムの cast 関数を提供する必要があります。デフォルトの cast は通常の整数と浮動小数点数を処理しますが、これらは文字列のままにします)

</critical_requirements>


自動検出: PlanetScale, @planetscale/database, planetscale serverless driver, pscale, deploy request, safe migrations, Vitess, database branching, planetscale branch, planetscale boost, mysql serverless, pscale CLI, planetscale connection

使用する場面:

  • PlanetScale サーバーレスドライバーを介して、エッジ/サーバーレス関数から MySQL をクエリする場合
  • デプロイリクエストと安全なマイグレーションを通じてスキーマ変更を管理する場合
  • 開発、プレビュー、または CI 環境用にデータベースブランチを作成する場合
  • @planetscale/database で接続を設定する場合 (host/username/password または URL)
  • サーバーレスコンテキストでトランザクションを実行する場合
  • Vitess 固有の SQL 互換性の制約を処理する場合
  • pscale CLI を介してプログラムでブランチを管理する場合

カバーする主要なパターン:

  • host、username、password を使用した connect() / Client 接続の設定
  • 位置 (?) および名前付き (:param) パラメータを使用した conn.execute()
  • アトミックな複数ステートメント操作のための conn.transaction()
  • 型安全な値変換のためのカスタム cast 関数 (BigInt、Date、boolean)
  • デプロイリクエストのワークフロー (ブランチ、スキーマの変更、DR の作成、レビュー、デプロイ)
  • 安全なマイグレーションと直接 DDL 禁止モデル
  • 開発/プレビュー/CI 環境のためのデータベースブランチング
  • Vitess SQL の互換性の制約と回避策
  • ブランチとデプロイリクエストの管理のための pscale CLI

使用しない場面:

  • 永続的な TCP MySQL 接続を使用する長時間実行されるサーバープロセス (mysql2 ドライバーを使用)
  • 複雑な ORM 固有のパターン (ORM 独自の skill を使用)
  • 一般的な MySQL クエリ構文 (SQL/MySQL skill を使用)
  • PostgreSQL ワークロード (Neon または別の Postgres プロバイダーを使用)

詳細なリソース:

  • 意思決定フレームワーク、CLI リファレンス、およびクイックルックアップテーブルについては、reference.md を参照してください。

ドライバーとクエリ:

  • examples/core.md -- 接続設定、パラメータ化されたクエリ、トランザクション、型キャスト

ブランチングとスキーマ変更:

  • examples/branching.md -- 開発ブランチ、デプロイリクエスト、安全なマイグレーション、pscale CLI、CI/CD ワークフロー

<philosophy>

Philosophy

PlanetScale は、YouTube のデータベースインフラストラクチャを支えるのと同じテクノロジーである Vitess 上に構築されたサーバーレス MySQL プラットフォームです。@planetscale/database ドライバーは、TCP の代わりに HTTP (Fetch API) を使用するため、TCP をサポートしていないエッジランタイムから MySQL にアクセスできます。

コア原則:

  1. HTTP ベースのステートレス接続 -- すべてのクエリは HTTP リクエストです。管理する永続的な接続はなく、設定する接続プールもありません。接続を作成し、クエリを実行して完了です。PlanetScale は、インフラストラクチャレベル (Vitess VTTablet + グローバルルーティング) で接続プーリングを処理します。
  2. デプロイリクエストによるスキーマ変更、直接 DDL は絶対に行わない -- 安全なマイグレーションを使用する本番ブランチは、直接 CREATEALTERDROP ステートメントを拒否します。すべてのスキーマ変更はデプロイリクエストを介して行われます。ブランチを作成し、ブランチでスキーマを変更し、デプロイリクエストを作成し、差分を確認し、オンライン DDL を介してダウンタイムなしでデプロイします。
  3. ブランチは安価 -- データベースブランチは、スキーマ (およびオプションでデータ) の分離されたコピーです。機能開発、PR プレビュー、CI 実行のために作成します。完了したら削除します。
  4. Vitess の内部動作 -- PlanetScale は Vitess を実行します。これにより、水平スケーリングが追加されますが、SQL の互換性の違いが生じます。ストアドプロシージャ、DDL の RENAME COLUMN:= 演算子はありません。外部キーはサポートされていますが、オプトインであり、パフォーマンス上のトレードオフがあります。
  5. デフォルトの cast は一般的な型を処理し、残りはカスタマイズする -- ドライバーの組み込み cast 関数は、INT8-32 および FLOAT32/64 を JavaScript の数値に自動的に変換し、JSON を解析します。ただし、INT64/UINT64 (BigInt)、DATETIME/TIMESTAMP (Date)、DECIMAL、および TINYINT(1) (boolean) は文字列のままです。これらにはカスタムの cast 関数を提供してください。

PlanetScale サーバーレスドライバーを使用する場面:

  • TCP 接続を開くことができないエッジ/サーバーレス関数
  • PlanetScale のブランチングとデプロイリクエストのワークフローを使用するアプリケーション
  • PlanetScale のインフラストラクチャレベルのプーリングの恩恵を受ける高並行サーバーレスアプリ
  • git のようなデータベースワークフロー (ブランチ、レビュー、マージ) を必要とするチーム

使用しない場面:

  • 長時間実行されるサーバープロセス (mysql2 を TCP で使用して永続化

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

PlanetScale Serverless MySQL Patterns

Quick Guide: Use @planetscale/database for edge/serverless MySQL access via HTTP (Fetch API). Use Client to create per-request connections, conn.execute() for parameterized queries, and conn.transaction() for atomic operations. Never run DDL directly on production -- use deploy requests with safe migrations enabled. PlanetScale runs on Vitess: foreign keys are supported but opt-in, stored procedures are not supported, and all schema changes go through online DDL. The built-in cast handles regular integers and floats automatically, but provide a custom cast for BigInt, Date, and boolean columns. Branch your database like git branches for dev/preview environments.


<critical_requirements>

CRITICAL: Before Using This Skill

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST use conn.execute(sql, params) with parameterized queries -- never interpolate user input into SQL strings)

(You MUST use deploy requests for ALL schema changes on production branches with safe migrations enabled -- direct DDL is rejected)

(You MUST create a fresh Client.connection() per request in serverless environments -- do not reuse connections across invocations)

(You MUST handle the Vitess/MySQL compatibility differences: no stored procedures, no RENAME COLUMN via direct DDL, no := operator, no LOAD DATA INFILE)

(You MUST provide a custom cast function for BigInt (INT64/UINT64), Date (DATETIME/TIMESTAMP), and boolean (TINYINT(1)) columns -- the default cast handles regular integers and floats but leaves these as strings)

</critical_requirements>


Auto-detection: PlanetScale, @planetscale/database, planetscale serverless driver, pscale, deploy request, safe migrations, Vitess, database branching, planetscale branch, planetscale boost, mysql serverless, pscale CLI, planetscale connection

When to use:

  • Querying MySQL from edge/serverless functions via the PlanetScale serverless driver
  • Managing schema changes through deploy requests and safe migrations
  • Creating database branches for dev, preview, or CI environments
  • Setting up connections with @planetscale/database (host/username/password or URL)
  • Running transactions in serverless contexts
  • Handling Vitess-specific SQL compatibility constraints
  • Programmatic branch management via pscale CLI

Key patterns covered:

  • connect() / Client connection setup with host, username, password
  • conn.execute() with positional (?) and named (:param) parameters
  • conn.transaction() for atomic multi-statement operations
  • Custom cast functions for type-safe value conversion (BigInt, Date, boolean)
  • Deploy request workflow (branch, change schema, create DR, review, deploy)
  • Safe migrations and the no-direct-DDL enforcement model
  • Database branching for dev/preview/CI environments
  • Vitess SQL compatibility constraints and workarounds
  • pscale CLI for branch and deploy request management

When NOT to use:

  • Long-running server processes with persistent TCP MySQL connections (use mysql2 driver)
  • Complex ORM-specific patterns (use your ORM's own skill)
  • General MySQL query syntax (use a SQL/MySQL skill)
  • PostgreSQL workloads (use Neon or another Postgres provider)

Detailed Resources:

  • For decision frameworks, CLI reference, and quick lookup tables, see reference.md

Driver & Queries:

  • examples/core.md -- Connection setup, parameterized queries, transactions, type casting

Branching & Schema Changes:


<philosophy>

Philosophy

PlanetScale is a serverless MySQL platform built on Vitess, the same technology that powers YouTube's database infrastructure. The @planetscale/database driver uses HTTP (Fetch API) instead of TCP, making MySQL accessible from edge runtimes that lack TCP support.

Core principles:

  1. HTTP-based, stateless connections -- Every query is an HTTP request. There are no persistent connections to manage, no connection pools to configure. Create a connection, execute queries, done. PlanetScale handles connection pooling at the infrastructure level (Vitess VTTablet + Global Routing).
  2. Schema changes via deploy requests, never direct DDL -- Production branches with safe migrations reject direct CREATE, ALTER, DROP statements. All schema changes go through deploy requests: branch, modify schema on the branch, create a deploy request, review the diff, deploy with zero downtime via online DDL.
  3. Branches are cheap -- Database branches are isolated copies of your schema (and optionally data). Create them for feature development, PR previews, CI runs. Delete when done.
  4. Vitess under the hood -- PlanetScale runs Vitess, which adds horizontal scaling but introduces SQL compatibility differences. No stored procedures, no RENAME COLUMN in DDL, no := operator. Foreign keys are supported but opt-in and come with performance trade-offs.
  5. Default cast handles common types, customize for the rest -- The driver's built-in cast function automatically converts INT8-32 and FLOAT32/64 to JavaScript numbers, and parses JSON. However, INT64/UINT64 (BigInt), DATETIME/TIMESTAMP (Date), DECIMAL, and TINYINT(1) (boolean) remain as strings -- provide a custom cast function for these.

When to use PlanetScale serverless driver:

  • Edge/serverless functions that cannot open TCP connections
  • Applications using PlanetScale's branching and deploy request workflow
  • High-concurrency serverless apps benefiting from PlanetScale's infrastructure-level pooling
  • Teams wanting git-like database workflows (branch, review, merge)

When NOT to use:

  • Long-running server processes (use mysql2 with TCP for persistent connections)
  • Workloads requiring stored procedures, triggers, or events (Vitess does not support them)
  • Applications requiring LOAD DATA INFILE (not supported)

</philosophy>


<patterns>

Core Patterns

Pattern 1: Connection Setup

The driver provides two connection methods: connect() for a single connection and Client for a connection factory. Use Client in serverless (fresh connection per request), connect() for single long-lived connection objects.

import { connect } from "@planetscale/database";

const conn = connect({
  host: process.env.DATABASE_HOST!,
  username: process.env.DATABASE_USERNAME!,
  password: process.env.DATABASE_PASSWORD!,
});
const { rows } = await conn.execute(
  "SELECT id, name FROM users WHERE active = ?",
  [true],
);

See examples/core.md for full connection patterns including Client factory, URL-based config, and custom fetch for HTTP/2.


Pattern 2: Parameterized Queries

The driver supports positional (?) and named (:param) parameter styles. Both are auto-escaped preventing SQL injection. Never mix styles in a single execute() call.

// Positional: array of values
await conn.execute("SELECT id, name FROM users WHERE id = ? AND active = ?", [
  userId,
  true,
]);

// Named: object of values
await conn.execute("SELECT id, name FROM users WHERE role = :role", {
  role: "admin",
});

See examples/core.md for complex named parameter queries and bad examples to avoid.


Pattern 3: Transactions

conn.transaction() executes multiple queries atomically with automatic rollback on error. Each tx.execute() is an HTTP round trip, but conditional logic runs client-side within the callback.

const result = await conn.transaction(async (tx) => {
  const debit = await tx.execute(
    "UPDATE accounts SET balance = balance - ? WHERE id = ? AND balance >= ?",
    [amount, fromId, amount],
  );
  if (debit.rowsAffected === 0) throw new Error("Insufficient funds"); // triggers rollback
  await tx.execute("UPDATE accounts SET balance = balance + ? WHERE id = ?", [
    amount,
    toId,
  ]);
  return debit;
});

See examples/core.md for full transaction examples with inventory checks and FOR UPDATE locking.


Pattern 4: Custom Type Casting

The built-in cast handles INT8-32 and FLOAT32/64 automatically. Provide a custom cast for INT64/UINT64 (BigInt), DATETIME/TIMESTAMP (Date), and TINYINT(1) (boolean) -- these remain as strings by default.

import { connect, cast } from "@planetscale/database";
import type { Field } from "@planetscale/database";

function customCast(field: Field, value: any): any {
  if (value == null) return null;
  if (field.type === "INT64" || field.type === "UINT64") return BigInt(value);
  if (field.type === "DATETIME" || field.type === "TIMESTAMP")
    return new Date(value + "Z");
  if (field.type === "INT8" && field.columnLength === 1) return value === "1";
  return cast(field, value);
}

const conn = connect({ url: process.env.DATABASE_URL, cast: customCast });

See examples/core.md for per-query cast overrides and type-specific cast variants.


Pattern 5: Deploy Request Workflow

Schema changes on production branches with safe migrations must go through deploy requests. Direct DDL is rejected. The workflow is: branch, modify schema, create deploy request, review diff, deploy.

pscale branch create my-database add-user-roles          # 1. Create dev branch
pscale shell my-database add-user-roles                  # 2. Make schema changes (DDL)
pscale deploy-request create my-database add-user-roles --into main  # 3. Create DR
pscale deploy-request diff my-database 1                 # 4. Review schema diff
pscale deploy-request deploy my-database 1               # 5. Deploy (online DDL)
pscale deploy-request revert my-database 1               # 6. Revert within 30 min if needed

See examples/branching.md for gated deployments, instant deployments, and CI/CD workflows.


Pattern 6: Database Branching

Branches are isolated copies of your database schema. Development branches allow direct DDL. Production branches require deploy requests when safe migrations is enabled.

pscale branch create my-database dev-alice               # Create dev branch
pscale shell my-database dev-alice                       # Interactive MySQL shell
pscale password create my-database dev-alice my-password # Generate app credentials
pscale branch delete my-database dev-alice               # Clean up when done

See examples/branching.md for PR preview branches, safe column renames, FK setup, and branch cleanup scripts.


Pattern 7: Vitess SQL Compatibility

PlanetScale runs on Vitess, which introduces SQL differences from standard MySQL. Key constraints: no stored procedures/triggers/events, no RENAME COLUMN (use three-step add/migrate/drop pattern), no := operator, no LOAD DATA INFILE, no CREATE DATABASE.

See reference.md for the full supported/unsupported SQL compatibility table.

</patterns>


<decision_framework>

Decision Framework

Connection Method

What is the runtime environment?
+-- Edge/serverless (Cloudflare Workers, Vercel Edge, etc.)
|   +-- Use @planetscale/database (HTTP-based, no TCP needed)
+-- Traditional Node.js server (always-on)
|   +-- Need PlanetScale branching/deploy workflow?
|   |   +-- YES --> @planetscale/database works fine (HTTP)
|   |   +-- NO --> mysql2 driver with TCP may be simpler
+-- ORM integration?
    +-- Check your ORM's docs for its PlanetScale/serverless adapter

connect() vs Client

How many connections per process?
+-- Single connection (scripts, simple handlers) --> connect()
+-- Multiple connections (serverless, per-request) --> Client + client.connection()

Schema Change Strategy

Is the target branch a production branch with safe migrations?
+-- YES --> Deploy requests ONLY (direct DDL is rejected)
|   +-- Simple change (add column, add index) --> Standard deploy request
|   +-- Needs controlled cutover timing --> Gated deployment (--disable-auto-apply)
|   +-- Instant-eligible change --> Deploy with --instant flag
+-- NO (development branch) --> Direct DDL is allowed
    +-- Experimenting --> pscale shell <db> <branch>
    +-- Scripted migration --> Connect to branch, run DDL

Foreign Keys

Do you need foreign key constraints?
+-- YES --> Enable in database settings (opt-in)
|   +-- Aware of limitations?
|   |   +-- Deploy requests don't validate existing referential integrity
|   |   +-- Reverts can create orphaned rows
|   |   +-- Performance impact in high-concurrency workloads
|   +-- Sharded database? --> FK only supported on unsharded databases
+-- NO --> Use application-level referential integrity
    +-- ORM-level relationship definitions
    +-- Application validation before INSERT/DELETE

</decision_framework>


<red_flags>

RED FLAGS

High Priority Issues:

  • String interpolation in SQL -- conn.execute(\SELECT * FROM users WHERE id = '${id}'`)bypasses parameterization. Always use?or:param` placeholders with the params argument.
  • Direct DDL on production with safe migrations -- ALTER TABLE statements are silently rejected on production branches with safe migrations enabled. All schema changes must go through deploy requests.
  • No custom cast for BigInt/Date columns -- The default cast handles regular integers and floats, but INT64/UINT64 remain as strings and DATETIME/TIMESTAMP are not converted to Date objects. Provide a custom cast for these types.

Medium Priority Issues:

  • Reusing connections across serverless invocations -- Each serverless invocation gets a fresh execution context. Do not store connection state in global variables expecting it to persist.
  • Using RENAME COLUMN in deploy requests -- Column renames can be destructive through Vitess online DDL. Use the three-step pattern: add new column, migrate data, drop old column.
  • Missing revert window awareness -- Deploy requests can be reverted within 30 minutes. After that window closes, you must create a new deploy request to undo changes. Plan accordingly.
  • Foreign keys enabled without understanding implications -- FK constraints on PlanetScale don't validate existing referential integrity during ALTER TABLE ADD FOREIGN KEY. Orphaned rows will silently remain.

Common Mistakes:

  • Wrong package name -- The package is @planetscale/database, not planetscale, mysql-planetscale, or @planetscale/serverless.
  • Expecting connection pooling in the driver -- @planetscale/database does not do client-side connection pooling. PlanetScale handles pooling at the infrastructure level (Vitess VTTablet + Global Routing). Do not wrap it in a pool library.
  • Using positional and named params together -- A single execute() call uses either ? with an array OR :param with an object. Never mix them.
  • Expecting Node.js mysql2 compatibility -- @planetscale/database has a different API from mysql2. There is no pool.query(), no connection.query(). The API is conn.execute(sql, params).
  • Running CREATE DATABASE or DROP DATABASE -- Database creation/deletion is managed via the PlanetScale dashboard, API, or pscale CLI, not SQL.

Gotchas & Edge Cases:

  • INT64/UINT64 and dates remain as strings with the default cast -- SELECT count(*) as total returns { total: 42 } (INT64 is an exception -- it stays as "42" string). DATETIME returns "2024-01-15 10:30:00". Regular INT32 and FLOAT types are auto-converted.
  • rowsAffected is 0 for SELECT -- Only DML statements (INSERT, UPDATE, DELETE) populate rowsAffected. For SELECT, check rows.length or size.
  • insertId is a string -- Even though MySQL auto-increment IDs are integers, insertId in the result is always a string. Cast if needed: BigInt(result.insertId).
  • Transactions over HTTP are not interactive -- Unlike traditional MySQL transactions, PlanetScale's HTTP transactions send all statements in a single request. You CAN use conditional logic within the transaction() callback (it runs client-side), but each tx.execute() is an HTTP round trip.
  • DATETIME values lack timezone -- MySQL DATETIME is stored without timezone info. The driver returns it as a string like "2024-01-15 10:30:00". Append "Z" when parsing as UTC, or handle timezone explicitly.
  • 64KB query limit per execute -- Individual SQL statements have a size limit. For bulk inserts, batch into multiple execute() calls.
  • SQL mode is session-only -- SET sql_mode = '...' only lasts for the current connection. On PlanetScale's HTTP driver, that means a single request. Global SQL mode changes are not allowed.
  • PlanetScale Boost requires explicit opt-in -- Boost query caching is available on Scaler Pro plans and above. Enable per-query via @@boost_cached_queries = true in a session SET before the boosted query. Not all queries are eligible.
  • Empty schemas are invalid -- Production branches require at least one table. You cannot have an empty database on a production branch.
  • Instant deployments cannot be reverted -- Using --instant on a deploy request uses MySQL's ALGORITHM=INSTANT and skips the revert window entirely.

</red_flags>


<critical_reminders>

CRITICAL REMINDERS

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST use conn.execute(sql, params) with parameterized queries -- never interpolate user input into SQL strings)

(You MUST use deploy requests for ALL schema changes on production branches with safe migrations enabled -- direct DDL is rejected)

(You MUST create a fresh Client.connection() per request in serverless environments -- do not reuse connections across invocations)

(You MUST handle the Vitess/MySQL compatibility differences: no stored procedures, no RENAME COLUMN via direct DDL, no := operator, no LOAD DATA INFILE)

(You MUST provide a custom cast function for BigInt (INT64/UINT64), Date (DATETIME/TIMESTAMP), and boolean (TINYINT(1)) columns -- the default cast handles regular integers and floats but leaves these as strings)

Failure to follow these rules will cause SQL injection vulnerabilities, failed deploy requests, or silent type coercion bugs.

</critical_reminders>