PlanetScale
PlanetScale is a serverless database platform based on MySQL that provides horizontal scaling, branching workflows, and zero-downtime schema changes. Alchemy provides resources to manage PlanetScale databases and branches programmatically.
Official PlanetScale Documentation | PlanetScale API Reference
Resources
Section titled “Resources”- Database - Create and manage PlanetScale databases with configuration options
- Branch - Create and manage database branches for development workflows
Example Usage
Section titled “Example Usage”import { Database, Branch } from "alchemy/planetscale";
// Create a databaseconst database = await Database("my-app-db", { name: "my-app-db", organizationId: "my-org", clusterSize: "PS_10", allowDataBranching: true, automaticMigrations: true,});
// Create a development branchconst devBranch = await Branch("feature-123", { name: "feature-123", organizationId: "my-org", databaseName: database.name, parentBranch: "main", isProduction: false,});
// Create a production branch from a backupconst prodBranch = await Branch("production", { name: "production", organizationId: "my-org", databaseName: database.name, parentBranch: "main", isProduction: true, clusterSize: "PS_20", backupId: "backup-123",});