PREFERRED APPROACH: Smart schema sync script that detects and applies only missing changes.
scripts/sync-production-schema.py for production deployments✅ Advantages:
❌ Alembic Migration Problems:
# Show what would change WITHOUT applying
python scripts/sync-production-schema.py --dry-run
# Output shows:
# ✓ Tables/columns that already exist (skipped)
# ℹ New tables/columns that would be created
# ⚠ Any potential issues
# Apply changes to production database
export DATABASE_URL="postgresql://..."
python scripts/sync-production-schema.py --apply
# Connect and verify schema
psql "$DATABASE_URL" -c "\dt" # List tables
psql "$DATABASE_URL" -c "\d table_name" # Describe table
/Users/tobymorning/Desktop/core/scripts/sync-production-schema.py/Users/tobymorning/Desktop/core/docs/deployment/SCHEMA_SYNC_GUIDE.md小蔥技能站7w4.net每天更新,海量AI技能等你發現。
/Users/tobymorning/Desktop/core/src/backend/alembic/versions/src/backend/app/models/scripts/sync-production-schema.pydocs/deployment/SCHEMA_SYNC_GUIDE.md with new table info--dry-run firstsrc/backend/app/models/--dry-run firstRailway Deployment:
# In Procfile or deploy script
release: python scripts/sync-production-schema.py --apply
GitHub Actions:
- name: Sync Production Schema
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: python scripts/sync-production-schema.py --apply
alembic upgrade head in productionscripts/sync-production-schema.py for schema changes--dry-run before --applyTHIS IS A REQUIRED STANDARD. USE SCHEMA SYNC SCRIPT FOR ALL DATABASE CHANGES.
See references/sync-vs-alembic.md for detailed comparison of sync script vs Alembic migrations.
See references/workflow-examples.md for code examples of adding tables, columns, indexes, and handling complex migrations.
Run scripts/verify-sync-script.sh to validate that sync script exists and is properly configured.
這個 Skill 的文件質量不錯,講解了資料庫管理的安全規範和最佳實踐,但對實際使用幫助有限。主要問題是文件引用了特定的本地路徑,通用性不足,而且缺少可以實際執行的指令碼程式碼。如果你需要這個工具,建議先確認專案中是否已有對應的同步指令碼,否則可能需要額外的工作來適配。整體來說,這是一個思路清晰但依賴外部實現的 Skill 包。