MySQLDatabase
Source:
src/Planetscale/MySQL/MySQLDatabase.ts
A MySQL PlanetScale database (powered by Vitess). For PostgreSQL use {@link PostgresDatabase} instead.
Creating a MySQL Database
Section titled “Creating a MySQL Database”Basic MySQL database
const db = yield* Planetscale.MySQLDatabase("MyDb", { clusterSize: "PS_10",});MySQL with Vitess migration tooling
const db = yield* Planetscale.MySQLDatabase("MyDb", { clusterSize: "PS_10", automaticMigrations: true, migrationFramework: "rails", migrationTableName: "schema_migrations", allowDataBranching: true,});Migrations and seed data
Section titled “Migrations and seed data”const db = yield* Planetscale.MySQLDatabase("MyDb", { clusterSize: "PS_10", migrationsDir: "./migrations/mysql", importFiles: ["./seed/mysql.sql"],});Adoption
Section titled “Adoption”import { adopt } from "alchemy/AdoptPolicy";
const db = yield* Planetscale.MySQLDatabase("Existing", { name: "existing-db", clusterSize: "PS_10",}).pipe(adopt());