upgrade
Contents
Usage
$ airflow db upgrade [-h] [--from-revision FROM_REVISION]
[--from-version FROM_VERSION] [-s] [-r TO_REVISION]
[-n TO_VERSION] [-m] [-v]
Arguments
| Parameter | Description |
|---|---|
--from-revision |
(Optional) If generating SQL, select the Alembic revision to upgrade from |
--from-version |
(Optional) If generating SQL, select the version to upgrade from |
-s, --show-sql-only |
Print out SQL scripts for offline migration instead of running an actual migration. Required if using either |
-r, --to-revision |
Migrate up to and including the specified Alembic revision |
-n, --to-version |
The Airflow version to upgrade to |
-m, --use-migration-files |
Use migration files to perform migration |
-h, --help |
Print out the help manual for this command |
-v, --verbose |
Make logging output more verbose |
Examples
Example command that displays SQL instructions for upgrading a database:
$ airflow db upgrade --from-version 2.3.2 --to-version 2.3.3 --show-sql-only
Output example:
DB: postgresql+psycopg2://airflow:***@elenas-ado.ru-central1.internal:5432/airflow Generating sql for upgrade -- upgrade commands will *not* be submitted. BEGIN; -- Running upgrade 3c94c427fdf6 -> f5fcbda3e651 CREATE INDEX idx_task_fail_task_instance ON task_fail (dag_id, task_id, run_id, map_index); CREATE INDEX idx_task_reschedule_dag_run ON task_reschedule (dag_id, run_id); CREATE INDEX idx_xcom_task_instance ON xcom (dag_id, task_id, run_id, map_index); UPDATE alembic_version SET version_num='f5fcbda3e651' WHERE alembic_version.version_num = '3c94c427fdf6'; COMMIT;