In Chapter 11, we initialized and configured the Alembic migration environment to prepare for adding data classes to our application and to create migrations to add them to our database. We’re going to explore how to use autogenerate for adding tables, and how to handcraft migrations to accomplish things that autogenerate cannot do. It’s always a good idea to start with an empty migration, so let’s begin there as it gives us a clean starting point for our migrations.
To create the base empty migration, make sure you are in the CH12/ folder of the example code for this book. We’ll create an empty migration using this command:
# alembic revision -m "Empty Init"
This will create a migration file in the alembic/versions/ subfolder. The filenames will always begin with a hash that represents the revision ID and then whatever message you supply. Let’s look inside this file: