CREATE TABLE IF NOT EXISTS fee_structures ( id CHAR(36) NOT NULL PRIMARY KEY, name VARCHAR(255) NOT NULL, academic_year VARCHAR(50) NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'Draft' CHECK (status IN ('Draft', 'Active', 'Archived')), created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS fee_structure_lines ( id CHAR(36) NOT NULL PRIMARY KEY, fee_structure_id CHAR(36) NOT NULL, description VARCHAR(255) NOT NULL, amount DECIMAL(10, 2) NOT NULL, revenue_account_id CHAR(36) NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), FOREIGN KEY (fee_structure_id) REFERENCES fee_structures(id) ON DELETE CASCADE, FOREIGN KEY (revenue_account_id) REFERENCES accounts(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;