feat: Add comprehensive database migration tooling#38
Merged
Conversation
Adds scripts, documentation, and Makefile commands for managing database migrations with Alembic. What's Changed: - Add db_migrate.py script for migration management - Add db_init.py script for database initialization - Add comprehensive DATABASE_MIGRATIONS.md documentation - Update Makefile with new migration commands - Deprecate old Makefile commands with migration path Features: - Database initialization with extension support (uuid-ossp, pgcrypto) - Migration creation with autogeneration from models - Upgrade/downgrade operations with revision targeting - Migration history and status viewing - Comprehensive documentation with examples and best practices - Simple CLI interface for all migration operations New Commands: - make db-init: Initialize database and extensions - make db-create MESSAGE="...": Create new migration - make db-upgrade: Upgrade to latest schema - make db-downgrade REV=...: Downgrade to specific revision - make db-current: Show current schema version - make db-history: Show migration history - make db-reset: Reset and rebuild schema Scripts: - scripts/db_init.py: Creates database and installs extensions - scripts/db_migrate.py: Unified migration management interface Documentation includes: - Quick start guide - Migration creation patterns - Common operations - Production deployment guide - Troubleshooting section - Best practices 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What's Included
Migration Management Script
Database Initialization Script
Comprehensive Documentation
Updated Makefile Commands
Usage Examples
Initialize New Database
Create New Migration
Upgrade Database
View Migration Status
Rollback Changes
Documentation Highlights
The guide includes:
Scripts Features
db_migrate.py
db_init.py
Test Plan
Migration Path
Existing Makefile commands continue to work with deprecation warnings:
make db-migrate→ Usemake db-upgradeinsteadmake db-revision MSG="..."→ Usemake db-create MESSAGE="..."insteadThis ensures backward compatibility while encouraging adoption of the new, clearer command names.
🤖 Generated with Claude Code