-- =============================================================================
-- Remove unused payment request fields + work-details table
-- Run against: dyu_vendor_payment_db
-- Backup your database before executing.
-- =============================================================================

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Drop work-detail line items (no longer used by mobile API)
DROP TABLE IF EXISTS payment_request_work_details;

-- 2. Drop columns from payment_requests header
ALTER TABLE payment_requests
    DROP COLUMN requested_amount,
    DROP COLUMN tax_amount,
    DROP COLUMN tds_amount,
    DROP COLUMN retention_amount,
    DROP COLUMN net_payable_amount,
    DROP COLUMN payment_due_date,
    DROP COLUMN priority,
    DROP COLUMN work_summary,
    DROP COLUMN remarks;

SET FOREIGN_KEY_CHECKS = 1;

-- Verify (optional):
-- DESCRIBE payment_requests;
-- SHOW TABLES LIKE 'payment_request_work_details';
