Skip to content

MySQLBranch

Source: src/Planetscale/MySQL/MySQLBranch.ts

A PlanetScale branch of a {@link MySQLDatabase}. For PostgreSQL branches use {@link PostgresBranch} instead.

Branch from main

const branch = yield* Planetscale.MySQLBranch("Feature123", {
database: "my-db",
parentBranch: "main",
isProduction: false,
});

Branch from a MySQLDatabase resource

const db = yield* Planetscale.MySQLDatabase("MyDb", { clusterSize: "PS_10" });
const branch = yield* Planetscale.MySQLBranch("Feature456", {
database: db,
parentBranch: "main",
isProduction: false,
});
const branch = yield* Planetscale.MySQLBranch("Restored", {
database: "my-db",
parentBranch: "main",
isProduction: true,
backupId: "backup-123",
clusterSize: "PS_10",
});
const branch = yield* Planetscale.MySQLBranch("Feature123", {
database: db,
parentBranch: "main",
isProduction: false,
migrationsDir: "./migrations",
importFiles: ["./seed.sql"],
});