본문으로 건너뛰기
cccskills
무료GitHub에 공개

migration

Guide database structure changes in a project using Drizzle and node-pg-migrate. Covers generating and reviewing migration files, checking compatibility during deployment, handling indexes separately, and validating changes before applying them to shared databases.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

설치 방법 보기

이럴 때 유용합니다

  • Adding or changing database tables and columns
  • Creating or removing indexes on existing tables
  • Reviewing compatibility during staged schema changes
  • Checking migration files before sharing changes

포함된 파일(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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Review Slack access requests against Okta role and team information, then prepare narrowly scoped GitHub or AWS IAM permissions. Apply changes only after an eligible person's approval and record the grant, reasoning, approver, and timestamp.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Reviewing GitHub repository access requests from Slack
  • Preparing AWS IAM permissions for a specific task
  • Routing sensitive access requests for additional review
kortix-ai/suna2만2026년 10월 19일 업데이트

Research companies and people before outreach or meetings. Combines business profiles, recent news, hiring signals, and key contacts into a sourced brief with talking points and suggested questions, adding relationship history when CRM data is connected.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Research a prospective customer before outreach
  • Prepare background information for meeting attendees
  • Compare a competitor's products and positioning
kortix-ai/suna2만2026년 10월 19일 업데이트

Review daily Google Ads and Meta Ads results for budget pacing, declining performance, and unusual activity. Get prioritized findings with supporting numbers and concrete recommendations for a marketing team to assess and carry out.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking whether campaign budgets are being spent on schedule
  • Investigating rising acquisition costs or falling ad returns
  • Finding ads and keywords that spend without converting
kortix-ai/suna2만2026년 10월 19일 업데이트

Automate website tasks such as navigating pages, filling forms, clicking buttons, taking screenshots, and extracting data. The skill also supports web app testing, with specialized guides for Electron desktop apps, Slack, and cloud browsers.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Automate form entry and page navigation
  • Capture screenshots and extract page data
  • Explore web apps for bugs
kortix-ai/suna2만2026년 10월 19일 업데이트

Process emailed vendor invoices by extracting details, comparing them with purchase orders and invoice history, and recording duplicates, overcharges, or missing orders. Summarize results in Slack for human review; payment approval and execution remain with people.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking incoming invoices against purchase orders
  • Finding duplicate invoices and likely resends
  • Reviewing unit prices and remaining order balances
kortix-ai/suna2만2026년 10월 19일 업데이트

billing

무료

Guide changes to Kortix billing code, admin controls, and pricing screens. Explain how plans, trials, enterprise contracts, and access exceptions should work, where pricing is defined, and which audited routes must handle account changes.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Update billing logic and its specification together
  • Review how trials and enterprise contracts are handled
  • Find the code that defines prices and allowances
kortix-ai/suna2만2026년 10월 19일 업데이트

kortix-ai의 스킬 모두 보기

이 스킬의 문제 신고