-- Create followed_artists table for user-artist follow relationships
-- This is a many-to-many pivot table between users and artists

CREATE TABLE IF NOT EXISTS followed_artists (
  user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  artist_id UUID NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  PRIMARY KEY (user_id, artist_id)
);

-- Create indexes for faster lookups
CREATE INDEX IF NOT EXISTS idx_followed_artists_user_id ON followed_artists(user_id);
CREATE INDEX IF NOT EXISTS idx_followed_artists_artist_id ON followed_artists(artist_id);
