-- Add missing user_id column to loan_scoring table
ALTER TABLE loan_scoring ADD COLUMN user_id CHAR(32) NULL;

-- Add foreign key constraint
ALTER TABLE loan_scoring ADD CONSTRAINT loan_scoring_user_id_fk 
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

-- Add index for better performance
CREATE INDEX idx_loan_scoring_user_id ON loan_scoring(user_id);
