Clone the example project
Set up the environment and install dependencies
Create a Migration Script
./alembic/versions
directory.Here’s how to create a new migration script:./alembic/versions/13379be60997_create_account_table.py
. Now we want to edit the file and add the migration script to it:Connect to Database
.env
file and add the connection string there:Run the Migration
accounts
table on top of the existing one. If this happened to you, you can delete the new migration file (or alternatively, modify the table name).Create a new migration
models.py
file that defines two models: Todo
and Tenant
.To generate a migration for these models, you can use the following command:Tenants
table that can’t be dropped, we include the Tenant
model in models.py to prevent this.Run the generated migration file