清理所有业务表数据.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. -- Active: 1735126617549@@192.168.110.85@3306@xiaoding_dev
  2. /**
  3. * 清空表数据
  4. */
  5. use xiaoding_dev;
  6. -- 禁用外键检查
  7. SET FOREIGN_KEY_CHECKS = 0;
  8. -- 代理相关表
  9. TRUNCATE TABLE agent_info_records;
  10. TRUNCATE TABLE agent_infos;
  11. TRUNCATE TABLE agent_project;
  12. TRUNCATE TABLE agent_project_cate;
  13. TRUNCATE TABLE agent_real_auth_records;
  14. -- 教练相关表
  15. TRUNCATE TABLE coach_alerts;
  16. TRUNCATE TABLE coach_comment_tags;
  17. TRUNCATE TABLE coach_flow_orders;
  18. TRUNCATE TABLE coach_info_records;
  19. TRUNCATE TABLE coach_locations;
  20. TRUNCATE TABLE coach_order_comment_tags;
  21. TRUNCATE TABLE coach_order_comments;
  22. TRUNCATE TABLE coach_project;
  23. TRUNCATE TABLE coach_qual_records;
  24. TRUNCATE TABLE coach_real_records;
  25. TRUNCATE TABLE coach_schedules;
  26. TRUNCATE TABLE coach_scores;
  27. TRUNCATE TABLE coach_statistics;
  28. TRUNCATE TABLE coach_users;
  29. -- 优惠券相关表
  30. TRUNCATE TABLE coupon_info;
  31. -- 会员相关表
  32. TRUNCATE TABLE member_address;
  33. TRUNCATE TABLE member_bad_behaviors;
  34. TRUNCATE TABLE member_social_accounts;
  35. TRUNCATE TABLE member_users;
  36. -- 订单相关表
  37. TRUNCATE TABLE order_comments;
  38. TRUNCATE TABLE order_dist_records;
  39. TRUNCATE TABLE order_exc_records;
  40. TRUNCATE TABLE order_grab_records;
  41. TRUNCATE TABLE order_records;
  42. -- 项目相关表
  43. TRUNCATE TABLE project_cate;
  44. -- 商店相关表
  45. TRUNCATE TABLE shop_auth_records;
  46. TRUNCATE TABLE shop_coach_services;
  47. TRUNCATE TABLE shop_infos;
  48. TRUNCATE TABLE shop_services;
  49. -- 用户反馈表
  50. TRUNCATE TABLE user_feedbacks;
  51. -- 钱包相关表
  52. TRUNCATE TABLE wallet_payment_records;
  53. TRUNCATE TABLE wallet_refund_records;
  54. TRUNCATE TABLE wallet_split_records;
  55. TRUNCATE TABLE wallet_trans_records;
  56. TRUNCATE TABLE wallet_withdraw_records;
  57. -- 设置相关表
  58. TRUNCATE TABLE setting_groups;
  59. -- 启用外键检查
  60. SET FOREIGN_KEY_CHECKS = 1;
  61. /*
  62. select table_name from information_schema.TABLES where `TABLE_SCHEMA` = 'xiaoding_test'
  63. and `TABLE_NAME` like 'coach_%' and `TABLE_TYPE` = 'BASE TABLE'
  64. or ( `TABLE_NAME` like 'agent_%' or `TABLE_NAME` like 'coupon_%' or
  65. `TABLE_NAME` like 'order_%' or `TABLE_NAME` like 'user_%' or `TABLE_NAME` like 'member_%'
  66. or `TABLE_NAME` like 'project_%' or `TABLE_NAME` like 'setting_%' or `TABLE_NAME` like 'shop_%'
  67. or `TABLE_NAME` like 'wallet_%' );
  68. */