#!/usr/bin/env bash
set -e

if [ $# -lt 1 ]; then
  echo "Usage: $0 /full/path/to/backup.sql"
  exit 1
fi

SQL_FILE="$1"
DB_NAME="shquier_easychair"
DB_USER="root"
DB_PASS="_MohdShquier@2025!"

if [ ! -f "$SQL_FILE" ]; then
  echo "SQL file not found: $SQL_FILE"
  exit 1
fi

echo "Restoring database from: $SQL_FILE"
mysql -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" < "$SQL_FILE"
echo "Restore completed."
