Files
trainingstagebuch/backend/cleanupKeysMinimal.sql
Torsten Schulz (local) 5357dac9e1
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 54s
chore: update file permissions for multiple files and add migration for club fee rules
- Changed file permissions from 644 to 755 for various files in the mobile-app and mobile-app_legacy_rn_expo directories, ensuring executable permissions where necessary.
- Added a new SQL migration script to the backend to introduce missing columns for club billing and invoice settings in the clubs table, maintaining synchronization with the current Sequelize model.
2026-07-17 11:51:24 +02:00

80 lines
2.2 KiB
SQL
Executable File

-- Minimales Cleanup-Script
-- Entfernt alle INDEX außer PRIMARY KEY und UNIQUE Keys
USE trainingsdiary;
-- 1. Status vor Cleanup
SELECT '=== STATUS VOR CLEANUP ===' as info;
SELECT
TABLE_NAME,
COUNT(*) as key_count
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'trainingsdiary'
GROUP BY TABLE_NAME
ORDER BY key_count DESC;
SELECT
COUNT(*) as total_keys_before
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'trainingsdiary';
-- 2. Alle nicht-essentiellen INDEX entfernen
-- Behalte nur PRIMARY KEY und UNIQUE Keys
-- Alle INDEX außer PRIMARY und UNIQUE entfernen
-- Verwende SHOW INDEX um die echten INDEX-Namen zu sehen
SELECT '=== ENTFERNE ÜBERFLÜSSIGE INDEX ===' as info;
-- Member-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== MEMBER TABELLE ===' as info;
SHOW INDEX FROM member;
-- User-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== USER TABELLE ===' as info;
SHOW INDEX FROM user;
-- Clubs-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== CLUBS TABELLE ===' as info;
SHOW INDEX FROM clubs;
-- User_Club-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== USER_CLUB TABELLE ===' as info;
SHOW INDEX FROM user_club;
-- Log-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== LOG TABELLE ===' as info;
SHOW INDEX FROM log;
-- Diary_Dates-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== DIARY_DATES TABELLE ===' as info;
SHOW INDEX FROM diary_dates;
-- Participants-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== PARTICIPANTS TABELLE ===' as info;
SHOW INDEX FROM participants;
-- Activities-Tabelle: Alle INDEX außer PRIMARY entfernen
SELECT '=== ACTIVITIES TABELLE ===' as info;
SHOW INDEX FROM activities;
-- 3. Status nach Cleanup
SELECT '=== STATUS NACH CLEANUP ===' as info;
SELECT
TABLE_NAME,
COUNT(*) as key_count
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'trainingsdiary'
GROUP BY TABLE_NAME
ORDER BY key_count DESC;
SELECT
COUNT(*) as total_keys_after
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'trainingsdiary';
-- 4. Zusammenfassung
SELECT '=== ZUSAMMENFASSUNG ===' as info;
SELECT
'Minimales Cleanup abgeschlossen. Überprüfen Sie die Anzahl der Keys oben.' as message;