SHARE
TWEET

zabbix 2.0 database partitioning script diff

a guest May 30th, 2012 156 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 173a174,176
  2. > CONSTRAINT_TABLES="acknowledges alerts auditlog service_alarms auditlog_details"
  3. > CONSTRAINTS="c_acknowledges_1/c_acknowledges_2 c_alerts_1/c_alerts_2/c_alerts_3/c_alerts_4 c_auditlog_1 c_service_alarms_1 c_auditlog_details_1"
  4. >
  5. 174a178,186
  6. >
  7. > cnt=0
  8. > for i in $CONSTRAINT_TABLES; do
  9. >       cnt=$(($cnt+1))
  10. >       for constraint in $(echo $CONSTRAINTS |cut -f$cnt -d" " |awk -F/ '{for (i=1; i <= NF; i++) {if ($i != "") {print $i}}}'); do
  11. >               echo "ALTER TABLE $i DROP FOREIGN KEY $constraint;" >>$SQL
  12. >       done
  13. > done
  14. >
  15. 184d195
  16. <                       echo "ALTER TABLE $i DROP PRIMARY KEY ;" >>$SQL
  17. 186c197
  18. <                       echo "ALTER TABLE $i ADD KEY ${i}id ($id);" >>$SQL
  19. ---
  20. >                       echo "ALTER TABLE $i DROP PRIMARY KEY, ADD KEY ${i}id ($id);" >>$SQL
  21. 191d201
  22. <                       echo "ALTER TABLE $i DROP PRIMARY KEY ;" >>$SQL
  23. 193c203
  24. <                       echo "ALTER TABLE $i ADD KEY ${i}id ($id);" >>$SQL
  25. ---
  26. >                       echo "ALTER TABLE $i DROP PRIMARY KEY, ADD KEY ${i}id ($id);" >>$SQL
  27. 197d206
  28. <                       echo "ALTER TABLE $i DROP PRIMARY KEY;" >>$SQL
  29. 199c208
  30. <                       echo "ALTER TABLE $i ADD KEY ${i}id ($id);" >>$SQL
  31. ---
  32. >                       echo "ALTER TABLE $i DROP PRIMARY KEY, ADD KEY ${i}id ($id);" >>$SQL
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top