Skip to content

Commit

Permalink
add bash scripts for alembic
Browse files Browse the repository at this point in the history
  • Loading branch information
Vebop committed Nov 14, 2024
1 parent 190d5e2 commit f4a4d29
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
20 changes: 20 additions & 0 deletions check_db_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# List of database names to check
databases=("latiss" "lsstcomcam" "lsstcomcamsim" "startrackerfast" "startrackernarrow" "startrackerwide") # Replace with your actual database names

# Loop through each database and run Alembic commands
for db_name in "${databases[@]}"; do
echo "Checking Alembic status for database: $db_name"

echo "Running 'alembic current' for $db_name..."
alembic -n "$db_name" current
echo
echo
echo

echo "Running 'alembic history' for $db_name..."
alembic -n "$db_name" history
echo
echo "------------------------------------------"
done
23 changes: 23 additions & 0 deletions up_down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# List of database names to upgrade and downgrade
databases=("latiss" "lsstcomcam" "lsstcomcamsim" "startrackerfast" "startrackernarrow" "startrackerwide") # Replace with your actual database names
# Loop through each database and perform the sequence of Alembic commands
for db_name in "${databases[@]}"; do
echo "Processing database: $db_name"

# First upgrade to the latest version
echo "Upgrading $db_name to the latest version..."
alembic -n "$db_name" upgrade head
echo "------------------------------------------"

# Downgrade by one version
echo "Downgrading $db_name by one version..."
alembic -n "$db_name" downgrade -1
echo "------------------------------------------"

# Final upgrade back to the latest version
echo "Upgrading $db_name back to the latest version..."
alembic -n "$db_name" upgrade head
echo "------------------------------------------"
done

0 comments on commit f4a4d29

Please sign in to comment.