django migrations.com
django migrations.com logo

Django Migrations

Integrates Django migrations across distributed services, enabling coordinated database schema changes and enhanced migr...

Created byApr 23, 2025

Django Migrations MCP Service

A Model Context Protocol (MCP) service for managing Django migrations in distributed environments. This service wraps Django's migration commands and exposes them as MCP endpoints, making it easy to manage migrations across multiple services and integrate with CI/CD pipelines.

Features

  • Check migration status (equivalent to `showmigrations`)
  • Create new migrations with validation (equivalent to `makemigrations`)
  • Apply migrations with safety checks (equivalent to `migrate`)
  • Additional validation and safety checks: - Sequential migration order verification - Conflict detection - Dependency validation - Safety analysis of migration operations

Installation

Local Development

  1. Clone the repository:
  1. Install dependencies:

Configuration

Set the following environment variables:

Usage

Running the Service

  1. Directly with Python:
  1. Using Docker:

MCP Endpoints

  1. Show Migrations:
  1. Make Migrations:
  1. Apply Migrations:

CI/CD Integration

Example GitHub Actions workflow:
Example check_migrations.py script:

Development

Running Tests

Code Style

The project follows PEP 8 guidelines. Format your code using:

License

MIT License. See LICENSE file for details.

Contributing

  1. Fork the repository
  1. Create your feature branch (`git checkout -b feature/amazing-feature`)
  1. Commit your changes (`git commit -m 'Add amazing feature'`)
  1. Push to the branch (`git push origin feature/amazing-feature`)
  1. Open a Pull Request

Docker Usage

The project includes a `docker-commands.json` file that provides structured commands for different deployment scenarios. You can use these commands directly or parse them in your scripts.

Available Docker Configurations

  1. **Redis MCP Server**
  1. **Django Migrations MCP Server**
  1. **Development Environment**
  1. **Testing Environment**
  1. **Production Environment**

Using the Commands Programmatically

You can parse and use the commands programmatically:

Network Setup

  1. **Development Network**
  1. **Production Network**

Using MCP Tools

The service exposes several endpoints that can be accessed via curl or any HTTP client:
  1. **Show Migrations**
  1. **Make Migrations**
  1. **Apply Migrations**