Skip to content

Commit

Permalink
Improve the documentation around migration concurrency
Browse files Browse the repository at this point in the history
This is a possible source of surprise and confusion.
  • Loading branch information
pgjones committed Dec 15, 2024
1 parent 4aea104 commit ba11280
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/how_to_guides/migrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ signature,
``migrate`` will run before the app starts serving (in the foreground)
and should run whatever queries are required for the migration.

.. warning::

If you are using postgres Quart-DB will ensure only a single
invocation of ``migrate`` will occur regardless of the number of
app instances. This is not possible though with SQLite.

A migration may also include a ``background_migrate`` function for a
migration that runs whilst the app is serving (in the background) with
the following signature,
Expand All @@ -35,6 +41,11 @@ the following signature,
the foreground migrations will complete before the background
migrations start.

.. warning::

If you are running multiple instances of your app there will be
multiple instances of ``background_migrate`` running concurrently.

The file can also contain an optional ``valid_migration`` function
with the following signature,

Expand Down

0 comments on commit ba11280

Please sign in to comment.