Skip to content

PostgresDatabase

Source: src/Planetscale/Postgres/PostgresDatabase.ts

A PostgreSQL PlanetScale database. For MySQL, use MySQLDatabase instead.

Basic PostgreSQL database

const db = yield* Planetscale.PostgresDatabase("MyDb", {
clusterSize: "PS_10",
});

PlanetScale Metal (NVMe)

const db = yield* Planetscale.PostgresDatabase("MyDb", {
clusterSize: "M1_10_AWS_ARM_D_METAL_10",
arch: "arm",
});
const db = yield* Planetscale.PostgresDatabase("MyDb", {
clusterSize: "PS_10",
migrationsDir: "./migrations/postgres",
importFiles: ["./seed/postgres.sql"],
});
import { adopt } from "alchemy/AdoptPolicy";
const db = yield* Planetscale.PostgresDatabase("Existing", {
name: "existing-db",
clusterSize: "PS_10",
}).pipe(adopt());