Setting up the database¶
Airflow requires a database. If you're just experimenting and learning Airflow, you can stick with the default SQLite option. If you don't want to use SQLite, then take a look at Set up a Database Backend to setup a different database.
Usually, you need to run
airflow db upgrade in order to create the database schema that Airflow can use.
Similarly, upgrading Airflow usually requires an extra step of upgrading the database. This is done
airflow db upgrade CLI command. You should make sure that Airflow components are
not running while the upgrade is being executed.
In some deployments, such as Helm Chart for Apache Airflow, both initializing and running the database migration is executed automatically when Airflow is upgraded.
Sometimes, after the upgrade, you are also supposed to do some post-migration actions. See Upgrading Airflow to a newer version for more details about upgrading and doing post-migration actions.