Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,34 @@ Now run ``migrate_schemas --shared``, this will create the shared apps on the ``

You might need to run ``makemigrations`` and then ``migrate_schemas --shared`` again for your ``app.Models`` to be created in the database.

.. warning::

**Moving apps between SHARED_APPS and TENANT_APPS**

When you run ``migrate_schemas``, Django tracks all migrations as "applied" in the
``django_migrations`` table in **every schema**, even though it only creates the actual
tables in the appropriate schemas. This means:

- The public schema shows TENANT_APPS migrations as "applied" (but tables don't exist)
- Tenant schemas show SHARED_APPS migrations as "applied" (but tables don't exist)

**If you move an app** between SHARED_APPS and TENANT_APPS, Django sees the migrations
as already "applied" in the destination schemas and won't create the tables.

**To move an app from TENANT_APPS to SHARED_APPS:**

1. Move the app from TENANT_APPS to SHARED_APPS in your settings **first**
2. ``./manage.py migrate_schemas --schema=public <app> zero --fake``
3. ``./manage.py migrate_schemas --shared``
4. Migrate any data from tenant schemas to public schema as needed

**To move an app from SHARED_APPS to TENANT_APPS:**

1. Move the app from SHARED_APPS to TENANT_APPS in your settings **first**
2. ``./manage.py migrate_schemas --tenant <app> zero --fake``
3. ``./manage.py migrate_schemas --tenant``
4. Migrate any data from public schema to tenant schemas as needed

Lastly, you need to create a tenant whose schema is ``public`` and it's address is your domain URL. Please see the section on :doc:`use <use>`.

You can also specify extra schemas that should be visible to all queries using
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
breathe==4.36.0
docutils==0.22.2
docutils==0.22.4
Pygments==2.19.2
pyparsing==3.2.5
Sphinx==8.2.3
Expand Down