downgrade
Definition
Downgrades the schema of the metadata database.
You can downgrade to a particular Airflow version using the –-to-version option. Alternatively you may provide an Alembic revision ID to downgrade to using the –-to-revision option.
Options --from-revision and --from-version may only be used in conjunction with the --show-sql-only option because when actually running migrations, the downgrade must only be performed from current revision.
If you want to preview the commands but not execute them, use -–show-sql-only option.
For a mapping between Airflow version and Alembic revision see Reference for Database Migrations.
|
TIP
It is recommended that you backup your database before running a downgrade or any other database operation.
|
Usage
$ airflow db downgrade [-h] [--from-revision FROM_REVISION]
[--from-version FROM_VERSION] [-s] [-r TO_REVISION]
[-n TO_VERSION] [-v] [-y]
Arguments
| Parameter | Description |
|---|---|
--from-revision |
Downgrade from the specified Alembic revision (optional) |
--from-version |
Downgrade from the specified version (optional) |
-s, --show-sql-only |
Print out SQL scripts for offline migration instead of running an actual migration. Required when using either |
-r, --to-revision |
The Alembic revision to downgrade to |
-n, --to-version |
If provided, only run migrations up to this version |
-h, --help |
Print out the help manual for this command |
-v, --verbose |
Make logging output more verbose |
-y, --yes |
Do not prompt for confirmation |