Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

django-migrations-plus

Migrations Plus provides a method to run raw SQL in Django migrations with multiple DB connections.

Install

Using pip:

$ pip install django-migrations-plus

API

RunSQL(sql, reverse_sql=None, state_operations=None, db='default')

Allows running of arbitrary SQL on the database - useful for more advanced features of database backends that Django doesn’t support directly, like partial indexes.

sql, and reverse_sql if provided, should be strings of SQL to run on the database. On most database backends (all but PostgreSQL), Django will split the SQL into individual statements prior to executing them. This requires installing the sqlparse Python library.

The state_operations argument is so you can supply operations that are equivalent to the SQL in terms of project state; for example, if you are manually creating a column, you should pass in a list containing an AddField operation here so that the autodetector still has an up-to-date state of the model (otherwise, when you next run makemigrations, it won’t see any operation that adds that field and so will try to run it again).

db should be a string with the name of the connection from your settings you want to run your SQL on.

Example

from django.db import migrations
import migrations_plus


class Migration(migrations.Migration):

    operations = [
        migrations_plus.RunSQL('DROP TABLE Students;')  # Runs only against connection 'default'
        migrations_plus.RunSQL('DROP TABLE OtherStudents;', db='other')  # Runs only against connection 'other'
    ]

Metadata

Release files for django-migrations-plus 0.1.0.dev5.gdd1abd3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-migrations-plus 0.1.0.dev5.gdd1abd3
File Size Uploaded Provenance Actions
django-migrations-plus-0.1.0.dev5.gdd1abd3.tar.gz 5.3 kB Without provenance Details for django-migrations-plus-0.1.0.dev5.gdd1abd3.tar.gz

Release files / django-migrations-plus-0.1.0.dev5.gdd1abd3.tar.gz

Download URL django-migrations-plus-0.1.0.dev5.gdd1abd3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fcbc5a8d81b484163a6009b42c7285aab492e958d624c6448ed1cc117af83d6a
BLAKE2b-256 checksum
How to use checksums
2d2660b14dd82fb58865ace8beafceede8afabc603b7c1c300adacbc1e76efe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-migrations-plus 0.1.0.dev5.gdd1abd3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page