-- Deploy gaia:create_table_api_preblacklist to mysql
-- 添加待拉黑表，用于用户三次被举报待拉黑列表

BEGIN;

CREATE TABLE `api_preblacklist` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `report_user_id` int(11) NOT NULL,
  `reported_user_id` int(11) NOT NULL,
  `report_time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `api_preblacklist` ADD CONSTRAINT `api_preblacklist_report_user_id_ref_auth_user` FOREIGN KEY (`report_user_id`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE;
ALTER TABLE `api_preblacklist` ADD CONSTRAINT `api_preblacklist_reported_user_id_ref_auth_user` FOREIGN KEY (`reported_user_id`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE;

COMMIT;
