New Features: - USB Device checkout/check-in system with barcode scanning - displayusb.asp: List all USB devices with status - addusb.asp: Add new USB devices via barcode scan - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation - usb_history.asp: Full checkout history with filters - api_usb.asp: JSON API for AJAX lookups - displayprofile.asp: SSO profile page showing user info and USB history - Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM) - SSO links in USB history now link to profile page via search Database: - New machinetypeid 44 for USB devices - New usb_checkouts table for tracking checkouts Cleanup: - Removed v2 folder (duplicate/old files) - Removed old debug/test files - Removed completed migration documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.7 KiB
SQL
65 lines
1.7 KiB
SQL
-- =====================================================
|
|
-- ROLLBACK 03: Remove appid from notifications
|
|
-- =====================================================
|
|
-- Date: 2025-11-25
|
|
-- Purpose: Rollback script for 03_add_appid_to_notifications.sql
|
|
-- =====================================================
|
|
|
|
USE shopdb;
|
|
SET SQL_SAFE_UPDATES = 0;
|
|
|
|
-- Drop FK first
|
|
SET @fk_exists = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.TABLE_CONSTRAINTS
|
|
WHERE TABLE_SCHEMA = 'shopdb'
|
|
AND TABLE_NAME = 'notifications'
|
|
AND CONSTRAINT_NAME = 'fk_notifications_appid'
|
|
);
|
|
|
|
SET @sql = IF(@fk_exists > 0,
|
|
'ALTER TABLE notifications DROP FOREIGN KEY fk_notifications_appid',
|
|
'SELECT "FK does not exist" AS status'
|
|
);
|
|
PREPARE stmt FROM @sql;
|
|
EXECUTE stmt;
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
-- Drop index
|
|
SET @idx_exists = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.STATISTICS
|
|
WHERE TABLE_SCHEMA = 'shopdb'
|
|
AND TABLE_NAME = 'notifications'
|
|
AND INDEX_NAME = 'idx_notifications_appid'
|
|
);
|
|
|
|
SET @sql = IF(@idx_exists > 0,
|
|
'ALTER TABLE notifications DROP INDEX idx_notifications_appid',
|
|
'SELECT "Index does not exist" AS status'
|
|
);
|
|
PREPARE stmt FROM @sql;
|
|
EXECUTE stmt;
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
-- Drop column
|
|
SET @column_exists = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.COLUMNS
|
|
WHERE TABLE_SCHEMA = 'shopdb'
|
|
AND TABLE_NAME = 'notifications'
|
|
AND COLUMN_NAME = 'appid'
|
|
);
|
|
|
|
SET @sql = IF(@column_exists > 0,
|
|
'ALTER TABLE notifications DROP COLUMN appid',
|
|
'SELECT "Column does not exist" AS status'
|
|
);
|
|
PREPARE stmt FROM @sql;
|
|
EXECUTE stmt;
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
SELECT '✓ appid removed from notifications' AS status;
|
|
|
|
SET SQL_SAFE_UPDATES = 1;
|