Files
shopdb/sql/migration_phase4/ROLLBACK_01_appversions_table.sql
cproudlock 65b622c361 Add USB checkout system and SSO profile page
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>
2025-12-07 11:16:14 -05:00

35 lines
1.0 KiB
SQL

-- =====================================================
-- ROLLBACK 01: Remove appversions table
-- =====================================================
-- Date: 2025-11-25
-- Purpose: Rollback script for 01_create_appversions_table.sql
-- WARNING: This will delete all version data!
-- =====================================================
USE shopdb;
SET SQL_SAFE_UPDATES = 0;
-- Must remove FK from installedapps first (if it exists)
SET @fk_exists = (
SELECT COUNT(*)
FROM information_schema.TABLE_CONSTRAINTS
WHERE TABLE_SCHEMA = 'shopdb'
AND TABLE_NAME = 'installedapps'
AND CONSTRAINT_NAME = 'fk_installedapps_appversionid'
);
SET @sql = IF(@fk_exists > 0,
'ALTER TABLE installedapps DROP FOREIGN KEY fk_installedapps_appversionid',
'SELECT "FK does not exist" AS status'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- Drop appversions table
DROP TABLE IF EXISTS appversions;
SELECT '✓ appversions table dropped' AS status;
SET SQL_SAFE_UPDATES = 1;