-- Rollback Script for Pixels Dating Database Updates
-- Use this ONLY if you need to undo the database changes
-- WARNING: This will remove new features and data!

-- Remove new tables (this will delete all data in these tables)
DROP TABLE IF EXISTS user_sessions;
DROP TABLE IF EXISTS notification_preferences;
DROP TABLE IF EXISTS user_activity_log;
DROP TABLE IF EXISTS user_preferences;

-- Remove new columns from existing tables
ALTER TABLE messages DROP COLUMN IF EXISTS message_type;
ALTER TABLE messages DROP COLUMN IF EXISTS read_at;
ALTER TABLE matches DROP COLUMN IF EXISTS last_interaction;
ALTER TABLE matches DROP COLUMN IF EXISTS created_at;
ALTER TABLE users DROP COLUMN IF EXISTS heartbeat;
ALTER TABLE users DROP COLUMN IF EXISTS settings;

-- Remove new indexes
DROP INDEX IF EXISTS idx_sessions_expires ON user_sessions;
DROP INDEX IF EXISTS idx_sessions_user ON user_sessions;
DROP INDEX IF EXISTS idx_activity_created ON user_activity_log;
DROP INDEX IF EXISTS idx_activity_type ON user_activity_log;
DROP INDEX IF EXISTS idx_activity_user ON user_activity_log;
DROP INDEX IF EXISTS idx_messages_sender ON messages;
DROP INDEX IF EXISTS idx_messages_recipient ON messages;
DROP INDEX IF EXISTS idx_matches_compatibility ON matches;
DROP INDEX IF EXISTS idx_users_last_seen ON users;
DROP INDEX IF EXISTS idx_users_heartbeat ON users;
