Metadata-Version: 2.3
Name: django-tenants-smart-executor
Version: 0.1.0
Summary: Executors for django-tenants which check whether any migrations need running before running them, making it faster.
License: MIT
Keywords: django,django-tenants,migrations
Author: Mikuláš Poul
Author-email: mikulas.poul@xelix.com
Requires-Python: >=3.9
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Framework :: Django
Requires-Dist: django-tenants (>=3.8)
Project-URL: Repository, https://github.com/xelixdev/django-tenants-smart-executor
Description-Content-Type: text/markdown

# Django Tenants Smart Executor

When using [django-tenants](https://github.com/django-tenants/django-tenants), migrations can be quite slow when you have a lot of tenants.
This is the case even if there are actually no migrations to run.
This package provides executors that skip running the migrations for a tenant if there are no migrations to run.
If there's no migratuons to run, the `schema_migrated` signal is still triggered.

## Installation

Install using pip (or your package manager of choice):
```bash
pip install django-tenants-smart-executor
```

And configure the `GET_EXECUTOR_FUNCTION` in your `settings.py`:
```python
GET_EXECUTOR_FUNCTION = "django_tenants_smart_executor.load_executor"
```

## Usage

When you run migrations when all tenants are migrated, the output will look something like this:

```bash
$ python manage.py migrate_schemas
No migrations needed for schema public, only triggering signals
No migrations needed for schema test, only triggering signals
```

The multiprocessing executor is also supported.

```bash
$ python manage.py migrate_schemas --executor multiprocessing
No migrations needed for schema public, only triggering signals
No migrations needed for schema test, only triggering signals
```

