ALTER TABLE `crm_document` ADD `have_unpaid` TINYINT UNSIGNED NOT NULL DEFAULT '0' AFTER `status`, ADD `have_partially_paid` TINYINT UNSIGNED NOT NULL DEFAULT '0' AFTER `have_unpaid`;
ALTER TABLE `espresso_crm`.`crm_document` ADD INDEX `i_user_id_type` (`user_id`, `type`, `document_date`) USING BTREE;
ALTER TABLE `espresso_crm`.`crm_document` ADD INDEX `i_unp` (`have_unpaid`, `user_id`, `type`, `document_date`);
ALTER TABLE `espresso_crm`.`crm_document` ADD INDEX `i_ppaid` (`have_partially_paid`, `user_id`, `type`, `document_date`);
