File tree Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change 1- # Django Tenants Smart Executor
1+ # Django Tenants Smart Executor
2+
3+ When using [ django-tenants] ( https://github.com/django-tenants/django-tenants ) , migrations can be quite slow when you have a lot of tenants.
4+ This is the case even if there are actually no migrations to run.
5+ This package provides executors that skip running the migrations for a tenant if there are no migrations to run.
6+ If there's no migratuons to run, the ` schema_migrated ` signal is still triggered.
7+
8+ ## Installation
9+
10+ Install using pip (or your package manager of choice):
11+ ``` bash
12+ pip install django-tenants-smart-executor
13+ ```
14+
15+ And configure the ` GET_EXECUTOR_FUNCTION ` in your ` settings.py ` :
16+ ``` python
17+ GET_EXECUTOR_FUNCTION = " django_tenants_smart_executor.load_executor"
18+ ```
19+
20+ ## Usage
21+
22+ When you run migrations when all tenants are migrated, the output will look something like this:
23+
24+ ``` bash
25+ $ python manage.py migrate_schemas
26+ No migrations needed for schema public, only triggering signals
27+ No migrations needed for schema test, only triggering signals
28+ ```
29+
30+ The multiprocessing executor is also supported.
31+
32+ ``` bash
33+ $ python manage.py migrate_schemas --executor multiprocessing
34+ No migrations needed for schema public, only triggering signals
35+ No migrations needed for schema test, only triggering signals
36+ ```
You can’t perform that action at this time.
0 commit comments