清理数据表相关.sql 5.65 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
-- 清空报价单相关
TRUNCATE TABLE ecw_offer;
TRUNCATE TABLE ecw_offer_log;
TRUNCATE TABLE ecw_offer_prod;
TRUNCATE TABLE ecw_offer_approval;
TRUNCATE TABLE ecw_offer_transport;
-- 清空订单相关
TRUNCATE TABLE ecw_order;
TRUNCATE TABLE ecw_order_item;
TRUNCATE TABLE ecw_order_time;
TRUNCATE TABLE ecw_order_split;
TRUNCATE TABLE ecw_order_mutual;
TRUNCATE TABLE ecw_order_pickup;
TRUNCATE TABLE ecw_order_approval;
TRUNCATE TABLE ecw_order_guanlian;
TRUNCATE TABLE ecw_order_location;
TRUNCATE TABLE ecw_order_consignee;
TRUNCATE TABLE ecw_order_consignor;
TRUNCATE TABLE ecw_order_departure;
TRUNCATE TABLE ecw_order_exception;
TRUNCATE TABLE ecw_order_objective;
TRUNCATE TABLE ecw_order_number_log;
TRUNCATE TABLE ecw_order_split_item;
TRUNCATE TABLE ecw_order_special_need;
TRUNCATE TABLE ecw_order_warehouse_in;
TRUNCATE TABLE ecw_order_cargo_control;
TRUNCATE TABLE ecw_order_fee_application;
TRUNCATE TABLE ecw_order_exception_result;
TRUNCATE TABLE ecw_order_warehouse_adjust;
TRUNCATE TABLE ecw_order_warehouse_picture;
TRUNCATE TABLE ecw_order_cargo_control_pick;
TRUNCATE TABLE ecw_order_warehouse_approval;
TRUNCATE TABLE ecw_order_label;
TRUNCATE TABLE ecw_merge;

-- 清理优惠信息相关
TRUNCATE TABLE ecw_coupon;
TRUNCATE TABLE ecw_coupon_line;
TRUNCATE TABLE ecw_coupon_prod;
TRUNCATE TABLE ecw_coupon_content;
TRUNCATE TABLE ecw_coupon_customer;
TRUNCATE TABLE ecw_coupon_use_record;


-- 线路脏数据,清理线路、路线价格
truncate table ecw_warehouse_line;
truncate table ecw_product_price;
truncate table ecw_product_price_step;
truncate table ecw_product_price_special;
-- truncate table ecw_product;
-- truncate table ecw_product_attr;
-- truncate table ecw_product_type;

-- 清理出货
truncate table ecw_box;
truncate table ecw_box_abnormal;
truncate table ecw_box_agent;
truncate table ecw_box_approval;
truncate table ecw_box_arrival;
truncate table ecw_box_arrival_air;
truncate table ecw_box_barge;
truncate table ecw_box_book_air;
truncate table ecw_box_book_sea;
truncate table ecw_box_cabinet;
truncate table ecw_box_cabinet_unload;
truncate table ecw_box_cabinet_unload_abnormal;
truncate table ecw_box_checkout_air;
truncate table ecw_box_clearance;
truncate table ecw_box_clearance_doc;
truncate table ecw_box_cost;
truncate table ecw_box_customs;
truncate table ecw_box_customs_extra_cost;
truncate table ecw_box_lading_bill;
truncate table ecw_box_lading_copy;
truncate table ecw_box_load_info;
truncate table ecw_box_number_record;
truncate table ecw_box_op_log;
truncate table ecw_box_preload_goods;
truncate table ecw_box_preload_section;
truncate table ecw_box_settlement;
truncate table ecw_box_ship_config;
truncate table ecw_box_shipping;
truncate table ecw_box_takeoff;
truncate table ecw_box_trailer;
truncate table ecw_box_tally;
truncate table ecw_make_bill_of_lading;


