本文へ移動
cccskills
無料GitHub で公開

migration

How to change the database schema in this repo. Current engine: node-pg-migrate, with SQL generated from Drizzle schema changes when possible. Load whenever you add/alter/drop a table, column, enum, index, constraint, RLS/function/grant, or any file under packages/db/migrations.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Database migrations

The canonical, detailed runbook is packages/db/MIGRATIONS.md. This skill is a short safety wrapper; if anything here seems incomplete, trust that file and the current package.json scripts.

Also load the learnings skill. It carries the incident rules that apply while WRITING a migration — above all: never backfill data inside a single-transaction .sql migration (2026-08-10 v0.12.7 prod outage; enforced by the backfill-safe lint guard, but the rule explains what to build instead: a batched .concurrent.ts pass or an out-of-band runbook).

Current model

  • Engine: node-pg-migrate, invoked by packages/db/scripts/migrate.ts.
  • Schema source: packages/db/src/schema/kortix.ts for the Drizzle-modeled kortix schema.
  • Migration files: immutable SQL files in packages/db/migrations/, named with a 17-digit UTC timestamp (YYYYMMDDHHMMSSmmm_slug.sql).
  • Applied-state table: kortix_migrations.pgmigrations (node-pg-migrate tracks migration names; it does not checksum file contents).
  • Deploy: deploy-dev.yml and deploy-prod.yml run pnpm --filter @kortix/db migrate before the ECS Fargate rollout (infra/scripts/ecs-deploy.sh). Migrations always land before new code.

Rules

  1. Never edit a migration that has been applied anywhere. Write a new migration.
  2. Never use drizzle-kit push or hand-apply production DDL outside the migration flow.
  3. Review every generated SQL file before it reaches a shared DB.
  4. Prefer expand/contract for destructive or compatibility-sensitive changes. Any migration that drops/alters a constraint, unique index, column, or enum value needs a -- mixed-version-safe: <...> (or -- enum-value-checked: <...> for ADD VALUE) annotation, or CI fails it — see MIGRATIONS.md's worked examples (the 20260713220001000 unique-index-drop incident and the sandbox_provider "platinum" enum-drift incident).
  5. Adding an index/dropping an index on an EXISTING table: use pnpm migrate:create <slug> --concurrent (the .concurrent.ts escape hatch), never a plain CREATE INDEX — see MIGRATIONS.md "Roll-forward safety" for why plain SQL migrations structurally can't run CONCURRENTLY here, and the multi-statement pgm.sql() footgun to avoid.
  6. Prod is live: show the exact SQL and get explicit go-ahead before any manual prod migration action.

Commands from repo root

CommandWhat it does
pnpm migrateApply pending migrations using node-pg-migrate.
pnpm migrate:statusList pending migrations; read-only (reads the ledger, never runs a migration); exits non-zero if any are pending.
pnpm migrate:create <slug>Scaffold a hand-written SQL migration with the house-rules template.
pnpm migrate:create <slug> --concurrentScaffold the .concurrent.ts CONCURRENTLY escape hatch.
pnpm migrate:generate <slug>Generate SQL from a kortix.ts schema change and update the Drizzle snapshot.
pnpm migrate:fakeMark pending migrations as applied without running them (for baselining existing envs).
pnpm --filter @kortix/db lintFull local check: filename/order rules + mixed-version/enum-value guard + squawk (deterministic Postgres zero-downtime linter). Run before every push touching packages/db/migrations.
pnpm migrate:lintJust the filename/order/mixed-version/enum-value checks (no squawk, no network).

Safe schema-change loop

  1. Edit packages/db/src/schema/kortix.ts for schema-shape changes, or create a hand-written migration for data/RLS/functions/grants/custom SQL, or a --concurrent migration for index create/drop.
  2. Run pnpm migrate:generate <slug> or pnpm migrate:create <slug> [--concurrent].
  3. Read the SQL top-to-bottom. Stop on accidental DROP, unsafe type changes, immediate NOT NULL on populated tables, non-idempotent backfills, or a missing mixed-version/enum-value annotation.
  4. Run pnpm --filter @kortix/db lint and the relevant package tests/checks.
  5. Apply to a local/throwaway DB before dev/prod when the change is non-trivial.
  6. Commit both the migration SQL and any generated Drizzle snapshot changes.

See packages/db/MIGRATIONS.md for the full baseline, preview/prod behavior, self-hosting command, and failure drill.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Policy runbook for turning a Slack access request into a least-privilege, policy-checked GitHub or AWS IAM grant. Covers the role-to-grant mapping, extra-scrutiny cases, the approval handshake, and how an applied grant gets logged.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

Get a complete picture of any company or person before outreach. This skill always works with web search, and gets significantly better with enrichment and CRM data.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

Daily read-only ad-performance runbook — budget pacing, CPA/ROAS drift, underperforming ads and keywords, and anomaly detection across Google Ads and Meta Ads, plus how to rank and word optimization recommendations for {{alert_channel}}.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

Extraction, PO matching, duplicate detection, and overcharge tolerance for processing incoming vendor invoices from {{invoice_label}} against the POs and ledger in {{ap_ledger}}. Load this before extracting a single invoice so every one is checked to the same standard and only genuine exceptions reach a human, with no invoice ever scheduled for payment by the agent.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

Daily brand-mention monitoring loop for {{brand_terms}}. Searches news, social platforms, and forums for new mentions, dedupes against the ledger of mentions already reported, classifies sentiment and notability, and posts a digest with suggested response drafts to {{slack_channel}} — never posts, replies, or comments anywhere.

日本語の概要は準備中です。原文の説明を表示しています。

kortix-ai/suna2万2026年10月11日 更新

kortix-ai のスキルをすべて見る

このスキルの問題を報告する