-
Notifications
You must be signed in to change notification settings - Fork 3
09. Database migration
kevin-hashimoto edited this page Mar 4, 2024
·
1 revision
The migrate.sh script inside the backend
directory is a versatile tool for managing database migrations in this fastapi project. It automates various tasks related to Alembic, including generating new migrations, upgrading and downgrading the database, and managing the virtual environment and dependencies.
Make Script Executable
chmod +x migrate.sh
Generate a new migration with a descriptive message:
./migrate.sh -g "Description of changes"
Upgrade the database to a specific revision or to the latest version:
./migrate.sh -u [revision]
Omit [revision]
to upgrade to the latest version (head).
Downgrade the database to a specific revision or to the base state:
./migrate.sh -d [revision]
Omit [revision]
to revert to the base state.
Display the help manual for script usage:
./migrate.sh -h