db-migrate
Skill3 starsChanged 9 months agoMITView on GitHub
Use when creating or modifying database schema in Go projects using golang-migrate with PostgreSQL
- Deletes or force-pushes
12 other projects use a version of this.
Adopted by
Most recently taken up by
- suxrobGM/jobpilottheir own version, first seen Oct 3, 2026
- mgiovani/cc-arsenaltheir own version, first seen Sep 25, 2026
- pgnzbl-ux/crucibletheir own version, first seen Aug 27, 2026
- hiromps/claude-skillstheir own version, first seen Aug 4, 2026
- lfrodrigues/packt-claude-code-course-auththeir own version, first seen Jul 15, 2026
- Pradnyeshp/Claude-Skillstheir own version, first seen Jul 6, 2026
Used with
Projects with it also use e2e and ship.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- alexeykrol/claude-code-starter★ 194same name
- suxrobGM/jobpilot★ 81same name
- getsentry/abacus★ 77same name
- lfrodrigues/packt-claude-code-course-auth★ 9same name
- mgiovani/cc-arsenal★ 8same name
- mean-weasel/bullhorn★ 4same name
- pgnzbl-ux/crucible★ 4same name
- amajorai/skills★ 3same name
- Pradnyeshp/Claude-Skills★ 2same name
- bibektimilsina00/runmycrew★ 1same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- adrSkill
- analyticsSkill
- api-contractSkill
- api-designSkill
- ci-pipelineSkill
- claude-mdSkill
- code-qualitySkill
- data-modelSkill
- debugSkill
- deploySkill
- dep-updateSkill
- disk-cleanupSkill
- docker-buildSkill
- eng-leadSkill
- event-drivenSkill
- fullstack-healthcheckSkill
- go-featureSkill
- go-integration-testSkill
- go-refactorSkill
- go-scaffoldSkill
- incident-responseSkill
- interactive-clarifySkill
- observabilitySkill
- onboardingSkill
- product-specSkill
- py-featureSkill
- py-integration-testSkill
- py-migrateSkill
- py-refactorSkill
- py-scaffoldSkill
- react-featureSkill
- react-refactorSkill
- react-scaffoldSkill
- review-codeSkill
- securitySkill
- system-designSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Core principle: Every up.sql must have a working down.sql.
- Distinctive: line 111
Always run the idempotency check:
- Very specific: line 126
REQUIRED: Update CLAUDE.md if new migration commands are added (claude-md)
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database Migrations (golang-migrate)
Overview
Safe, reversible PostgreSQL schema changes using golang-migrate. Every migration must be idempotent and have a working rollback.
Core principle: Every up.sql must have a working down.sql. Verify with up → down → up cycle.
When to Use
- Adding tables, columns, indexes, or constraints
- Modifying existing schema
- Creating enum types
- Adding seed data via migrations
File Naming
migrations/
000001_create_users_table.up.sql
000001_create_users_table.down.sql
000002_add_user_email_index.up.sql
000002_add_user_email_index.down.sqlSequential numbering. Descriptive names. Always pairs.
Makefile Targets
MIGRATE=migrate -path migrations -database "$(DATABASE_URL)"
migrate-up:
$(MIGRATE) up
migrate-down:
$(MIGRATE) down 1
migrate-create:
migrate create -ext sql -dir migrations -seq $(name)
migrate-force:
$(MIGRATE) force $(version)Safe DDL Patterns
-- Tables: always IF NOT EXISTS
CREATE TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Indexes: CONCURRENTLY to avoid locks
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_users_email ON users (email);
-- Columns: nullable first for zero-downtime
ALTER TABLE users ADD COLUMN IF NOT EXISTS phone TEXT;
-- Later migration: backfill, then NOT NULLZero-Downtime Checklist
| Operation | Safe Approach |
| Add column | Add as nullable → backfill → add NOT NULL constraint |
| Drop column | Stop reading → deploy → drop in next migration |
| Rename column | Add new → copy data → update code → drop old |
| Add NOT NULL | Add with DEFAULT first |
| Add index | Use CONCURRENTLY |
| Drop table | Remove all references first |
PostgreSQL Type Conventions
| Go Type | Postgres Type |
uuid.UUID | UUID |
time.Time | TIMESTAMPTZ |
string | TEXT |
int64 | BIGINT |
float64 | DOUBLE PRECISION |
map/struct | JSONB |
bool | BOOLEAN |
Enum Patterns
-- up.sql
CREATE TYPE user_role AS ENUM ('admin', 'member', 'viewer');
ALTER TABLE users ADD COLUMN role user_role NOT NULL DEFAULT 'member';
-- down.sql
ALTER TABLE users DROP COLUMN IF EXISTS role;
DROP TYPE IF EXISTS user_role;
-- Adding values to existing enum (cannot be in transaction)
ALTER TYPE user_role ADD VALUE IF NOT EXISTS 'moderator';Verification
Always run the idempotency check:
make migrate-up && make migrate-down && make migrate-upCommon Mistakes
- Missing
down.sql— always write rollback - Using
VARCHAR(n)— preferTEXTin Postgres TIMESTAMPwithout timezone — always useTIMESTAMPTZ- Non-concurrent index creation on large tables — causes locks
- Adding NOT NULL without DEFAULT — fails on existing rows
Chains
- REQUIRED: Update CLAUDE.md if new migration commands are added (
claude-md)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

