sailfork / t3code-github / .repos/ alchemy-effect/ website/ src/ content/ docs/ sql/ index.mdx

Choose a database

See Databases to compare engines and connection paths, with links directly to each database's setup guide.

Choose a client

ClientGuides
Effect SQLPostgres · MySQL · D1 · libSQL · Durable Objects
DrizzlePostgres · MySQL · D1 · libSQL · Durable Objects
Prisma ORM v8Contracts · Postgres · Migrations

Prisma ORM v8 requires PostgreSQL 17+ and is separate from the Prisma hosting provider.

Find an integration

IntegrationGuide
Lambda + Aurora PostgreSQL + DrizzleAWS
Lambda + Aurora DSQL + DrizzleAWS
Workers + Neon or PlanetScale + DrizzleCloudflare
Workers + D1 + DrizzleCloudflare
Workers + Turso + DrizzleTurso
Durable Objects + SQLiteCloudflare
Fly Service + Postgres + DrizzleFly
Hetzner Service + external Postgres + DrizzleHetzner
Prisma Compute + Postgres + DrizzlePrisma
Railway Service + Postgres + DrizzleRailway
Railway Service + MySQL + DrizzleRailway
Workers + Neon + Prisma ORMCloudflare

See runnable examples for complete projects.

Already have a database?

import * as SQL from "@alchemy.run/sql/Postgres";
import * as Config from "effect/Config";
import * as Effect from "effect/Effect";

const query = Effect.gen(function* () {
  const sql = yield* SQL.Postgres({ url: Config.Redacted("DATABASE_URL") });
  return yield* sql`SELECT 1 AS value`;
});

Run queries within the application's execution scope, or use Effect.scoped in a standalone program; see connection lifecycle.

Manage schema changes

Generate migrations when schemas change, stage and review the schema, SQL, and snapshots with git diff --cached, then commit them before deployment. Apply the committed files using the selected database's workflow.

SQL files · Drizzle migrations · Prisma migrations