Synaptic SkillsSynapticSkills
MarketplaceSkill GraphCriar SkillMCP ServerPlataformaEnterprise
v0.1.0-beta
Voltar ao Marketplace
DataAvançadoAuto-Sync

Database Migration

porTHIAGONOMA·THIAGONOMA· v2.0.1 · atualizado em 2026-04-12T22:48:18.496Z
84
Score

Cria e executa migrations de banco de dados com zero downtime usando o padrão expand-contract. Suporta Prisma, Knex, Alembic e Flyway com estratégias seguras de rollback para tabelas com bilhões de linhas.

databasemigrationpostgresqlprismaalembiczero-downtimeschema
Linguagens
SQLTypeScriptPython
1.2KStars
89Forks
15.8KUsos
Fork

Documento do Skill

SKILL.mddatabase-migration/workflow
Passo-a-passo detalhado do skill, referenciando as fases cognitivas:
1
SENSE — Identificar mudança e classificar risco
```sql
-- Verificar tamanho da tabela antes de migrar
SELECT reltuples::bigint AS row_estimate
FROM pg_class WHERE relname = 'users';
-- Verificar dependências
SELECT tc.table_name, kcu.column_name, ccu.table_name AS foreign_table
FROM information_schema.table_constraints AS tc
WHERE ccu.table_name = 'target_table';
```
2
CONTEXTUALIZAR — Avaliar estratégia
| Tipo | Risco | Estratégia |
|------|-------|-----------|
| ADD COLUMN nullable | Baixo | Direto, sem downtime |
| ADD COLUMN NOT NULL | Médio | Add nullable → backfill → add constraint |
| ALTER COLUMN TYPE | Alto | Expand-contract ou ghost table |
| DROP COLUMN/TABLE | Crítico | Apenas após contrato com código removido |
3
RECOMMEND — Gerar migration (Prisma)
```typescript
// prisma/migrations/20260411_add_user_status/migration.sql
SET lock_timeout = '5s'; -- CRÍTICO: prevenir cascata de locks
-- Fase 1: Expand (safe)
ALTER TABLE users ADD COLUMN status TEXT;
-- Índice sem lock (demora mais, mas não bloqueia queries)
CREATE INDEX CONCURRENTLY idx_users_status ON users(status);
RESET lock_timeout;
```
4
RECOMMEND — Script de backfill (para ADD NOT NULL)
```python
BATCH_SIZE = 5_000
offset = 0
while True:
updated = db.execute(
"UPDATE users SET status = 'active' "
"WHERE id IN (SELECT id FROM users WHERE status IS NULL LIMIT %s)",
[BATCH_SIZE]).rowcount
if updated == 0:
break
time.sleep(0.1) # pause para não saturar o banco
offset += updated
```
5
EVALUATE — Testar DOWN (rollback)
```sql
-- Testar que o rollback funciona
BEGIN;
-- Aplicar DOWN migration
ALTER TABLE users DROP COLUMN IF EXISTS status;
DROP INDEX CONCURRENTLY IF EXISTS idx_users_status;
ROLLBACK; -- só verificando, não commitando
```
6
REFLECT — Validar e documentar
Confirmar integridade: contagem de linhas, constraints, foreign keys
Adicionar ao CHANGELOG com data, autor e ticket de referência
Reportar telemetria via mcp-skillschain

Telemetria de Agentes

Execuções
0
total
Taxa de Sucesso
0%
últimos 30d
Latência Média
0.0s
p50
Alucinação
0.0%
detecção
Tokens Entrada
0
avg 0/exec
Tokens Saída
0
avg 0/exec

Uso por Plataforma

Skills Relacionados

Depende deSQL Query Builder
24%
Hebbian Synapse
Composite0.240
w = 0.3·α + 0.5·β + 0.2·γ
91
Depende deDatabase Connector
24%
Hebbian Synapse
Composite0.240
w = 0.3·α + 0.5·β + 0.2·γ
88
Compõe com ←ETL Pipeline Builder
21%
Hebbian Synapse
Composite0.210
w = 0.3·α + 0.5·β + 0.2·γ
86
Similar a ←Requirements for Outputs
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
83
Similar a ←SQL Query Builder
15%
Hebbian Synapse
Composite0.150
w = 0.3·α + 0.5·β + 0.2·γ
91
Similar a ←BigQuery Pipeline Audit: Cost, Safety and Production Readiness
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
80
Similar a ←Azure Cosmos DB NoSQL Data Modeling Expert System Prompt
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
83
Similar a ←When to Use This Skill
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
80
Similar a ←Geofeed Tuner – Create Better IP Geolocation Feeds
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
80
Similar a ←Migrating Stored Procedures from Oracle to PostgreSQL
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
82
Similar a ←Oracle-to-PostgreSQL Database Migration
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
82
Similar a ←Shuffle JSON Data
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
79
Similar a ←Snowflake Semantic Views
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
82
Similar a ←SQL Performance Optimization Assistant
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
87
Similar a ←Schema Markup
60%
Hebbian Synapse
Composite0.600
w = 0.3·α + 0.5·β + 0.2·γ
83
Co-executedSQL Query Builder
26%
Hebbian Synapse
Composite0.262
w = 0.3·α + 0.5·β + 0.2·γ
91
Co-executed ←Database Connector
26%
Hebbian Synapse
Composite0.262
w = 0.3·α + 0.5·β + 0.2·γ
88
Co-executed ←BigQuery Pipeline Audit: Cost, Safety and Production Readiness
47%
Hebbian Synapse
Composite0.475
w = 0.3·α + 0.5·β + 0.2·γ
80
Co-executed ←Azure Cosmos DB NoSQL Data Modeling Expert System Prompt
47%
Hebbian Synapse
Composite0.475
w = 0.3·α + 0.5·β + 0.2·γ
83

Árvore do Skill

Database Migration
database-migration
Fases Cognitivas6
1.SENSE: Percepção
2.CONTEXTUALIZE: Contextualização
3.HYPOTHESIZE: Hipótese
4.EVALUATE: Avaliação
5.RECOMMEND: Recomendação
6.REFLECT: Reflexão
Triggers16
create migrationcriar migraçãoalter tableschema changemigrar bancodatabase migrationdb migrationschema migrationadd columndrop tablezero downtime migrationexpand contract patternflyway migrationalembic migrateprisma migratebackfill data

Avaliar este Skill

Score Breakdown

⭐Avaliação Humana0%
🤖Sucesso de Agentes0%
🕐Atualidade100%
🔗Saúde de Dependências100%
🕸️Centralidade no Grafo0%
🛡️Segurança50%
CompositeScore = α·Humano + β·Agente + γ·Recência + δ·Deps + ε·Centralidade + ζ·Segurança

Instalação

$ synaptic mcp download database-migration
$ synaptic skills detail database-migration
$ synaptic skills live database-migration

Links

GitHub Repository