From c33e03d7b1c362ebe50200371df4dabc21073a08 Mon Sep 17 00:00:00 2001
From: Peter Cock
Date: Tue, 5 Nov 2024 19:08:02 +0000
Subject: [PATCH] Clarify what autogenerate compares
I was struggling with empty upgrade/downgrade functions
because both my database and my ORM were up to date.
I wrongly assumed the comparison was against the previous
database scheme as per the prior revision script(s).
---
docs/build/autogenerate.rst | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/docs/build/autogenerate.rst b/docs/build/autogenerate.rst
index 519aa5bc..835d4073 100644
--- a/docs/build/autogenerate.rst
+++ b/docs/build/autogenerate.rst
@@ -1,10 +1,12 @@
Auto Generating Migrations
===========================
-Alembic can view the status of the database and compare against the table metadata
-in the application, generating the "obvious" migrations based on a comparison. This
-is achieved using the ``--autogenerate`` option to the ``alembic revision`` command,
-which places so-called *candidate* migrations into our new migrations file. We
+Alembic can view the status of the database (pointed to by ``sqlalchemy.url`` in
+your ``alemic.ini`` file using the *previous* schema) and compare against the
+table metadata in the application (your ORM which defines the *latest* schema),
+generating the "obvious" migrations based on a comparison. This is achieved
+using the ``--autogenerate`` option to the ``alembic revision`` command, which
+places so-called *candidate* migrations into our new migrations file. We
review and modify these by hand as needed, then proceed normally.
To use autogenerate, we first need to modify our ``env.py`` so that it gets access
--
2.47.3