-- 清理客户,客户联系人
TRUNCATE TABLE ecw_customer;
TRUNCATE TABLE ecw_customer_contacts;
-- 清理客户佣金
TRUNCATE TABLE ecw_customer_commission;
TRUNCATE TABLE ecw_customer_commission_info;
-- 清理客户投诉
TRUNCATE TABLE ecw_customer_complaint;
-- 清理客户跟进
TRUNCATE TABLE ecw_customer_follow;
-- 清理客户线路
TRUNCATE TABLE ecw_customer_line;
-- 清理客户级别日志
TRUNCATE TABLE ecw_customer_level_log;
-- 清理客户信用日志
TRUNCATE TABLE ecw_customer_credit_log;


-- 清理用户相关
TRUNCATE TABLE member_user;
TRUNCATE TABLE member_user_card_auth;
TRUNCATE TABLE member_user_enterprise_auth;
TRUNCATE TABLE member_user_operation_log;

-- 清理品牌信息
TRUNCATE TABLE ecw_product_brank;
-- 清理品牌与商标关联表
TRUNCATE TABLE ecw_product_brand_trademark_rel;
-- 清理商品与商品分类多对多关联表
TRUNCATE TABLE ecw_product_brand_trademark_cateogry_rel;
-- 清理商品品牌-客户授权表
TRUNCATE TABLE ecw_product_brand_empower;
-- 清理商品品牌-未授权的收费模式表
TRUNCATE TABLE ecw_product_brand_unauth_empower;

-- 清理预定舱
truncate table ecw_future_box;

-- 清理站内信
TRUNCATE TABLE ecw_internal_message;
TRUNCATE TABLE ecw_internal_message_to;

-- 清理财务相关
TRUNCATE TABLE ecw_receipt;
TRUNCATE TABLE ecw_receipt_account;
TRUNCATE TABLE ecw_receipt_item;
TRUNCATE TABLE ecw_receivable;
TRUNCATE TABLE ecw_receivable_discount;

TRUNCATE TABLE ecw_payable;
TRUNCATE TABLE ecw_payment;

-- 清理工作流
TRUNCATE TABLE bpm_process_copy;
TRUNCATE TABLE bpm_process_instance_ext;
TRUNCATE TABLE bpm_task_ext;


truncate table act_hi_actinst;
truncate table act_hi_attachment;
truncate table act_hi_comment;
truncate table act_hi_detail;
truncate table act_hi_entitylink;
truncate table act_hi_identitylink;
truncate table act_hi_procinst;
truncate table act_hi_taskinst;
truncate table act_hi_varinst;
truncate table act_hi_tsk_log;


truncate table act_ru_actinst;
truncate table act_ru_deadletter_job;
truncate table act_ru_entitylink;
truncate table act_ru_event_subscr;

truncate table act_ru_external_job;
truncate table act_ru_history_job;
truncate table act_ru_identitylink;
truncate table act_ru_job;
truncate table act_ru_suspended_job;
truncate table act_ru_timer_job;
truncate table act_ru_variable;
SET foreign_key_checks = 0;
truncate table act_ru_execution;
truncate table act_ru_task;
SET foreign_key_checks = 1;

-- 清理业绩
TRUNCATE TABLE ecw_target_log;
TRUNCATE TABLE ecw_dept_target;

-- 通知、咨询、建议
TRUNCATE TABLE system_notice;
TRUNCATE TABLE system_sms_log;
TRUNCATE TABLE system_operate_log;
TRUNCATE TABLE system_mail_log;
TRUNCATE TABLE system_login_log;
TRUNCATE TABLE infra_job_log;
TRUNCATE TABLE ecw_message;
TRUNCATE TABLE ecw_message_leave;

--清理供应商
TRUNCATE TABLE ecw_supplier;
TRUNCATE TABLE ecw_supplier_bank;
TRUNCATE TABLE ecw_supplier_contacts;