Skip to main content

Adds SQL Output and a Rules system to Django Migrations

Project description

Django Better Migrations

Deployed to PyPI GitHub Repository Continuous Integration MIT License

This project aims at providing improvements to Django's default migration system.

More informations in the documentation, see "docs/" folder.

Example

See below migration, generated automatically via manage.py makemigrations:

# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-12-01 00:00
from __future__ import unicode_literals

from django.db import migrations, models


# Generated SQL code (sqlite):
#
# --
# -- Create model Person
# --
# CREATE TABLE "example_app_person" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "name" varchar(100) NOT NULL);
#

# Check results:
# CHECK OK: No ALTER TABLE ADD COLUMN with non-NULL constraint
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
    ]

License

MIT, see LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_better_migrations-1.0.3.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

django_better_migrations-1.0.3-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page