energensy contacts, dashboard
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
32
deploy_migration.sh
Executable file
32
deploy_migration.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Deploy database migration to production server
|
||||
echo "Deploying database migration to production server 192.168.0.103..."
|
||||
|
||||
# Create migration file on server
|
||||
echo "Creating migration directory on server..."
|
||||
ssh trevor@192.168.0.103 "sudo mkdir -p /opt/chat/alembic/versions"
|
||||
|
||||
# Copy migration file
|
||||
echo "Copying migration file..."
|
||||
scp alembic/versions/d9c621d45a82_add_is_active_to_emergency_contacts.py trevor@192.168.0.103:/tmp/
|
||||
ssh trevor@192.168.0.103 "sudo mv /tmp/d9c621d45a82_add_is_active_to_emergency_contacts.py /opt/chat/alembic/versions/"
|
||||
|
||||
# Apply migration on server
|
||||
echo "Applying migration on production server..."
|
||||
ssh trevor@192.168.0.103 << 'EOF'
|
||||
cd /opt/chat
|
||||
|
||||
# Activate virtual environment if it exists
|
||||
if [ -d ".venv" ]; then
|
||||
source .venv/bin/activate
|
||||
fi
|
||||
|
||||
# Apply migration
|
||||
export PYTHONPATH="/opt/chat:$PYTHONPATH"
|
||||
python -m alembic upgrade head
|
||||
|
||||
echo "Migration applied successfully!"
|
||||
EOF
|
||||
|
||||
echo "Migration deployment completed!"
|
||||
Reference in New Issue
Block a user