db-migrator

A database-change assistant for Supabase or Prisma, tools used to manage application databases. It handles migrations, which are recorded changes to tables, indexes, and access rules.

In plain words
What is it for?
Use it when adding tables, changing a database schema, creating indexes, or configuring row-level security policies.
Why use it?
It provides a repeatable process for checking the existing schema, creating the change, applying it, and verifying the result.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/kensaurus/cursor-kenji/db-migrator
Clone the repo
git clone --depth 1 https://github.com/kensaurus/cursor-kenji
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 809 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00809
Opus 5 $0.00020 $0.00404
Sonnet 5 $0.00008 $0.00162
Haiku 4.5 $0.00004 $0.00081

Measured 3d ago against content hash c795fb4283f3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

db-migrator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/db-migrator.md · 125 lines

How it starts

The opening of the file, as written. The whole thing — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When Invoked

  1. Understand the schema change needed
  2. Check existing schema and migrations
  3. Generate migration SQL
  4. Apply and verify

Pre-Migration Checklist

# Check existing schema
ls -la supabase/migrations/ | tail -10
# Check current tables (Supabase MCP)
# Review related migrations for naming patterns

Migration Standards

File Naming

supabase/migrations/YYYYMMDD_description.sql

Example: 20260208_add_user_profiles.sql

Required Elements for Every Table

-- 1. UUID primary key
CREATE TABLE table_name (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  
  -- 2. Your columns here
  name TEXT NOT NULL,
  status TEXT NOT NULL DEFAULT 'active',
  
  -- 3. Always include timestamps
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- 4. Auto-update trigger for updated_at
CREATE TRIGGER set_updated_at
  BEFORE UPDATE ON table_name
  FOR EACH ROW EXECUTE FUNCTION moddatetime(updated_at);

-- 5. Indexes on foreign keys and frequently queried columns
CREATE INDEX idx_table_name_status ON table_name(status);

-- 6. RLS — MANDATORY on every table
ALTER TABLE table_name ENABLE ROW LEVEL SECURITY;

-- 7. RLS policies
CREATE POLICY "Users can read own data" ON table_name
  FOR SELECT USING (auth.uid() = user_id);

CREATE POLICY "Users can insert own data" ON table_name
  FOR INSERT WITH CHECK (auth.uid() = user_id);

CREATE POLICY "Users can update own data" ON table_name
  FOR UPDATE USING (auth.uid() = user_id)
  WITH CHECK (auth.uid() = user_id);

Column Type Guide

Data Use Don't Use
IDs UUID SERIAL, TEXT
Money DECIMAL(10,2) FLOAT, REAL
Timestamps TIMESTAMPTZ TIMESTAMP
Status/enum TEXT + CHECK or PG ENUM Unconstrained TEXT
JSON data JSONB JSON, TEXT
Boolean BOOLEAN INT, TEXT

ALTER TABLE Patterns

-- Add column (safe, non-breaking)
ALTER TABLE users ADD COLUMN bio TEXT;

-- Add column with default (safe)
ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user';

-- Add NOT NULL to existing (requires backfill first)
UPDATE users SET bio = '' WHERE bio IS NULL;
ALTER TABLE users ALTER COLUMN bio SET NOT NULL;

-- Rename column (breaking — update app code first)
ALTER TABLE users RENAME COLUMN name TO full_name;

-- Add index (non-blocking)
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);

Read the full file on GitHub · 125 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 125 lines · 41 tokens per session scan A c795fb4283f3

Subscribe to this mod's changes

db-migrator is an agent published in the GitHub repository kensaurus/cursor-kenji (9 stars, last pushed 5d ago), licensed MIT. It adds 41 tokens to every session and 809 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.