Files
shopdb/sql/naming_convention_fix/06_update_docs.sh
cproudlock 2894260235 Add database naming convention fix scripts
Scripts to standardize table names from snake_case to camelCase:
- machine_overrides -> machineoverrides
- pc_comm_config -> commconfig
- pc_dnc_config -> dncconfig
- pc_dualpath_assignments -> dualpathassignments
- pc_network_interfaces -> networkinterfaces
- usb_checkouts -> usbcheckouts

Includes:
- SQL scripts for table renames and view recreation
- ASP file update script
- Documentation update script
- Production deployment guide for Windows/IIS/MySQL 5.6

Related to Gitea Issue #1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 14:48:40 -05:00

80 lines
2.4 KiB
Bash

#!/bin/bash
# ============================================================================
# Script: 06_update_docs.sh
# Purpose: Update documentation files to reference new table names
# Target: ShopDB and PowerShell-scripts repos
#
# USAGE:
# cd /path/to/shopdb
# bash sql/naming_convention_fix/06_update_docs.sh [--execute]
#
# This is lower priority - docs can be updated anytime after migration
# ============================================================================
set -e
EXECUTE_MODE="${1:-}"
echo "============================================"
echo "Documentation Table Name Updates"
echo "============================================"
echo ""
# Define replacements
declare -A REPLACEMENTS=(
["machine_overrides"]="machineoverrides"
["pc_comm_config"]="commconfig"
["pc_dnc_config"]="dncconfig"
["pc_dualpath_assignments"]="dualpathassignments"
["pc_network_interfaces"]="networkinterfaces"
["usb_checkouts"]="usbcheckouts"
)
echo "Searching for documentation files with old table names..."
echo ""
# Find all md files with old table names
for old_name in "${!REPLACEMENTS[@]}"; do
new_name="${REPLACEMENTS[$old_name]}"
echo "--- $old_name -> $new_name ---"
# Search in current directory and subdirectories
files=$(grep -rl "$old_name" --include="*.md" . 2>/dev/null || true)
if [ -n "$files" ]; then
for f in $files; do
count=$(grep -c "$old_name" "$f" 2>/dev/null || echo "0")
echo " $f ($count occurrences)"
done
else
echo " (no matches)"
fi
echo ""
done
if [ "$EXECUTE_MODE" == "--execute" ]; then
echo "============================================"
echo "EXECUTING CHANGES..."
echo "============================================"
echo ""
for old_name in "${!REPLACEMENTS[@]}"; do
new_name="${REPLACEMENTS[$old_name]}"
# Update all md files
find . -name "*.md" -type f -exec sed -i "s/$old_name/$new_name/g" {} \;
echo "Updated all .md files: $old_name -> $new_name"
done
echo ""
echo "Documentation updated successfully!"
else
echo "============================================"
echo "DRY RUN COMPLETE"
echo "============================================"
echo "To apply changes, run:"
echo " bash sql/naming_convention_fix/06_update_docs.sh --execute"
echo ""
echo "NOTE: Documentation updates are low priority."
echo " Focus on database and ASP changes first."
fi