- Small changes to show when upgrades are finished
This commit is contained in:
42
scripts/db_squash.sh
Executable file
42
scripts/db_squash.sh
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Usage: ./db_migrate.sh -m "Your migration message" -d migrations/public
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
set -a
|
||||||
|
source .env
|
||||||
|
set +a
|
||||||
|
|
||||||
|
project_dir=$(pwd)
|
||||||
|
# Ensure you're in the correct directory
|
||||||
|
cd "$project_dir" || exit 1
|
||||||
|
|
||||||
|
# Load environment variables (including database connection details)
|
||||||
|
source .env
|
||||||
|
|
||||||
|
# Set Flask app and Python path
|
||||||
|
export FLASK_APP=scripts/run_eveai_app.py
|
||||||
|
export PYTHONPATH="$PYTHONPATH:$project_dir"
|
||||||
|
|
||||||
|
while getopts m: flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
m) message=${OPTARG};;
|
||||||
|
*)
|
||||||
|
echo "Invalid option: ${flag}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if the message and directory are provided
|
||||||
|
if [ -z "$message" ]; then
|
||||||
|
echo "Message is required."
|
||||||
|
echo "Usage: ./db_migrate.sh -m \"Your migration message\" -d migrations/public"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the alembic commands
|
||||||
|
flask db revision --autogenerate -m "Consolidated Public Migrations - $message" -d migrations/public
|
||||||
|
flask db revision --autogenerate -m "Consolidated Tenant Migrations - $message" -d migrations/tenant
|
||||||
|
|
||||||
@@ -32,10 +32,12 @@ export PYTHONPATH="$PROJECT_DIR/patched_packages:$PYTHONPATH:$PROJECT_DIR" # In
|
|||||||
# Run Alembic upgrade for the public schema
|
# Run Alembic upgrade for the public schema
|
||||||
echo "Applying migrations to the public schema..."
|
echo "Applying migrations to the public schema..."
|
||||||
flask db upgrade -d "${PROJECT_DIR}/migrations/public"
|
flask db upgrade -d "${PROJECT_DIR}/migrations/public"
|
||||||
|
echo "Finished applying migrations to the public schema..."
|
||||||
|
|
||||||
# Run Alembic upgrade for the tenant schema
|
# Run Alembic upgrade for the tenant schema
|
||||||
echo "Applying migrations to the tenant schema..."
|
echo "Applying migrations to the tenant schema..."
|
||||||
flask db upgrade -d "${PROJECT_DIR}/migrations/tenant"
|
flask db upgrade -d "${PROJECT_DIR}/migrations/tenant"
|
||||||
|
echo "Finished applying migrations to the tenant schema..."
|
||||||
|
|
||||||
# Set flask environment variables
|
# Set flask environment variables
|
||||||
#export FLASK_ENV=development # Use 'production' as appropriate
|
#export FLASK_ENV=development # Use 'production' as appropriate
|
||||||
|
|||||||
Reference in New Issue
Block a user