19 lines
484 B
Bash
19 lines
484 B
Bash
|
|
#!/bin/bash
|
||
|
|
set -e
|
||
|
|
SQL_DIR="/home/cmc/cmc-sales-staging/go-app/sql/schema"
|
||
|
|
DB_USER="cmc"
|
||
|
|
DB_PASS="xVRQI&cA?7AU=hqJ!%au"
|
||
|
|
DB_NAME="cmc"
|
||
|
|
DB_HOST="127.0.0.1"
|
||
|
|
|
||
|
|
for sqlfile in "$SQL_DIR"/*.sql; do
|
||
|
|
# Skip files starting with "ignore_"
|
||
|
|
if [[ "$sqlfile" == ignore_* ]]; then
|
||
|
|
echo "Skipping ignored migration: $sqlfile"
|
||
|
|
continue
|
||
|
|
fi
|
||
|
|
echo "Running migration: $sqlfile"
|
||
|
|
mariadb -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" < "$sqlfile"
|
||
|
|
done
|
||
|
|
echo "All migrations applied."
|