#!/bin/bash # Apply migration to add custom_price column # Usage: ./apply_migration.sh # Load database config from config.yaml or environment DB_HOST="${DB_HOST:-localhost}" DB_PORT="${DB_PORT:-3306}" DB_NAME="${DB_NAME:-RFQ_LOG}" DB_USER="${DB_USER:-root}" DB_PASS="${DB_PASS}" echo "Applying migration: 002_add_custom_price.sql" echo "Database: $DB_NAME at $DB_HOST:$DB_PORT" if [ -z "$DB_PASS" ]; then mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" "$DB_NAME" < migrations/002_add_custom_price.sql else mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" < migrations/002_add_custom_price.sql fi if [ $? -eq 0 ]; then echo "Migration applied successfully!" else echo "Migration failed!" exit 1 fi