From 6aa34dac650d9b28654dac5282b857940acf3977 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Thu, 10 Oct 2024 11:35:17 -0400 Subject: [PATCH] chore:Add Alembic Commands to Makefile (#4083) Update Makefile added make commands related to alembic --- Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Makefile b/Makefile index e67557f8e..752fcbb00 100644 --- a/Makefile +++ b/Makefile @@ -443,3 +443,34 @@ ifdef main poetry config repositories.test-pypi https://test.pypi.org/legacy/ make publish_langflow_testpypi endif + + +# example make alembic-revision message="Add user table" +alembic-revision: ## generate a new migration + @echo 'Generating a new Alembic revision' + cd src/backend/base/langflow/ && uv run alembic revision --autogenerate -m "$(message)" + + +alembic-upgrade: ## upgrade database to the latest version + @echo 'Upgrading database to the latest version' + cd src/backend/base/langflow/ && uv run alembic upgrade head + +alembic-downgrade: ## downgrade database by one version + @echo 'Downgrading database by one version' + cd src/backend/base/langflow/ && uv run alembic downgrade -1 + +alembic-current: ## show current revision + @echo 'Showing current Alembic revision' + cd src/backend/base/langflow/ && uv run alembic current + +alembic-history: ## show migration history + @echo 'Showing Alembic migration history' + cd src/backend/base/langflow/ && uv run alembic history --verbose + +alembic-check: ## check migration status + @echo 'Running alembic check' + cd src/backend/base/langflow/ && uv run alembic check + +alembic-stamp: ## stamp the database with a specific revision + @echo 'Stamping the database with revision $(revision)' + cd src/backend/base/langflow/ && uv run alembic stamp $(revision)