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>
This commit is contained in:
83
sql/naming_convention_fix/03_rename_tables.sql
Normal file
83
sql/naming_convention_fix/03_rename_tables.sql
Normal file
@@ -0,0 +1,83 @@
|
||||
-- ============================================================================
|
||||
-- Script: 03_rename_tables.sql
|
||||
-- Purpose: Rename tables from snake_case to camelCase
|
||||
-- Target: MySQL 5.6 (dev and production)
|
||||
--
|
||||
-- IMPORTANT:
|
||||
-- 1. Run 04_drop_and_recreate_views.sql FIRST to drop dependent views
|
||||
-- 2. Then run this script
|
||||
-- 3. Then run 04_drop_and_recreate_views.sql again to recreate views
|
||||
-- ============================================================================
|
||||
|
||||
-- Pre-flight check: Verify tables exist
|
||||
SELECT 'Verifying tables to rename exist...' AS status;
|
||||
|
||||
SELECT TABLE_NAME, TABLE_ROWS, CREATE_TIME
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME IN (
|
||||
'machine_overrides',
|
||||
'pc_comm_config',
|
||||
'pc_dnc_config',
|
||||
'pc_dualpath_assignments',
|
||||
'pc_network_interfaces',
|
||||
'usb_checkouts'
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- TABLE RENAMES
|
||||
-- ============================================================================
|
||||
|
||||
-- Rename: machine_overrides -> machineoverrides
|
||||
RENAME TABLE machine_overrides TO machineoverrides;
|
||||
|
||||
-- Rename: pc_comm_config -> commconfig
|
||||
RENAME TABLE pc_comm_config TO commconfig;
|
||||
|
||||
-- Rename: pc_dnc_config -> dncconfig
|
||||
RENAME TABLE pc_dnc_config TO dncconfig;
|
||||
|
||||
-- Rename: pc_dualpath_assignments -> dualpathassignments
|
||||
RENAME TABLE pc_dualpath_assignments TO dualpathassignments;
|
||||
|
||||
-- Rename: pc_network_interfaces -> networkinterfaces
|
||||
RENAME TABLE pc_network_interfaces TO networkinterfaces;
|
||||
|
||||
-- Rename: usb_checkouts -> usbcheckouts
|
||||
RENAME TABLE usb_checkouts TO usbcheckouts;
|
||||
|
||||
-- ============================================================================
|
||||
-- VERIFICATION
|
||||
-- ============================================================================
|
||||
|
||||
SELECT 'Verifying renames completed...' AS status;
|
||||
|
||||
SELECT TABLE_NAME, TABLE_ROWS
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME IN (
|
||||
'machineoverrides',
|
||||
'commconfig',
|
||||
'dncconfig',
|
||||
'dualpathassignments',
|
||||
'networkinterfaces',
|
||||
'usbcheckouts'
|
||||
);
|
||||
|
||||
-- Check old names no longer exist
|
||||
SELECT 'Checking old table names are gone...' AS status;
|
||||
|
||||
SELECT TABLE_NAME
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME IN (
|
||||
'machine_overrides',
|
||||
'pc_comm_config',
|
||||
'pc_dnc_config',
|
||||
'pc_dualpath_assignments',
|
||||
'pc_network_interfaces',
|
||||
'usb_checkouts'
|
||||
);
|
||||
-- Should return 0 rows
|
||||
|
||||
SELECT 'Table renames complete!' AS status;
|
||||
Reference in New Issue
Block a user