-- Migration: Repayment and Dividend System

-- 1. Add repayment_term to startups table
ALTER TABLE startups ADD COLUMN repayment_term INT DEFAULT 12 AFTER founder_return_rate;

-- 2. Update investments table with locked terms and payment tracking
ALTER TABLE investments 
ADD COLUMN interest_rate DECIMAL(5, 2) AFTER amount,
ADD COLUMN repayment_term INT AFTER interest_rate,
ADD COLUMN total_return DECIMAL(15, 2) AFTER repayment_term,
ADD COLUMN monthly_dividend DECIMAL(15, 2) AFTER total_return,
ADD COLUMN paid_amount DECIMAL(15, 2) DEFAULT 0.00 AFTER monthly_dividend,
ADD COLUMN next_payment_date DATE AFTER paid_amount;

-- 3. Update status enum in investments table
ALTER TABLE investments MODIFY COLUMN status ENUM('pending', 'approved', 'rejected', 'completed') DEFAULT 'pending';
