chore: add db migration helper scripts
This commit is contained in:
22
migrate.sh
Normal file
22
migrate.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./migrate.sh path/to/migration.sql"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SQL_FILE=$1
|
||||
|
||||
if [ ! -f "$SQL_FILE" ]; then
|
||||
echo "Error: File $SQL_FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running $SQL_FILE against pragativeer_db..."
|
||||
docker exec -i pragativeer_db psql -U pragativeer_admin -d pragativeer_prod < "$SQL_FILE"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Migration applied successfully!"
|
||||
else
|
||||
echo "Migration failed!"
|
||||
fi
|
||||
Reference in New Issue
Block a user