Recipe: Postgres schema writer with indexes
Generate production-ready DDL with Meridian's schema agent. Indexes, constraints, and sane defaults — no ORM required.
-- users
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT NOT NULL UNIQUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_users_email ON users (email);
-- sessions
CREATE TABLE sessions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
token_hash TEXT NOT NULL,
expires_at TIMESTAMPTZ NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_sessions_user ON sessions (user_id);
CREATE INDEX idx_sessions_expires ON sessions (expires_at);Why this matters
Every Meridian recipe ships with index recommendations tuned for real query patterns. No guesswork — the agent reads your access patterns and emits covering indexes where they count.
Usage
Paste the output directly into psql or pipe it through your migration tool. Every table gets a UUID primary key, timestamps, and foreign keys with cascading deletes where appropriate.