From eed582394c97e1589644be4dafca707b87cf3f68 Mon Sep 17 00:00:00 2001 From: inter Date: Mon, 8 Sep 2025 16:35:36 +0800 Subject: [PATCH] Add File --- backend/scripts/alembic/auto.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 backend/scripts/alembic/auto.sh diff --git a/backend/scripts/alembic/auto.sh b/backend/scripts/alembic/auto.sh new file mode 100644 index 0000000..d94dfd2 --- /dev/null +++ b/backend/scripts/alembic/auto.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +usage() { + echo -e "${GREEN}Usage:${NC} $0 [\"migration message\"]" + echo -e "Example: $0 \"Added user table\"" + exit 1 +} + +if [ "$#" -eq 0 ]; then + echo -e "${RED}Error:${NC} No migration message provided" + usage +fi + +echo -e "${GREEN}Generating migration with message:${NC} \"$1\"" +alembic revision --autogenerate -m "$1" + +if [ $? -eq 0 ]; then + echo -e "${GREEN}Migration created successfully!${NC}" +else + echo -e "${RED}Error:${NC} Failed to create migration" + exit 1 +fi \ No newline at end of file